rancher

package
v0.12.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2017 License: Apache-2.0 Imports: 41 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LB_IMAGE       = "rancher/load-balancer-service"
	DNS_IMAGE      = "rancher/dns-service"
	EXTERNAL_IMAGE = "rancher/external-service"

	RancherType         = ServiceType(iota)
	LegacyLbServiceType = ServiceType(iota)
	LbServiceType       = ServiceType(iota)
	DnsServiceType      = ServiceType(iota)
	ExternalServiceType = ServiceType(iota)
	StorageDriverType   = ServiceType(iota)
	NetworkDriverType   = ServiceType(iota)
)

Variables

This section is empty.

Functions

func NewProject

func NewProject(context *Context) (*project.Project, error)

func ResolveRancherCompose added in v0.5.0

func ResolveRancherCompose(composeFile, rancherComposeFile string) (string, error)

func Upload

func Upload(c *Context, name string) (string, string, error)

Types

type BindingProperty added in v0.11.0

type BindingProperty struct {
	Services map[string]Service `json:"services"`
}

type CompositeService added in v0.5.0

type CompositeService struct {
	client.Service

	StorageDriver *client.StorageDriver `json:"storageDriver,omitempty" yaml:"storageDriver,omitempty"`
	NetworkDriver *client.NetworkDriver `json:"networkDriver,omitempty" yaml:"networkDriver,omitempty"`
	RealLbConfig  *client.LbConfig      `json:"lbConfig,omitempty" yaml:"lb_config,omitempty"`

	// External Service Fields
	ExternalIpAddresses []string                    `json:"externalIpAddresses,omitempty" yaml:"external_ip_addresses,omitempty"`
	Hostname            string                      `json:"hostname,omitempty" yaml:"hostname,omitempty"`
	HealthCheck         *client.InstanceHealthCheck `json:"healthCheck,omitempty" yaml:"health_check,omitempty"`
}

type Container added in v0.2.0

type Container struct {
	// contains filtered or unexported fields
}

func NewContainer added in v0.2.0

func NewContainer(id, name string) *Container

func (*Container) ID added in v0.4.1

func (c *Container) ID() (string, error)

func (*Container) IsRunning added in v0.9.1

func (c *Container) IsRunning(ctx context.Context) (bool, error)

TODO implement

func (*Container) Name added in v0.2.0

func (c *Container) Name() string

func (*Container) Port added in v0.2.3

func (c *Container) Port(ctx context.Context, port string) (string, error)

TODO implement

type ContainerInspect

type ContainerInspect struct {
	Name       string
	Config     *container.Config
	HostConfig *container.HostConfig
}

type Context

type Context struct {
	project.Context

	RancherConfig       map[string]RancherConfig
	RancherComposeFile  string
	RancherComposeBytes []byte
	BindingsFile        string
	Binding             *client.Binding
	BindingsBytes       []byte
	Url                 string
	AccessKey           string
	SecretKey           string
	Client              *client.RancherClient
	Stack               *client.Stack

	SidekickInfo *SidekickInfo
	Uploader     Uploader
	PullCached   bool
	Pull         bool
	Args         []string

	Upgrade        bool
	ForceUpgrade   bool
	Rollback       bool
	Interval       int64
	BatchSize      int64
	ConfirmUpgrade bool
	// contains filtered or unexported fields
}

func (*Context) LoadStack added in v0.10.0

func (c *Context) LoadStack() (*client.Stack, error)

type Factory added in v0.5.0

type Factory interface {
	Hash(service *RancherService) (digest.ServiceHash, error)
	Create(service *RancherService) error
	Upgrade(r *RancherService, force bool, selected []string) error
	Rollback(r *RancherService) error
}

func GetFactory added in v0.5.0

func GetFactory(service *RancherService) (Factory, error)

type IsDone

type IsDone func(*client.Resource) (bool, error)

type LBConfig added in v0.11.0

type LBConfig struct {
	Certs            []string            `json:"certs" yaml:"certs"`
	DefaultCert      string              `json:"default_cert" yaml:"default_cert"`
	PortRules        []PortRule          `json:"port_rules" yaml:"port_rules"`
	Config           string              `json:"config" yaml:"config"`
	StickinessPolicy *LBStickinessPolicy `json:"stickiness_policy" yaml:"stickiness_policy"`
}

type LBStickinessPolicy added in v0.11.0

type LBStickinessPolicy struct {
	Name     string `json:"name" yaml:"name"`
	Cookie   string `json:"cookie" yaml:"cookie"`
	Domain   string `json:"domain" yaml:"domain"`
	Indirect bool   `json:"indirect" yaml:"indirect"`
	Nocache  bool   `json:"nocache" yaml:"nocache"`
	Postonly bool   `json:"postonly" yaml:"postonly"`
	Mode     string `json:"mode" yaml:"mode"`
}
type Link struct {
	ServiceName, Alias string
}

type NormalFactory added in v0.5.0

type NormalFactory struct {
}

func (*NormalFactory) Create added in v0.5.0

func (f *NormalFactory) Create(r *RancherService) error

func (*NormalFactory) Hash added in v0.5.0

func (f *NormalFactory) Hash(service *RancherService) (digest.ServiceHash, error)

func (*NormalFactory) Rollback added in v0.5.0

func (f *NormalFactory) Rollback(r *RancherService) error

func (*NormalFactory) Upgrade added in v0.5.0

func (f *NormalFactory) Upgrade(r *RancherService, force bool, selected []string) error

type PortRule added in v0.11.0

type PortRule struct {
	SourcePort  int    `json:"source_port" yaml:"source_port"`
	Protocol    string `json:"protocol" yaml:"protocol"`
	Path        string `json:"path" yaml:"path"`
	Hostname    string `json:"hostname" yaml:"hostname"`
	Service     string `json:"service" yaml:"service"`
	TargetPort  int    `json:"target_port" yaml:"target_port"`
	Priority    int    `json:"priority" yaml:"priority"`
	BackendName string `json:"backend_name" yaml:"backend_name"`
	Selector    string `json:"selector" yaml:"selector"`
}

type RancherConfig

type RancherConfig struct {
	// VirtualMachine fields
	Vcpu     composeYaml.StringorInt     `yaml:"vcpu,omitempty"`
	Userdata string                      `yaml:"userdata,omitempty"`
	Memory   composeYaml.StringorInt     `yaml:"memory,omitempty"`
	Disks    []client.VirtualMachineDisk `yaml:"disks,omitempty"`

	Type        string                      `yaml:"type,omitempty"`
	Scale       composeYaml.StringorInt     `yaml:"scale,omitempty"`
	RetainIp    bool                        `yaml:"retain_ip,omitempty"`
	LbConfig    *LBConfig                   `yaml:"lb_config,omitempty"`
	ExternalIps []string                    `yaml:"external_ips,omitempty"`
	Hostname    string                      `yaml:"hostname,omitempty"`
	HealthCheck *client.InstanceHealthCheck `yaml:"health_check,omitempty"`

	// Present only for compatibility with legacy load balancers
	// New load balancers will have these fields under 'lb_config'
	LegacyLoadBalancerConfig *legacyClient.LoadBalancerConfig `yaml:"load_balancer_config,omitempty"`
	DefaultCert              string                           `yaml:"default_cert,omitempty"`
	Certs                    []string                         `yaml:"certs,omitempty"`

	Metadata        map[string]interface{}          `yaml:"metadata,omitempty"`
	ScalePolicy     *client.ScalePolicy             `yaml:"scale_policy,omitempty"`
	ServiceSchemas  map[string]client.Schema        `yaml:"service_schemas,omitempty"`
	UpgradeStrategy client.InServiceUpgradeStrategy `yaml:"upgrade_strategy,omitempty"`
	StorageDriver   *client.StorageDriver           `yaml:"storage_driver,omitempty"`
	NetworkDriver   *client.NetworkDriver           `yaml:"network_driver,omitempty"`
}

type RancherService

type RancherService struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(name string, config *config.ServiceConfig, context *Context) *RancherService

func (*RancherService) Build added in v0.2.2

func (r *RancherService) Build(ctx context.Context, buildOptions options.Build) error

func (*RancherService) Client added in v0.2.2

func (r *RancherService) Client() *client.RancherClient

func (*RancherService) Config

func (r *RancherService) Config() *config.ServiceConfig

func (*RancherService) Containers added in v0.2.0

func (r *RancherService) Containers(ctx context.Context) ([]project.Container, error)

func (*RancherService) Context added in v0.5.0

func (r *RancherService) Context() *Context

func (*RancherService) Create

func (r *RancherService) Create(ctx context.Context, options options.Create) error

func (*RancherService) Delete

func (r *RancherService) Delete(ctx context.Context, options options.Delete) error

func (*RancherService) DependentServices added in v0.2.0

func (r *RancherService) DependentServices() []project.ServiceRelationship

func (*RancherService) Down

func (r *RancherService) Down() error

func (*RancherService) Events added in v0.9.1

func (r *RancherService) Events(ctx context.Context, messages chan events.ContainerEvent) error

func (*RancherService) FindExisting added in v0.5.0

func (r *RancherService) FindExisting(name string) (*client.Service, error)

func (*RancherService) HealthCheck added in v0.5.0

func (r *RancherService) HealthCheck(service string) *client.InstanceHealthCheck

func (*RancherService) Info added in v0.2.3

func (*RancherService) Kill added in v0.2.2

func (r *RancherService) Kill(ctx context.Context, signal string) error

func (*RancherService) Log

func (r *RancherService) Log(ctx context.Context, follow bool) error

func (*RancherService) Metadata added in v0.5.0

func (r *RancherService) Metadata() map[string]interface{}

func (*RancherService) Name

func (r *RancherService) Name() string

func (*RancherService) Pause added in v0.8.0

func (r *RancherService) Pause(ctx context.Context) error

func (*RancherService) Pull added in v0.2.0

func (r *RancherService) Pull(ctx context.Context) (err error)

func (*RancherService) RancherConfig added in v0.5.0

func (r *RancherService) RancherConfig() RancherConfig

func (*RancherService) RancherService added in v0.2.2

func (r *RancherService) RancherService() (*client.Service, error)

func (*RancherService) RemoveImage added in v0.9.1

func (r *RancherService) RemoveImage(ctx context.Context, imageType options.ImageType) error

func (*RancherService) Restart

func (r *RancherService) Restart(ctx context.Context, timeout int) error

func (*RancherService) Run added in v0.8.0

func (r *RancherService) Run(ctx context.Context, commandParts []string, options options.Run) (int, error)

func (*RancherService) Scale

func (r *RancherService) Scale(ctx context.Context, count int, timeout int) error

func (*RancherService) SelectorContainer added in v0.5.0

func (r *RancherService) SelectorContainer() string
func (r *RancherService) SelectorLink() string

func (*RancherService) Start added in v0.2.2

func (r *RancherService) Start(ctx context.Context) error

func (*RancherService) Stop added in v0.8.0

func (r *RancherService) Stop(ctx context.Context, timeout int) error

func (*RancherService) Unpause added in v0.8.0

func (r *RancherService) Unpause(ctx context.Context) error

func (*RancherService) Up

func (r *RancherService) Up(ctx context.Context, options options.Up) error

func (*RancherService) Wait added in v0.2.2

func (r *RancherService) Wait(service *client.Service) error

func (*RancherService) WaitFor added in v0.4.0

func (r *RancherService) WaitFor(resource *client.Resource, output interface{}, transitioning func() string) error

type RancherServiceFactory

type RancherServiceFactory struct {
	Context *Context
}

func (*RancherServiceFactory) Create

func (r *RancherServiceFactory) Create(project *project.Project, name string, serviceConfig *config.ServiceConfig) (project.Service, error)

type RancherVolumesFactory added in v0.11.0

type RancherVolumesFactory struct {
	Context *Context
}

func (*RancherVolumesFactory) Create added in v0.11.0

func (f *RancherVolumesFactory) Create(projectName string, volumeConfigs map[string]*config.VolumeConfig, serviceConfigs *config.ServiceConfigs, volumeEnabled bool) (project.Volumes, error)

type S3Uploader

type S3Uploader struct {
}

func (*S3Uploader) Name

func (s *S3Uploader) Name() string

func (*S3Uploader) Upload

func (s *S3Uploader) Upload(p *project.Project, name string, reader io.ReadSeeker, hash string) (string, string, error)

type Service added in v0.11.0

type Service struct {
	Labels map[string]interface{} `json:"labels"`
	Ports  []interface{}          `json:"ports"`
}

type ServiceType added in v0.5.0

type ServiceType int

func FindServiceType added in v0.5.0

func FindServiceType(r *RancherService) ServiceType

type Sidekick

type Sidekick struct {
	project.EmptyService
	// contains filtered or unexported fields
}

func NewSidekick

func NewSidekick(name string, serviceConfig *config.ServiceConfig, context *Context) *Sidekick

func (*Sidekick) Config

func (s *Sidekick) Config() *config.ServiceConfig

func (*Sidekick) DependentServices added in v0.2.0

func (s *Sidekick) DependentServices() []project.ServiceRelationship

func (*Sidekick) Log

func (s *Sidekick) Log(ctx context.Context, follow bool) error

func (*Sidekick) Name

func (s *Sidekick) Name() string

type SidekickInfo

type SidekickInfo struct {
	// contains filtered or unexported fields
}

func NewSidekickInfo

func NewSidekickInfo(project *project.Project) *SidekickInfo

type Uploader

type Uploader interface {
	Upload(p *project.Project, name string, reader io.ReadSeeker, hash string) (string, string, error)
	Name() string
}

type Volume added in v0.11.0

type Volume struct {
	// contains filtered or unexported fields
}

func NewVolume added in v0.11.0

func NewVolume(projectName, name string, config *config.VolumeConfig, context *Context) *Volume

func (*Volume) EnsureItExists added in v0.11.0

func (v *Volume) EnsureItExists(ctx context.Context) error

func (*Volume) InspectExternal added in v0.11.0

func (v *Volume) InspectExternal(ctx context.Context) (*client.Volume, error)

InspectExternal looks up a volume

func (*Volume) InspectTemplate added in v0.11.0

func (v *Volume) InspectTemplate(ctx context.Context) (*client.VolumeTemplate, error)

InspectTemplate looks up a volume template

func (*Volume) Remove added in v0.11.0

func (v *Volume) Remove(ctx context.Context) error

type Volumes added in v0.11.0

type Volumes struct {
	Context *Context
	// contains filtered or unexported fields
}

func (*Volumes) Initialize added in v0.11.0

func (v *Volumes) Initialize(ctx context.Context) error

func (*Volumes) Remove added in v0.11.0

func (v *Volumes) Remove(ctx context.Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL