feat: BREAKING-CHANGE Remove manifest-manager completely (#499)

**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?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ 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._
This commit is contained in:
Kjeld Schouten
2023-07-15 19:26:55 +02:00
committed by GitHub
parent 07d4558f5e
commit f8eca3ee95
5 changed files with 2 additions and 189 deletions

View File

@@ -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

View File

@@ -15,4 +15,4 @@ maintainers:
name: common
sources: null
type: library
version: 12.15.0
version: 13.0.0

View File

@@ -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 -}}

View File

@@ -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" . }}

View File

@@ -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