Documentation
¶
Overview ¶
Package v1alpha1 contains API Schema definitions for the run v1alpha1 API group +kubebuilder:object:generate=true +groupName=run.terraform-operator.io
Index ¶
- Constants
- Variables
- type DependsOn
- type GitSSHKey
- type Module
- type Output
- type PreviousRunStatus
- type Terraform
- func (t *Terraform) CleanupResources(ctx context.Context) error
- func (t *Terraform) CreateTerraformRun(ctx context.Context, namespacedName types.NamespacedName) (*batchv1.Job, error)
- func (in *Terraform) DeepCopy() *Terraform
- func (in *Terraform) DeepCopyInto(out *Terraform)
- func (in *Terraform) DeepCopyObject() runtime.Object
- func (t *Terraform) DeleteAfterCompletion(ctx context.Context) error
- func (t *Terraform) GetJobByRun(ctx context.Context) (*batchv1.Job, error)
- func (t *Terraform) GetOutputSecretName() string
- func (t *Terraform) GetOwnerReference() metav1.OwnerReference
- func (t *Terraform) HasErrored() bool
- func (t *Terraform) IsRunning() bool
- func (t *Terraform) IsStarted() bool
- func (t *Terraform) IsSubmitted() bool
- func (t *Terraform) IsUpdated() bool
- func (t *Terraform) IsWaiting() bool
- func (t *Terraform) SetRunID()
- type TerraformDependencyRef
- type TerraformList
- type TerraformRunStatus
- type TerraformSpec
- type TerraformStatus
- type Variable
- type VariableFile
Constants ¶
const TerraformFinalizer string = "finalizers.terraform-operator.io"
TerraformFinalizer is the finalizer name
Variables ¶
var ( // GroupVersion is group version used to register these objects GroupVersion = schema.GroupVersion{Group: "run.terraform-operator.io", Version: "v1alpha1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme )
Kubernetes Controller information
Functions ¶
This section is empty.
Types ¶
type DependsOn ¶
type DependsOn struct {
// The Terraform object metadata.name
Name string `json:"name"`
// The namespace where the Terraform run exist
// +optional
Namespace string `json:"namespace,omitempty"`
}
DependsOn holds the information of the Terraform dependency
func (*DependsOn) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DependsOn.
func (*DependsOn) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type GitSSHKey ¶
type GitSSHKey struct {
// The source of the value where the private SSH key exist
ValueFrom *corev1.VolumeSource `json:"valueFrom"`
}
GitSSHKey holds the information of the Git SSH key
func (*GitSSHKey) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitSSHKey.
func (*GitSSHKey) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Module ¶
type Module struct {
// module source, must be a valid Terraform module source
Source string `json:"source"`
// module version
// +optional
Version string `json:"version,omitempty"`
}
Module holds the Terraform module source and version information
func (*Module) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Module.
func (*Module) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Output ¶
type Output struct {
// Output key specifies the Kubernetes secret key
// +optional
Key string `json:"key"`
// The output name as defined in the source Terraform module
// +optional
ModuleOutputName string `json:"moduleOutputName"`
}
Output holds the information of the Terraform output information that will be written to a Kubernetes secret
func (*Output) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Output.
func (*Output) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PreviousRunStatus ¶
type PreviousRunStatus struct {
// Attribute name in module
// +optional
RunID string `json:"id"`
// Value
// +optional
Status TerraformRunStatus `json:"status"`
}
PreviousRunStatus stores the previous workflows/runs information in case the current workflow/run object was modified
func (*PreviousRunStatus) DeepCopy ¶
func (in *PreviousRunStatus) DeepCopy() *PreviousRunStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PreviousRunStatus.
func (*PreviousRunStatus) DeepCopyInto ¶
func (in *PreviousRunStatus) DeepCopyInto(out *PreviousRunStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Terraform ¶
type Terraform struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec TerraformSpec `json:"spec,omitempty"`
Status TerraformStatus `json:"status,omitempty"`
}
Terraform is the Schema for the terraforms API +kubebuilder:resource:shortName=tf,path=terraforms +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.runStatus" +kubebuilder:printcolumn:name="Secret",type="string",JSONPath=".status.outputSecretName" +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
func (*Terraform) CleanupResources ¶
CleanupResources cleans up old resources (secrets & configmaps)
func (*Terraform) CreateTerraformRun ¶
func (t *Terraform) CreateTerraformRun(ctx context.Context, namespacedName types.NamespacedName) (*batchv1.Job, error)
CreateTerraformRun creates the Kubernetes objects to start the workflow/run
(RBAC (service account & Role), ConfigMap for the terraform module file, Secret to store the outputs if any, will be empty if no outputs are defined, Job to execute the workflow/run)
func (*Terraform) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Terraform.
func (*Terraform) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Terraform) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*Terraform) DeleteAfterCompletion ¶
DeleteAfterCompletion removes the Kubernetes of the workflow/run once completed
func (*Terraform) GetJobByRun ¶
GetJobByRun returns the Kubernetes job of the workflow/run
func (*Terraform) GetOutputSecretName ¶
GetOutputSecretName returns the secret name of the Terraform outputs
func (*Terraform) GetOwnerReference ¶
func (t *Terraform) GetOwnerReference() metav1.OwnerReference
GetOwnerReference returns the Kubernetes owner reference meta
func (*Terraform) HasErrored ¶
HasErrored evaluates if the workflow/run failed
func (*Terraform) IsSubmitted ¶
IsSubmitted evaluates if the workflow/run is created for the first time
type TerraformDependencyRef ¶
TerraformDependencyRef holds the information of the Terraform dependency name and key for the module to use as a variable
func (*TerraformDependencyRef) DeepCopy ¶
func (in *TerraformDependencyRef) DeepCopy() *TerraformDependencyRef
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TerraformDependencyRef.
func (*TerraformDependencyRef) DeepCopyInto ¶
func (in *TerraformDependencyRef) DeepCopyInto(out *TerraformDependencyRef)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type TerraformList ¶
type TerraformList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Terraform `json:"items"`
}
TerraformList contains a list of Terraform
func (*TerraformList) DeepCopy ¶
func (in *TerraformList) DeepCopy() *TerraformList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TerraformList.
func (*TerraformList) DeepCopyInto ¶
func (in *TerraformList) DeepCopyInto(out *TerraformList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*TerraformList) DeepCopyObject ¶
func (in *TerraformList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type TerraformRunStatus ¶
type TerraformRunStatus string
TerraformRunStatus is the status of the workflow/run
const ( RunStarted TerraformRunStatus = "Started" RunRunning TerraformRunStatus = "Running" RunCompleted TerraformRunStatus = "Completed" RunFailed TerraformRunStatus = "Failed" RunWaitingForDependency TerraformRunStatus = "WaitingForDependency" RunDeleted TerraformRunStatus = "Deleted" )
workflow/run statuses
type TerraformSpec ¶
type TerraformSpec struct {
// The terraform version to use
TerraformVersion string `json:"terraformVersion"`
// The module information (source & version)
Module Module `json:"module"`
// A custom terraform backend configuration
// +optional
Backend string `json:"backend,omitempty"`
// A custom terraform providers configuration
// +optional
ProvidersConfig string `json:"providersConfig,omitempty"`
// The terraform workspae. Defaults to `default`
// +optional
Workspace string `json:"workspace,omitempty"`
// A list of dependencies on other Terraform runs
// +optional
DependsOn []*DependsOn `json:"dependsOn,omitempty"`
// Variables as inputs to the Terraform module
// +optional
Variables []Variable `json:"variables,omitempty"`
// Terraform variable files
// +optional
VariableFiles []VariableFile `json:"variableFiles,omitempty"`
// Terraform outputs will be written to a Kubernetes secret
// +optional
Outputs []*Output `json:"outputs,omitempty"`
// Indicates whether a destroy job should run
// +optional
Destroy bool `json:"destroy,omitempty"`
// Indicates whether to keep the jobs/pods after the run is successful/completed
// +optional
DeleteCompletedJobs bool `json:"deleteCompletedJobs,omitempty"`
// A retry limit to be set on the Job as a backOffLimit
// +optional
RetryLimit int32 `json:"retryLimit,omitempty"`
// An SSH key to be able to pull modules from private git repositories
// +optional
GitSSHKey *GitSSHKey `json:"gitSSHKey,omitempty"`
}
TerraformSpec defines the desired state of Terraform object
func (*TerraformSpec) DeepCopy ¶
func (in *TerraformSpec) DeepCopy() *TerraformSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TerraformSpec.
func (*TerraformSpec) DeepCopyInto ¶
func (in *TerraformSpec) DeepCopyInto(out *TerraformSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type TerraformStatus ¶
type TerraformStatus struct {
RunID string `json:"currentRunId"`
PreviousRunID string `json:"previousRunId,omitempty"`
OutputSecretName string `json:"outputSecretName,omitempty"`
ObservedGeneration int64 `json:"observedGeneration"`
RunStatus TerraformRunStatus `json:"runStatus"`
Message string `json:"message,omitempty"`
StartedTime string `json:"startTime,omitempty"`
CompletionTime string `json:"completionTime,omitempty"`
}
TerraformStatus defines the observed state of Terraform
func (*TerraformStatus) DeepCopy ¶
func (in *TerraformStatus) DeepCopy() *TerraformStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TerraformStatus.
func (*TerraformStatus) DeepCopyInto ¶
func (in *TerraformStatus) DeepCopyInto(out *TerraformStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Variable ¶
type Variable struct {
// Terraform module variable name
Key string `json:"key"`
// The value of the variable
// +optional
Value string `json:"value"`
// The variable value from a key source (secret or configmap)
// +optional
ValueFrom *corev1.EnvVarSource `json:"valueFrom,omitempty"`
// EnvironmentVariable denotes if this variable should be created as environment variable
// +optional
EnvironmentVariable bool `json:"environmentVariable,omitempty"`
// DependencyRef denotes if this variable should be fetched from the output of a dependency
// +optional
DependencyRef *TerraformDependencyRef `json:"dependencyRef,omitempty"`
}
Variable holds the information of the Terraform variable
func (*Variable) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Variable.
func (*Variable) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type VariableFile ¶
type VariableFile struct {
// The module variable name
Key string `json:"key"`
// The source of the variable file
ValueFrom *corev1.VolumeSource `json:"valueFrom"`
}
VariableFile holds the information of the Terraform variable files to include
func (*VariableFile) DeepCopy ¶
func (in *VariableFile) DeepCopy() *VariableFile
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VariableFile.
func (*VariableFile) DeepCopyInto ¶
func (in *VariableFile) DeepCopyInto(out *VariableFile)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.