aboutsummaryrefslogtreecommitdiffstats
path: root/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus-operator/templates/prometheus-operator/cleanup-crds.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'kud/tests/vnfs/comp-app/collection/app2/helm/prometheus-operator/templates/prometheus-operator/cleanup-crds.yaml')
-rwxr-xr-xkud/tests/vnfs/comp-app/collection/app2/helm/prometheus-operator/templates/prometheus-operator/cleanup-crds.yaml45
1 files changed, 45 insertions, 0 deletions
diff --git a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus-operator/templates/prometheus-operator/cleanup-crds.yaml b/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus-operator/templates/prometheus-operator/cleanup-crds.yaml
new file mode 100755
index 00000000..7329701f
--- /dev/null
+++ b/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus-operator/templates/prometheus-operator/cleanup-crds.yaml
@@ -0,0 +1,45 @@
+{{- if and .Values.prometheusOperator.enabled .Values.prometheusOperator.cleanupCustomResource }}
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: {{ template "prometheus-operator.fullname" . }}-operator-cleanup
+ namespace: {{ template "prometheus-operator.namespace" . }}
+ annotations:
+ "helm.sh/hook": pre-delete
+ "helm.sh/hook-weight": "3"
+ "helm.sh/hook-delete-policy": hook-succeeded
+ labels:
+ app: {{ template "prometheus-operator.name" . }}-operator
+{{ include "prometheus-operator.labels" . | indent 4 }}
+spec:
+ template:
+ metadata:
+ name: {{ template "prometheus-operator.fullname" . }}-operator-cleanup
+ labels:
+ app: {{ template "prometheus-operator.name" . }}-operator
+{{ include "prometheus-operator.labels" . | indent 8 }}
+ spec:
+ {{- if .Values.global.rbac.create }}
+ serviceAccountName: {{ template "prometheus-operator.operator.serviceAccountName" . }}
+ {{- end }}
+ containers:
+ - name: kubectl
+ image: "{{ .Values.prometheusOperator.hyperkubeImage.repository }}:{{ .Values.prometheusOperator.hyperkubeImage.tag }}"
+ imagePullPolicy: "{{ .Values.prometheusOperator.hyperkubeImage.pullPolicy }}"
+ command:
+ - /bin/sh
+ - -c
+ - >
+ kubectl delete alertmanager --all;
+ kubectl delete prometheus --all;
+ kubectl delete prometheusrule --all;
+ kubectl delete servicemonitor --all;
+ sleep 10;
+ kubectl delete crd alertmanagers.monitoring.coreos.com;
+ kubectl delete crd prometheuses.monitoring.coreos.com;
+ kubectl delete crd prometheusrules.monitoring.coreos.com;
+ kubectl delete crd servicemonitors.monitoring.coreos.com;
+ kubectl delete crd podmonitors.monitoring.coreos.com;
+ kubectl delete crd thanosrulers.monitoring.coreos.com;
+ restartPolicy: OnFailure
+{{- end }}