diff --git a/api/v1alpha1/common_types.go b/api/v1alpha1/common_types.go index 2f4c20f..4058b89 100644 --- a/api/v1alpha1/common_types.go +++ b/api/v1alpha1/common_types.go @@ -77,7 +77,7 @@ type NetworkPolicy struct { type HAProxy struct { Enabled bool `json:"enabled,omitempty"` // +kubebuilder:default:="haproxytech/haproxy-alpine:3.1" - Image string `json:"image"` + Image string `json:"image,omitempty"` // +kubebuilder:default:=1 ReplicaCount int32 `json:"replicas,omitempty"` // +kubebuilder:default:=80 diff --git a/api/v1alpha1/marklogiccluster_types.go b/api/v1alpha1/marklogiccluster_types.go index f46f055..e68e338 100644 --- a/api/v1alpha1/marklogiccluster_types.go +++ b/api/v1alpha1/marklogiccluster_types.go @@ -26,6 +26,8 @@ import ( // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. // MarklogicClusterSpec defines the desired state of MarklogicCluster + +// +kubebuilder:validation:XValidation:rule="!(self.haproxy.enabled == true && self.haproxy.pathBasedRouting == true) || int(self.image.split(':')[1].split('.')[0] + self.image.split(':')[1].split('.')[1]) >= 111", message="HAProxy and Pathbased Routing is enabled. PathBasedRouting is only supported for MarkLogic 11.1 and above" type MarklogicClusterSpec struct { // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // Important: Run "make" to regenerate code after modifying this file diff --git a/config/crd/bases/database.marklogic.com_marklogicclusters.yaml b/config/crd/bases/database.marklogic.com_marklogicclusters.yaml index ee03c94..1187168 100644 --- a/config/crd/bases/database.marklogic.com_marklogicclusters.yaml +++ b/config/crd/bases/database.marklogic.com_marklogicclusters.yaml @@ -37,7 +37,6 @@ spec: metadata: type: object spec: - description: MarklogicClusterSpec defines the desired state of MarklogicCluster properties: affinity: description: Affinity is a group of affinity scheduling rules. @@ -2048,8 +2047,6 @@ spec: secretName: type: string type: object - required: - - image type: object hugePages: default: @@ -4200,8 +4197,6 @@ spec: secretName: type: string type: object - required: - - image type: object hugePages: properties: @@ -9391,6 +9386,12 @@ spec: required: - image type: object + x-kubernetes-validations: + - message: HAProxy and Pathbased Routing is enabled. PathBasedRouting + is only supported for MarkLogic 11.1 and above + rule: '!(self.haproxy.enabled == true && self.haproxy.pathBasedRouting + == true) || int(self.image.split('':'')[1].split(''.'')[0] + self.image.split('':'')[1].split(''.'')[1]) + >= 111' status: description: MarklogicClusterStatus defines the observed state of MarklogicCluster properties: