v1alpha1

package
v0.0.0-...-f440afa Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

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

View Source
const TerraformFinalizer string = "finalizers.terraform-operator.io"

TerraformFinalizer is the finalizer name

Variables

View Source
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

func (in *DependsOn) DeepCopy() *DependsOn

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DependsOn.

func (*DependsOn) DeepCopyInto

func (in *DependsOn) DeepCopyInto(out *DependsOn)

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

func (in *GitSSHKey) DeepCopy() *GitSSHKey

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitSSHKey.

func (*GitSSHKey) DeepCopyInto

func (in *GitSSHKey) DeepCopyInto(out *GitSSHKey)

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

func (in *Module) DeepCopy() *Module

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Module.

func (*Module) DeepCopyInto

func (in *Module) DeepCopyInto(out *Module)

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

func (in *Output) DeepCopy() *Output

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Output.

func (*Output) DeepCopyInto

func (in *Output) DeepCopyInto(out *Output)

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

func (t *Terraform) CleanupResources(ctx context.Context) error

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

func (in *Terraform) DeepCopy() *Terraform

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Terraform.

func (*Terraform) DeepCopyInto

func (in *Terraform) DeepCopyInto(out *Terraform)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Terraform) DeepCopyObject

func (in *Terraform) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Terraform) DeleteAfterCompletion

func (t *Terraform) DeleteAfterCompletion(ctx context.Context) error

DeleteAfterCompletion removes the Kubernetes of the workflow/run once completed

func (*Terraform) GetJobByRun

func (t *Terraform) GetJobByRun(ctx context.Context) (*batchv1.Job, error)

GetJobByRun returns the Kubernetes job of the workflow/run

func (*Terraform) GetOutputSecretName

func (t *Terraform) GetOutputSecretName() string

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

func (t *Terraform) HasErrored() bool

HasErrored evaluates if the workflow/run failed

func (*Terraform) IsRunning

func (t *Terraform) IsRunning() bool

IsRunning evaluates that the workflow/run is running

func (*Terraform) IsStarted

func (t *Terraform) IsStarted() bool

IsStarted evaluates that the workflow/run is started

func (*Terraform) IsSubmitted

func (t *Terraform) IsSubmitted() bool

IsSubmitted evaluates if the workflow/run is created for the first time

func (*Terraform) IsUpdated

func (t *Terraform) IsUpdated() bool

IsUpdated evaluates if the workflow/run was updated

func (*Terraform) IsWaiting

func (t *Terraform) IsWaiting() bool

IsWaiting evaluates if the workflow/run is waiting for a dependency

func (*Terraform) SetRunID

func (t *Terraform) SetRunID()

SetRunID sets a new value for the run ID

type TerraformDependencyRef

type TerraformDependencyRef struct {
	Name string `json:"name"`
	Key  string `json:"key"`
}

TerraformDependencyRef holds the information of the Terraform dependency name and key for the module to use as a variable

func (*TerraformDependencyRef) DeepCopy

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

func (in *Variable) DeepCopy() *Variable

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Variable.

func (*Variable) DeepCopyInto

func (in *Variable) DeepCopyInto(out *Variable)

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.

Jump to

Keyboard shortcuts

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