v1alpha1

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

+kubebuilder:object:generate=true +groupName=infra.contrib.fluxcd.io

Package v1alpha1 contains API Schema definitions for the infra v1alpha1 API group +kubebuilder:object:generate=true +groupName=infra.contrib.fluxcd.io

Index

Constants

View Source
const (
	HealthCheckTypeTCP     = "tcp"
	HealthCheckTypeHttpGet = "http"
)
View Source
const (
	CACertSecretName = "tf-controller.tls"
	// RunnerTLSSecretName is the name of the secret containing a TLS cert that will be written to
	// the namespace in which a terraform runner is created
	RunnerTLSSecretName        = "terraform-runner.tls"
	RunnerLabel                = "infra.contrib.fluxcd.io/terraform"
	GitRepositoryIndexKey      = ".metadata.gitRepository"
	BucketIndexKey             = ".metadata.bucket"
	OCIRepositoryIndexKey      = ".metadata.ociRepository"
	PlanStorageMountSubDirBase = "terraform_controller"
)
View Source
const (
	TerraformKind             = "Terraform"
	TerraformFinalizer        = "finalizers.tf.contrib.fluxcd.io"
	MaxConditionMessageLength = 20000
	DisabledValue             = "disabled"
	ApprovePlanAutoValue      = "auto"
	ApprovePlanDisableValue   = "disable"
	DefaultWorkspaceName      = "default"
)
View Source
const (
	ArtifactFailedReason            = "ArtifactFailed"
	DeletionBlockedByDependants     = "DeletionBlockedByDependantsReason"
	DependencyNotReadyReason        = "DependencyNotReady"
	DriftDetectedReason             = "DriftDetected"
	DriftDetectionFailedReason      = "DriftDetectionFailed"
	HealthChecksFailedReason        = "HealthChecksFailed"
	NoDriftReason                   = "NoDrift"
	OutputsWritingFailedReason      = "OutputsWritingFailed"
	PlannedNoChangesReason          = "TerraformPlannedNoChanges"
	PlannedWithChangesReason        = "TerraformPlannedWithChanges"
	PostPlanningWebhookFailedReason = "PostPlanningWebhookFailed"
	TFExecApplyFailedReason         = "TFExecApplyFailed"
	TFExecApplySucceedReason        = "TerraformAppliedSucceed"
	TFExecForceUnlockReason         = "ForceUnlock"
	TFExecInitFailedReason          = "TFExecInitFailed"
	TFExecLockHeldReason            = "LockHeld"
	TFExecNewFailedReason           = "TFExecNewFailed"
	TFExecOutputFailedReason        = "TFExecOutputFailed"
	TFExecPlanFailedReason          = "TFExecPlanFailed"
	TemplateGenerationFailedReason  = "TemplateGenerationFailed"
	VarsGenerationFailedReason      = "VarsGenerationFailed"
	WorkspaceSelectFailedReason     = "SelectWorkspaceFailed"
)

The potential reasons that are associated with condition types

View Source
const (
	ConditionTypeApply       = "Apply"
	ConditionTypeHealthCheck = "HealthCheck"
	ConditionTypeOutput      = "Output"
	ConditionTypePlan        = "Plan"
	ConditionTypeStateLocked = "StateLocked"
)

These constants are the Condition Types that the Terraform Resource works with

View Source
const (
	PostPlanningWebhook = "post-planning"
)

Webhook stages

View Source
const (
	TFDependencyOfPrefix = "tf.dependency.of."
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "infra.contrib.fluxcd.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
)

Functions

func GetPlanIdAndApproveMessage

func GetPlanIdAndApproveMessage(revision string, message string) (string, string)

func SetTerraformReadiness

func SetTerraformReadiness(terraform *Terraform, status metav1.ConditionStatus, reason, message string, revision string)

SetTerraformReadiness sets the ReadyCondition, ObservedGeneration, and LastAttemptedRevision, on the Terraform.

Types

type BackendConfigSpec

type BackendConfigSpec struct {

	// Disable is to completely disable the backend configuration.
	// +optional
	Disable bool `json:"disable"`

	// +optional
	SecretSuffix string `json:"secretSuffix,omitempty"`

	// +optional
	InClusterConfig bool `json:"inClusterConfig,omitempty"`

	// +optional
	CustomConfiguration string `json:"customConfiguration,omitempty"`

	// +optional
	ConfigPath string `json:"configPath,omitempty"`

	// +optional
	Labels map[string]string `json:"labels,omitempty"`
}

BackendConfigSpec is for specifying configuration for Terraform's Kubernetes backend

func (*BackendConfigSpec) DeepCopy

func (in *BackendConfigSpec) DeepCopy() *BackendConfigSpec

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

func (*BackendConfigSpec) DeepCopyInto

func (in *BackendConfigSpec) DeepCopyInto(out *BackendConfigSpec)

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

type BackendConfigsReference

type BackendConfigsReference struct {
	// Kind of the values referent, valid values are ('Secret', 'ConfigMap').
	// +kubebuilder:validation:Enum=Secret;ConfigMap
	// +required
	Kind string `json:"kind"`

	// Name of the configs referent. Should reside in the same namespace as the
	// referring resource.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=253
	// +required
	Name string `json:"name"`

	// Keys is the data key where a specific value can be found at. Defaults to all keys.
	// +optional
	Keys []string `json:"keys,omitempty"`

	// Optional marks this BackendConfigsReference as optional. When set, a not found error
	// for the values reference is ignored, but any Key or
	// transient error will still result in a reconciliation failure.
	// +optional
	Optional bool `json:"optional,omitempty"`
}

func (*BackendConfigsReference) DeepCopy

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

func (*BackendConfigsReference) DeepCopyInto

func (in *BackendConfigsReference) DeepCopyInto(out *BackendConfigsReference)

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

type CrossNamespaceSourceReference

type CrossNamespaceSourceReference struct {
	// API version of the referent.
	// +optional
	APIVersion string `json:"apiVersion,omitempty"`

	// Kind of the referent.
	// +kubebuilder:validation:Enum=GitRepository;Bucket;OCIRepository
	// +required
	Kind string `json:"kind"`

	// Name of the referent.
	// +required
	Name string `json:"name"`

	// Namespace of the referent, defaults to the namespace of the Kubernetes resource object that contains the reference.
	// +optional
	Namespace string `json:"namespace,omitempty"`
}

CrossNamespaceSourceReference contains enough information to let you locate the typed Kubernetes resource object at cluster level.

func (*CrossNamespaceSourceReference) DeepCopy

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

func (*CrossNamespaceSourceReference) DeepCopyInto

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

func (*CrossNamespaceSourceReference) String

type FileMapping

type FileMapping struct {
	// Reference to a Secret that contains the file content
	SecretRef meta.SecretKeyReference `json:"secretRef"`
	// Location can be either user's home directory or the Terraform workspace
	// +kubebuilder:validation:Enum=home;workspace
	// +required
	Location string `json:"location"`
	// Path of the file - relative to the "location"
	// +kubebuilder:validation:Pattern=`^(.?[/_a-zA-Z0-9]{1,})*$`
	// +required
	Path string `json:"path"`
}

func (*FileMapping) DeepCopy

func (in *FileMapping) DeepCopy() *FileMapping

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

func (*FileMapping) DeepCopyInto

func (in *FileMapping) DeepCopyInto(out *FileMapping)

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

type ForceUnlockEnum

type ForceUnlockEnum string
const (
	ForceUnlockEnumAuto ForceUnlockEnum = "auto"
	ForceUnlockEnumYes  ForceUnlockEnum = "yes"
	ForceUnlockEnumNo   ForceUnlockEnum = "no"
)

type HealthCheck

type HealthCheck struct {
	// Name of the health check.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=253
	// +required
	Name string `json:"name"`

	// Type of the health check, valid values are ('tcp', 'http').
	// If tcp is specified, address is required.
	// If http is specified, url is required.
	// +kubebuilder:validation:Enum=tcp;http
	// +required
	Type string `json:"type"`

	// URL to perform http health check on. Required when http type is specified.
	// Go template can be used to reference values from the terraform output
	// (e.g. https://example.org, {{.output_url}}).
	// +optional
	URL string `json:"url,omitempty"`

	// Address to perform tcp health check on. Required when tcp type is specified.
	// Go template can be used to reference values from the terraform output
	// (e.g. 127.0.0.1:8080, {{.address}}:{{.port}}).
	// +optional
	Address string `json:"address,omitempty"`

	// The timeout period at which the connection should timeout if unable to
	// complete the request.
	// When not specified, default 20s timeout is used.
	// +kubebuilder:default="20s"
	// +optional
	Timeout *metav1.Duration `json:"timeout,omitempty"`
}

HealthCheck contains configuration needed to perform a health check after terraform is applied.

func (*HealthCheck) DeepCopy

func (in *HealthCheck) DeepCopy() *HealthCheck

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

func (*HealthCheck) DeepCopyInto

func (in *HealthCheck) DeepCopyInto(out *HealthCheck)

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

func (HealthCheck) GetTimeout

func (in HealthCheck) GetTimeout() time.Duration

type LockStatus

type LockStatus struct {
	// +optional
	LastApplied string `json:"lastApplied,omitempty"`

	// Pending holds the identifier of the Lock Holder to be used with Force Unlock
	// +optional
	Pending string `json:"pending,omitempty"`
}

LockStatus defines the observed state of a Terraform State Lock

func (*LockStatus) DeepCopy

func (in *LockStatus) DeepCopy() *LockStatus

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

func (*LockStatus) DeepCopyInto

func (in *LockStatus) DeepCopyInto(out *LockStatus)

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

type PlanConfigSpec

type PlanConfigSpec struct {
	Storage *PlanStorage `json:"storage,omitempty"`
}

PlanConfigSpec is for specifying configuration for Terraform plan related options

func (*PlanConfigSpec) DeepCopy

func (in *PlanConfigSpec) DeepCopy() *PlanConfigSpec

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

func (*PlanConfigSpec) DeepCopyInto

func (in *PlanConfigSpec) DeepCopyInto(out *PlanConfigSpec)

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

type PlanStatus

type PlanStatus struct {
	// +optional
	LastApplied string `json:"lastApplied,omitempty"`

	// +optional
	Pending string `json:"pending,omitempty"`

	// +optional
	IsDestroyPlan bool `json:"isDestroyPlan,omitempty"`

	// +optional
	IsDriftDetectionPlan bool `json:"isDriftDetectionPlan,omitempty"`
}

func (*PlanStatus) DeepCopy

func (in *PlanStatus) DeepCopy() *PlanStatus

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

func (*PlanStatus) DeepCopyInto

func (in *PlanStatus) DeepCopyInto(out *PlanStatus)

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

type PlanStorage

type PlanStorage struct {
	// ClaimName hold a name of a Kubernetes PVC that will hold the tf-runner plan file.
	ClaimName string `json:"claimName,omitempty"`
}

PlanStorage is for specifying Terraform Plan storage configurations

func (*PlanStorage) DeepCopy

func (in *PlanStorage) DeepCopy() *PlanStorage

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

func (*PlanStorage) DeepCopyInto

func (in *PlanStorage) DeepCopyInto(out *PlanStorage)

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

type ReadInputsFromSecretSpec

type ReadInputsFromSecretSpec struct {
	// +required
	Name string `json:"name"`

	// +required
	As string `json:"as"`
}

func (*ReadInputsFromSecretSpec) DeepCopy

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

func (*ReadInputsFromSecretSpec) DeepCopyInto

func (in *ReadInputsFromSecretSpec) DeepCopyInto(out *ReadInputsFromSecretSpec)

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

type ResourceInventory

type ResourceInventory struct {
	// Entries of Kubernetes resource object references.
	Entries []ResourceRef `json:"entries"`
}

ResourceInventory contains a list of Kubernetes resource object references that have been applied by a Kustomization.

func (*ResourceInventory) DeepCopy

func (in *ResourceInventory) DeepCopy() *ResourceInventory

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

func (*ResourceInventory) DeepCopyInto

func (in *ResourceInventory) DeepCopyInto(out *ResourceInventory)

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

type ResourceRef

type ResourceRef struct {
	// Terraform resource's name.
	Name string `json:"n"`

	// Type is Terraform resource's type
	Type string `json:"t"`

	// ID is the resource identifier. This is cloud-specific. For example, ARN is an ID on AWS.
	Identifier string `json:"id"`
}

ResourceRef contains the information necessary to locate a resource within a cluster.

func (*ResourceRef) DeepCopy

func (in *ResourceRef) DeepCopy() *ResourceRef

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

func (*ResourceRef) DeepCopyInto

func (in *ResourceRef) DeepCopyInto(out *ResourceRef)

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

type RunnerPodMetadata

type RunnerPodMetadata struct {

	// Labels to add to the runner pod
	// +optional
	Labels map[string]string `json:"labels,omitempty"`

	// Annotations to add to the runner pod
	// +optional
	Annotations map[string]string `json:"annotations,omitempty"`
}

func (*RunnerPodMetadata) DeepCopy

func (in *RunnerPodMetadata) DeepCopy() *RunnerPodMetadata

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

func (*RunnerPodMetadata) DeepCopyInto

func (in *RunnerPodMetadata) DeepCopyInto(out *RunnerPodMetadata)

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

type RunnerPodSpec

type RunnerPodSpec struct {

	// Runner pod image to use other than default
	// +optional
	Image string `json:"image,omitempty"`

	// List of sources to populate environment variables in the container.
	// The keys defined within a source must be a C_IDENTIFIER. All invalid keys
	// will be reported as an event when the container is starting. When a key exists in multiple
	// sources, the value associated with the last source will take precedence.
	// Values defined by an Env with a duplicate key will take precedence.
	// Cannot be updated.
	// +optional
	EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"`

	// List of environment variables to set in the container.
	// Cannot be updated.
	// +optional
	// +patchMergeKey=name
	// +patchStrategy=merge
	Env []corev1.EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name"`

	// Set the NodeSelector for the Runner Pod
	// +optional
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`

	// Set the Affinity for the Runner Pod
	// +optional
	Affinity *corev1.Affinity `json:"affinity,omitempty"`

	// Set the Tolerations for the Runner Pod
	// +optional
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

	// Set Volume Mounts for the Runner Pod
	// +optional
	VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`

	// Set Volumes for the Runner Pod
	// +optional
	Volumes []corev1.Volume `json:"volumes,omitempty"`

	// Set up Init Containers for the Runner
	// +optional
	InitContainers []corev1.Container `json:"initContainers,omitempty"`
}

func (*RunnerPodSpec) DeepCopy

func (in *RunnerPodSpec) DeepCopy() *RunnerPodSpec

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

func (*RunnerPodSpec) DeepCopyInto

func (in *RunnerPodSpec) DeepCopyInto(out *RunnerPodSpec)

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

type RunnerPodTemplate

type RunnerPodTemplate struct {

	// +optional
	Metadata RunnerPodMetadata `json:"metadata,omitempty"`

	// +optional
	Spec RunnerPodSpec `json:"spec,omitempty"`
}

func (*RunnerPodTemplate) DeepCopy

func (in *RunnerPodTemplate) DeepCopy() *RunnerPodTemplate

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

func (*RunnerPodTemplate) DeepCopyInto

func (in *RunnerPodTemplate) DeepCopyInto(out *RunnerPodTemplate)

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

type TFStateSpec

type TFStateSpec struct {
	// ForceUnlock a Terraform state if it has become locked for any reason. Defaults to `no`.
	//
	// This is an Enum and has the expected values of:
	//
	// - auto
	// - yes
	// - no
	//
	// WARNING: Only use `auto` in the cases where you are absolutely certain that
	// no other system is using this state, you could otherwise end up in a bad place
	// See https://www.terraform.io/language/state/locking#force-unlock for more
	// information on the terraform state lock and force unlock.
	//
	// +optional
	// +kubebuilder:validation:Enum:=yes;no;auto
	// +kubebuilder:default:string=no
	ForceUnlock ForceUnlockEnum `json:"forceUnlock,omitempty"`

	// LockIdentifier holds the Identifier required by Terraform to unlock the state
	// if it ever gets into a locked state.
	//
	// You'll need to put the Lock Identifier in here while setting ForceUnlock to
	// either `yes` or `auto`.
	//
	// Leave this empty to do nothing, set this to the value of the `Lock Info: ID: [value]`,
	// e.g. `f2ab685b-f84d-ac0b-a125-378a22877e8d`, to force unlock the state.
	//
	// +optional
	LockIdentifier string `json:"lockIdentifier,omitempty"`
}

TFStateSpec allows the user to set ForceUnlock

func (*TFStateSpec) DeepCopy

func (in *TFStateSpec) DeepCopy() *TFStateSpec

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

func (*TFStateSpec) DeepCopyInto

func (in *TFStateSpec) DeepCopyInto(out *TFStateSpec)

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

func TerraformApplied

func TerraformApplied(terraform Terraform, revision string, message string, isDestroyApply bool, entries []ResourceRef) Terraform

func TerraformAppliedFailResetPlanAndNotReady

func TerraformAppliedFailResetPlanAndNotReady(terraform Terraform, revision, reason, message string) Terraform

func TerraformApplying

func TerraformApplying(terraform Terraform, revision string, message string) Terraform

func TerraformDriftDetected

func TerraformDriftDetected(terraform Terraform, revision, reason, message string) Terraform

func TerraformForceUnlock

func TerraformForceUnlock(terraform Terraform, message string) Terraform

TerraformForceUnlock will set a new condition on the Terraform resource indicating that we are attempting to force unlock it.

func TerraformHealthCheckFailed

func TerraformHealthCheckFailed(terraform Terraform, message string) Terraform

func TerraformHealthCheckSucceeded

func TerraformHealthCheckSucceeded(terraform Terraform, message string) Terraform

func TerraformNoDrift

func TerraformNoDrift(terraform Terraform, revision, reason, message string) Terraform

func TerraformNotReady

func TerraformNotReady(terraform Terraform, revision, reason, message string) Terraform

TerraformNotReady registers a failed apply attempt of the given Terraform.

func TerraformOutputsAvailable

func TerraformOutputsAvailable(terraform Terraform, availableOutputs []string, message string) Terraform

func TerraformOutputsWritten

func TerraformOutputsWritten(terraform Terraform, revision string, message string) Terraform

func TerraformPlannedNoChanges

func TerraformPlannedNoChanges(terraform Terraform, revision string, message string) Terraform

func TerraformPlannedWithChanges

func TerraformPlannedWithChanges(terraform Terraform, revision string, forceOrAutoApply bool, message string) Terraform

func TerraformPostPlanningWebhookFailed

func TerraformPostPlanningWebhookFailed(terraform Terraform, revision string, message string) Terraform

func TerraformProgressing

func TerraformProgressing(terraform Terraform, message string) Terraform

TerraformProgressing resets the conditions of the given Terraform to a single ReadyCondition with status ConditionUnknown.

func TerraformStateLocked

func TerraformStateLocked(terraform Terraform, lockID, message string) Terraform

TerraformStateLocked will set a new condition on the Terraform resource indicating that the resource has been locked.

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) FromBytes

func (in *Terraform) FromBytes(b []byte, scheme *runtime.Scheme) error

func (Terraform) GetClaimName

func (in Terraform) GetClaimName() string

func (Terraform) GetDependsOn

func (in Terraform) GetDependsOn() []meta.NamespacedObjectReference

GetDependsOn returns the list of dependencies, namespace scoped.

func (Terraform) GetPlanStorageMountSubDir

func (in Terraform) GetPlanStorageMountSubDir() string

func (Terraform) GetRetryInterval

func (in Terraform) GetRetryInterval() time.Duration

GetRetryInterval returns the retry interval

func (*Terraform) GetRunnerHostname

func (in *Terraform) GetRunnerHostname(ip string) string

func (*Terraform) GetStatusConditions

func (in *Terraform) GetStatusConditions() *[]metav1.Condition

GetStatusConditions returns a pointer to the Status.Conditions slice.

func (Terraform) HasDrift

func (in Terraform) HasDrift() bool

HasDrift returns true if drift has been detected since the last successful apply

func (Terraform) ToBytes

func (in Terraform) ToBytes(scheme *runtime.Scheme) ([]byte, error)

func (*Terraform) WorkspaceName

func (in *Terraform) WorkspaceName() string

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 TerraformSpec

type TerraformSpec struct {

	// ApprovePlan specifies name of a plan wanted to approve.
	// If its value is "auto", the controller will automatically approve every plan.
	// +optional
	ApprovePlan string `json:"approvePlan,omitempty"`

	// Destroy produces a destroy plan. Applying the plan will destroy all resources.
	// +optional
	Destroy bool `json:"destroy,omitempty"`

	// +optional
	PlanConfig *PlanConfigSpec `json:"planConfig,omitempty"`

	// +optional
	BackendConfig *BackendConfigSpec `json:"backendConfig,omitempty"`

	// +optional
	BackendConfigsFrom []BackendConfigsReference `json:"backendConfigsFrom,omitempty"`

	// +optional
	// +kubebuilder:default:=default
	Workspace string `json:"workspace,omitempty"`

	// List of input variables to set for the Terraform program.
	// +optional
	Vars []Variable `json:"vars,omitempty"`

	// List of references to a Secret or a ConfigMap to generate variables for
	// Terraform resources based on its data, selectively by varsKey. Values of the later
	// Secret / ConfigMap with the same keys will override those of the former.
	// +optional
	VarsFrom []VarsReference `json:"varsFrom,omitempty"`

	// Values map to the Terraform variable "values", which is an object of arbitrary values.
	// It is a convenient way to pass values to Terraform resources without having to define
	// a variable for each value. To use this feature, your Terraform file must define the variable "values".
	// +optional
	Values *apiextensionsv1.JSON `json:"values,omitempty"`

	// TfVarsFiles loads all given .tfvars files. It copycats the -var-file functionality.
	// +optional
	TfVarsFiles []string `json:"tfVarsFiles,omitempty"`

	// List of all configuration files to be created in initialization.
	// +optional
	FileMappings []FileMapping `json:"fileMappings,omitempty"`

	// The interval at which to reconcile the Terraform.
	// +required
	Interval metav1.Duration `json:"interval"`

	// The interval at which to retry a previously failed reconciliation.
	// When not specified, the controller uses the TerraformSpec.Interval
	// value to retry failures.
	// +optional
	RetryInterval *metav1.Duration `json:"retryInterval,omitempty"`

	// Path to the directory containing Terraform (.tf) files.
	// Defaults to 'None', which translates to the root path of the SourceRef.
	// +optional
	Path string `json:"path,omitempty"`

	// SourceRef is the reference of the source where the Terraform files are stored.
	// +required
	SourceRef CrossNamespaceSourceReference `json:"sourceRef"`

	// Suspend is to tell the controller to suspend subsequent TF executions,
	// it does not apply to already started executions. Defaults to false.
	// +optional
	Suspend bool `json:"suspend,omitempty"`

	// Force instructs the controller to unconditionally
	// re-plan and re-apply TF resources. Defaults to false.
	// +kubebuilder:default:=false
	// +optional
	Force bool `json:"force,omitempty"`

	// +optional
	ReadInputsFromSecrets []ReadInputsFromSecretSpec `json:"readInputsFromSecrets,omitempty"`

	// A list of target secrets for the outputs to be written as.
	// +optional
	WriteOutputsToSecret *WriteOutputsToSecretSpec `json:"writeOutputsToSecret,omitempty"`

	// Disable automatic drift detection. Drift detection may be resource intensive in
	// the context of a large cluster or complex Terraform statefile. Defaults to false.
	// +kubebuilder:default:=false
	// +optional
	DisableDriftDetection bool `json:"disableDriftDetection,omitempty"`

	// +optional
	CliConfigSecretRef *corev1.SecretReference `json:"cliConfigSecretRef,omitempty"`

	// List of health checks to be performed.
	// +optional
	HealthChecks []HealthCheck `json:"healthChecks,omitempty"`

	// Create destroy plan and apply it to destroy terraform resources
	// upon deletion of this object. Defaults to false.
	// +kubebuilder:default:=false
	// +optional
	DestroyResourcesOnDeletion bool `json:"destroyResourcesOnDeletion,omitempty"`

	// Name of a ServiceAccount for the runner Pod to provision Terraform resources.
	// Default to tf-runner.
	// +kubebuilder:default:=tf-runner
	// +optional
	ServiceAccountName string `json:"serviceAccountName,omitempty"`

	// Clean the runner pod up after each reconciliation cycle
	// +kubebuilder:default:=true
	// +optional
	AlwaysCleanupRunnerPod *bool `json:"alwaysCleanupRunnerPod,omitempty"`

	// Configure the termination grace period for the runner pod. Use this parameter
	// to allow the Terraform process to gracefully shutdown. Consider increasing for
	// large, complex or slow-moving Terraform managed resources.
	// +kubebuilder:default:=30
	// +optional
	RunnerTerminationGracePeriodSeconds *int64 `json:"runnerTerminationGracePeriodSeconds,omitempty"`

	// RefreshBeforeApply forces refreshing of the state before the apply step.
	// +kubebuilder:default:=false
	// +optional
	RefreshBeforeApply bool `json:"refreshBeforeApply,omitempty"`

	// +optional
	RunnerPodTemplate RunnerPodTemplate `json:"runnerPodTemplate,omitempty"`

	// EnableInventory enables the object to store resource entries as the inventory for external use.
	// +optional
	EnableInventory bool `json:"enableInventory,omitempty"`

	// +optional
	TFState *TFStateSpec `json:"tfstate,omitempty"`

	// Targets specify the resource, module or collection of resources to target.
	// +optional
	Targets []string `json:"targets,omitempty"`

	// StoreReadablePlan enables storing the plan in a readable format.
	// +kubebuilder:validation:Enum=none;json;human
	// +kubebuilder:default:=none
	// +optional
	StoreReadablePlan string `json:"storeReadablePlan,omitempty"`

	// +optional
	Webhooks []Webhook `json:"webhooks,omitempty"`

	// +optional
	DependsOn []meta.NamespacedObjectReference `json:"dependsOn,omitempty"`
}

TerraformSpec defines the desired state of Terraform

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.

func (*TerraformSpec) GetAlwaysCleanupRunnerPod

func (in *TerraformSpec) GetAlwaysCleanupRunnerPod() bool

type TerraformStatus

type TerraformStatus struct {
	meta.ReconcileRequestStatus `json:",inline"`

	// ObservedGeneration is the last reconciled generation.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`

	// The last successfully applied revision.
	// The revision format for Git sources is <branch|tag>/<commit-sha>.
	// +optional
	LastAppliedRevision string `json:"lastAppliedRevision,omitempty"`

	// LastAttemptedRevision is the revision of the last reconciliation attempt.
	// +optional
	LastAttemptedRevision string `json:"lastAttemptedRevision,omitempty"`

	// LastPlannedRevision is the revision used by the last planning process.
	// The result could be either no plan change or a new plan generated.
	// +optional
	LastPlannedRevision string `json:"lastPlannedRevision,omitempty"`

	// LastDriftDetectedAt is the time when the last drift was detected
	// +optional
	LastDriftDetectedAt *metav1.Time `json:"lastDriftDetectedAt,omitempty"`

	// LastAppliedByDriftDetectionAt is the time when the last drift was detected and
	// terraform apply was performed as a result
	// +optional
	LastAppliedByDriftDetectionAt *metav1.Time `json:"lastAppliedByDriftDetectionAt,omitempty"`

	// +optional
	AvailableOutputs []string `json:"availableOutputs,omitempty"`

	// +optional
	Plan PlanStatus `json:"plan,omitempty"`

	// Inventory contains the list of Terraform resource object references that have been successfully applied.
	// +optional
	Inventory *ResourceInventory `json:"inventory,omitempty"`

	// +optional
	Lock LockStatus `json:"lock,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 {
	// Name is the name of the variable
	// +required
	Name string `json:"name"`

	// +optional
	Value *apiextensionsv1.JSON `json:"value,omitempty"`

	// +optional
	ValueFrom *corev1.EnvVarSource `json:"valueFrom,omitempty"`
}

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 VarsReference

type VarsReference struct {
	// Kind of the values referent, valid values are ('Secret', 'ConfigMap').
	// +kubebuilder:validation:Enum=Secret;ConfigMap
	// +required
	Kind string `json:"kind"`

	// Name of the values referent. Should reside in the same namespace as the
	// referring resource.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=253
	// +required
	Name string `json:"name"`

	// VarsKeys is the data key at which a specific value can be found. Defaults to all keys.
	// +optional
	VarsKeys []string `json:"varsKeys,omitempty"`

	// Optional marks this VarsReference as optional. When set, a not found error
	// for the values reference is ignored, but any VarsKey or
	// transient error will still result in a reconciliation failure.
	// +optional
	Optional bool `json:"optional,omitempty"`
}

VarsReference contain a reference of a Secret or a ConfigMap to generate variables for Terraform resources based on its data, selectively by varsKey.

func (*VarsReference) DeepCopy

func (in *VarsReference) DeepCopy() *VarsReference

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

func (*VarsReference) DeepCopyInto

func (in *VarsReference) DeepCopyInto(out *VarsReference)

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

type Webhook

type Webhook struct {
	// +kubebuilder:validation:Enum=post-planning
	// +kubebuilder:default:=post-planning
	// +required
	Stage string `json:"stage"`

	// +kubebuilder:default:=true
	// +optional
	Enabled *bool `json:"enabled,omitempty"`

	// +required
	URL string `json:"url"`

	// +kubebuilder:value:Enum=SpecAndPlan,SpecOnly,PlanOnly
	// +kubebuilder:default:=SpecAndPlan
	// +optional
	PayloadType string `json:"payloadType,omitempty"`

	// +optional
	ErrorMessageTemplate string `json:"errorMessageTemplate,omitempty"`

	// +required
	TestExpression string `json:"testExpression,omitempty"`
}

func (*Webhook) DeepCopy

func (in *Webhook) DeepCopy() *Webhook

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

func (*Webhook) DeepCopyInto

func (in *Webhook) DeepCopyInto(out *Webhook)

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

func (Webhook) IsEnabled

func (w Webhook) IsEnabled() bool

type WriteOutputsToSecretSpec

type WriteOutputsToSecretSpec struct {
	// Name is the name of the Secret to be written
	// +required
	Name string `json:"name"`

	// Outputs contain the selected names of outputs to be written
	// to the secret. Empty array means writing all outputs, which is default.
	// +optional
	Outputs []string `json:"outputs,omitempty"`
}

WriteOutputsToSecretSpec defines where to store outputs, and which outputs to be stored.

func (*WriteOutputsToSecretSpec) DeepCopy

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

func (*WriteOutputsToSecretSpec) DeepCopyInto

func (in *WriteOutputsToSecretSpec) DeepCopyInto(out *WriteOutputsToSecretSpec)

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