diff --git a/api/v2beta1/helmrelease_types.go b/api/v2beta1/helmrelease_types.go index 69743fca1..1cec7f3d2 100644 --- a/api/v2beta1/helmrelease_types.go +++ b/api/v2beta1/helmrelease_types.go @@ -219,11 +219,32 @@ func (in HelmReleaseSpec) GetUninstall() Uninstall { // generate a v1beta2.HelmChart object in the same namespace as the referenced // v1beta2.Source. type HelmChartTemplate struct { + // ObjectMeta holds the template for metadata like labels and annotations. + // +optional + ObjectMeta HelmChartTemplateObjectMeta `json:"metadata,omitempty"` + // Spec holds the template for the v1beta2.HelmChartSpec for this HelmRelease. // +required Spec HelmChartTemplateSpec `json:"spec"` } +// HelmChartTemplateObjectMeta defines the template for the ObjectMeta of a +// v1beta2.HelmChart. +type HelmChartTemplateObjectMeta struct { + // Map of string keys and values that can be used to organize and categorize + // (scope and select) objects. + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ + // +optional + Labels map[string]string `json:"labels,omitempty"` + + // Annotations is an unstructured key value map stored with a resource that may be + // set by external tools to store and retrieve arbitrary metadata. They are not + // queryable and should be preserved when modifying objects. + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + // +optional + Annotations map[string]string `json:"annotations,omitempty"` +} + // HelmChartTemplateSpec defines the template from which the controller will // generate a v1beta2.HelmChartSpec object. type HelmChartTemplateSpec struct { diff --git a/api/v2beta1/zz_generated.deepcopy.go b/api/v2beta1/zz_generated.deepcopy.go index 30dee88ee..252c475b3 100644 --- a/api/v2beta1/zz_generated.deepcopy.go +++ b/api/v2beta1/zz_generated.deepcopy.go @@ -47,6 +47,7 @@ func (in *CrossNamespaceObjectReference) DeepCopy() *CrossNamespaceObjectReferen // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HelmChartTemplate) DeepCopyInto(out *HelmChartTemplate) { *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) } @@ -60,6 +61,35 @@ func (in *HelmChartTemplate) DeepCopy() *HelmChartTemplate { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmChartTemplateObjectMeta) DeepCopyInto(out *HelmChartTemplateObjectMeta) { + *out = *in + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartTemplateObjectMeta. +func (in *HelmChartTemplateObjectMeta) DeepCopy() *HelmChartTemplateObjectMeta { + if in == nil { + return nil + } + out := new(HelmChartTemplateObjectMeta) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HelmChartTemplateSpec) DeepCopyInto(out *HelmChartTemplateSpec) { *out = *in diff --git a/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml b/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml index fd5d268f4..8e60df492 100644 --- a/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml +++ b/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml @@ -51,6 +51,27 @@ spec: description: Chart defines the template of the v1beta2.HelmChart that should be created for this HelmRelease. properties: + metadata: + description: ObjectMeta holds the template for metadata like labels + and annotations. + properties: + annotations: + additionalProperties: + type: string + description: 'Annotations is an unstructured key value map + stored with a resource that may be set by external tools + to store and retrieve arbitrary metadata. They are not queryable + and should be preserved when modifying objects. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/' + type: object + labels: + additionalProperties: + type: string + description: 'Map of string keys and values that can be used + to organize and categorize (scope and select) objects. More + info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/' + type: object + type: object spec: description: Spec holds the template for the v1beta2.HelmChartSpec for this HelmRelease. diff --git a/docs/api/helmrelease.md b/docs/api/helmrelease.md index 2f6277671..844aa2d14 100644 --- a/docs/api/helmrelease.md +++ b/docs/api/helmrelease.md @@ -457,6 +457,20 @@ v1beta2.Source.
metadataObjectMeta holds the template for metadata like labels and annotations.
+spec+(Appears on: +HelmChartTemplate) +
+HelmChartTemplateObjectMeta defines the template for the ObjectMeta of a +v1beta2.HelmChart.
+| Field | +Description | +
|---|---|
+labels+ +map[string]string + + |
+
+(Optional)
+ Map of string keys and values that can be used to organize and categorize +(scope and select) objects. +More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ + |
+
+annotations+ +map[string]string + + |
+
+(Optional)
+ Annotations is an unstructured key value map stored with a resource that may be +set by external tools to store and retrieve arbitrary metadata. They are not +queryable and should be preserved when modifying objects. +More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + |
+
diff --git a/docs/spec/v2beta1/helmreleases.md b/docs/spec/v2beta1/helmreleases.md
index 2fdc42095..8dfe39206 100644
--- a/docs/spec/v2beta1/helmreleases.md
+++ b/docs/spec/v2beta1/helmreleases.md
@@ -134,11 +134,32 @@ type KubeConfig struct {
// generate a v1beta1.HelmChart object in the same namespace as the referenced
// v1beta1.Source.
type HelmChartTemplate struct {
+ // ObjectMeta holds the template for metadata like labels and annotations.
+ // +optional
+ ObjectMeta HelmChartTemplateObjectMeta `json:"metadata,omitempty"`
+
// Spec holds the template for the v1beta1.HelmChartSpec for this HelmRelease.
// +required
Spec HelmChartTemplateSpec `json:"spec"`
}
+// HelmChartTemplateObjectMeta defines the template for the ObjectMeta of a
+// v1beta2.HelmChart.
+type HelmChartTemplateObjectMeta struct {
+ // Map of string keys and values that can be used to organize and categorize
+ // (scope and select) objects.
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
+ // +optional
+ Labels map[string]string `json:"labels,omitempty"`
+
+ // Annotations is an unstructured key value map stored with a resource that may be
+ // set by external tools to store and retrieve arbitrary metadata. They are not
+ // queryable and should be preserved when modifying objects.
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
+ // +optional
+ Annotations map[string]string `json:"annotations,omitempty"`
+}
+
// HelmChartTemplateSpec defines the template from which the controller will
// generate a v1beta1.HelmChartSpec object.
type HelmChartTemplateSpec struct {
@@ -681,7 +702,7 @@ of the `HelmRelease`. These can be overridden respectively via `spec.targetNames
## Helm chart template
-The `spec.chart.spec` values are used by the helm-controller as a template
+The `spec.chart` values are used by the helm-controller as a template
to create a new `HelmChart` resource with the given spec.
The `spec.chart.spec.sourceRef` is a reference to an object managed by
@@ -699,8 +720,8 @@ The `HelmChart` is created in the same namespace as the `sourceRef`,
with a name matching the `HelmRelease` `