diff --git a/.github/workflows/zz_generated.diff_helm_render_templates.yaml b/.github/workflows/zz_generated.diff_helm_render_templates.yaml index c996ebf6b..454e03ead 100644 --- a/.github/workflows/zz_generated.diff_helm_render_templates.yaml +++ b/.github/workflows/zz_generated.diff_helm_render_templates.yaml @@ -44,12 +44,32 @@ jobs: echo "values=[\"$(ls -m helm/${{ github.event.repository.name }}/ci/test-*-values.yaml | tr -d ' \n' | sed 's/,/\", \"/g')\"]" >> $GITHUB_OUTPUT outputs: values: ${{ steps.get-rendering-values.outputs.values }} + get-old-rendering-values: + needs: check-cmp-state + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' && needs.check-cmp-state.outputs.suspendcmp == 0 + steps: + - uses: actions/checkout@v4 + with: + ref: "${{ github.event.repository.default_branch }}" + path: 'old' + - name: list old rendering values + id: get-old-rendering-values + run: | + echo "values=[\"$(ls -m old/helm/${{ github.event.repository.name }}/ci/test-*-values.yaml | tr -d ' \n' | sed 's/,/\", \"/g')\"]" + echo + echo "values=[\"$(ls -m old/helm/${{ github.event.repository.name }}/ci/test-*-values.yaml | tr -d ' \n' | sed 's/,/\", \"/g')\"]" >> $GITHUB_OUTPUT + outputs: + values: ${{ steps.get-old-rendering-values.outputs.values }} cmp-helm-rendering: - needs: get-rendering-values + needs: + - get-rendering-values + - get-old-rendering-values runs-on: ubuntu-latest strategy: matrix: values: ${{ fromJson(needs.get-rendering-values.outputs.values) }} + oldValues: ${{ fromJson(needs.get-old-rendering-values.outputs.values) }} if: github.event_name == 'pull_request' steps: - name: install helm @@ -90,15 +110,16 @@ jobs: path: 'old' - name: render helm with main branch code run: | + mkdir -p /tmp/${{ matrix.oldValues }} # TODO split files by "API"_"KIND"_"NAMESPACE|clusterwide"_"NAME" helm dependency build old/helm/${{ github.event.repository.name }} - helm template -n org-giantswarm -f "old/helm/${{ github.event.repository.name }}/ci/ci-values.yaml" -f "${{ matrix.values }}" "old/helm/${{ github.event.repository.name }}" > /tmp/${{ matrix.values }}/render-old.yaml + helm template -n org-giantswarm -f "old/helm/${{ github.event.repository.name }}/ci/ci-values.yaml" -f "${{ matrix.oldValues }}" "old/helm/${{ github.event.repository.name }}" > /tmp/${{ matrix.oldValues }}/render-old.yaml - name: get the diffs uses: mathiasvr/command-output@v1 id: diff with: run: | - dyff between -s -i -b -g /tmp/${{ matrix.values }}/render-old.yaml /tmp/${{ matrix.values }}/render-new.yaml && echo "No diff detected" || if [[ $? -eq 255 ]]; then echo "Diff error"; fi; + dyff between -s -i -b -g /tmp/${{ matrix.oldValues }}/render-old.yaml /tmp/${{ matrix.values }}/render-new.yaml && echo "No diff detected" || if [[ $? -eq 255 ]]; then echo "Diff error"; fi; - name: Find diff comment uses: peter-evans/find-comment@v2 continue-on-error: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c31d0be9..5b90096f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### **Breaking change** + +- Move Helm values property `.Values.metadata` to `.Values.global.metadata`. + ### Added - Expose value to configure launch template overrides, used to override the instance type specified by the launch template with multiple instance types that can be used to launch instances. diff --git a/helm/cluster-aws/README.md b/helm/cluster-aws/README.md index cbdeb0c17..c8d009231 100644 --- a/helm/cluster-aws/README.md +++ b/helm/cluster-aws/README.md @@ -195,17 +195,11 @@ Properties within the `.global.metadata` object | **Property** | **Description** | **More Details** | | :----------- | :-------------- | :--------------- | +| `global.metadata.description` | **Cluster description** - User-friendly description of the cluster's purpose.|**Type:** `string`
| +| `global.metadata.name` | **Cluster name** - Unique identifier, cannot be changed after creation.|**Type:** `string`
| +| `global.metadata.organization` | **Organization**|**Type:** `string`
| | `global.metadata.preventDeletion` | **Prevent cluster deletion**|**Type:** `boolean`
**Default:** `false`| - -### Metadata -Properties within the `.metadata` top-level object - -| **Property** | **Description** | **More Details** | -| :----------- | :-------------- | :--------------- | -| `metadata.description` | **Cluster description** - User-friendly description of the cluster's purpose.|**Type:** `string`
| -| `metadata.name` | **Cluster name** - Unique identifier, cannot be changed after creation.|**Type:** `string`
| -| `metadata.organization` | **Organization**|**Type:** `string`
| -| `metadata.servicePriority` | **Service priority** - The relative importance of this cluster.|**Type:** `string`
**Default:** `"highest"`| +| `global.metadata.servicePriority` | **Service priority** - The relative importance of this cluster.|**Type:** `string`
**Default:** `"highest"`| ### Node pools Properties within the `.nodePools` top-level object diff --git a/helm/cluster-aws/ci/ci-values.yaml b/helm/cluster-aws/ci/ci-values.yaml index 53cbb5dae..0b5b34a29 100644 --- a/helm/cluster-aws/ci/ci-values.yaml +++ b/helm/cluster-aws/ci/ci-values.yaml @@ -1,5 +1,6 @@ -metadata: - organization: "test" +global: + metadata: + organization: "test" baseDomain: example.com connectivity: diff --git a/helm/cluster-aws/ci/test-mc-proxy.yaml b/helm/cluster-aws/ci/test-mc-proxy.yaml index c478d93fe..c83479395 100644 --- a/helm/cluster-aws/ci/test-mc-proxy.yaml +++ b/helm/cluster-aws/ci/test-mc-proxy.yaml @@ -1,7 +1,8 @@ -metadata: - name: test-mc-proxy - organization: test - servicePriority: lowest +global: + metadata: + name: test-mc-proxy + organization: test + servicePriority: lowest baseDomain: example.com connectivity: proxy: diff --git a/helm/cluster-aws/ci/test-spot-instances.yaml b/helm/cluster-aws/ci/test-spot-instances.yaml index 3994f8d52..5df39d0d4 100644 --- a/helm/cluster-aws/ci/test-spot-instances.yaml +++ b/helm/cluster-aws/ci/test-spot-instances.yaml @@ -1,7 +1,8 @@ -metadata: - name: test-wc-minimal - organization: test - servicePriority: lowest +global: + metadata: + name: test-wc-minimal + organization: test + servicePriority: lowest baseDomain: example.com nodePools: pool0: diff --git a/helm/cluster-aws/ci/test-wc-minimal-values.yaml b/helm/cluster-aws/ci/test-wc-minimal-values.yaml index ee169049e..bc04cea78 100644 --- a/helm/cluster-aws/ci/test-wc-minimal-values.yaml +++ b/helm/cluster-aws/ci/test-wc-minimal-values.yaml @@ -1,5 +1,6 @@ -metadata: - name: test-wc-minimal - organization: test - servicePriority: lowest +global: + metadata: + name: test-wc-minimal + organization: test + servicePriority: lowest baseDomain: example.com diff --git a/helm/cluster-aws/templates/_cluster.tpl b/helm/cluster-aws/templates/_cluster.tpl index f5c83c8ef..a1327f0e3 100644 --- a/helm/cluster-aws/templates/_cluster.tpl +++ b/helm/cluster-aws/templates/_cluster.tpl @@ -3,7 +3,7 @@ apiVersion: cluster.x-k8s.io/v1beta1 kind: Cluster metadata: annotations: - {{- with .Values.metadata.description }} + {{- with .Values.global.metadata.description }} cluster.giantswarm.io/description: "{{ . }}" {{- end }} network-topology.giantswarm.io/mode: "{{ .Values.connectivity.topology.mode }}" @@ -15,8 +15,8 @@ metadata: {{- end }} labels: cluster-apps-operator.giantswarm.io/watching: "" - {{- if .Values.metadata.servicePriority }} - giantswarm.io/service-priority: {{ .Values.metadata.servicePriority }} + {{- if .Values.global.metadata.servicePriority }} + giantswarm.io/service-priority: {{ .Values.global.metadata.servicePriority }} {{- end }} {{- include "labels.common" $ | nindent 4 }} {{- include "preventDeletionLabel" $ | nindent 4 -}} diff --git a/helm/cluster-aws/templates/_helpers.tpl b/helm/cluster-aws/templates/_helpers.tpl index 5b40b17a9..8df6f9a44 100644 --- a/helm/cluster-aws/templates/_helpers.tpl +++ b/helm/cluster-aws/templates/_helpers.tpl @@ -31,7 +31,7 @@ app: {{ include "name" . | quote }} app.kubernetes.io/managed-by: {{ .Release.Service | quote }} cluster.x-k8s.io/cluster-name: {{ include "resource.default.name" . | quote }} giantswarm.io/cluster: {{ include "resource.default.name" . | quote }} -giantswarm.io/organization: {{ required "You must provide an existing organization name in .metadata.organization" .Values.metadata.organization | quote }} +giantswarm.io/organization: {{ required "You must provide an existing organization name in .global.metadata.organization" .Values.global.metadata.organization | quote }} cluster.x-k8s.io/watch-filter: capi {{- end -}} @@ -42,7 +42,7 @@ Given that Kubernetes allows 63 characters for resource names, the stem is trunc room for such suffix. */}} {{- define "resource.default.name" -}} -{{- .Values.metadata.name | default (.Release.Name | replace "." "-" | trunc 47 | trimSuffix "-") -}} +{{- .Values.global.metadata.name | default (.Release.Name | replace "." "-" | trunc 47 | trimSuffix "-") -}} {{- end -}} {{- define "controlPlaneFiles" -}} diff --git a/helm/cluster-aws/templates/aws-ebs-csi-driver-helmrelease.yaml b/helm/cluster-aws/templates/aws-ebs-csi-driver-helmrelease.yaml index 0e11131f3..5c272402d 100644 --- a/helm/cluster-aws/templates/aws-ebs-csi-driver-helmrelease.yaml +++ b/helm/cluster-aws/templates/aws-ebs-csi-driver-helmrelease.yaml @@ -4,7 +4,7 @@ metadata: name: {{ include "resource.default.name" $ }}-aws-ebs-csi-driver namespace: {{ $.Release.Namespace }} annotations: - cluster.giantswarm.io/description: "{{ .Values.metadata.description }}" + cluster.giantswarm.io/description: "{{ .Values.global.metadata.description }}" labels: cluster-apps-operator.giantswarm.io/watching: "" {{- include "labels.common" . | nindent 4 }} diff --git a/helm/cluster-aws/templates/cilium-helmrelease.yaml b/helm/cluster-aws/templates/cilium-helmrelease.yaml index 85a471276..cc1affba4 100644 --- a/helm/cluster-aws/templates/cilium-helmrelease.yaml +++ b/helm/cluster-aws/templates/cilium-helmrelease.yaml @@ -4,7 +4,7 @@ metadata: name: {{ include "resource.default.name" $ }}-cilium namespace: {{ $.Release.Namespace }} annotations: - cluster.giantswarm.io/description: "{{ .Values.metadata.description }}" + cluster.giantswarm.io/description: "{{ .Values.global.metadata.description }}" labels: {{- include "labels.common" . | nindent 4 }} spec: diff --git a/helm/cluster-aws/templates/cloud-provider-aws-helmrelease.yaml b/helm/cluster-aws/templates/cloud-provider-aws-helmrelease.yaml index 10b3173f9..697fff7be 100644 --- a/helm/cluster-aws/templates/cloud-provider-aws-helmrelease.yaml +++ b/helm/cluster-aws/templates/cloud-provider-aws-helmrelease.yaml @@ -4,7 +4,7 @@ metadata: name: {{ include "resource.default.name" $ }}-cloud-provider-aws namespace: {{ $.Release.Namespace }} annotations: - cluster.giantswarm.io/description: "{{ .Values.metadata.description }}" + cluster.giantswarm.io/description: "{{ .Values.global.metadata.description }}" labels: cluster-apps-operator.giantswarm.io/watching: "" {{- include "labels.common" . | nindent 4 }} diff --git a/helm/cluster-aws/templates/coredns-helmrelease.yaml b/helm/cluster-aws/templates/coredns-helmrelease.yaml index 78e1d06fa..7b377f339 100644 --- a/helm/cluster-aws/templates/coredns-helmrelease.yaml +++ b/helm/cluster-aws/templates/coredns-helmrelease.yaml @@ -4,7 +4,7 @@ metadata: name: {{ include "resource.default.name" $ }}-coredns namespace: {{ $.Release.Namespace }} annotations: - cluster.giantswarm.io/description: "{{ .Values.metadata.description }}" + cluster.giantswarm.io/description: "{{ .Values.global.metadata.description }}" labels: {{- include "labels.common" . | nindent 4 }} spec: diff --git a/helm/cluster-aws/templates/default-helmrepository.yaml b/helm/cluster-aws/templates/default-helmrepository.yaml index 3164cfc6d..6852029ce 100644 --- a/helm/cluster-aws/templates/default-helmrepository.yaml +++ b/helm/cluster-aws/templates/default-helmrepository.yaml @@ -4,7 +4,7 @@ metadata: name: {{ include "resource.default.name" $ }}-default namespace: {{ $.Release.Namespace }} annotations: - cluster.giantswarm.io/description: "{{ .Values.metadata.description }}" + cluster.giantswarm.io/description: "{{ .Values.global.metadata.description }}" labels: {{- include "labels.common" . | nindent 4 }} spec: @@ -17,7 +17,7 @@ metadata: name: {{ include "resource.default.name" $ }}-default-test namespace: {{ $.Release.Namespace }} annotations: - cluster.giantswarm.io/description: "{{ .Values.metadata.description }}" + cluster.giantswarm.io/description: "{{ .Values.global.metadata.description }}" labels: {{- include "labels.common" . | nindent 4 }} spec: diff --git a/helm/cluster-aws/templates/vpa-crd-helmrelease.yaml b/helm/cluster-aws/templates/vpa-crd-helmrelease.yaml index 127ec3fa8..590a4fae9 100644 --- a/helm/cluster-aws/templates/vpa-crd-helmrelease.yaml +++ b/helm/cluster-aws/templates/vpa-crd-helmrelease.yaml @@ -4,7 +4,7 @@ metadata: name: {{ include "resource.default.name" $ }}-vertical-pod-autoscaler-crd namespace: {{ $.Release.Namespace }} annotations: - cluster.giantswarm.io/description: "{{ .Values.metadata.description }}" + cluster.giantswarm.io/description: "{{ .Values.global.metadata.description }}" labels: {{- include "labels.common" . | nindent 4 }} spec: diff --git a/helm/cluster-aws/values.schema.json b/helm/cluster-aws/values.schema.json index c82a54c8a..4280f50cb 100644 --- a/helm/cluster-aws/values.schema.json +++ b/helm/cluster-aws/values.schema.json @@ -700,8 +700,11 @@ }, "global": { "type": "object", - "title": "Global properties", + "title": "Global", "description": "Properties that are available to all charts and subcharts.", + "required": [ + "metadata" + ], "additionalProperties": true, "properties": { "metadata": { @@ -709,10 +712,36 @@ "title": "Metadata", "additionalProperties": true, "properties": { + "description": { + "type": "string", + "title": "Cluster description", + "description": "User-friendly description of the cluster's purpose." + }, + "name": { + "type": "string", + "title": "Cluster name", + "description": "Unique identifier, cannot be changed after creation." + }, + "organization": { + "type": "string", + "title": "Organization" + }, "preventDeletion": { "type": "boolean", "title": "Prevent cluster deletion", "default": false + }, + "servicePriority": { + "type": "string", + "title": "Service priority", + "description": "The relative importance of this cluster.", + "$comment": "Defined in https://github.com/giantswarm/rfc/tree/main/classify-cluster-priority", + "enum": [ + "highest", + "medium", + "lowest" + ], + "default": "highest" } } } @@ -912,38 +941,6 @@ "title": "Management cluster", "description": "Name of the Cluster API cluster managing this workload cluster." }, - "metadata": { - "type": "object", - "title": "Metadata", - "properties": { - "description": { - "type": "string", - "title": "Cluster description", - "description": "User-friendly description of the cluster's purpose." - }, - "name": { - "type": "string", - "title": "Cluster name", - "description": "Unique identifier, cannot be changed after creation." - }, - "organization": { - "type": "string", - "title": "Organization" - }, - "servicePriority": { - "type": "string", - "title": "Service priority", - "description": "The relative importance of this cluster.", - "$comment": "Defined in https://github.com/giantswarm/rfc/tree/main/classify-cluster-priority", - "enum": [ - "highest", - "medium", - "lowest" - ], - "default": "highest" - } - } - }, "nodePools": { "type": "object", "title": "Node pools", diff --git a/helm/cluster-aws/values.yaml b/helm/cluster-aws/values.yaml index 01396a633..8586f2700 100644 --- a/helm/cluster-aws/values.yaml +++ b/helm/cluster-aws/values.yaml @@ -59,6 +59,7 @@ controlPlane: global: metadata: preventDeletion: false + servicePriority: highest internal: cgroupsv1: false kubernetesVersion: 1.24.14 @@ -83,8 +84,6 @@ kubectlImage: name: giantswarm/kubectl registry: quay.io tag: 1.23.5 -metadata: - servicePriority: highest providerSpecific: awsClusterRoleIdentityName: default flatcarAwsAccount: "706635527432"