Documentation ¶
Index ¶
- func StringID(id ID) string
- func WaitFor(desc string, d time.Duration, i time.Duration, fn func() (bool, error)) error
- type App
- type BytesValue
- type Component
- type ComponentAddresses
- type ContainerBlueprint
- type CoresValue
- type CpuAllocation
- type CustomDeployScript
- type Entrypoint
- type EnvVar
- type ID
- type ImageRegistry
- type ImageRepo
- type Instance
- type InstanceStatus
- type Meta
- type Mount
- type Node
- type Port
- type PortAddress
- type RamAllocation
- type Release
- type ResourceMetrics
- type Tags
- type Task
- type Timestamp
- type VolumeBlueprint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
App is the main top-level Resource within Supergiant, acting as a logical namespace for Components and all of their controlled assets -- along with provisioning an actual Kubernetes Namespace, it is used as a base name for app-specific cloud assets.
type BytesValue ¶
type BytesValue struct {
Bytes int64
}
func BytesFromString ¶ added in v0.5.4
func BytesFromString(str string) *BytesValue
func (*BytesValue) Gibibytes ¶ added in v0.5.3
func (v *BytesValue) Gibibytes() float64
func (*BytesValue) MarshalJSON ¶ added in v0.5.1
func (b *BytesValue) MarshalJSON() ([]byte, error)
func (*BytesValue) Mebibytes ¶ added in v0.5.3
func (v *BytesValue) Mebibytes() float64
func (*BytesValue) ToKubeMebibytes ¶
func (v *BytesValue) ToKubeMebibytes() string
func (*BytesValue) UnmarshalJSON ¶ added in v0.5.1
func (b *BytesValue) UnmarshalJSON(raw []byte) error
type Component ¶
type Component struct { Name ID `json:"name"` // validate:"regexp=^[a-z]([-a-z0-9]*[a-z0-9])?$" CustomDeployScript *CustomDeployScript `json:"custom_deploy_script"` CurrentReleaseTimestamp ID `json:"current_release_id"` TargetReleaseTimestamp ID `json:"target_release_id"` *Meta Addresses *ComponentAddresses `json:"addresses,omitempty" db:"-"` }
type ComponentAddresses ¶
type ComponentAddresses struct { External []*PortAddress `json:"external"` Internal []*PortAddress `json:"internal"` }
type ContainerBlueprint ¶
type ContainerBlueprint struct { Image string `json:"image"` Name string `json:"name,omitempty"` Command []string `json:"command,omitempty"` Ports []*Port `json:"ports"` Env []*EnvVar `json:"env"` CPU *CpuAllocation `json:"cpu"` RAM *RamAllocation `json:"ram"` Mounts []*Mount `json:"mounts,omitempty"` }
Container ==============================================================================
type CoresValue ¶
type CoresValue struct {
Millicores int
}
func CoresFromString ¶ added in v0.5.4
func CoresFromString(str string) *CoresValue
func (*CoresValue) Cores ¶ added in v0.5.3
func (v *CoresValue) Cores() float64
func (*CoresValue) MarshalJSON ¶ added in v0.5.1
func (c *CoresValue) MarshalJSON() ([]byte, error)
func (*CoresValue) ToKubeMillicores ¶
func (v *CoresValue) ToKubeMillicores() string
func (*CoresValue) UnmarshalJSON ¶ added in v0.5.1
func (c *CoresValue) UnmarshalJSON(raw []byte) error
type CpuAllocation ¶ added in v0.5.1
type CpuAllocation struct { Min *CoresValue `json:"min"` Max *CoresValue `json:"max"` }
type CustomDeployScript ¶
type Entrypoint ¶
type Entrypoint struct { Domain ID `json:"domain"` // e.g. test.example.com Address string `json:"address"` // the ELB address *Meta }
Entrypoint ==============================================================================
type EnvVar ¶
type EnvVar struct { Name string `json:"name"` Value string `json:"value"` // this may be templated, "something_{{ instance_id }}" }
EnvVar ==============================================================================
type ID ¶
type ID *string
ID is defined as a string pointer in order to check for nil in the context of relations. NOTE this may not be best practice.
type ImageRegistry ¶ added in v0.5.0
ImageRegistry ==============================================================================
type ImageRepo ¶
ImageRepo ==============================================================================
type Instance ¶
type Instance struct { ID ID `json:"id"` // actually just the number (starting w/ 1) of the instance order in the release // BaseName is the name of the instance without the Release ID appended. It is // used for naming volumes, which move between releases. BaseName string `json:"base_name"` Name string `json:"name"` Status InstanceStatus `json:"status"` CPU *ResourceMetrics `json:"cpu"` RAM *ResourceMetrics `json:"ram"` }
NOTE Instances are not stored in etcd, so the json tags here apply to HTTP
type InstanceStatus ¶
type InstanceStatus string
Instance ==============================================================================
const ( InstanceStatusStopped InstanceStatus = "STOPPED" InstanceStatusStarted InstanceStatus = "STARTED" )
type Meta ¶
type Meta struct { Created *Timestamp `json:"created"` Updated *Timestamp `json:"updated"` Tags Tags `json:"tags"` }
Meta is a set of fields on all Resources for holding metadata.
type Mount ¶
type Mount struct { Volume ID `json:"volume"` // TODO should be VolumeName Path string `json:"path"` }
Mount ==============================================================================
type Node ¶ added in v0.5.0
type Node struct { ID ID `json:"id"` Name string `json:"name"` Class string `json:"class"` ExternalIP string `json:"external_ip" db:"-"` ProviderCreationTimestamp *Timestamp `json:"provider_creation_timestamp"` OutOfDisk bool `json:"out_of_disk" db:"-"` Status string `json:"status" db:"-"` CPU *ResourceMetrics `json:"cpu" db:"-"` RAM *ResourceMetrics `json:"ram" db:"-"` *Meta }
type Port ¶
type Port struct { Protocol string `json:"protocol"` Number int `json:"number"` Public bool `json:"public"` // EntrypointDomain specifies which Entrypoint this Port is added to. Does not // apply when Public is false. EntrypointDomain ID `json:"entrypoint_domain,omitempty"` // ExternalNumber instructs the Entrypoint to set the actual Port number // specified as the external load balancer port. Does not apply when // EntrypointDomain is nil. ExternalNumber int `json:"external_number"` }
Port ==============================================================================
type PortAddress ¶
type RamAllocation ¶ added in v0.5.1
type RamAllocation struct { Min *BytesValue `json:"min"` Max *BytesValue `json:"max"` }
type Release ¶
type Release struct { // NOTE Timestamp here does not use the Timestamp type. Timestamp ID `json:"timestamp"` // InstanceGroup is used as a labeling mechanism for instances. If nil, // InstanceGroup is set equal to the release's Timestamp. If a value is // supplied by the user, it MUST be the current (previous) Release's // Timestamp. InstanceGroup ID `json:"instance_group"` InstanceCount int `json:"instance_count"` // These attributes, when changed from last Release, indicate a restart is // needed (or just new instances through other means). Volumes []*VolumeBlueprint `json:"volumes"` Containers []*ContainerBlueprint `json:"containers"` TerminationGracePeriod int `json:"termination_grace_period"` // Retired defines whether or not a Release still has active assets, like pods // or services. When retired is true, we skip attempting to delete assets. Retired bool `json:"retired"` // Committed defines whether or not a Release is being / has been deployed. Committed bool `json:"committed"` *Meta }
Release ============================================================================== NOTE the word Blueprint is used for Volumes and Containers, since they are both "definitions" that create "instances" of the real thing
type ResourceMetrics ¶ added in v0.5.0
Node ============================================================================== NOTE this is not to be confused with our concept of Resources like Apps and Components -- this is for CPU / RAM / disk.
type Task ¶
type Task struct { ID ID `json:"id"` ActionData string `json:"action_data"` Status string `json:"status"` Attempts int `json:"attempts"` MaxAttempts int `json:"max_attempts"` // this is static; config-level Error string `json:"error"` *Meta }
Task ==============================================================================
type Timestamp ¶
func NewTimestamp ¶
func NewTimestamp() *Timestamp
func TimestampFromString ¶ added in v0.4.4
func (*Timestamp) MarshalJSON ¶
func (*Timestamp) UnmarshalJSON ¶
type VolumeBlueprint ¶
type VolumeBlueprint struct { Name ID `json:"name"` Type string `json:"type"` Size int `json:"size"` }
Volume ==============================================================================