Merge "[operator] Add Receiver CustomResource"
diff --git a/container-images/gerrit-init/tools/gerrit-initializer/initializer/tasks/init.py b/container-images/gerrit-init/tools/gerrit-initializer/initializer/tasks/init.py
index 92ba2d0..df6878a 100755
--- a/container-images/gerrit-init/tools/gerrit-initializer/initializer/tasks/init.py
+++ b/container-images/gerrit-init/tools/gerrit-initializer/initializer/tasks/init.py
@@ -169,10 +169,17 @@
 
         if self.gerrit_config:
             LOG.info("Existing gerrit.config found.")
+            dev_option = (
+                "--dev"
+                if self.gerrit_config.get("auth.type").lower()
+                == "development_become_any_account"
+                else ""
+            )
         else:
             LOG.info("No gerrit.config found. Initializing default site.")
+            dev_option = "--dev"
 
-        flags = "--no-auto-start --batch"
+        flags = f"--no-auto-start --batch {dev_option}"
 
         command = f"java -jar /var/war/gerrit.war init {flags} -d {self.site}"
 
diff --git a/helm-charts/gerrit-replica/README.md b/helm-charts/gerrit-replica/README.md
index d87009e..5faee1e 100644
--- a/helm-charts/gerrit-replica/README.md
+++ b/helm-charts/gerrit-replica/README.md
@@ -382,6 +382,7 @@
 | | | podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.labelSelector.matchExpressions[0].operator: In |
 | | | podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.labelSelector.matchExpressions[0].values[0]: gerrit-replica |
 | `gerritReplica.replicas` | Number of pod replicas to deploy | `1` |
+| `gerritReplica.additionalAnnotations` | Additional annotations for the Pods | {} |
 | `gerritReplica.maxSurge` | Max. percentage or number of pods allowed to be scheduled above the desired number | `25%` |
 | `gerritReplica.maxUnavailable` | Max. percentage or number of pods allowed to be unavailable at a time | `100%` |
 | `gerritReplica.livenessProbe` | Configuration of the liveness probe timings | `{initialDelaySeconds: 60, periodSeconds: 5}` |
diff --git a/helm-charts/gerrit-replica/templates/gerrit-replica.stateful-set.yaml b/helm-charts/gerrit-replica/templates/gerrit-replica.stateful-set.yaml
index 77ed1b2..0c284dc 100644
--- a/helm-charts/gerrit-replica/templates/gerrit-replica.stateful-set.yaml
+++ b/helm-charts/gerrit-replica/templates/gerrit-replica.stateful-set.yaml
@@ -27,6 +27,9 @@
         release: {{ .Release.Name }}
       annotations:
         chartRevision: "{{ .Release.Revision }}"
+        {{- if .Values.gerritReplica.additionalAnnotations }}
+{{ toYaml .Values.gerritReplica.additionalAnnotations  | indent 8 }}
+        {{- end }}
     spec:
       {{- with .Values.gerritReplica.tolerations }}
       tolerations:
diff --git a/helm-charts/gerrit-replica/values.yaml b/helm-charts/gerrit-replica/values.yaml
index 5e6a307..ffce551 100644
--- a/helm-charts/gerrit-replica/values.yaml
+++ b/helm-charts/gerrit-replica/values.yaml
@@ -268,6 +268,7 @@
 
   replicas: 1
   updatePartition: 0
+  additionalAnnotations: {}
 
   livenessProbe:
     initialDelaySeconds: 60
diff --git a/helm-charts/gerrit/README.md b/helm-charts/gerrit/README.md
index 19dba27..778bb50 100644
--- a/helm-charts/gerrit/README.md
+++ b/helm-charts/gerrit/README.md
@@ -287,6 +287,7 @@
 
 | `gerrit.topologySpreadConstraints` | Control how Pods are spread across your cluster among failure-domains. For more information, please refer to the following documents. [Pod Topology Spread Constraints](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints) | {} |
 | `gerrit.affinity` | Assigns a Pod to the specified Nodes. For more information, please refer to the following documents. [Assign Pods to Nodes using Node Affinity](https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/). [Assigning Pods to Nodes](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/) | {} |
+| `gerrit.additionalAnnotations` | Additional annotations for the Pods | {} |
 | `gerrit.replicas` | Number of replica pods to deploy | `1` |
 | `gerrit.updatePartition` | Ordinal at which to start updating pods. Pods with a lower ordinal will not be updated. | `0` |
 | `gerrit.resources` | Configure the amount of resources the pod requests/is allowed | `requests.cpu: 1` |
diff --git a/helm-charts/gerrit/templates/gerrit.stateful-set.yaml b/helm-charts/gerrit/templates/gerrit.stateful-set.yaml
index e7b101f..33e4b84 100644
--- a/helm-charts/gerrit/templates/gerrit.stateful-set.yaml
+++ b/helm-charts/gerrit/templates/gerrit.stateful-set.yaml
@@ -27,6 +27,9 @@
         release: {{ .Release.Name }}
       annotations:
         chartRevision: "{{ .Release.Revision }}"
+        {{- if .Values.gerrit.additionalAnnotations }}
+{{ toYaml .Values.gerrit.additionalAnnotations  | indent 8 }}
+        {{- end }}
     spec:
       {{- with .Values.gerrit.tolerations }}
       tolerations:
diff --git a/helm-charts/gerrit/values.yaml b/helm-charts/gerrit/values.yaml
index 2365c9e..9432567 100644
--- a/helm-charts/gerrit/values.yaml
+++ b/helm-charts/gerrit/values.yaml
@@ -148,6 +148,7 @@
   tolerations: []
   topologySpreadConstraints: {}
   affinity: {}
+  additionalAnnotations: {}
 
   replicas: 1
   updatePartition: 0