You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- use CRD schema to set defaults for CRD fields specs.
- defaults are directly set on CRDs so it preserves the default with new
versions of CRD
- defaults can be set for integer, string, slice, and objects, which covers all types
- unit tests on api now creates rabbitmqcluster directly to test
defaulting behavior
Copy file name to clipboardExpand all lines: api/v1beta1/rabbitmqcluster_types.go
+12-77
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,6 @@
9
9
package v1beta1
10
10
11
11
import (
12
-
"reflect"
13
12
"strings"
14
13
15
14
appsv1 "k8s.io/api/apps/v1"
@@ -21,16 +20,6 @@ import (
21
20
"k8s.io/apimachinery/pkg/runtime"
22
21
)
23
22
24
-
const (
25
-
rabbitmqImagestring="rabbitmq:3.8.9"
26
-
defaultPersistentCapacitystring="10Gi"
27
-
defaultMemoryLimitstring="2Gi"
28
-
defaultCPULimitstring="2000m"
29
-
defaultMemoryRequeststring="2Gi"
30
-
defaultCPURequeststring="1000m"
31
-
defaultServiceType=corev1.ServiceTypeClusterIP
32
-
)
33
-
34
23
// +kubebuilder:object:root=true
35
24
36
25
// RabbitmqCluster is the Schema for the rabbitmqclusters API
@@ -50,15 +39,20 @@ type RabbitmqCluster struct {
50
39
typeRabbitmqClusterSpecstruct {
51
40
// 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.
52
41
// +kubebuilder:validation:Minimum:=0
42
+
// +kubebuilder:default:=1
53
43
Replicas*int32`json:"replicas"`
54
44
// Image is the name of the RabbitMQ docker image to use for RabbitMQ nodes in the RabbitmqCluster.
45
+
// +kubebuilder:default:="rabbitmq:3.8.9"
55
46
Imagestring`json:"image,omitempty"`
56
47
// Name of the Secret resource containing access credentials to the registry for the RabbitMQ image. Required if the docker registry is private.
0 commit comments