You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ho...@apache.org on 2021/11/10 22:30:48 UTC

[solr-operator] branch release-0.5 updated: Add leader election role binding to the helm chart.

This is an automated email from the ASF dual-hosted git repository.

houston pushed a commit to branch release-0.5
in repository https://gitbox.apache.org/repos/asf/solr-operator.git


The following commit(s) were added to refs/heads/release-0.5 by this push:
     new b176b8f  Add leader election role binding to the helm chart.
b176b8f is described below

commit b176b8f9def8e4886724f9b43eb2be23beafe467
Author: Houston Putman <ho...@apache.org>
AuthorDate: Wed Nov 10 17:29:51 2021 -0500

    Add leader election role binding to the helm chart.
---
 hack/release/artifacts/create_artifacts.sh         |  4 +-
 helm/solr-operator/templates/deployment.yaml       |  4 +-
 .../templates/leader_election_role.yaml            | 59 ++++++++++++++++++++++
 .../templates/leader_election_role_binding.yaml    | 33 ++++++++++++
 4 files changed, 97 insertions(+), 3 deletions(-)

diff --git a/hack/release/artifacts/create_artifacts.sh b/hack/release/artifacts/create_artifacts.sh
index f32892b..f9ce593 100755
--- a/hack/release/artifacts/create_artifacts.sh
+++ b/hack/release/artifacts/create_artifacts.sh
@@ -91,7 +91,7 @@ echo "Setting up Solr Operator ${VERSION} release artifacts at '${ARTIFACTS_DIR}
       for artifact in $(find * -type f -maxdepth 0 ! \( -name '*.asc' -o -name '*.sha512' -o -name '*.prov' \) ); do
         echo "Signing ${artifact_directory}/${artifact}"
         if [ ! -f "${artifact}.asc" ]; then
-          gpg "${GPG_USER[@]}" --pinentry-mode loopback -ab "${artifact}"
+          gpg "${GPG_USER[@]}" -ab "${artifact}"
         fi
         if [ ! -f "${artifact}.sha512" ]; then
           sha512sum -b "${artifact}" > "${artifact}.sha512"
@@ -103,7 +103,7 @@ echo "Setting up Solr Operator ${VERSION} release artifacts at '${ARTIFACTS_DIR}
   for artifact in $(find * -type f -maxdepth 0 ! \( -name '*.asc' -o -name '*.sha512' -o -name '*.prov' \) ); do
     echo "Signing ${artifact}"
     if [ ! -f "${artifact}.asc" ]; then
-      gpg "${GPG_USER[@]}" --pinentry-mode loopback -ab "${artifact}"
+      gpg "${GPG_USER[@]}" -ab "${artifact}"
     fi
     if [ ! -f "${artifact}.sha512" ]; then
       sha512sum -b "${artifact}" > "${artifact}.sha512"
diff --git a/helm/solr-operator/templates/deployment.yaml b/helm/solr-operator/templates/deployment.yaml
index ae6e8d3..777d62b 100644
--- a/helm/solr-operator/templates/deployment.yaml
+++ b/helm/solr-operator/templates/deployment.yaml
@@ -71,7 +71,9 @@ spec:
         {{- if .Values.metrics.enable }}
         - "--metrics-bind-address=:8080"
         {{- end }}
-        {{- if not .Values.leaderElection.enable }}
+        {{- if .Values.leaderElection.enable }}
+        - "--leader-elect=true"
+        {{- else }}
         - "--leader-elect=false"
         {{- end }}
 
diff --git a/helm/solr-operator/templates/leader_election_role.yaml b/helm/solr-operator/templates/leader_election_role.yaml
new file mode 100644
index 0000000..88b2b8b
--- /dev/null
+++ b/helm/solr-operator/templates/leader_election_role.yaml
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+{{- if .Values.leaderElection.enable }}
+{{- range $namespace := (split "," (include "solr-operator.watchNamespaces" $)) }}
+---
+# permissions to do leader election.
+apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
+metadata:
+  name: {{ include "solr-operator.fullname" $ }}-leader-election-role
+  namespace: {{ $namespace }}
+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
+
+{{- end }}
+{{- end }}
diff --git a/helm/solr-operator/templates/leader_election_role_binding.yaml b/helm/solr-operator/templates/leader_election_role_binding.yaml
new file mode 100644
index 0000000..81bf9fe
--- /dev/null
+++ b/helm/solr-operator/templates/leader_election_role_binding.yaml
@@ -0,0 +1,33 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+{{- if .Values.leaderElection.enable }}
+{{- range $namespace := (split "," (include "solr-operator.watchNamespaces" $)) }}
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+  name: {{ include "solr-operator.fullname" $ }}-leader-election-rolebinding
+  namespace: {{ $namespace }}
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: Role
+  name: {{ include "solr-operator.fullname" $ }}-leader-election-role
+subjects:
+  - kind: ServiceAccount
+    name: {{ include "solr-operator.serviceAccountName" $ }}
+    namespace: {{ $.Release.Namespace }}
+
+{{- end }}
+{{- end }}