123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292 |
- {{- if and .Values.deploy.operator .Values.serviceAccount.create }}
- {{- $allowedNamespaces := regexSplit " " (include "allowedNamespaces" .) -1 }}
- {{- range $index, $namespace := $allowedNamespaces }}
- {{- if and (eq $index 0) (not $.Values.disableClusterRole) }}
- ---
- apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: {{ $.Release.Name }}
- {{- with $.Values.clusterOwnerRefereces }}
- ownerReferences:
- {{- toYaml . | nindent 4 }}
- {{- end }}
- rules:
- - apiGroups: [""]
- resources: ["namespaces"]
- verbs:
- - get
- - list
- - apiGroups: ["storage.k8s.io"]
- resources: ["storageclasses"]
- verbs:
- - get
- - list
- - apiGroups: ["apiextensions.k8s.io"]
- resources:
- - customresourcedefinitions
- resourceNames:
- - sgconfigs.stackgres.io
- - sgclusters.stackgres.io
- - sginstanceprofiles.stackgres.io
- - sgpgconfigs.stackgres.io
- - sgpoolconfigs.stackgres.io
- - sgbackups.stackgres.io
- - sgbackupconfigs.stackgres.io
- - sgobjectstorages.stackgres.io
- - sgdbops.stackgres.io
- - sgdistributedlogs.stackgres.io
- - sgshardedclusters.stackgres.io
- - sgshardedbackups.stackgres.io
- - sgshardeddbops.stackgres.io
- - sgscripts.stackgres.io
- - sgstreams.stackgres.io
- verbs:
- - get
- - apiGroups: ["apiextensions.k8s.io"]
- resources:
- - customresourcedefinitions
- verbs:
- - list
- {{- if not $.Values.disableCrdsAndWebhooksUpdate }}
- - apiGroups:
- - admissionregistration.k8s.io
- resources:
- - mutatingwebhookconfigurations
- - validatingwebhookconfigurations
- resourceNames:
- - {{ $.Release.Name }}
- verbs:
- - get
- - patch
- - apiGroups: ["apiextensions.k8s.io"]
- resources:
- - customresourcedefinitions
- verbs:
- - create
- - apiGroups: ["apiextensions.k8s.io"]
- resources:
- - customresourcedefinitions
- resourceNames:
- - sgconfigs.stackgres.io
- - sgclusters.stackgres.io
- - sginstanceprofiles.stackgres.io
- - sgpgconfigs.stackgres.io
- - sgpoolconfigs.stackgres.io
- - sgbackups.stackgres.io
- - sgbackupconfigs.stackgres.io
- - sgobjectstorages.stackgres.io
- - sgdbops.stackgres.io
- - sgdistributedlogs.stackgres.io
- - sgshardedclusters.stackgres.io
- - sgshardedbackups.stackgres.io
- - sgshardeddbops.stackgres.io
- - sgscripts.stackgres.io
- - sgstreams.stackgres.io
- verbs:
- - patch
- - update
- {{- end }}
- {{- if (or $.Values.collector.prometheusOperator.allowDiscovery (gt (len $.Values.collector.prometheusOperator.monitors) 0)) }}
- - apiGroups: ["apiextensions.k8s.io"]
- resources:
- - customresourcedefinitions
- resourceNames:
- - prometheuses.monitoring.coreos.com
- verbs:
- - get
- {{- end }}
- {{- if and $.Values.sgConfigNamespace (not (eq $.Values.sgConfigNamespace $.Release.Namespace)) }}
- - apiGroups: ["rbac.authorization.k8s.io"]
- resources:
- - clusterrolebindings
- verbs:
- - create
- - watch
- - list
- - get
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - users
- - groups
- verbs:
- - impersonate
- {{- end }}
- {{- end }}
- {{- if not (eq $namespace "_all_namespaces_placeholder") }}
- ---
- apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- namespace: {{ $namespace }}
- name: {{ $.Release.Name }}
- rules:
- {{- end }}
- - apiGroups: ["", "apps", "extensions", "rbac.authorization.k8s.io", "batch"]
- resources:
- - pods
- - pods/exec
- - pods/log
- - services
- - endpoints
- - endpoints/restricted
- - persistentvolumeclaims
- - configmaps
- - secrets
- - deployments
- - statefulsets
- - serviceaccounts
- - namespaces
- - roles
- - rolebindings
- - events
- - cronjobs
- - jobs
- verbs:
- - get
- - list
- - watch
- - update
- - create
- - delete
- - deletecollection
- - patch
- - apiGroups: ["stackgres.io"]
- resources:
- - sgclusters
- - sgpgconfigs
- - sginstanceprofiles
- - sgpoolconfigs
- - sgbackupconfigs
- - sgbackups
- - sgdistributedlogs
- - sgdbops
- - sgobjectstorages
- - sgscripts
- - sgshardedclusters
- - sgshardedbackups
- - sgshardeddbops
- - sgstreams
- - sgconfigs
- verbs:
- - create
- - watch
- - list
- - get
- - update
- - patch
- - delete
- - apiGroups: ["stackgres.io"]
- resources:
- - sgconfigs/status
- - sgclusters/status
- - sgdistributedlogs/status
- - sgclusters/finalizers
- - sgpgconfigs/finalizers
- - sginstanceprofiles/finalizers
- - sgpoolconfigs/finalizers
- - sgbackupconfigs/finalizers
- - sgbackups/finalizers
- - sgdistributedlogs/finalizers
- - sgdbops/finalizers
- - sgobjectstorages/finalizers
- - sgscripts/finalizers
- - sgshardedclusters/finalizers
- - sgshardedbackups/finalizers
- - sgshardeddbops/finalizers
- - sgstreams/finalizers
- - sgconfigs/finalizers
- verbs:
- - update
- - apiGroups: ["", "apps", "batch"]
- resources:
- - statefulsets/finalizers
- - persistentvolumeclaims/finalizers
- - deployments/finalizers
- - services/finalizers
- - endpoints/finalizers
- - cronjobs/finalizers
- - jobs/finalizers
- - pods/finalizers
- verbs:
- - update
- - apiGroups: ["snapshot.storage.k8s.io"]
- resources:
- - volumesnapshots
- verbs:
- - list
- - get
- - watch
- - create
- {{- if (or $.Values.collector.prometheusOperator.allowDiscovery (gt (len $.Values.collector.prometheusOperator.monitors) 0)) }}
- - apiGroups: ["monitoring.coreos.com"]
- resources:
- - servicemonitors
- - podmonitors
- verbs:
- - list
- - get
- - create
- - delete
- - update
- - patch
- - apiGroups: ["monitoring.coreos.com"]
- resources:
- - prometheus
- - prometheuses
- - podmonitors
- verbs:
- - list
- - get
- {{- end }}
- - apiGroups: ["shardingsphere.apache.org"]
- resources:
- - computenodes
- verbs:
- - get
- - list
- - watch
- - update
- - create
- - delete
- - patch
- - apiGroups: ["keda.sh"]
- resources:
- - scaledobjects
- - triggerauthentications
- verbs:
- - get
- - list
- - watch
- - update
- - create
- - delete
- - patch
- - apiGroups: ["autoscaling.k8s.io"]
- resources:
- - verticalpodautoscalers
- verbs:
- - get
- - list
- - watch
- - update
- - create
- - delete
- - patch
- - apiGroups: ["serving.knative.dev"]
- resources:
- - services
- verbs:
- - get
- - list
- - watch
- - update
- - create
- - delete
- - patch
- {{- end }}
- {{- end }}
|