Documentation ¶
Overview ¶
Package terra contains interfaces that model Terra's infrastructure, and support querying and updating the state of said infrastructure.
Index ¶
- func DestinationTypeNames() []string
- func LifecycleNames() []string
- type AppRelease
- type Cluster
- type ClusterRelease
- type Clusters
- type Destination
- type DestinationFilter
- type DestinationType
- type Destinations
- type Environment
- type EnvironmentFilter
- type Environments
- type Fiab
- type Lifecycle
- type Release
- type ReleaseFilter
- type ReleaseType
- type Releases
- type State
- type StateLoader
- type VersionOverride
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DestinationTypeNames ¶
func DestinationTypeNames() []string
DestinationTypeNames returns a list of destination type names as strings
func LifecycleNames ¶
func LifecycleNames() []string
LifecycleNames returns a slice of all Lifecycle names as strings
Types ¶
type AppRelease ¶
type AppRelease interface { AppVersion() string Environment() Environment Release }
type Cluster ¶
type Cluster interface { Address() string Destination }
type ClusterRelease ¶
type Clusters ¶
type Clusters interface { // All returns a list of all clusters All() ([]Cluster, error) // Get returns the cluster with the given name, or an error if no such cluster exists Get(name string) (Cluster, error) // Exists returns true if a cluster by the given name exists Exists(name string) (bool, error) }
Clusters is an interface for querying clusters
type Destination ¶
type Destination interface { Type() DestinationType // Type is the name of the destination type, either "environment" or "cluster" Base() string // Base is the base of the environment or cluster Name() string // Name is the name of the environment or cluster ReleaseType() ReleaseType // ReleaseType returns the types of releases that can be deployed to this destination Releases() []Release // Releases returns the set of releases configured for this destination TerraHelmfileRef() string // TerraHelmfileRef this destination's generator should be pinned to IsCluster() bool // IsCluster Returns true if this destination is a cluster IsEnvironment() bool // IsEnvironment Returns true if this destination is an environment }
Destination is the location where a release is deployed (environment or cluster)
type DestinationFilter ¶
type DestinationFilter interface { // String returns a string representation of the filter String() string // Matches returns true if this filter matches the destination Matches(Destination) bool // And returns a new filter that matches this filter and another And(DestinationFilter) DestinationFilter // Or returns a new filter that matches this filter or another Or(DestinationFilter) DestinationFilter // Filter given a list of destinations, return the sublist that match this filter Filter([]Destination) []Destination }
A DestinationFilter is a predicate for filtering lists of destinations
type DestinationType ¶
type DestinationType int
DestinationType is an enum type referring to the two types of destinations supported by terra-helmfile.
const ( EnvironmentDestination DestinationType = iota ClusterDestination )
func DestinationTypes ¶
func DestinationTypes() []DestinationType
DestinationTypes returns all destination types
func (DestinationType) Compare ¶
func (t DestinationType) Compare(other DestinationType) int
Compare returns 0 if t == other, -1 if t < other, or +1 if t > other.
func (*DestinationType) FromString ¶
func (t *DestinationType) FromString(value string) error
FromString will set the receiver's value to the one denoted by the given string
func (DestinationType) String ¶
func (t DestinationType) String() string
func (*DestinationType) UnmarshalYAML ¶
func (t *DestinationType) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML is a custom unmarshaler so that the string "environment" or "cluster" in a yaml file can be unmarshaled into a DestinationType
type Destinations ¶
type Destinations interface { // All returns a list of all destinations All() ([]Destination, error) // Filter returns a list of clusters matching the given filter Filter(filter DestinationFilter) ([]Destination, error) // Get returns the destination with the given name, or an error if no such destination exists Get(name string) (Destination, error) }
Destinations is an interface for querying release destinations
type Environment ¶
type Environment interface { // DefaultCluster Returns the name of the default cluster for this environment. Eg. "terra-qa" DefaultCluster() string // Namespace Returns the namespace for this environment. Eg. "terra-dev" Namespace() string // Lifecycle returns the lifecycle for this environment. Lifecycle() Lifecycle // Template returns the name of this environment's configuration template, if it has one. // Returns the empty string if the environment has no configuration template. Template() string // IsHybrid DEPRECATED returns true if this is a hybrid environment (connected to a FiaB) IsHybrid() bool // Fiab DEPRECATED returns the Fiab associated with this hybrid environment (nil if this is not a hybrid environment) Fiab() Fiab Destination }
type EnvironmentFilter ¶
type EnvironmentFilter interface { // String returns a string representation of the filter String() string // Matches returns true if this filter matches the environment Matches(Environment) bool // And returns a new filter that matches this filter and another And(EnvironmentFilter) EnvironmentFilter // Or returns a new filter that matches this filter or another Or(EnvironmentFilter) EnvironmentFilter // Filter given a list of environments, return the sublist that match this filter Filter([]Environment) []Environment }
An EnvironmentFilter is a predicate for filtering lists of environments
type Environments ¶
type Environments interface { // All returns a list of all environments All() ([]Environment, error) // Filter returns a list of environments matching the given filter Filter(filter EnvironmentFilter) ([]Environment, error) // Get returns the environment with the given name, or nil if no such environment exists Get(name string) (Environment, error) // Exists returns true if an environment by the given name exists Exists(name string) (bool, error) // CreateFromTemplate creates a new environment with the given name from the given template. // Should panic if the template environment's lifecycle is not "template". CreateFromTemplate(name string, template Environment) error // CreateHybridFromTemplate creates a new hybrid environment with the given name from the given template. CreateHybridFromTemplate(name string, template Environment, fiab Fiab) error // EnableRelease enables a release in an environment // TODO this should move to Environment at some point EnableRelease(environmentName string, releaseName string) error // DisableRelease disables a release in an environment // TODO this should move to Environment at some point DisableRelease(environmentName string, releaseName string) error // PinVersions sets a version override in the given environment // TODO this should move to Environment at some point PinVersions(environmentName string, versions map[string]VersionOverride) (map[string]VersionOverride, error) // UnpinVersions removes version overrides in the given environment // TODO this should move to Environment at some point UnpinVersions(environmentName string) (map[string]VersionOverride, error) // PinEnvironmentToTerraHelmfileRef pins an environment to a specific terra-helmfile ref // Note this can be overridden by individual service version overrides PinEnvironmentToTerraHelmfileRef(environmentName string, terraHelmfileRef string) error // Delete deletes the environment with the given name Delete(name string) error }
Environments is an interface for querying and updating environments
type Fiab ¶
type Fiab interface { // IP returns the public IP address for the Fiab IP() string // Name returns the name of the Fiab Name() string }
Fiab (DEPRECATED) represents a legacy Fiab ("firecloud-in-a-box") environment
type Lifecycle ¶
type Lifecycle int
Lifecycle is an enum type that represents the different types of lifecycles a Terra environment can have
const ( // Static environments are long-lived environments that are created manually and never destroyed. `prod` is an example of a static environment. Static Lifecycle = iota // Template environments are never created or destroyed. They exist solely in configuration files, and are used to create dynamic environments. Template // Dynamic environments are created and destroyed on demand, from a template environment. Dynamic )
func (*Lifecycle) FromString ¶
FromString will set the receiver's value to the one denoted by the given string
func (Lifecycle) IsTemplate ¶
func (*Lifecycle) UnmarshalYAML ¶
UnmarshalYAML is a custom unmarshaler so that the string "app" or "cluster" in a yaml file can be unmarshaled into a ReleaseType
type Release ¶
type Release interface { Name() string Type() ReleaseType IsAppRelease() bool IsClusterRelease() bool ChartVersion() string ChartName() string Repo() string Namespace() string ClusterName() string ClusterAddress() string Destination() Destination TerraHelmfileRef() string FirecloudDevelopRef() string }
Release represents a deployed instance of a Helm chart, running in a Kubernetes cluster. The term comes from Helm.
type ReleaseFilter ¶
type ReleaseFilter interface { // String returns a string representation of the filter String() string // Matches returns true if this filter matches the release Matches(Release) bool // And returns a new filter that matches this filter and another And(ReleaseFilter) ReleaseFilter // Or returns a new filter that matches this filter or another Or(ReleaseFilter) ReleaseFilter // Filter given a list of releases, return the sublist that match this filter Filter([]Release) []Release }
A ReleaseFilter is a predicate for filtering lists of releases
type ReleaseType ¶
type ReleaseType int
ReleaseType is an enum type referring to the two types of releases supported by terra-helmfile.
const ( AppReleaseType ReleaseType = iota ClusterReleaseType )
func ReleaseTypes ¶
func ReleaseTypes() []ReleaseType
func (ReleaseType) Compare ¶
func (r ReleaseType) Compare(other ReleaseType) int
Returns 0 if r == other, -1 if r < other, or +1 if r > other.
func (ReleaseType) String ¶
func (r ReleaseType) String() string
func (*ReleaseType) UnmarshalYAML ¶
func (r *ReleaseType) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML is a custom unmarshaler so that the string "app" or "cluster" in a yaml file can be unmarshaled into a ReleaseType
type Releases ¶
type Releases interface { // All returns a list of all releases All() ([]Release, error) // Filter filters releases Filter(filter ReleaseFilter) ([]Release, error) }
Releases is an interface for querying releases
type State ¶
type State interface { // Destinations is an interface for querying terra.Destination instances Destinations() Destinations // Environments is an interface for querying terra.Environment instances Environments() Environments // Clusters is an interface for querying terra.Cluster instances Clusters() Clusters // Releases is an interface for querying terra.Release instances Releases() Releases }
State is an interface for querying the state of Terra infrastructure.
type StateLoader ¶
type VersionOverride ¶ added in v0.0.35
type VersionOverride struct { AppVersion string `json:"appVersion,omitempty" yaml:"appVersion,omitempty"` ChartVersion string `json:"chartVersion,omitempty" yaml:"chartVersion,omitempty"` TerraHelmfileRef string `json:"terraHelmfileRef,omitempty" yaml:"terraHelmfileRef,omitempty"` FirecloudDevelopRef string `json:"firecloudDevelopRef,omitempty" yaml:"firecloudDevelopRef,omitempty"` }
VersionOverride represents version overrides for a release in an environment