core

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2016 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Log = logrus.New()
)

Functions

func ResourceLocation added in v0.5.0

func ResourceLocation(location Locatable) (path string)

ResourceLocation will take a Locatable and return a path just as "/apps/:name/components/:name/releases/:timestamp/instances/0" This will mirror API routes.

func RunCustomDeployment added in v0.4.0

func RunCustomDeployment(core *Core, component *ComponentResource) error

func SetLogLevel added in v0.4.1

func SetLogLevel(level string)

TODO inconsistent with method in Guber and client/

func ZeroPrivateFields added in v0.5.6

func ZeroPrivateFields(r Resource)

ZeroPrivateFields takes a Resource with pointer, and zeroes any fields with the tag sg:"private".

func ZeroReadonlyFields added in v0.5.6

func ZeroReadonlyFields(r Resource)

ZeroReadonlyFields takes a Resource with pointer, and zeroes any fields with the tag sg:"readonly".

Types

type Action added in v0.5.0

type Action struct {
	ResourceLocation string `json:"resource_location"`
	ActionName       string `json:"action_name"`
	// contains filtered or unexported fields
}

func (*Action) ID added in v0.5.0

func (a *Action) ID() common.ID

ID returns a common.ID which is an SHA1 checksum of action_name:resource_key. This creates a simple "mutex" on Resource actions since a create operation on an existing key will fail.

func (*Action) Perform added in v0.5.0

func (a *Action) Perform() error

Perform performs the Action by calling the performer func.

func (*Action) Supervise added in v0.5.0

func (a *Action) Supervise() error

Supervise sets the ResourceLocation of the resource and creates a Task from the Action.

type ActionPerformer added in v0.5.0

type ActionPerformer func(r Resource) error

type AppCollection

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

func (*AppCollection) Create

func (c *AppCollection) Create(r *AppResource) error

Create takes an App and creates it in etcd. It also creates a Kubernetes Namespace with the name of the App.

func (*AppCollection) Delete added in v0.4.4

func (c *AppCollection) Delete(ri Resource) error

Delete deletes the App in etcd, and deletes the namespace and all Components.

NOTE I know it's weird that we take an App here and not an ID, but we do that to prevent double lookup when component.Delete() is called. And while it may be weird, the resource-level Delete() is the natural approach to calling Delete, and so it would be rare to have to manually say components.Delete(component). The reason we put this logic here and not on the Component itself is because we want to isolate shared Resource behavior (CRUD) from Resources, preventing Resources from having any operational logic (like deleting volumes and such) that we want to mock. It is difficult to approach mocking Resources, because if they are returned as interfaces from methods like collection.Get(), we no longer have access to the attributes of the Resource without type casting.

func (*AppCollection) Get

func (c *AppCollection) Get(name common.ID) (*AppResource, error)

Get takes a name and returns an AppResource if it exists.

func (*AppCollection) List

func (c *AppCollection) List() (*AppList, error)

List returns an AppList.

func (*AppCollection) New

func (c *AppCollection) New() *AppResource

New initializes an App with a pointer to the Collection.

func (*AppCollection) Patch added in v0.5.11

func (c *AppCollection) Patch(name common.ID, r *AppResource) error

Patch partially updates the App in etcd.

func (*AppCollection) Update added in v0.4.4

func (c *AppCollection) Update(name common.ID, r *AppResource) error

Update updates the App in etcd.

type AppList

type AppList struct {
	Items []*AppResource `json:"items"`
}

NOTE this does not inherit from common like model does; all we need is a List object, internally, that has a slice of our composed model above.

type AppResource

type AppResource struct {
	*common.App

	// Relations
	ComponentsInterface ComponentsInterface `json:"-"`
	// contains filtered or unexported fields
}

func (*AppResource) Action added in v0.5.0

func (r *AppResource) Action(name string) *Action

Action implements the Resource interface.

func (*AppResource) Components

func (r *AppResource) Components() ComponentsInterface

Components returns a ComponentsInterface with a pointer to the AppResource.

func (*AppResource) Delete

func (r *AppResource) Delete() error

Delete is a proxy method to AppCollection's Delete.

func (*AppResource) Patch added in v0.5.11

func (r *AppResource) Patch() error

Patch is a proxy method to collection Patch.

func (*AppResource) Update added in v0.4.4

func (r *AppResource) Update() error

Update is a proxy method to AppCollection's Update.

type AppsInterface added in v0.5.0

type AppsInterface interface {
	List() (*AppList, error)
	New() *AppResource
	Create(*AppResource) error
	Get(common.ID) (*AppResource, error)
	Update(common.ID, *AppResource) error
	Patch(common.ID, *AppResource) error
	Delete(Resource) error
}

type AwsVolume

type AwsVolume struct {
	Blueprint *common.VolumeBlueprint
	Instance  *InstanceResource
	// contains filtered or unexported fields
}

func (*AwsVolume) Create added in v0.3.3

func (m *AwsVolume) Create() error

func (*AwsVolume) Delete

func (m *AwsVolume) Delete() error

Delete deletes the EBS volume on AWS.

func (*AwsVolume) Exists added in v0.3.3

func (m *AwsVolume) Exists() (bool, error)

type Collection

type Collection interface {
	// contains filtered or unexported methods
}

type ComponentCollection

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

ComponentCollection implements ComponentsInterface.

func (*ComponentCollection) App

func (c *ComponentCollection) App() *AppResource

func (*ComponentCollection) Create

Create takes an Component and creates it in etcd.

func (*ComponentCollection) Delete added in v0.4.4

func (c *ComponentCollection) Delete(ri Resource) error

Delete cascades delete calls to current and target releases, and deletes the Component in etcd.

TODO this should somehow stop any ongoing tasks related to the Component.

func (*ComponentCollection) Deploy added in v0.5.0

func (c *ComponentCollection) Deploy(ri Resource) (err error)

func (*ComponentCollection) Get

Get takes a name and returns an ComponentResource if it exists.

func (*ComponentCollection) List

func (c *ComponentCollection) List() (*ComponentList, error)

List returns an ComponentList.

func (*ComponentCollection) New

New initializes an Component with a pointer to the Collection.

func (*ComponentCollection) Patch added in v0.5.11

Patch partially updates the App in etcd.

func (*ComponentCollection) Update added in v0.4.4

func (c *ComponentCollection) Update(name common.ID, r *ComponentResource) error

Update saves the Component in etcd through an update.

type ComponentList

type ComponentList struct {
	Items []*ComponentResource `json:"items"`
}

type ComponentResource

type ComponentResource struct {
	*common.Component

	// Relations
	ReleasesInterface ReleasesInterface `json:"-"`
	// contains filtered or unexported fields
}

func (*ComponentResource) Action added in v0.5.0

func (r *ComponentResource) Action(name string) *Action

Action implements the Resource interface.

func (*ComponentResource) App

func (r *ComponentResource) App() *AppResource

func (*ComponentResource) CurrentRelease

func (r *ComponentResource) CurrentRelease() (*ReleaseResource, error)

func (*ComponentResource) Delete

func (r *ComponentResource) Delete() error

Delete is a proxy method to ComponentCollection's Delete.

func (*ComponentResource) Patch added in v0.5.11

func (r *ComponentResource) Patch() error

Patch is a proxy method to collection Patch.

func (*ComponentResource) Releases

func (r *ComponentResource) Releases() ReleasesInterface

Releases returns a ReleasesInterface with a pointer to the AppResource.

func (*ComponentResource) TargetRelease

func (r *ComponentResource) TargetRelease() (*ReleaseResource, error)

func (*ComponentResource) Update added in v0.4.4

func (r *ComponentResource) Update() error

Update is a proxy method to ComponentCollection's Update.

type ComponentsInterface added in v0.4.4

type ComponentsInterface interface {
	// A simple getter since App is an attribute on actual Collections implementing this
	App() *AppResource

	List() (*ComponentList, error)
	New() *ComponentResource
	Create(*ComponentResource) error
	Get(common.ID) (*ComponentResource, error)
	Update(common.ID, *ComponentResource) error
	Patch(common.ID, *ComponentResource) error
	Deploy(Resource) error
	Delete(Resource) error
}

type Core

type Core struct {
	EtcdEndpoints          []string
	K8sHost                string
	K8sUser                string
	K8sPass                string
	K8sInsecureHTTPS       bool
	AwsRegion              string
	AwsAZ                  string
	AwsSgID                string
	AwsSubnetID            string
	AwsAccessKey           string
	AwsSecretKey           string
	CapacityServiceEnabled bool

	AppsInterface            AppsInterface
	EntrypointsInterface     EntrypointsInterface
	ImageRegistriesInterface ImageRegistriesInterface
	NodesInterface           NodesInterface
	TasksInterface           TasksInterface
	// contains filtered or unexported fields
}

func (*Core) Apps

func (c *Core) Apps() AppsInterface

func (*Core) Entrypoints

func (c *Core) Entrypoints() EntrypointsInterface

func (*Core) ImageRegistries added in v0.5.0

func (c *Core) ImageRegistries() ImageRegistriesInterface

func (*Core) ImageRepos

func (c *Core) ImageRepos() ImageReposInterface

TODO this goes away when Dockerhub is not the only ImageRegistry

func (*Core) Initialize added in v0.4.4

func (c *Core) Initialize()

NOTE this used to be core.New(), but due to how we load in values from the cli package, I needed to first actually initialize a Core struct and then configure.

func (*Core) Nodes added in v0.5.0

func (c *Core) Nodes() NodesInterface

func (*Core) Tasks

func (c *Core) Tasks() TasksInterface

type EntrypointCollection

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

func (*EntrypointCollection) Create

Create takes an Entrypoint and creates it in etcd, and creates an AWS ELB.

func (*EntrypointCollection) Delete added in v0.4.4

Delete cascades deletes to all Components, deletes the Kube Namespace, and deletes the Entrypoint in etcd.

func (*EntrypointCollection) Get

Get takes a name and returns an EntrypointResource if it exists.

func (*EntrypointCollection) List

List returns an EntrypointList.

func (*EntrypointCollection) New

New initializes an Entrypoint with a pointer to the Collection.

func (*EntrypointCollection) Patch added in v0.5.11

Patch partially updates the App in etcd.

func (*EntrypointCollection) Update added in v0.4.4

func (c *EntrypointCollection) Update(domain common.ID, r *EntrypointResource) error

Update saves the Entrypoint in etcd through an update.

type EntrypointList

type EntrypointList struct {
	Items []*EntrypointResource `json:"items"`
}

NOTE this does not inherit from common like model does; all we need is a List object, internally, that has a slice of our composed model above.

type EntrypointResource

type EntrypointResource struct {
	*common.Entrypoint
	// contains filtered or unexported fields
}

func (*EntrypointResource) Action added in v0.5.0

func (r *EntrypointResource) Action(name string) *Action

Action implements the Resource interface.

func (*EntrypointResource) AddPort

func (r *EntrypointResource) AddPort(elbPort int, instancePort int) error

AddPort creates a listener on the ELB.

func (*EntrypointResource) Delete

func (r *EntrypointResource) Delete() error

Delete is a proxy method to EntrypointCollection's Delete.

func (*EntrypointResource) Patch added in v0.5.11

func (r *EntrypointResource) Patch() error

Patch is a proxy method to collection Patch.

func (*EntrypointResource) RemovePort

func (r *EntrypointResource) RemovePort(elbPort int) error

RemovePort removes a listener from the ELB.

func (*EntrypointResource) Update added in v0.4.4

func (r *EntrypointResource) Update() error

Update is a proxy method to EntrypointCollection's Update.

type EntrypointsInterface added in v0.5.0

type EntrypointsInterface interface {
	List() (*EntrypointList, error)
	New() *EntrypointResource
	Create(*EntrypointResource) error
	Get(common.ID) (*EntrypointResource, error)
	Update(common.ID, *EntrypointResource) error
	Patch(common.ID, *EntrypointResource) error
	Delete(*EntrypointResource) error
}

type ImageRegistriesInterface added in v0.5.0

type ImageRegistryCollection added in v0.5.0

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

func (*ImageRegistryCollection) Create added in v0.5.0

Create takes an ImageRegistry and creates it in etcd.

func (*ImageRegistryCollection) Delete added in v0.5.0

Delete deletes the ImageRegistry in etcd.

func (*ImageRegistryCollection) Get added in v0.5.0

Get takes a name and returns an ImageRegistryResource if it exists.

func (*ImageRegistryCollection) List added in v0.5.0

List returns an ImageRegistryList.

func (*ImageRegistryCollection) New added in v0.5.0

New initializes an ImageRegistry with a pointer to the Collection.

func (*ImageRegistryCollection) Patch added in v0.5.11

Patch partially updates the App in etcd.

func (*ImageRegistryCollection) Update added in v0.5.0

Update updates the ImageRegistry in etcd.

type ImageRegistryList added in v0.5.0

type ImageRegistryList struct {
	Items []*ImageRegistryResource `json:"items"`
}

NOTE this does not inherit from common like model does; all we need is a List object, internally, that has a slice of our composed model above.

type ImageRegistryResource added in v0.5.0

type ImageRegistryResource struct {
	*common.ImageRegistry

	// Relations
	ImageReposInterface ImageReposInterface `json:"-"`
	// contains filtered or unexported fields
}

func (*ImageRegistryResource) Action added in v0.5.0

func (r *ImageRegistryResource) Action(name string) *Action

Action implements the Resource interface.

func (*ImageRegistryResource) Delete added in v0.5.0

func (r *ImageRegistryResource) Delete() error

Delete is a proxy method to ImageRegistryCollection's Delete.

func (*ImageRegistryResource) ImageRepos added in v0.5.0

ImageRepos returns a ImageReposInterface with a pointer to the ImageRegistryResource.

func (*ImageRegistryResource) Patch added in v0.5.11

func (r *ImageRegistryResource) Patch() error

Patch is a proxy method to collection Patch.

func (*ImageRegistryResource) Update added in v0.5.0

func (r *ImageRegistryResource) Update() error

Update is a proxy method to ImageRegistryCollection's Update.

type ImageRepoCollection

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

func (*ImageRepoCollection) Create

Create takes an ImageRepo and creates it in etcd.

func (*ImageRepoCollection) Delete added in v0.4.4

Delete deletes the ImageRepo in etcd.

func (*ImageRepoCollection) Get

Get takes a name and returns an ImageRepoResource if it exists.

func (*ImageRepoCollection) List

func (c *ImageRepoCollection) List() (*ImageRepoList, error)

List returns an ImageRepoList.

func (*ImageRepoCollection) New

New initializes an ImageRepo with a pointer to the Collection.

func (*ImageRepoCollection) Patch added in v0.5.11

Patch partially updates the App in etcd.

func (*ImageRepoCollection) Update added in v0.4.4

func (c *ImageRepoCollection) Update(name common.ID, r *ImageRepoResource) error

Update updates the ImageRepo in etcd.

type ImageRepoList

type ImageRepoList struct {
	Items []*ImageRepoResource `json:"items"`
}

NOTE this does not inherit from common like model does; all we need is a List object, internally, that has a slice of our composed model above.

type ImageRepoResource

type ImageRepoResource struct {
	*common.ImageRepo
	// contains filtered or unexported fields
}

func (*ImageRepoResource) Action added in v0.5.0

func (r *ImageRepoResource) Action(name string) *Action

Action implements the Resource interface.

func (*ImageRepoResource) Delete

func (r *ImageRepoResource) Delete() error

Delete is a proxy method to ImageRepoCollection's Delete.

func (*ImageRepoResource) Patch added in v0.5.11

func (r *ImageRepoResource) Patch() error

Patch is a proxy method to collection Patch.

func (*ImageRepoResource) Update added in v0.4.4

func (r *ImageRepoResource) Update() error

Update is a proxy method to ImageRepoCollection's Update.

type ImageReposInterface added in v0.5.0

type ImageReposInterface interface {
	List() (*ImageRepoList, error)
	New() *ImageRepoResource
	Create(*ImageRepoResource) error
	Get(common.ID) (*ImageRepoResource, error)
	Update(common.ID, *ImageRepoResource) error
	Patch(common.ID, *ImageRepoResource) error
	Delete(*ImageRepoResource) error
}

type InstanceCollection

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

func (*InstanceCollection) App added in v0.5.12

func (c *InstanceCollection) App() *AppResource

func (*InstanceCollection) Component added in v0.5.12

func (c *InstanceCollection) Component() *ComponentResource

func (*InstanceCollection) Delete added in v0.5.12

func (c *InstanceCollection) Delete(r *InstanceResource) (err error)

func (*InstanceCollection) Get

Get takes an id and returns an InstanceResource if it exists.

func (*InstanceCollection) List

func (c *InstanceCollection) List() *InstanceList

List returns an InstanceList.

func (*InstanceCollection) New

New initializes an Instance with a pointer to the Collection.

func (*InstanceCollection) Release

func (c *InstanceCollection) Release() *ReleaseResource

func (*InstanceCollection) Start added in v0.5.0

func (c *InstanceCollection) Start(ri Resource) error

func (*InstanceCollection) Stop added in v0.5.0

func (c *InstanceCollection) Stop(ri Resource) error

type InstanceList

type InstanceList struct {
	Items []*InstanceResource `json:"items"`
}

type InstanceResource

type InstanceResource struct {
	*common.Instance
	// contains filtered or unexported fields
}

func (*InstanceResource) Action added in v0.5.0

func (r *InstanceResource) Action(name string) *Action

Action implements the Resource interface.

func (*InstanceResource) App

func (r *InstanceResource) App() *AppResource

func (*InstanceResource) Component

func (r *InstanceResource) Component() *ComponentResource

func (*InstanceResource) Delete

func (r *InstanceResource) Delete() error

Delete tears down the instance

func (*InstanceResource) DeleteVolumes

func (r *InstanceResource) DeleteVolumes() error

exposed for use in deploy_component.go

func (*InstanceResource) IsStarted

func (r *InstanceResource) IsStarted() bool

func (*InstanceResource) IsStopped

func (r *InstanceResource) IsStopped() bool

func (*InstanceResource) Log added in v0.4.0

func (r *InstanceResource) Log() (string, error)

func (*InstanceResource) Release

func (r *InstanceResource) Release() *ReleaseResource

func (*InstanceResource) Start

func (r *InstanceResource) Start() error

The following 2 are only diff from Provision() and Delete() in that they do not delete the create or delete the volumes.

func (*InstanceResource) Stop

func (r *InstanceResource) Stop() error

func (*InstanceResource) Volumes

func (r *InstanceResource) Volumes() (vols []*AwsVolume)

type InstancesInterface added in v0.5.0

type InstancesInterface interface {
	App() *AppResource
	Component() *ComponentResource
	Release() *ReleaseResource

	List() *InstanceList
	New(common.ID) *InstanceResource
	Get(common.ID) (*InstanceResource, error)
	Start(Resource) error
	Stop(Resource) error
	Delete(*InstanceResource) error
}

type Locatable added in v0.5.0

type Locatable interface {
	// contains filtered or unexported methods
}

type NodeCollection added in v0.5.0

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

func (*NodeCollection) Create added in v0.5.0

func (c *NodeCollection) Create(r *NodeResource) error

Create takes an Node and creates it in etcd.

func (*NodeCollection) Delete added in v0.5.0

func (c *NodeCollection) Delete(r *NodeResource) error

Delete deletes the Node in etcd.

func (*NodeCollection) Get added in v0.5.0

func (c *NodeCollection) Get(id common.ID) (*NodeResource, error)

Get takes a name and returns an NodeResource if it exists.

func (*NodeCollection) List added in v0.5.0

func (c *NodeCollection) List() (*NodeList, error)

List returns an NodeList.

func (*NodeCollection) New added in v0.5.0

func (c *NodeCollection) New() *NodeResource

New initializes an Node with a pointer to the Collection.

func (*NodeCollection) Patch added in v0.5.11

func (c *NodeCollection) Patch(name common.ID, r *NodeResource) error

Patch partially updates the App in etcd.

func (*NodeCollection) Update added in v0.5.0

func (c *NodeCollection) Update(id common.ID, r *NodeResource) error

Update updates the Node in etcd.

type NodeList added in v0.5.0

type NodeList struct {
	Items []*NodeResource `json:"items"`
}

NOTE this does not inherit from common like model does; all we need is a List object, internally, that has a slice of our composed model above.

type NodeResource added in v0.5.0

type NodeResource struct {
	*common.Node
	// contains filtered or unexported fields
}

func (*NodeResource) Action added in v0.5.0

func (r *NodeResource) Action(name string) *Action

Action implements the Resource interface.

func (*NodeResource) Delete added in v0.5.0

func (r *NodeResource) Delete() error

Delete is a proxy method to NodeCollection's Delete.

func (*NodeResource) Patch added in v0.5.11

func (r *NodeResource) Patch() error

Patch is a proxy method to collection Patch.

func (*NodeResource) Update added in v0.5.0

func (r *NodeResource) Update() error

Update is a proxy method to NodeCollection's Update.

type NodesInterface added in v0.5.0

type NodesInterface interface {
	List() (*NodeList, error)
	New() *NodeResource
	Create(*NodeResource) error
	Get(common.ID) (*NodeResource, error)
	Update(common.ID, *NodeResource) error
	Patch(common.ID, *NodeResource) error
	Delete(*NodeResource) error
	// contains filtered or unexported methods
}

type Port added in v0.6.1

type Port struct {
	*common.Port
	// contains filtered or unexported fields
}

type ReleaseCollection

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

func (*ReleaseCollection) Component

func (c *ReleaseCollection) Component() *ComponentResource

func (*ReleaseCollection) Create

func (c *ReleaseCollection) Create(r *ReleaseResource) error

Create takes an Release and creates it in etcd.

func (*ReleaseCollection) Delete added in v0.4.4

func (c *ReleaseCollection) Delete(r *ReleaseResource) error

Delete removes all assets (volumes, pods, etc.) and deletes the Release in etcd.

func (*ReleaseCollection) Get

func (c *ReleaseCollection) Get(timestamp common.ID) (*ReleaseResource, error)

Get takes an id and returns an ReleaseResource if it exists.

func (*ReleaseCollection) List

func (c *ReleaseCollection) List() (*ReleaseList, error)

List returns an ReleaseList.

func (*ReleaseCollection) MergeCreate added in v0.4.2

func (c *ReleaseCollection) MergeCreate(r *ReleaseResource) error

MergeCreate creates a Release by taking a new Release and merging it with the Component's current Release.

func (*ReleaseCollection) New

New initializes an Release with a pointer to the Collection.

func (*ReleaseCollection) Patch added in v0.5.11

func (c *ReleaseCollection) Patch(name common.ID, r *ReleaseResource) error

Patch partially updates the App in etcd.

func (*ReleaseCollection) Update added in v0.4.4

func (c *ReleaseCollection) Update(timestamp common.ID, r *ReleaseResource) error

Update saves the Release in etcd through an update.

type ReleaseList

type ReleaseList struct {
	Items []*ReleaseResource `json:"items"`
}

type ReleaseResource

type ReleaseResource struct {
	*common.Release

	// Relations
	InstancesInterface InstancesInterface `json:"-"`

	// TODO these are shared between releases, it's kinda funky right now
	ExternalService *guber.Service `json:"-"`
	InternalService *guber.Service `json:"-"`
	// contains filtered or unexported fields
}

func (*ReleaseResource) Action added in v0.5.0

func (r *ReleaseResource) Action(name string) *Action

Action implements the Resource interface.

func (*ReleaseResource) AddNewPorts added in v0.3.2

func (r *ReleaseResource) AddNewPorts(oldR *ReleaseResource) error

AddNewPorts adds any new ports defined in containers to the existing Services. This is used as a part of the deployment process, and is used in conjunction with RemoveOldPorts. We use the config returned from the services themselves, as opposed to just updating the config, because auto-assigned ports need to be preserved.

func (*ReleaseResource) App

func (r *ReleaseResource) App() *AppResource

func (*ReleaseResource) Component

func (r *ReleaseResource) Component() *ComponentResource

func (*ReleaseResource) Delete

func (r *ReleaseResource) Delete() error

Delete is a proxy method to ReleaseCollection's Delete.

func (*ReleaseResource) ExternalPorts added in v0.3.2

func (r *ReleaseResource) ExternalPorts() (ports []*Port)

func (*ReleaseResource) ExternalServiceName added in v0.3.2

func (r *ReleaseResource) ExternalServiceName() string

func (*ReleaseResource) ImagePullSecrets

func (r *ReleaseResource) ImagePullSecrets() (pullSecrets []*guber.ImagePullSecret, err error)

TODO naming inconsistencies for kube definitions of resources ImagePullSecrets returns repo names defined for Kube pods

func (*ReleaseResource) Instances

func (r *ReleaseResource) Instances() InstancesInterface

func (*ReleaseResource) InternalPorts added in v0.3.2

func (r *ReleaseResource) InternalPorts() (ports []*Port)

func (*ReleaseResource) InternalServiceName added in v0.3.2

func (r *ReleaseResource) InternalServiceName() string

func (*ReleaseResource) IsStarted

func (r *ReleaseResource) IsStarted() bool

func (*ReleaseResource) IsStopped

func (r *ReleaseResource) IsStopped() bool

func (*ReleaseResource) Patch added in v0.5.11

func (r *ReleaseResource) Patch() error

Patch is a proxy method to collection Patch.

func (*ReleaseResource) Provision

func (r *ReleaseResource) Provision() error

Provision creates needed assets for all instances. It does not actually start instances -- that is handled by deploy.go.

func (*ReleaseResource) RemoveOldPorts added in v0.3.2

func (r *ReleaseResource) RemoveOldPorts(oldR *ReleaseResource) error

func (*ReleaseResource) Update added in v0.4.4

func (r *ReleaseResource) Update() error

Update is a proxy method to ReleaseCollection's Update.

type ReleasesInterface added in v0.4.4

type ReleasesInterface interface {
	Component() *ComponentResource

	List() (*ReleaseList, error)
	New() *ReleaseResource
	Create(*ReleaseResource) error
	MergeCreate(*ReleaseResource) error
	Get(common.ID) (*ReleaseResource, error)
	Update(common.ID, *ReleaseResource) error
	Patch(common.ID, *ReleaseResource) error
	Delete(*ReleaseResource) error
}

type Resource

type Resource interface {
	Action(string) *Action
	// contains filtered or unexported methods
}

func LocateResource added in v0.5.0

func LocateResource(coreLoc Locatable, path string) Resource

type Supervisor added in v0.5.0

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

func NewSupervisor added in v0.5.0

func NewSupervisor(c *Core, workers int) *Supervisor

func (*Supervisor) Run added in v0.5.0

func (s *Supervisor) Run()

type TaskCollection

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

func (*TaskCollection) Create

func (c *TaskCollection) Create(r *TaskResource) error

Create takes an Task and creates it in etcd.

func (*TaskCollection) Delete added in v0.5.0

func (c *TaskCollection) Delete(r *TaskResource) error

Delete deletes the Task in etcd.

func (*TaskCollection) Get

func (c *TaskCollection) Get(id common.ID) (*TaskResource, error)

Get takes a name and returns an TaskResource if it exists.

func (*TaskCollection) List

func (c *TaskCollection) List() (*TaskList, error)

List returns an TaskList.

func (*TaskCollection) New

func (c *TaskCollection) New() *TaskResource

New initializes an Task with a pointer to the Collection.

func (*TaskCollection) Patch added in v0.5.11

func (c *TaskCollection) Patch(name common.ID, r *TaskResource) error

Patch partially updates the App in etcd.

func (*TaskCollection) Start

func (c *TaskCollection) Start(action *Action) (*TaskResource, error)

Start builds a Task from an Action and creates it in etcd. The QUEUED status will inform the Supervisor to Claim the Task.

func (*TaskCollection) Update added in v0.5.0

func (c *TaskCollection) Update(id common.ID, r *TaskResource) error

Update updates the Task in etcd.

type TaskList

type TaskList struct {
	Items []*TaskResource `json:"items"`
}

NOTE this does not inherit from common like model does; all we need is a List object, internally, that has a slice of our composed model above.

type TaskResource

type TaskResource struct {
	*common.Task
	// contains filtered or unexported fields
}

func (*TaskResource) Action added in v0.5.0

func (r *TaskResource) Action(name string) *Action

Action implements the Resource interface. NOTE Tasks are inextricably linked to Actions, but can have Actions of their own, since they are Resources themselves. The ToAction() method is very, very different from this method, and is used to convert a Task into the Action.

func (*TaskResource) Claim

func (r *TaskResource) Claim() error

Claim updates the Task status to "RUNNING" and returns nil. compareAndSwap is used to prevent a race condition and ensure only one worker performs the task.

func (*TaskResource) Delete

func (r *TaskResource) Delete() error

Delete deletes the Task in etcd.

func (*TaskResource) IsQueued

func (r *TaskResource) IsQueued() bool

func (*TaskResource) Patch added in v0.5.11

func (r *TaskResource) Patch() error

Patch is a proxy method to collection Patch.

func (*TaskResource) RecordError

func (r *TaskResource) RecordError(err error) error

func (*TaskResource) ToAction added in v0.5.0

func (r *TaskResource) ToAction() *Action

See NOTE on Action() method

func (*TaskResource) Update added in v0.4.4

func (r *TaskResource) Update() error

Update saves the Task in etcd through an update.

type TasksInterface added in v0.5.0

type TasksInterface interface {
	List() (*TaskList, error)
	New() *TaskResource
	Start(*Action) (*TaskResource, error)
	Create(*TaskResource) error
	Get(common.ID) (*TaskResource, error)
	Update(common.ID, *TaskResource) error
	Patch(common.ID, *TaskResource) error
	Delete(*TaskResource) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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