fix(common): reenable manifest manager and add deletion logic (#437)

**Description**
This PR reenables manifest manager by default and creates additional
toggles for both install and checks.

It also, more importantly, adds an option to delete resources created
using manifestmanager, a prerequisite for moving to building our own
operator helm-charts

**⚙️ Type of change**

- [x] ⚙️ Feature/App addition
- [x] 🪛 Bugfix
- [ ] ⚠️ 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-05-27 15:00:19 +02:00
committed by GitHub
parent 24f5d54271
commit ed4a40bb34
4 changed files with 25 additions and 2 deletions

View File

@@ -42,3 +42,10 @@ args:
operator:
register: true
manifestManager:
enabled: false
staging: false
install: false
check: false
delete: false

View File

@@ -15,4 +15,4 @@ maintainers:
name: common
sources: null
type: library
version: 12.10.2
version: 12.10.3

View File

@@ -83,11 +83,14 @@ spec:
{{- $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..."
@@ -102,6 +105,16 @@ spec:
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

View File

@@ -312,8 +312,11 @@ APPURL: ""
# -- Used to inject our own operator manifests into SCALE
manifestManager:
enabled: false
enabled: true
staging: false
install: true
check: true
delete: false
gluetunImage:
repository: tccr.io/truecharts/gluetun