Skip to content

Commit 7bb5e4e

Browse files
authored
Make replicas optional (#393)
such that the default value of 1 will be used if not specified
1 parent e33d7a6 commit 7bb5e4e

File tree

5 files changed

+4
-4
lines changed

5 files changed

+4
-4
lines changed

api/v1beta1/rabbitmqcluster_types.go

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type RabbitmqCluster struct {
3838
// Spec is the desired state of the RabbitmqCluster Custom Resource.
3939
type RabbitmqClusterSpec struct {
4040
// Replicas is the number of nodes in the RabbitMQ cluster. Each node is deployed as a Replica in a StatefulSet. Only 1, 3, 5 replicas clusters are tested.
41+
// +optional
4142
// +kubebuilder:validation:Minimum:=0
4243
// +kubebuilder:default:=1
4344
Replicas *int32 `json:"replicas"`

bin/kubectl-rabbitmq

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ create() {
115115

116116
# special case when no options are provided
117117
if [[ "$#" -eq 0 ]]; then
118-
echo " replicas: 1" >>"$rabbitmq_manifest_file"
118+
echo " {}" >>"$rabbitmq_manifest_file"
119119
fi
120120

121121
while [[ "$#" -ne 0 ]]; do

charts/rabbitmq/expected-template-output

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ metadata:
2222
spec:
2323
image: rabbitmq:3.8.1
2424
imagePullSecret: foo
25-
2625
replicas: 3
2726
service:
2827
type: LoadBalancer

charts/rabbitmq/templates/rabbitmq.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ spec:
3030
imagePullSecret: {{ .Values.imagePullSecret }}
3131
{{- end }}
3232

33+
{{- if .Values.replicas }}
3334
replicas: {{ .Values.replicas }}
35+
{{- end }}
3436

3537
{{- if .Values.service }}
3638
service:

config/crd/bases/rabbitmq.com_rabbitmqclusters.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -3773,8 +3773,6 @@ spec:
37733773
type: string
37743774
type: object
37753775
type: array
3776-
required:
3777-
- replicas
37783776
type: object
37793777
status:
37803778
description: Status presents the observed state of RabbitmqCluster

0 commit comments

Comments
 (0)