|
| 1 | + |
| 2 | +{{- if and (not .Values.cdEnabled) .Values.rbac.create -}} |
| 3 | +apiVersion: v1 |
| 4 | +kind: ServiceAccount |
| 5 | +metadata: |
| 6 | + annotations: |
| 7 | + helm.sh/hook: post-delete |
| 8 | + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded |
| 9 | + helm.sh/hook-weight: "-20" |
| 10 | + labels: |
| 11 | + {{- include "newrelic.common.labels" . | nindent 4 }} |
| 12 | + name: {{ include "newrelic.common.naming.truncateToDNSWithSuffix" (dict "name" .Release.Name "suffix" "uninstall-job") }} |
| 13 | + namespace: {{ .Release.Namespace }} |
| 14 | +--- |
| 15 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 16 | +kind: ClusterRole |
| 17 | +metadata: |
| 18 | + annotations: |
| 19 | + helm.sh/hook: post-delete |
| 20 | + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded |
| 21 | + helm.sh/hook-weight: "-20" |
| 22 | + labels: |
| 23 | + {{- include "newrelic.common.labels" . | nindent 4 }} |
| 24 | + name: {{ include "newrelic.common.naming.truncateToDNSWithSuffix" (dict "name" (include "newrelic.common.naming.fullname" .) "suffix" "uninstall-job-resources") }} |
| 25 | +rules: |
| 26 | + - apiGroups: [ "" ] |
| 27 | + resources: [ "namespaces" ] |
| 28 | + verbs: |
| 29 | + - get |
| 30 | + - apiGroups: [ "" ] |
| 31 | + resources: [ "configmaps" ] |
| 32 | + verbs: |
| 33 | + - get |
| 34 | + - list |
| 35 | + - watch |
| 36 | + - delete |
| 37 | + - deletecollection |
| 38 | +--- |
| 39 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 40 | +kind: RoleBinding |
| 41 | +metadata: |
| 42 | + annotations: |
| 43 | + helm.sh/hook: post-delete |
| 44 | + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded |
| 45 | + helm.sh/hook-weight: "-20" |
| 46 | + labels: |
| 47 | + {{- include "newrelic.common.labels" . | nindent 4 }} |
| 48 | + name: {{ include "newrelic.common.naming.truncateToDNSWithSuffix" (dict "name" (include "newrelic.common.naming.fullname" .) "suffix" "uninstall-job") }} |
| 49 | + namespace: {{ .Release.Namespace }} |
| 50 | +roleRef: |
| 51 | + apiGroup: rbac.authorization.k8s.io |
| 52 | + kind: ClusterRole |
| 53 | + name: {{ include "newrelic.common.naming.truncateToDNSWithSuffix" (dict "name" (include "newrelic.common.naming.fullname" .) "suffix" "uninstall-job-resources") }} |
| 54 | +subjects: |
| 55 | + - kind: ServiceAccount |
| 56 | + name: {{ include "newrelic.common.naming.truncateToDNSWithSuffix" (dict "name" .Release.Name "suffix" "uninstall-job") }} |
| 57 | + namespace: {{ .Release.Namespace }} |
| 58 | +--- |
| 59 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 60 | +kind: RoleBinding |
| 61 | +metadata: |
| 62 | + annotations: |
| 63 | + helm.sh/hook: post-delete |
| 64 | + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded |
| 65 | + helm.sh/hook-weight: "-20" |
| 66 | + labels: |
| 67 | + {{- include "newrelic.common.labels" . | nindent 4 }} |
| 68 | + name: {{ include "newrelic.common.naming.truncateToDNSWithSuffix" (dict "name" (include "newrelic.common.naming.fullname" .) "suffix" "uninstall-job-agents") }} |
| 69 | + namespace: {{ .Values.subAgentsNamespace }} |
| 70 | +roleRef: |
| 71 | + apiGroup: rbac.authorization.k8s.io |
| 72 | + kind: ClusterRole |
| 73 | + name: {{ include "newrelic.common.naming.truncateToDNSWithSuffix" (dict "name" (include "newrelic.common.naming.fullname" .) "suffix" "uninstall-job-resources") }} |
| 74 | +subjects: |
| 75 | + - kind: ServiceAccount |
| 76 | + name: {{ include "newrelic.common.naming.truncateToDNSWithSuffix" (dict "name" .Release.Name "suffix" "uninstall-job") }} |
| 77 | + namespace: {{ .Release.Namespace }} |
| 78 | +{{- end }} |
0 commit comments