Documentation ¶
Index ¶
- type Condition
- type ConditionStatus
- type ConditionType
- type Conditions
- type ConfigMapHash
- type ConfigMapKeys
- type EmbeddedConfigMaps
- type GCSObjects
- type PodStatus
- type TFKind
- type TFKindShort
- type TFVar
- type Terraform
- func (parent *Terraform) GetConditionOrder() []ConditionType
- func (parent *Terraform) GetSig() string
- func (parent *Terraform) GetTFKind() TFKind
- func (parent *Terraform) GetTFKindShort() TFKindShort
- func (parent *Terraform) Log(level, msgfmt string, fmtargs ...interface{})
- func (parent *Terraform) MakeConditions(initTime metav1.Time) Conditions
- func (parent *Terraform) Verify() error
- type TerraformConfigInputs
- type TerraformConfigSource
- type TerraformConfigVarsFrom
- type TerraformOperatorState
- type TerraformOperatorStatus
- type TerraformOperatorStatusSources
- type TerraformOutputVar
- type TerraformPlanFileSummary
- type TerraformSourceConfigMap
- type TerraformSpec
- type TerraformSpecFrom
- type TerraformSpecProviderConfig
- type VarMapItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Condition ¶
type Condition struct { Type ConditionType `json:"type"` Status ConditionStatus `json:"status"` LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"` LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` Reason string `json:"reason,omitempty"` Message string `json:"message,omitempty"` }
Condition defines the format for a status condition element.
type ConditionStatus ¶
type ConditionStatus string
const ( ConditionTrue ConditionStatus = "True" ConditionFalse ConditionStatus = "False" ConditionUnknown ConditionStatus = "Unknown" )
type ConditionType ¶
type ConditionType string
ConditionType is a valid value for TerraformCondition.Type
const ( // ConditionSpecFromReady is True when the given specFrom terraform resource is ready. ConditionSpecFromReady ConditionType = "SpecFromReady" // ConditionProviderConfigReady is True when the provider config is available and ready. ConditionProviderConfigReady ConditionType = "ProviderConfigReady" // ConditionConfigSourceReady is True when all config sources are ready. ConditionConfigSourceReady ConditionType = "ConfigSourceReady" // ConditionInputsReady is True when all var inputs are ready. ConditionInputsReady ConditionType = "TFInputsReady" // ConditionVarsFromReady is True when all vars from sources are ready. ConditionVarsFromReady ConditionType = "TFVarsFromReady" // ConditionPlanReady is True when a given tfplan source file path is ready. ConditionPlanReady ConditionType = "TFPlanReady" // ConditionPodComplete is True when the terraform pod has completed successfully. ConditionPodComplete ConditionType = "TFPodComplete" // ConditionReady is True when all prior conditions are ready. ConditionReady ConditionType = "Ready" )
The condition type constants listed below are in the order they should roughly happen and in the order they exist in the status.conditions list. This gives visibility to what the operator is doing. Some conditions can be satisfied in parallel with others.
func (*ConditionType) GetDependencies ¶
func (conditionType *ConditionType) GetDependencies() []ConditionType
GetDependencies returns a map of condition type names to an ordered slice of dependent condition types.
type Conditions ¶
type Conditions map[ConditionType]*Condition
Conditions is a map of the condition types to their condition.
func (Conditions) CheckConditions ¶
func (conditions Conditions) CheckConditions(conditionType ConditionType) error
CheckConditions verifies that all given conditions have been met for the given conditionType on the receiving conditions.
type ConfigMapHash ¶
type ConfigMapHash struct { Name string `json:"name,omitempty"` Hash string `json:"hash,omitempty"` }
ConfigMapHash is an element holding the configmap source name and a hash of the data spec.
type ConfigMapKeys ¶
type ConfigMapKeys [][]string
ConfigMapKeys is an ordered list of source keys as they appeard in the spec. List is a tuple containing the (configmap name , key name)
type EmbeddedConfigMaps ¶
type EmbeddedConfigMaps []string
EmbeddedConfigMaps is a list of ConfigMap names generated to hold the embedded source.
type GCSObjects ¶
type GCSObjects []string
GCSObjects is a list of GCS URLs containing terraform source bundles.
type TFKind ¶
type TFKind string
TFKind is an enum on the different kind of resources.
func (*TFKind) GetShort ¶
func (k *TFKind) GetShort() TFKindShort
GetShort translates a long kind to a short kind.
type TFKindShort ¶
type TFKindShort string
TFKindShort is the abbreviated name of the resource, defined in the CRD
const ( TFKindShortPlan TFKindShort = "tfplan" TFKindShortApply TFKindShort = "tfapply" TFKindShortDestroy TFKindShort = "tfdestroy" )
type Terraform ¶
type Terraform struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec *TerraformSpec `json:"spec,omitempty"` SpecFrom *TerraformSpecFrom `json:"specFrom,omitempty"` Status TerraformOperatorStatus `json:"status"` }
Terraform is the custom resource definition structure.
func (*Terraform) GetConditionOrder ¶
func (parent *Terraform) GetConditionOrder() []ConditionType
GetConditionOrder returns an ordered slice of the conditions as the should appear in the status. This is dependent on which fields are provided in the parent spec.
func (*Terraform) GetTFKindShort ¶
func (parent *Terraform) GetTFKindShort() TFKindShort
GetTFKindShort converts the object type to a TFKindShort
func (*Terraform) Log ¶
Log is a conventional log method to print the parent name and kind before the log message.
func (*Terraform) MakeConditions ¶
func (parent *Terraform) MakeConditions(initTime metav1.Time) Conditions
MakeConditions initializes a new AppDBConditions struct
type TerraformConfigInputs ¶
type TerraformConfigInputs struct { Name string `json:"name,omitempty"` WaitForReady bool `json:"waitForReady,omitempty"` VarMap []VarMapItem `json:"varMap,omitempty"` }
TerraformConfigInputs is the structure defining how to use output vars from other TerraformApply resources
type TerraformConfigSource ¶
type TerraformConfigSource struct { ConfigMap *TerraformSourceConfigMap `json:"configMap,omitempty"` Embedded string `json:"embedded,omitempty"` GCS string `json:"gcs,omitempty"` TFPlan string `json:"tfplan,omitempty"` TFApply string `json:"tfapply,omitempty"` }
TerraformConfigSource is the structure providing the source for terraform configs.
type TerraformConfigVarsFrom ¶
type TerraformConfigVarsFrom struct { TFApply string `json:"tfapply,omitempty"` TFPlan string `json:"tfplan,omitempty"` }
TerraformConfigVarsFrom is the spec for referencing TFVars from another object.
type TerraformOperatorState ¶
type TerraformOperatorState string
TerraformOperatorState represents the string mapping of the possible controller states. See the const definition below for enumerated states.
type TerraformOperatorStatus ¶
type TerraformOperatorStatus struct { Sources TerraformOperatorStatusSources `json:"sources,omitempty"` PodName string `json:"podName,omitempty"` PodStatus PodStatus `json:"podStatus,omitempty"` StartedAt string `json:"startedAt,omitempty"` FinishedAt string `json:"finishedAt,omitempty"` Duration string `json:"duration,omitempty"` TFPlan string `json:"planFile,omitempty"` TFPlanDiff *TerraformPlanFileSummary `json:"planDiff,omitempty"` TFOutput *[]TerraformOutputVar `json:"outputs,omitempty"` TFOutputSecret string `json:"outputsSecret,omitempty"` RetryCount int32 `json:"retryCount,omitempty"` RetryNextAt string `json:"retryNextAt,omitempty"` Workspace string `json:"workspace,omitempty"` StateFile string `json:"stateFile,omitempty"` Conditions []Condition `json:"conditions,omitempty"` }
TerraformOperatorStatus is the status structure for the custom resource
type TerraformOperatorStatusSources ¶
type TerraformOperatorStatusSources struct { ConfigMapHashes []ConfigMapHash `json:"configMapHashes,omitempty"` EmbeddedConfigMaps EmbeddedConfigMaps `json:"embeddedConfigMaps,omitempty"` }
TerraformOperatorStatusSources describes the status.sources structure.
type TerraformOutputVar ¶
type TerraformOutputVar struct { Name string `json:"name,omitempty"` Sensitive bool `json:"sensitive,omitempty"` Type string `json:"type,omitempty"` Value string `json:"value,omitempty"` }
TerraformOutputVar is the structure of a terraform output variable from `terraform output -json`
type TerraformPlanFileSummary ¶
type TerraformPlanFileSummary struct { Added int `json:"added"` Changed int `json:"changed"` Destroyed int `json:"destroyed"` }
TerraformPlanFileSummary summarizes the changes in a terraform plan
type TerraformSourceConfigMap ¶
type TerraformSourceConfigMap struct { Name string `json:"name,omitempty"` Trigger bool `json:"trigger,omitempty"` }
TerraformSourceConfigMap is the spec defining a config map source for terraform config.
type TerraformSpec ¶
type TerraformSpec struct { Image string `json:"image,omitempty"` ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"` BackendBucket string `json:"backendBucket,omitempty"` BackendPrefix string `json:"backendPrefix,omitempty"` ProviderConfig *[]TerraformSpecProviderConfig `json:"providerConfig,omitempty"` Sources []TerraformConfigSource `json:"sources,omitempty"` TFPlan string `json:"tfplan,omitempty"` TFInputs *[]TerraformConfigInputs `json:"tfinputs,omitempty"` TFVars *[]TFVar `json:"tfvars,omitempty"` TFVarsFrom *[]TerraformConfigVarsFrom `json:"tfvarsFrom,omitempty"` MaxAttempts *int32 `json:"maxAttempts,omitempty"` }
TerraformSpec is the top level structure of the spec body
func (*TerraformSpec) Verify ¶
func (spec *TerraformSpec) Verify() error
Verify checks all required fields in the spec.
type TerraformSpecFrom ¶
type TerraformSpecFrom struct { TFPlan string `json:"tfplan,omitempty"` TFApply string `json:"tfapply,omitempty"` TFDestroy string `json:"tfdestroy,omitempty"` WaitForReady bool `json:"waitForReady,omitempty"` }
TerraformSpecFrom is the the top level structure of specifying spec from antoher Terraform resource
type TerraformSpecProviderConfig ¶
type TerraformSpecProviderConfig struct { Name string `json:"name,omitempty"` SecretName string `json:"secretName,omitempty"` }
TerraformSpecProviderConfig is the structure providing the provider credentials block.
type VarMapItem ¶
type VarMapItem struct { Source string `json:"source,omitempty"` Dest string `json:"dest,omitempty"` }
VarMapItem is a config input mapping element