apiVersion: v1 kind: ServiceAccount metadata: name: {{ include "eg.fullname" . }}-certgen namespace: '{{ .Release.Namespace }}' labels: {{- include "eg.labels" . | nindent 4 }} {{- if .Values.certgen.rbac.labels }} {{- toYaml .Values.certgen.rbac.labels | nindent 4 }} {{- end }} annotations: "helm.sh/hook": pre-install, pre-upgrade "helm.sh/hook-weight": "-1" # Ensure rbac is created before the certgen job when using ArgoCD. {{- if .Values.certgen.rbac.annotations }} {{- toYaml .Values.certgen.rbac.annotations | nindent 4 -}} {{- end }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: {{ include "eg.fullname" . }}-certgen namespace: '{{ .Release.Namespace }}' labels: {{- include "eg.labels" . | nindent 4 }} {{- if .Values.certgen.rbac.labels }} {{- toYaml .Values.certgen.rbac.labels | nindent 4 }} {{- end }} annotations: "helm.sh/hook": pre-install, pre-upgrade "helm.sh/hook-weight": "-1" # Ensure rbac is created before the certgen job when using ArgoCD. {{- if .Values.certgen.rbac.annotations }} {{- toYaml .Values.certgen.rbac.annotations | nindent 4 -}} {{- end }} rules: - apiGroups: - "" resources: - secrets verbs: - get - create - update --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: {{ include "eg.fullname" . }}-certgen namespace: '{{ .Release.Namespace }}' labels: {{- include "eg.labels" . | nindent 4 }} {{- if .Values.certgen.rbac.labels }} {{- toYaml .Values.certgen.rbac.labels | nindent 4 }} {{- end }} annotations: "helm.sh/hook": pre-install, pre-upgrade "helm.sh/hook-weight": "-1" # Ensure rbac is created before the certgen job when using ArgoCD. {{- if .Values.certgen.rbac.annotations }} {{- toYaml .Values.certgen.rbac.annotations | nindent 4 -}} {{- end }} roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: '{{ include "eg.fullname" . }}-certgen' subjects: - kind: ServiceAccount name: '{{ include "eg.fullname" . }}-certgen' namespace: '{{ .Release.Namespace }}' --- {{- if .Values.topologyInjector.enabled }} apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: '{{ include "eg.fullname" . }}-certgen:{{ .Release.Namespace }}' labels: {{- include "eg.labels" . | nindent 4 }} {{- if .Values.certgen.rbac.labels }} {{- toYaml .Values.certgen.rbac.labels | nindent 4 }} {{- end }} annotations: "helm.sh/hook": pre-install, pre-upgrade "helm.sh/hook-weight": "-1" # Ensure rbac is created before the certgen job when using ArgoCD. {{- if .Values.certgen.rbac.annotations }} {{- toYaml .Values.certgen.rbac.annotations | nindent 4 -}} {{- end }} rules: - apiGroups: - admissionregistration.k8s.io resources: - mutatingwebhookconfigurations verbs: - get - list - watch - apiGroups: - admissionregistration.k8s.io resources: - mutatingwebhookconfigurations resourceNames: - 'envoy-gateway-topology-injector.{{ .Release.Namespace }}' verbs: - update - patch --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: '{{ include "eg.fullname" . }}-certgen:{{ .Release.Namespace }}' labels: {{- include "eg.labels" . | nindent 4 }} {{- if .Values.certgen.rbac.labels }} {{- toYaml .Values.certgen.rbac.labels | nindent 4 }} {{- end }} annotations: "helm.sh/hook": pre-install, pre-upgrade "helm.sh/hook-weight": "-1" # Ensure rbac is created before the certgen job when using ArgoCD. {{- if .Values.certgen.rbac.annotations }} {{- toYaml .Values.certgen.rbac.annotations | nindent 4 -}} {{- end }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: '{{ include "eg.fullname" . }}-certgen:{{ .Release.Namespace }}' subjects: - kind: ServiceAccount name: '{{ include "eg.fullname" . }}-certgen' namespace: '{{ .Release.Namespace }}' {{- end }}