From f8eca3ee95407b146c57e2a3b6ec8681a4e9ab9e Mon Sep 17 00:00:00 2001 From: Kjeld Schouten Date: Sat, 15 Jul 2023 19:26:55 +0200 Subject: [PATCH] feat: BREAKING-CHANGE Remove manifest-manager completely (#499) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** With the last operator being moved to a seperate chart, we can officially remove manifest-manager completely. Technically breaking, as this feature is removed and users now need to install the operators as seperate charts. Should not affect users much in practice, as we're already emploring them to move over. **โš™๏ธ Type of change** - [x] โš™๏ธ Feature/App addition - [ ] ๐Ÿช› Bugfix - [x] โš ๏ธ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] ๐Ÿ”ƒ Refactor of current code **๐Ÿงช How Has This Been Tested?** **๐Ÿ“ƒ Notes:** **โœ”๏ธ Checklist:** - [ ] โš–๏ธ My code follows the style guidelines of this project - [ ] ๐Ÿ‘€ I have performed a self-review of my own code - [ ] #๏ธโƒฃ I have commented my code, particularly in hard-to-understand areas - [ ] ๐Ÿ“„ I have made corresponding changes to the documentation - [ ] โš ๏ธ My changes generate no new warnings - [ ] ๐Ÿงช I have added tests to this description that prove my fix is effective or that my feature works - [ ] โฌ†๏ธ I increased versions for any altered app according to semantic versioning **โž• App addition** If this PR is an app addition please make sure you have done the following. - [ ] ๐Ÿชž I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] ๐Ÿ–ผ๏ธ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --- library/common-test/Chart.yaml | 2 +- library/common/Chart.yaml | 2 +- .../templates/lib/util/_manifest_manager.tpl | 176 ------------------ library/common/templates/loader/_init.tpl | 3 - library/common/values.yaml | 8 - 5 files changed, 2 insertions(+), 189 deletions(-) delete mode 100644 library/common/templates/lib/util/_manifest_manager.tpl diff --git a/library/common-test/Chart.yaml b/library/common-test/Chart.yaml index 3c22ff5a..4693fd66 100644 --- a/library/common-test/Chart.yaml +++ b/library/common-test/Chart.yaml @@ -3,7 +3,7 @@ appVersion: "" dependencies: - name: common repository: file://../common - version: ~12.15.0 + version: ~13.0.0 deprecated: false description: Helper chart to test different use cases of the common library home: https://github.com/truecharts/apps/tree/master/charts/library/common-test diff --git a/library/common/Chart.yaml b/library/common/Chart.yaml index 5b3e3aee..7d2578ac 100644 --- a/library/common/Chart.yaml +++ b/library/common/Chart.yaml @@ -15,4 +15,4 @@ maintainers: name: common sources: null type: library -version: 12.15.0 +version: 13.0.0 diff --git a/library/common/templates/lib/util/_manifest_manager.tpl b/library/common/templates/lib/util/_manifest_manager.tpl deleted file mode 100644 index e557c0d6..00000000 --- a/library/common/templates/lib/util/_manifest_manager.tpl +++ /dev/null @@ -1,176 +0,0 @@ -{{- define "tc.v1.common.lib.util.manifest.manage" -}} -{{- if .Values.manifestManager.enabled }} -{{- $fullName := include "tc.v1.common.lib.chart.names.fullname" . }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ $fullName }}-manifests - namespace: {{ .Release.Namespace }} - annotations: - "helm.sh/hook": pre-install, pre-upgrade - "helm.sh/hook-weight": "-6" - "helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation,hook-failed -spec: - template: - spec: - automountServiceAccountToken: true - serviceAccountName: {{ $fullName }}-manifests - dnsConfig: - options: - - name: ndots - value: "1" - containers: - - name: {{ $fullName }}-manifests - image: {{ .Values.kubectlImage.repository }}:{{ .Values.kubectlImage.tag }} - securityContext: - runAsUser: 568 - runAsGroup: 568 - readOnlyRootFilesystem: true - runAsNonRoot: true - allowPrivilegeEscalation: false - privileged: false - seccompProfile: - type: RuntimeDefault - capabilities: - add: [] - drop: - - ALL - resources: - requests: - cpu: 10m - memory: 50Mi - limits: - cpu: 4000m - memory: 8Gi - livenessProbe: - exec: - command: - - cat - - /tmp/healthy - initialDelaySeconds: 10 - failureThreshold: 60 - successThreshold: 1 - timeoutSeconds: 5 - periodSeconds: 10 - readinessProbe: - exec: - command: - - cat - - /tmp/healthy - initialDelaySeconds: 10 - failureThreshold: 60 - successThreshold: 2 - timeoutSeconds: 5 - periodSeconds: 10 - startupProbe: - exec: - command: - - cat - - /tmp/healthy - initialDelaySeconds: 10 - failureThreshold: 60 - successThreshold: 1 - timeoutSeconds: 2 - periodSeconds: 5 - command: - - "/bin/sh" - - "-c" - - | - /bin/sh <<'EOF' - touch /tmp/healthy - echo "Installing manifests..." - {{- $branch := "manifests" -}} - {{- $handleErr := "|| echo 'Job succeeded...'" -}} - {{- if .Values.manifestManager.staging -}} - {{- $branch = "staging" -}} - {{- $handleErr = "&& echo 'Job failed...'" -}} - {{- end }} - - {{- if .Values.manifestManager.install }} - kubectl apply --server-side --force-conflicts --grace-period 30 --v=4 -k https://github.com/truecharts/manifests/{{ $branch }} || \ - kubectl apply --server-side --force-conflicts --grace-period 30 -k https://github.com/truecharts/manifests/{{ $branch }} {{ $handleErr }} - - echo "Install finished..." - {{- end }} - - {{- if .Values.manifestManager.check }} - echo "Starting waits and checks..." - kubectl delete pod --field-selector=status.phase==Succeeded -n cnpg-system || echo "Delete of Completed Pods failed..." - kubectl delete pod --field-selector=status.phase==Failed -n cnpg-system || echo "Delete of Failed Pods failed..." - kubectl wait --namespace cnpg-system --for=condition=ready pod --selector=app.kubernetes.io/name=cloudnative-pg --timeout=60s || echo "metallb-system wait failed..." - - kubectl delete pod --field-selector=status.phase==Succeeded -n metallb-system || echo "Delete of Completed Pods failed..." - kubectl delete pod --field-selector=status.phase==Failed -n metallb-system || echo "Delete of Failed Pods failed..." - kubectl wait --namespace metallb-system --for=condition=ready pod --selector=app=metallb --timeout=60s || echo "metallb-system wait failed..." - - kubectl delete pod --field-selector=status.phase==Succeeded -n cert-manager || echo "Delete of Completed Pods failed..." - kubectl delete pod --field-selector=status.phase==Failed -n cert-manager || echo "Delete of Failed Pods failed..." - kubectl wait --namespace cert-manager --for=condition=ready pod --selector=app.kubernetes.io/instance=cert-manager --timeout=60s || echo "cert-manager wait failed..." - - cmctl check api --wait=1m || echo "cmctl wait failed..." - - echo "Checks finished..." - {{- end }} - - {{- if .Values.manifestManager.delete -}} - echo "Deleting manifests..." - kubectl delete --grace-period 30 --v=4 -k https://github.com/truecharts/manifests/delete && kubectl delete --grace-period 30 --v=4 -k https://github.com/truecharts/manifests/delete || \ - kubectl delete --force --grace-period 30 -k https://github.com/truecharts/manifests/delete {{ $handleErr }} - echo "Deletion finished..." - {{- end }} - EOF - volumeMounts: - - name: {{ $fullName }}-manifests-temp - mountPath: /tmp - - name: {{ $fullName }}-manifests-home - mountPath: /home/apps/ - restartPolicy: Never - volumes: - - name: {{ $fullName }}-manifests-temp - emptyDir: {} - - name: {{ $fullName }}-manifests-home - emptyDir: {} ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: {{ $fullName }}-manifests - annotations: - "helm.sh/hook": pre-install, pre-upgrade - "helm.sh/hook-weight": "-7" - "helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation,hook-failed -rules: - - apiGroups: ["*"] - resources: ["*"] - verbs: ["*"] ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: {{ $fullName }}-manifests - annotations: - "helm.sh/hook": pre-install, pre-upgrade - "helm.sh/hook-weight": "-7" - "helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation,hook-failed -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: {{ $fullName }}-manifests -subjects: - - kind: ServiceAccount - name: {{ $fullName }}-manifests - namespace: {{ .Release.Namespace }} ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ $fullName }}-manifests - namespace: {{ .Release.Namespace }} - annotations: - "helm.sh/hook": pre-install, pre-upgrade - "helm.sh/hook-weight": "-7" - "helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation,hook-failed -automountServiceAccountToken: false -{{- end }} -{{- end -}} diff --git a/library/common/templates/loader/_init.tpl b/library/common/templates/loader/_init.tpl index 9077208e..aff423a4 100644 --- a/library/common/templates/loader/_init.tpl +++ b/library/common/templates/loader/_init.tpl @@ -10,9 +10,6 @@ {{/* Ensure TrueCharts chart context information is available */}} {{- include "tc.v1.common.lib.util.chartcontext" . -}} - {{/* Add manifest manager pre-install and pre-update job */}} - {{- include "tc.v1.common.lib.util.manifest.manage" . | nindent 0 -}} - {{/* Autogenerate postgresql passwords if needed */}} {{- include "tc.v1.common.spawner.cnpg" . }} diff --git a/library/common/values.yaml b/library/common/values.yaml index 3b2fee9e..466ef006 100644 --- a/library/common/values.yaml +++ b/library/common/values.yaml @@ -313,14 +313,6 @@ portal: # -- Set by "open" portal, used for some applications internally. APPURL: "" -# -- Used to inject our own operator manifests into SCALE -manifestManager: - enabled: true - staging: false - install: true - check: true - delete: false - gluetunImage: repository: tccr.io/truecharts/gluetun tag: v3.35.0@sha256:d86c128a3b480b6de94c81928e1007390fc0722eb4be8cd087c5c292fbec7a5b