Skip to content

Commit b176b8f

Browse files
committed
Add leader election role binding to the helm chart.
1 parent afa369b commit b176b8f

4 files changed

Lines changed: 97 additions & 3 deletions

File tree

hack/release/artifacts/create_artifacts.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ echo "Setting up Solr Operator ${VERSION} release artifacts at '${ARTIFACTS_DIR}
9191
for artifact in $(find * -type f -maxdepth 0 ! \( -name '*.asc' -o -name '*.sha512' -o -name '*.prov' \) ); do
9292
echo "Signing ${artifact_directory}/${artifact}"
9393
if [ ! -f "${artifact}.asc" ]; then
94-
gpg "${GPG_USER[@]}" --pinentry-mode loopback -ab "${artifact}"
94+
gpg "${GPG_USER[@]}" -ab "${artifact}"
9595
fi
9696
if [ ! -f "${artifact}.sha512" ]; then
9797
sha512sum -b "${artifact}" > "${artifact}.sha512"
@@ -103,7 +103,7 @@ echo "Setting up Solr Operator ${VERSION} release artifacts at '${ARTIFACTS_DIR}
103103
for artifact in $(find * -type f -maxdepth 0 ! \( -name '*.asc' -o -name '*.sha512' -o -name '*.prov' \) ); do
104104
echo "Signing ${artifact}"
105105
if [ ! -f "${artifact}.asc" ]; then
106-
gpg "${GPG_USER[@]}" --pinentry-mode loopback -ab "${artifact}"
106+
gpg "${GPG_USER[@]}" -ab "${artifact}"
107107
fi
108108
if [ ! -f "${artifact}.sha512" ]; then
109109
sha512sum -b "${artifact}" > "${artifact}.sha512"

helm/solr-operator/templates/deployment.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ spec:
7171
{{- if .Values.metrics.enable }}
7272
- "--metrics-bind-address=:8080"
7373
{{- end }}
74-
{{- if not .Values.leaderElection.enable }}
74+
{{- if .Values.leaderElection.enable }}
75+
- "--leader-elect=true"
76+
{{- else }}
7577
- "--leader-elect=false"
7678
{{- end }}
7779

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
{{- if .Values.leaderElection.enable }}
17+
{{- range $namespace := (split "," (include "solr-operator.watchNamespaces" $)) }}
18+
---
19+
# permissions to do leader election.
20+
apiVersion: rbac.authorization.k8s.io/v1
21+
kind: Role
22+
metadata:
23+
name: {{ include "solr-operator.fullname" $ }}-leader-election-role
24+
namespace: {{ $namespace }}
25+
rules:
26+
- apiGroups:
27+
- ""
28+
resources:
29+
- configmaps
30+
verbs:
31+
- get
32+
- list
33+
- watch
34+
- create
35+
- update
36+
- patch
37+
- delete
38+
- apiGroups:
39+
- coordination.k8s.io
40+
resources:
41+
- leases
42+
verbs:
43+
- get
44+
- list
45+
- watch
46+
- create
47+
- update
48+
- patch
49+
- delete
50+
- apiGroups:
51+
- ""
52+
resources:
53+
- events
54+
verbs:
55+
- create
56+
- patch
57+
58+
{{- end }}
59+
{{- end }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
{{- if .Values.leaderElection.enable }}
17+
{{- range $namespace := (split "," (include "solr-operator.watchNamespaces" $)) }}
18+
apiVersion: rbac.authorization.k8s.io/v1
19+
kind: RoleBinding
20+
metadata:
21+
name: {{ include "solr-operator.fullname" $ }}-leader-election-rolebinding
22+
namespace: {{ $namespace }}
23+
roleRef:
24+
apiGroup: rbac.authorization.k8s.io
25+
kind: Role
26+
name: {{ include "solr-operator.fullname" $ }}-leader-election-role
27+
subjects:
28+
- kind: ServiceAccount
29+
name: {{ include "solr-operator.serviceAccountName" $ }}
30+
namespace: {{ $.Release.Namespace }}
31+
32+
{{- end }}
33+
{{- end }}

0 commit comments

Comments
 (0)