diff --git a/charts/rancher/templates/post-delete-hook-cluster-role-binding.yaml b/charts/rancher/templates/post-delete-hook-cluster-role-binding.yaml deleted file mode 100644 index 476957b..0000000 --- a/charts/rancher/templates/post-delete-hook-cluster-role-binding.yaml +++ /dev/null @@ -1,19 +0,0 @@ -{{- if .Values.postDelete.enabled }} -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: {{ template "rancher.fullname" . }}-post-delete - labels: {{ include "rancher.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": post-delete - "helm.sh/hook-weight": "2" - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: {{ template "rancher.fullname" . }}-post-delete -subjects: - - kind: ServiceAccount - name: {{ template "rancher.fullname" . }}-post-delete - namespace: {{ .Release.Namespace }} -{{- end }} diff --git a/charts/rancher/templates/post-delete-hook-cluster-role.yaml b/charts/rancher/templates/post-delete-hook-cluster-role.yaml deleted file mode 100644 index 4e6b7d3..0000000 --- a/charts/rancher/templates/post-delete-hook-cluster-role.yaml +++ /dev/null @@ -1,39 +0,0 @@ -{{- if .Values.postDelete.enabled }} -kind: ClusterRole -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: {{ template "rancher.fullname" . }}-post-delete - labels: {{ include "rancher.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": post-delete - "helm.sh/hook-weight": "1" - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed -rules: - - apiGroups: [ "extensions","apps" ] - resources: [ "deployments" ] - verbs: [ "get", "list", "delete" ] - - apiGroups: [ "batch" ] - resources: [ "jobs" ] - verbs: [ "get", "list", "watch", "delete", "create" ] - - apiGroups: [ "rbac.authorization.k8s.io" ] - resources: [ "clusterroles", "clusterrolebindings", "roles", "rolebindings" ] - verbs: [ "get", "list", "delete", "create" ] - - apiGroups: [ "" ] - resources: [ "pods", "secrets", "services", "configmaps" ] - verbs: [ "get", "list", "delete" ] - - apiGroups: [ "" ] - resources: [ "serviceaccounts" ] - verbs: [ "get", "list", "delete", "create" ] - - apiGroups: [ "networking.k8s.io" ] - resources: [ "networkpolicies" ] - verbs: [ "get", "list", "delete" ] - - apiGroups: [ "admissionregistration.k8s.io" ] - resources: [ "validatingwebhookconfigurations", "mutatingwebhookconfigurations" ] - verbs: [ "get", "list", "delete" ] - - apiGroups: [ "networking.k8s.io" ] - resources: [ "ingresses" ] - verbs: [ "delete" ] - - apiGroups: [ "cert-manager.io" ] - resources: [ "issuers" ] - verbs: [ "delete" ] -{{- end }} diff --git a/charts/rancher/templates/post-delete-hook-config-map.yaml b/charts/rancher/templates/post-delete-hook-config-map.yaml deleted file mode 100644 index eb7b9e6..0000000 --- a/charts/rancher/templates/post-delete-hook-config-map.yaml +++ /dev/null @@ -1,15 +0,0 @@ -{{- if .Values.postDelete.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ template "rancher.fullname" . }}-post-delete - namespace: {{ .Release.Namespace }} - labels: {{ include "rancher.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": post-delete - "helm.sh/hook-weight": "1" - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed -data: - post-delete-hook.sh: |- -{{ $.Files.Get "scripts/post-delete-hook.sh" | indent 4 }} -{{- end }} diff --git a/charts/rancher/templates/post-delete-hook-job.yaml b/charts/rancher/templates/post-delete-hook-job.yaml deleted file mode 100644 index d90ca80..0000000 --- a/charts/rancher/templates/post-delete-hook-job.yaml +++ /dev/null @@ -1,46 +0,0 @@ -{{- if .Values.postDelete.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ template "rancher.fullname" . }}-post-delete - namespace: {{ .Release.Namespace }} - labels: {{ include "rancher.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": post-delete - "helm.sh/hook-weight": "3" - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded -spec: - backoffLimit: 3 - template: - metadata: - name: {{ template "rancher.fullname" . }}-post-delete - labels: {{ include "rancher.labels" . | nindent 8 }} - spec: - serviceAccountName: {{ template "rancher.fullname" . }}-post-delete - restartPolicy: OnFailure - containers: - - name: {{ template "rancher.name" . }}-post-delete - image: "{{ include "system_default_registry" . }}{{ .Values.postDelete.image.repository }}:{{ .Values.postDelete.image.tag }}" - imagePullPolicy: IfNotPresent - securityContext: - runAsUser: 0 - command: - - /scripts/post-delete-hook.sh - volumeMounts: - - mountPath: /scripts - name: config-volume - env: - - name: NAMESPACES - value: {{ .Values.postDelete.namespaceList | join " " | quote }} - - name: RANCHER_NAMESPACE - value: {{ .Release.Namespace }} - - name: TIMEOUT - value: {{ .Values.postDelete.timeout | quote }} - - name: IGNORETIMEOUTERROR - value: {{ .Values.postDelete.ignoreTimeoutError | quote }} - volumes: - - name: config-volume - configMap: - name: {{ template "rancher.fullname" . }}-post-delete - defaultMode: 0777 -{{- end }} diff --git a/charts/rancher/templates/post-delete-hook-service-account.yaml b/charts/rancher/templates/post-delete-hook-service-account.yaml deleted file mode 100644 index 923687d..0000000 --- a/charts/rancher/templates/post-delete-hook-service-account.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{{- if .Values.postDelete.enabled }} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ template "rancher.fullname" . }}-post-delete - namespace: {{ .Release.Namespace }} - labels: {{ include "rancher.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": post-delete - "helm.sh/hook-weight": "1" - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed -{{- end }} diff --git a/charts/rancher/templates/postdeleteHook/cleanup-tls-ca-job.yaml b/charts/rancher/templates/postdeleteHook/cleanup-tls-ca-job.yaml deleted file mode 100644 index 1d4cd48..0000000 --- a/charts/rancher/templates/postdeleteHook/cleanup-tls-ca-job.yaml +++ /dev/null @@ -1,41 +0,0 @@ -{{- if .Values.preinstallHook }} -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ template "rancher.fullname" . }}-cleanup-tls-ca-job - namespace: {{ .Release.Namespace }} - labels: {{ include "rancher.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": post-delete - "helm.sh/hook-weight": "3" - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded -spec: - backoffLimit: 3 - template: - metadata: - name: {{ template "rancher.fullname" . }}-cleanup-tls-ca - labels: {{ include "rancher.labels" . | nindent 8 }} - spec: - serviceAccountName: {{ template "rancher.fullname" . }}-cleanup-tls-ca-sa - restartPolicy: OnFailure - containers: - - name: {{ template "rancher.name" . }}-cleanup-tls-ca - image: "{{ include "system_default_registry" . }}{{ .Values.postDelete.image.repository }}:{{ .Values.postDelete.image.tag }}" - imagePullPolicy: IfNotPresent - securityContext: - runAsUser: 0 - command: - - /bin/sh - - -c - - | - #!/bin/bash - kd () { - if [ $(kubectl get $@ --ignore-not-found | wc -l) -eq 2 ];then - echo [INFO] delete $@ - kubectl delete $@ - fi - } - kd secret tls-ca -n {{ .Release.Namespace }} - kd certificate {{ .Values.ingress.tls.secretName }} -n {{ .Release.Namespace }} - kd secret {{ .Values.ingress.tls.secretName }} -n {{ .Release.Namespace }} -{{- end }} \ No newline at end of file diff --git a/charts/rancher/templates/postdeleteHook/role.yaml b/charts/rancher/templates/postdeleteHook/role.yaml deleted file mode 100644 index ba59f56..0000000 --- a/charts/rancher/templates/postdeleteHook/role.yaml +++ /dev/null @@ -1,18 +0,0 @@ -{{- if .Values.preinstallHook }} -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: {{ template "rancher.fullname" . }}-cleanup-tls-ca-role - labels: {{ include "rancher.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": post-delete - "helm.sh/hook-weight": "1" - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed -rules: - - apiGroups: [""] - resources: ["secrets"] - verbs: ["get", "list", "delete"] - - apiGroups: ["cert-manager.io"] - resources: ["certificates"] - verbs: ["get", "list", "delete"] -{{- end }} diff --git a/charts/rancher/templates/postdeleteHook/rolebinding.yaml b/charts/rancher/templates/postdeleteHook/rolebinding.yaml deleted file mode 100644 index f2eee73..0000000 --- a/charts/rancher/templates/postdeleteHook/rolebinding.yaml +++ /dev/null @@ -1,18 +0,0 @@ -{{- if .Values.preinstallHook }} -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: {{ template "rancher.fullname" . }}-cleanup-tls-ca-rolebinding - labels: {{ include "rancher.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": post-delete - "helm.sh/hook-weight": "2" - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed -subjects: - - kind: ServiceAccount - name: {{ template "rancher.fullname" . }}-cleanup-tls-ca-sa - namespace: {{ .Release.Namespace }} -roleRef: - kind: Role - name: {{ template "rancher.fullname" . }}-cleanup-tls-ca-role -{{- end }} diff --git a/charts/rancher/templates/postdeleteHook/serviceaccount.yaml b/charts/rancher/templates/postdeleteHook/serviceaccount.yaml deleted file mode 100644 index 2742073..0000000 --- a/charts/rancher/templates/postdeleteHook/serviceaccount.yaml +++ /dev/null @@ -1,11 +0,0 @@ -{{- if .Values.preinstallHook }} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ template "rancher.fullname" . }}-cleanup-tls-ca-sa - labels: {{ include "rancher.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": post-delete - "helm.sh/hook-weight": "1" - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed -{{- end }}