123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- {{- if .Values.extensions.cache.enabled }}
- ---
- apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: {{ .Release.Name }}-extensions-cache
- namespace: {{ .Release.Namespace }}
- {{- if or .Values.serviceAccount.repoCredentials .Values.imagePullSecrets }}
- imagePullSecrets:
- {{- with .Values.serviceAccount.repoCredentials }}
- {{- range . }}
- - name: {{ . }}
- {{- end }}
- {{- end }}
- {{- with .Values.imagePullSecrets }}
- {{ . | toYaml }}
- {{- end }}
- {{- end }}
- {{- $allowedNamespaces := regexSplit " " (include "allowedNamespaces" .) -1 }}
- {{- range $index, $namespace := $allowedNamespaces }}
- {{- if eq $namespace "_all_namespaces_placeholder" }}
- ---
- apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: {{ $.Release.Name }}-extensions-cache
- {{- with $.Values.clusterOwnerRefereces }}
- ownerReferences:
- {{- toYaml . | nindent 4 }}
- {{- end }}
- {{- else }}
- ---
- apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- namespace: {{ $namespace }}
- name: {{ $.Release.Name }}-extensions-cache
- {{- end }}
- rules:
- - apiGroups: ["stackgres.io"]
- resources:
- - sgclusters
- - sgdistributedlogs
- verbs:
- - list
- - get
- {{- end }}
- {{- range $index, $namespace := $allowedNamespaces }}
- {{- if eq $namespace "_all_namespaces_placeholder" }}
- ---
- apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: {{ $.Release.Name }}-extensions-cache
- {{- with $.Values.clusterOwnerRefereces }}
- ownerReferences:
- {{- toYaml . | nindent 4 }}
- {{- end }}
- subjects:
- - kind: ServiceAccount
- name: {{ $.Release.Name }}-extensions-cache
- namespace: {{ $.Release.Namespace }}
- roleRef:
- kind: ClusterRole
- name: {{ $.Release.Name }}-extensions-cache
- apiGroup: rbac.authorization.k8s.io
- {{- else }}
- ---
- apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- namespace: {{ $namespace }}
- name: {{ $.Release.Name }}-extensions-cache
- subjects:
- - kind: ServiceAccount
- name: {{ $.Release.Name }}-extensions-cache
- namespace: {{ $.Release.Namespace }}
- roleRef:
- kind: Role
- name: {{ $.Release.Name }}-extensions-cache
- apiGroup: rbac.authorization.k8s.io
- {{- end }}
- {{- end }}
- ---
- apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- namespace: {{ .Release.Namespace }}
- name: {{ .Release.Name }}-extensions-cache-extra
- rules:
- - apiGroups: ["", "apps"]
- resources:
- - serviceaccounts
- - statefulsets
- verbs:
- - get
- - patch
- - update
- resourceNames:
- - {{ .Release.Name }}-extensions-cache
- - apiGroups: [""]
- resources:
- - pods
- verbs:
- - delete
- resourceNames:
- - {{ .Release.Name }}-extensions-cache-0
- ---
- apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- namespace: {{ .Release.Namespace }}
- name: {{ .Release.Name }}-extensions-cache-extra
- subjects:
- - kind: ServiceAccount
- name: {{ .Release.Name }}-extensions-cache
- namespace: {{ .Release.Namespace }}
- roleRef:
- kind: Role
- name: {{ .Release.Name }}-extensions-cache-extra
- apiGroup: rbac.authorization.k8s.io
- {{- end }}
|