Skip to main content

Kustomization

TypeComponent

Parameters

Parameter
Type
Required
DefaultDescription
intervalstringYes

The interval at which to reconcile the Kustomization. This interval is approximate and may be subject to jitter to ensure efficient use of resources.

prunebooleanYes

Prune enables garbage collection.

sourceRefobjectYes

Reference of the source where the kustomization file is.

annotationsmapNo

Annotations for the workload

commonMetadataobjectNo

CommonMetadata specifies the common labels and annotations that are applied to all resources. Any existing label or annotation will be overridden if its key matches a common one.

componentsarrayNo

Components specifies relative paths to specifications of other Components.

decryptionobjectNo

Decrypt Kubernetes secrets before applying them on the cluster.

deletionPolicystringNo

"MirrorPrune"

DeletionPolicy can be used to control garbage collection when this Kustomization is deleted. Valid values are ('MirrorPrune', 'Delete', 'Orphan'). 'MirrorPrune' mirrors the Prune field (orphan if false, delete if true). Defaults to 'MirrorPrune'.

dependsOnarrayNo

DependsOn may contain a meta.NamespacedObjectReference slice with references to Kustomization resources that must be ready before this Kustomization can be reconciled.

forcebooleanNo

Force instructs the controller to recreate resources when patching fails due to an immutable field change.

healthCheckExprsarrayNo

HealthCheckExprs is a list of healthcheck expressions for evaluating the health of custom resources using Common Expression Language (CEL). The expressions are evaluated only when Wait or HealthChecks are specified.

healthChecksarrayNo

A list of resources to be included in the health assessment.

imagesarrayNo

Images is a list of (image name, new name, new tag or digest) for changing image names, tags or digests. This can also be achieved with a patch, but this operator is simpler to specify.

kubeConfigobjectNo

The KubeConfig for reconciling the Kustomization on a remote cluster. When used in combination with KustomizationSpec.ServiceAccountName, forces the controller to act on behalf of that Service Account at the target cluster. If the --default-service-account flag is set, its value will be used as a controller level fallback for when KustomizationSpec.ServiceAccountName is empty.

labelsmapNo

Labels for the workload

namePrefixstringNo

NamePrefix will prefix the names of all managed resources.

nameSuffixstringNo

NameSuffix will suffix the names of all managed resources.

patchesarrayNo

Strategic merge and JSON patches, defined as inline YAML objects, capable of targeting objects based on kind, label and annotation selectors.

pathstringNo

Path to the directory containing the kustomization.yaml file, or the set of plain YAMLs a kustomization.yaml should be generated for. Defaults to 'None', which translates to the root path of the SourceRef.

postBuildobjectNo

PostBuild describes which actions to perform on the YAML manifest generated by building the kustomize overlay.

retryIntervalstringNo

The interval at which to retry a previously failed reconciliation. When not specified, the controller uses the KustomizationSpec.Interval value to retry failures.

serviceAccountNamestringNo

The name of the Kubernetes service account to impersonate when reconciling this Kustomization.

suspendbooleanNo

This flag tells the controller to suspend subsequent kustomize executions, it does not apply to already started executions. Defaults to false.

targetNamespacestringNo

TargetNamespace sets or overrides the namespace in the kustomization.yaml file.

timeoutstringNo

Timeout for validation, apply and health checking operations. Defaults to 'Interval' duration.

waitbooleanNo

Wait instructs the controller to check the health of all the reconciled resources. When enabled, the HealthChecks are ignored. Defaults to false.

Template

The following tabs display the definition's Cue template and the rendered YAML. The rendered YAML is the output of the Cue template when the definition is applied to a cluster.

kustomization: {
type: "component"
description: "Kustomization is the Schema for the kustomizations API."
labels: {
"componentdefinition.spectrocloud.com/type": "application"
"wl.spectrocloud.com/provider": "kustomize.toolkit.fluxcd.io"
"definition.spectrocloud.com/category": "Flux"
}
}

template: {
output: {
apiVersion: "kustomize.toolkit.fluxcd.io/v1"
kind: "Kustomization"
metadata: {
labels: {
if parameter.labels != _|_ {
parameter.labels
}
"wl.spectrocloud.com/name": context.workloadName
"wl.spectrocloud.com/component": context.name
}
if parameter.annotations != _|_ {
annotations: parameter.annotations
}
}
spec: {
if parameter.commonMetadata != _|_ {
commonMetadata: parameter.commonMetadata
}
if parameter.components != _|_ {
components: parameter.components
}
if parameter.decryption != _|_ {
decryption: parameter.decryption
}
if parameter.deletionPolicy != _|_ {
deletionPolicy: parameter.deletionPolicy
}
if parameter.dependsOn != _|_ {
dependsOn: parameter.dependsOn
}
if parameter.force != _|_ {
force: parameter.force
}
if parameter.healthCheckExprs != _|_ {
healthCheckExprs: parameter.healthCheckExprs
}
if parameter.healthChecks != _|_ {
healthChecks: parameter.healthChecks
}
if parameter.images != _|_ {
images: parameter.images
}
interval: parameter.interval
if parameter.kubeConfig != _|_ {
kubeConfig: parameter.kubeConfig
}
if parameter.namePrefix != _|_ {
namePrefix: parameter.namePrefix
}
if parameter.nameSuffix != _|_ {
nameSuffix: parameter.nameSuffix
}
if parameter.patches != _|_ {
patches: parameter.patches
}
if parameter.path != _|_ {
path: parameter.path
}
if parameter.postBuild != _|_ {
postBuild: parameter.postBuild
}
prune: parameter.prune
if parameter.retryInterval != _|_ {
retryInterval: parameter.retryInterval
}
if parameter.serviceAccountName != _|_ {
serviceAccountName: parameter.serviceAccountName
}
sourceRef: parameter.sourceRef
if parameter.suspend != _|_ {
suspend: parameter.suspend
}
if parameter.targetNamespace != _|_ {
targetNamespace: parameter.targetNamespace
}
if parameter.timeout != _|_ {
timeout: parameter.timeout
}
if parameter.wait != _|_ {
wait: parameter.wait
}
}
}

parameter: {
// +usage=Annotations for the workload
annotations?: [string]: string

// +usage=Labels for the workload
labels?: [string]: string

// +usage=CommonMetadata specifies the common labels and annotations that are applied to all resources. Any existing label or annotation will be overridden if its key matches a common one.
commonMetadata?: {

// +usage=Annotations to be added to the object's metadata.
annotations?: [string]: string

// +usage=Labels to be added to the object's metadata.
labels?: [string]: string
}

// +usage=Components specifies relative paths to specifications of other Components.
components?: [...string]

// +usage=Decrypt Kubernetes secrets before applying them on the cluster.
decryption?: {

// +usage=Provider is the name of the decryption engine.
provider: *"sops" | string

// +usage=The secret name containing the private OpenPGP keys used for decryption.
secretRef?: {

// +usage=Name of the referent.
name: string
}
}

// +usage=DeletionPolicy can be used to control garbage collection when this Kustomization is deleted. Valid values are ('MirrorPrune', 'Delete', 'Orphan'). 'MirrorPrune' mirrors the Prune field (orphan if false, delete if true). Defaults to 'MirrorPrune'.
deletionPolicy?: *"MirrorPrune" | "Delete" | "Orphan"

// +usage=DependsOn may contain a meta.NamespacedObjectReference slice with references to Kustomization resources that must be ready before this Kustomization can be reconciled.
dependsOn?: [...{

// +usage=Name of the referent.
name: string

// +usage=Namespace of the referent, when not specified it acts as LocalObjectReference.
namespace?: string
}]

// +usage=Force instructs the controller to recreate resources when patching fails due to an immutable field change.
force?: bool

// +usage=HealthCheckExprs is a list of healthcheck expressions for evaluating the health of custom resources using Common Expression Language (CEL). The expressions are evaluated only when Wait or HealthChecks are specified.
healthCheckExprs?: [...{

// +usage=APIVersion of the custom resource under evaluation.
apiVersion: string

// +usage=Current is the CEL expression that determines if the status of the custom resource has reached the desired state.
current: string

// +usage=Failed is the CEL expression that determines if the status of the custom resource has failed to reach the desired state.
failed?: string

// +usage=InProgress is the CEL expression that determines if the status of the custom resource has not yet reached the desired state.
inProgress?: string

// +usage=Kind of the custom resource under evaluation.
kind: string
}]

// +usage=A list of resources to be included in the health assessment.
healthChecks?: [...{

// +usage=API version of the referent, if not specified the Kubernetes preferred version will be used.
apiVersion?: string

// +usage=Kind of the referent.
kind: string

// +usage=Name of the referent.
name: string

// +usage=Namespace of the referent, when not specified it acts as LocalObjectReference.
namespace?: string
}]

// +usage=Images is a list of (image name, new name, new tag or digest) for changing image names, tags or digests. This can also be achieved with a patch, but this operator is simpler to specify.
images?: [...{

// +usage=Digest is the value used to replace the original image tag. If digest is present NewTag value is ignored.
digest?: string

// +usage=Name is a tag-less image name.
name: string

// +usage=NewName is the value used to replace the original name.
newName?: string

// +usage=NewTag is the value used to replace the original tag.
newTag?: string
}]

// +usage=The interval at which to reconcile the Kustomization. This interval is approximate and may be subject to jitter to ensure efficient use of resources.
interval: =~"^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"

// +usage=The KubeConfig for reconciling the Kustomization on a remote cluster. When used in combination with KustomizationSpec.ServiceAccountName, forces the controller to act on behalf of that Service Account at the target cluster. If the --default-service-account flag is set, its value will be used as a controller level fallback for when KustomizationSpec.ServiceAccountName is empty.
kubeConfig?: {

// +usage=SecretRef holds the name of a secret that contains a key with the kubeconfig file as the value. If no key is set, the key will default to 'value'. It is recommended that the kubeconfig is self-contained, and the secret is regularly updated if credentials such as a cloud-access-token expire. Cloud specific `cmd-path` auth helpers will not function without adding binaries and credentials to the Pod that is responsible for reconciling Kubernetes resources.
secretRef: {

// +usage=Key in the Secret, when not specified an implementation-specific default key is used.
key?: string

// +usage=Name of the Secret.
name: string
}
}

// +usage=NamePrefix will prefix the names of all managed resources.
namePrefix?: string

// +usage=NameSuffix will suffix the names of all managed resources.
nameSuffix?: string

// +usage=Strategic merge and JSON patches, defined as inline YAML objects, capable of targeting objects based on kind, label and annotation selectors.
patches?: [...{

// +usage=Patch contains an inline StrategicMerge patch or an inline JSON6902 patch with an array of operation objects.
patch: string

// +usage=Target points to the resources that the patch document should be applied to.
target?: {

// +usage=AnnotationSelector is a string that follows the label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api It matches with the resource annotations.
annotationSelector?: string

// +usage=Group is the API group to select resources from. Together with Version and Kind it is capable of unambiguously identifying and/or selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
group?: string

// +usage=Kind of the API Group to select resources from. Together with Group and Version it is capable of unambiguously identifying and/or selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
kind?: string

// +usage=LabelSelector is a string that follows the label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api It matches with the resource labels.
labelSelector?: string

// +usage=Name to match resources with.
name?: string

// +usage=Namespace to select resources from.
namespace?: string

// +usage=Version of the API Group to select resources from. Together with Group and Kind it is capable of unambiguously identifying and/or selecting resources. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
version?: string
}
}]

// +usage=Path to the directory containing the kustomization.yaml file, or the set of plain YAMLs a kustomization.yaml should be generated for. Defaults to 'None', which translates to the root path of the SourceRef.
path?: string

// +usage=PostBuild describes which actions to perform on the YAML manifest generated by building the kustomize overlay.
postBuild?: {

// +usage=Substitute holds a map of key/value pairs. The variables defined in your YAML manifests that match any of the keys defined in the map will be substituted with the set value. Includes support for bash string replacement functions e.g. ${var:=default}, ${var:position} and ${var/substring/replacement}.
substitute?: [string]: string

// +usage=SubstituteFrom holds references to ConfigMaps and Secrets containing the variables and their values to be substituted in the YAML manifests. The ConfigMap and the Secret data keys represent the var names, and they must match the vars declared in the manifests for the substitution to happen.
substituteFrom?: [...{

// +usage=Kind of the values referent, valid values are ('Secret', 'ConfigMap').
kind: *"Secret" | "ConfigMap"

// +usage=Name of the values referent. Should reside in the same namespace as the referring resource.
name: string

// +usage=Optional indicates whether the referenced resource must exist, or whether to tolerate its absence. If true and the referenced resource is absent, proceed as if the resource was present but empty, without any variables defined.
optional?: bool
}]
}

// +usage=Prune enables garbage collection.
prune: bool

// +usage=The interval at which to retry a previously failed reconciliation. When not specified, the controller uses the KustomizationSpec.Interval value to retry failures.
retryInterval?: =~"^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"

// +usage=The name of the Kubernetes service account to impersonate when reconciling this Kustomization.
serviceAccountName?: string

// +usage=Reference of the source where the kustomization file is.
sourceRef: {

// +usage=API version of the referent.
apiVersion?: string

// +usage=Kind of the referent.
kind: *"OCIRepository" | "GitRepository" | "Bucket"

// +usage=Name of the referent.
name: string

// +usage=Namespace of the referent, defaults to the namespace of the Kubernetes resource object that contains the reference.
namespace?: string
}

// +usage=This flag tells the controller to suspend subsequent kustomize executions, it does not apply to already started executions. Defaults to false.
suspend?: bool

// +usage=TargetNamespace sets or overrides the namespace in the kustomization.yaml file.
targetNamespace?: string

// +usage=Timeout for validation, apply and health checking operations. Defaults to 'Interval' duration.
timeout?: =~"^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"

// +usage=Wait instructs the controller to check the health of all the reconciled resources. When enabled, the HealthChecks are ignored. Defaults to false.
wait?: bool
}
}