core

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2016 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Log = logrus.New()

	EtcdEndpoints []string
	K8sHost       string
	K8sUser       string
	K8sPass       string
	AwsRegion     string
	AwsAZ         string
	AwsSgID       string
	AwsSubnetID   string
)

Functions

func ImageRepoName

func ImageRepoName(m *common.ContainerBlueprint) string

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/

Types

type AppCollection

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

func (*AppCollection) Create

func (c *AppCollection) Create(r *AppResource) (*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) 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.

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
	// contains filtered or unexported fields
}

func (*AppResource) Components

func (r *AppResource) Components() *ComponentCollection

Components returns a ComponentCollection with a pointer to the AppResource.

func (*AppResource) Delete

func (r *AppResource) Delete() error

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

func (*AppResource) Save added in v0.4.0

func (r *AppResource) Save() error

Save saves the App in etcd through an update.

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
}

Collection is an interface for defining behavior of a collection of Resources.

type ComponentCollection

type ComponentCollection struct {
	App *AppResource
	// contains filtered or unexported fields
}

func (*ComponentCollection) Create

Create takes an Component and creates it in etcd.

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.

type ComponentList

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

type ComponentResource

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

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 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 (*ComponentResource) Releases

func (r *ComponentResource) Releases() *ReleaseCollection

func (*ComponentResource) Save

func (r *ComponentResource) Save() error

Save saves the Component in etcd through an update.

func (*ComponentResource) TargetRelease

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

type Core

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

func New

func New(httpsMode bool, aws_access_key_id string, aws_secret_access_key string) *Core

func (*Core) Apps

func (c *Core) Apps() *AppCollection

Top-level resources ==============================================================================

func (*Core) Entrypoints

func (c *Core) Entrypoints() *EntrypointCollection

func (*Core) ImageRepos

func (c *Core) ImageRepos() *ImageRepoCollection

func (*Core) Tasks

func (c *Core) Tasks() *TaskCollection

type EntrypointCollection

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

func (*EntrypointCollection) Create

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

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.

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) 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 cascades deletes to all Components, deletes the Kube Namespace, and deletes the Entrypoint in etcd.

func (*EntrypointResource) RemovePort

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

RemovePort removes a listener from the ELB.

func (*EntrypointResource) Save

func (r *EntrypointResource) Save() error

Save saves the Entrypoint in etcd through an update.

type ExternalPort added in v0.3.2

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

type ImageRepoCollection

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

func (*ImageRepoCollection) Create

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

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.

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) Delete

func (r *ImageRepoResource) Delete() error

Delete deletes the ImageRepo in etcd.

type InstanceCollection

type InstanceCollection struct {
	Release *ReleaseResource
	// contains filtered or unexported fields
}

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.

type InstanceList

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

type InstanceResource

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

func (*InstanceResource) App

func (r *InstanceResource) App() *AppResource

func (*InstanceResource) Component

func (r *InstanceResource) Component() *ComponentResource

func (*InstanceResource) Delete

func (r *InstanceResource) Delete() (err 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 InternalPort added in v0.3.2

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

type OrderedResource

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

OrderedResource is similar to Resource, but provides a setID() method to set an auto-generated ID from etcd on the Resource.

type ReleaseCollection

type ReleaseCollection struct {
	Component *ComponentResource
	// contains filtered or unexported fields
}

func (*ReleaseCollection) Create

Create takes an Release and creates it in etcd.

func (*ReleaseCollection) Get

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) (*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.

type ReleaseList

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

type ReleaseResource

type ReleaseResource struct {
	*common.Release

	// 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) AddNewPorts added in v0.3.2

func (newR *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 removes all assets (volumes, pods, etc.) and deletes the Release in etcd.

func (*ReleaseResource) ExternalPorts added in v0.3.2

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

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() *InstanceCollection

func (*ReleaseResource) InternalPorts added in v0.3.2

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

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) 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 (newR *ReleaseResource) RemoveOldPorts(oldR *ReleaseResource) error

func (*ReleaseResource) Save added in v0.3.1

func (r *ReleaseResource) Save() error

Save saves the Release in etcd through an update.

type Resource

type Resource interface {
}

Resource is an interface used mainly for generalized marshalling purposes for resource common.

type TaskCollection

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

func (*TaskCollection) Create

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

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

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) Start

func (c *TaskCollection) Start(t common.TaskType, msg interface{}) (*TaskResource, error)

NOTE kinda like a New().Save()

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) 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) RecordError

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

func (*TaskResource) Save

func (r *TaskResource) Save() error

Save saves the Task in etcd through an update.

func (*TaskResource) TypeName added in v0.3.0

func (r *TaskResource) TypeName() string

Jump to

Keyboard shortcuts

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