diff --git a/api/v2/helmrelease_types.go b/api/v2/helmrelease_types.go index 73cea73a4..19ec1518f 100644 --- a/api/v2/helmrelease_types.go +++ b/api/v2/helmrelease_types.go @@ -101,7 +101,7 @@ type HelmReleaseSpec struct { StorageNamespace string `json:"storageNamespace,omitempty"` // DependsOn may contain a DependencyReference slice with - // references to HelmRelease resources that must be ready before this HelmRelease + // references to Kubernetes resources that must be ready before this HelmRelease // can be reconciled. // +optional DependsOn []DependencyReference `json:"dependsOn,omitempty"` diff --git a/api/v2/reference_types.go b/api/v2/reference_types.go index 9f3ee4a1c..d6958394e 100644 --- a/api/v2/reference_types.go +++ b/api/v2/reference_types.go @@ -69,17 +69,32 @@ type CrossNamespaceSourceReference struct { Namespace string `json:"namespace,omitempty"` } -// DependencyReference defines a HelmRelease dependency on another HelmRelease resource. +// DependencyReference defines a HelmRelease dependency on a Kubernetes resource. +// When the dependency is a HelmRelease, defaults are applied during reconciliation. type DependencyReference struct { - // Name of the referent. + // APIVersion of the resource to depend on, defaults to the HelmRelease API + // group version when the dependency is a HelmRelease. + // +optional + APIVersion string `json:"apiVersion,omitempty"` + + // Kind of the resource to depend on, defaults to HelmRelease. + // +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 HelmRelease - // resource object that contains the reference. + // Namespace of the resource to depend on, defaults to the namespace of the + // HelmRelease 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 HelmRelease. + // +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/v2/zz_generated.deepcopy.go b/api/v2/zz_generated.deepcopy.go index f371a2181..e97dc01b9 100644 --- a/api/v2/zz_generated.deepcopy.go +++ b/api/v2/zz_generated.deepcopy.go @@ -90,6 +90,11 @@ func (in *CrossNamespaceSourceReference) DeepCopy() *CrossNamespaceSourceReferen // 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. @@ -321,7 +326,9 @@ func (in *HelmReleaseSpec) DeepCopyInto(out *HelmReleaseSpec) { 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.Timeout != nil { in, out := &in.Timeout, &out.Timeout diff --git a/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml b/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml index bf06f7d30..a7a5db823 100644 --- a/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml +++ b/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml @@ -241,20 +241,35 @@ spec: dependsOn: description: |- DependsOn may contain a DependencyReference slice with - references to HelmRelease resources that must be ready before this HelmRelease + references to Kubernetes resources that must be ready before this HelmRelease can be reconciled. items: - description: DependencyReference defines a HelmRelease dependency - on another HelmRelease resource. + description: |- + DependencyReference defines a HelmRelease dependency on a Kubernetes resource. + When the dependency is a HelmRelease, defaults are applied during reconciliation. properties: + apiVersion: + description: |- + APIVersion of the resource to depend on, defaults to the HelmRelease API + group version when the dependency is a HelmRelease. + type: string + kind: + description: Kind of the resource to depend on, defaults to + HelmRelease. + 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 HelmRelease - resource object that contains the reference. + Namespace of the resource to depend on, defaults to the namespace of the + HelmRelease 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 HelmRelease. + type: boolean readyExpr: description: |- ReadyExpr is a CEL expression that can be used to assess the readiness diff --git a/docs/api/v2/helm.md b/docs/api/v2/helm.md index 639745c4f..b8f99936f 100644 --- a/docs/api/v2/helm.md +++ b/docs/api/v2/helm.md @@ -195,7 +195,7 @@ Defaults to the namespace of the HelmRelease.
DependsOn may contain a DependencyReference slice with -references to HelmRelease resources that must be ready before this HelmRelease +references to Kubernetes resources that must be ready before this HelmRelease can be reconciled.
DependencyReference defines a HelmRelease dependency on another HelmRelease resource.
+DependencyReference defines a HelmRelease dependency on a Kubernetes resource. +When the dependency is a HelmRelease, defaults are applied during reconciliation.
+apiVersion+ +string + + |
+
+(Optional)
+ APIVersion of the resource to depend on, defaults to the HelmRelease API +group version when the dependency is a HelmRelease. + |
+
+kind+ +string + + |
+
+(Optional)
+ Kind of the resource to depend on, defaults to HelmRelease. + |
+
namestring |
- Name of the referent. +Name of the resource to depend on. |
|
(Optional)
- Namespace of the referent, defaults to the namespace of the HelmRelease -resource object that contains the reference. +Namespace of the resource to depend on, defaults to the namespace of the +HelmRelease 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 HelmRelease. |
|
(Optional)
DependsOn may contain a DependencyReference slice with -references to HelmRelease resources that must be ready before this HelmRelease +references to Kubernetes resources that must be ready before this HelmRelease can be reconciled. |