diff --git a/api/v1/kustomization_types.go b/api/v1/kustomization_types.go index 6bd217c3a..8e4f50d0f 100644 --- a/api/v1/kustomization_types.go +++ b/api/v1/kustomization_types.go @@ -50,7 +50,7 @@ type KustomizationSpec struct { CommonMetadata *CommonMetadata `json:"commonMetadata,omitempty"` // DependsOn may contain a DependencyReference slice - // with references to Kustomization resources that must be ready before this + // with references to Kubernetes resources that must be ready before this // Kustomization can be reconciled. // +optional DependsOn []DependencyReference `json:"dependsOn,omitempty"` diff --git a/api/v1/reference_types.go b/api/v1/reference_types.go index 07eb3b701..0ebdd9723 100644 --- a/api/v1/reference_types.go +++ b/api/v1/reference_types.go @@ -51,17 +51,32 @@ func (s *CrossNamespaceSourceReference) String() string { return fmt.Sprintf("%s/%s", s.Kind, s.Name) } -// DependencyReference defines a Kustomization dependency on another Kustomization resource. +// DependencyReference defines a Kustomization dependency on a Kubernetes resource. +// When the dependency is a Kustomization, defaults are applied during reconciliation. type DependencyReference struct { - // Name of the referent. + // APIVersion of the resource to depend on, defaults to the Kustomization API + // group version when the dependency is a Kustomization. + // +optional + APIVersion string `json:"apiVersion,omitempty"` + + // Kind of the resource to depend on, defaults to Kustomization. + // +optional + Kind string `json:"kind,omitempty"` + + // Name of the resource to depend on. // +required Name string `json:"name"` - // Namespace of the referent, defaults to the namespace of the Kustomization - // resource object that contains the reference. + // Namespace of the resource to depend on, defaults to the namespace of the + // Kustomization resource object that contains the reference. // +optional Namespace string `json:"namespace,omitempty"` + // Ready checks if the resource Ready status condition is true, defaults to + // true when the dependency is a Kustomization. + // +optional + Ready *bool `json:"ready,omitempty"` + // ReadyExpr is a CEL expression that can be used to assess the readiness // of a dependency. When specified, the built-in readiness check // is replaced by the logic defined in the CEL expression. diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index 231b5b525..f63570e18 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -94,6 +94,11 @@ func (in *Decryption) DeepCopy() *Decryption { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DependencyReference) DeepCopyInto(out *DependencyReference) { *out = *in + if in.Ready != nil { + in, out := &in.Ready, &out.Ready + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DependencyReference. @@ -176,7 +181,9 @@ func (in *KustomizationSpec) DeepCopyInto(out *KustomizationSpec) { if in.DependsOn != nil { in, out := &in.DependsOn, &out.DependsOn *out = make([]DependencyReference, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.Decryption != nil { in, out := &in.Decryption, &out.Decryption diff --git a/config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml b/config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml index beeff81f0..20c6feafa 100644 --- a/config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml +++ b/config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml @@ -137,20 +137,35 @@ spec: dependsOn: description: |- DependsOn may contain a DependencyReference slice - with references to Kustomization resources that must be ready before this + with references to Kubernetes resources that must be ready before this Kustomization can be reconciled. items: - description: DependencyReference defines a Kustomization dependency - on another Kustomization resource. + description: |- + DependencyReference defines a Kustomization dependency on a Kubernetes resource. + When the dependency is a Kustomization, defaults are applied during reconciliation. properties: + apiVersion: + description: |- + APIVersion of the resource to depend on, defaults to the Kustomization API + group version when the dependency is a Kustomization. + type: string + kind: + description: Kind of the resource to depend on, defaults to + Kustomization. + type: string name: - description: Name of the referent. + description: Name of the resource to depend on. type: string namespace: description: |- - Namespace of the referent, defaults to the namespace of the Kustomization - resource object that contains the reference. + Namespace of the resource to depend on, defaults to the namespace of the + Kustomization resource object that contains the reference. type: string + ready: + description: |- + Ready checks if the resource Ready status condition is true, defaults to + true when the dependency is a Kustomization. + type: boolean readyExpr: description: |- ReadyExpr is a CEL expression that can be used to assess the readiness diff --git a/docs/api/v1/kustomize.md b/docs/api/v1/kustomize.md index 11624c6c1..260d485f2 100644 --- a/docs/api/v1/kustomize.md +++ b/docs/api/v1/kustomize.md @@ -97,7 +97,7 @@ overridden if its key matches a common one.
DependsOn may contain a DependencyReference slice -with references to Kustomization resources that must be ready before this +with references to Kubernetes resources that must be ready before this Kustomization can be reconciled.
DependencyReference defines a Kustomization dependency on another Kustomization resource.
+DependencyReference defines a Kustomization dependency on a Kubernetes resource. +When the dependency is a Kustomization, defaults are applied during reconciliation.
+apiVersion+ +string + + |
+
+(Optional)
+ APIVersion of the resource to depend on, defaults to the Kustomization API +group version when the dependency is a Kustomization. + |
+
+kind+ +string + + |
+
+(Optional)
+ Kind of the resource to depend on, defaults to Kustomization. + |
+
namestring |
- Name of the referent. +Name of the resource to depend on. |
|
(Optional)
- Namespace of the referent, defaults to the namespace of the Kustomization -resource object that contains the reference. +Namespace of the resource to depend on, defaults to the namespace of the +Kustomization resource object that contains the reference. + |
+|
+ready+ +bool + + |
+
+(Optional)
+ Ready checks if the resource Ready status condition is true, defaults to +true when the dependency is a Kustomization. |
|
(Optional)
DependsOn may contain a DependencyReference slice -with references to Kustomization resources that must be ready before this +with references to Kubernetes resources that must be ready before this Kustomization can be reconciled. |