Skip to content

Commit

Permalink
refactor: generate old deployment manifest from chart
Browse files Browse the repository at this point in the history
  • Loading branch information
apricote committed Sep 14, 2023
1 parent 79c01ce commit 2fed332
Show file tree
Hide file tree
Showing 20 changed files with 427 additions and 654 deletions.
30 changes: 22 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,29 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Verify manifests are up to date
run: |
kustomize build deploy/kubernetes > /tmp/hcloud-csi.yml
# Workaround for kustomize stripping all comments. This comment is
# needed to automatically bump the referenced container tag through
# release-please
sed -i '/hetznercloud\/hcloud-csi-driver/ s/$/ # x-release-please-version/' /tmp/hcloud-csi.yml
diff deploy/kubernetes/hcloud-csi.yml /tmp/hcloud-csi.yml
- name: Run tests
run: |
go vet ./...
go test $(go list ./... | grep -v e2e) -v
deploy-manifests:
name: Check deployment manifests
runs-on: ubuntu-latest
steps:
- uses: yokawasa/action-setup-kube-tools@v0.9.3
with:
setup-tools: |
helm
helm: v3.11.2

- uses: actions/checkout@v4
- name: Generate manifests from helm chart
run: hack/update-deployment-yamls.sh

- name: Check for diff
run: git diff --exit-code -- deploy/

- name: Show warning
if: ${{ failure() }}
run: echo "::error title=Deployment Manifests outdated::Please run hack/update-deployment-yamls.sh and commit the changes to deploy/"
8 changes: 7 additions & 1 deletion chart/templates/controller/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: controller
app: hcloud-csi-controller # Compatibility with old manifests
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
Expand All @@ -19,8 +20,13 @@ spec:
strategy: {{- toYaml .Values.controller.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
matchLabels:
{{- if .Values.controller.matchLabelsOverride }}
{{- toYaml .Values.controller.matchLabelsOverride | nindent 6 }}
{{- else }}
{{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: controller
{{- end }}
template:
metadata:
{{- if .Values.controller.podAnnotations }}
Expand Down
8 changes: 7 additions & 1 deletion chart/templates/node/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: node
app: hcloud-csi # Compatibility with old manifests
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
Expand All @@ -16,8 +17,13 @@ spec:
updateStrategy: {{- toYaml .Values.node.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
matchLabels:
{{- if .Values.node.matchLabelsOverride }}
{{- toYaml .Values.node.matchLabelsOverride | nindent 6 }}
{{- else }}
{{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: node
{{- end }}
template:
metadata:
{{- if .Values.node.podAnnotations }}
Expand Down
10 changes: 10 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,11 @@ controller:
##
podLabels: {}

## @param controller.matchLabelsOverride Override the default spec.selector.matchLabels. Added for backwards compatibility with the static manifests.
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#label-selector-updates
##
# matchLabelsOverride: null

## @param controller.podAnnotations Annotations for controller pods
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
##
Expand Down Expand Up @@ -567,6 +572,11 @@ node:
##
podLabels: {}

## @param node.matchLabelsOverride Override the default spec.selector.matchLabels. Added for backwards compatibility with the static manifests.
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/#pod-selector
##
# matchLabelsOverride: {}

## @param node.podAnnotations Annotations for node pods
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
##
Expand Down
84 changes: 0 additions & 84 deletions deploy/kubernetes/controller/deployment.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions deploy/kubernetes/controller/kustomization.yaml

This file was deleted.

73 changes: 0 additions & 73 deletions deploy/kubernetes/controller/rbac.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions deploy/kubernetes/controller/service.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions deploy/kubernetes/core/csidriver.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions deploy/kubernetes/core/kustomization.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions deploy/kubernetes/core/storageclass.yaml

This file was deleted.

Loading

0 comments on commit 2fed332

Please sign in to comment.