plugin-barman-cloud/helm/plugin-barman-cloud/templates/additional-rbac/leader_election.yaml
QuantumEnigmaa 4994a17ae8 Feature: create helm chart
Signed-off-by: QuantumEnigmaa <thibaud@giantswarm.io>
2025-05-28 11:03:21 +02:00

73 lines
1.7 KiB
YAML

#
# Copyright The CloudNativePG Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# permissions to do leader election.
{{- if .Values.rbac.additional.leaderElection.create }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
{{- include "plugin-barman-cloud.labels" . | nindent 4 }}
name: {{ include "plugin-barman-cloud.fullname" . }}-leader-election-role
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
{{- include "plugin-barman-cloud.labels" . | nindent 4 }}
name: {{ include "plugin-barman-cloud.fullname" . }}-leader-election-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "plugin-barman-cloud.fullname" . }}-leader-election-role
subjects:
- kind: ServiceAccount
name: {{ include "plugin-barman-cloud.serviceAccountName" . }}
namespace: {{ include "plugin-barman-cloud.namespace" . }}
{{- end }}