Skip to content

Commit 548509c

Browse files
pengzhoumlPeng Zhou
andauthored
MLE-11585 Version Check of Pathbased Routing (#35)
* fix CRD Validation * MLE-11585: Implement CRD Validation for ML version Check * MLE-11585 Implement path based routing ML version check --------- Co-authored-by: Peng Zhou <[email protected]>
1 parent e5862ab commit 548509c

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

api/v1alpha1/common_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ type NetworkPolicy struct {
7777
type HAProxy struct {
7878
Enabled bool `json:"enabled,omitempty"`
7979
// +kubebuilder:default:="haproxytech/haproxy-alpine:3.1"
80-
Image string `json:"image"`
80+
Image string `json:"image,omitempty"`
8181
// +kubebuilder:default:=1
8282
ReplicaCount int32 `json:"replicas,omitempty"`
8383
// +kubebuilder:default:=80

api/v1alpha1/marklogiccluster_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import (
2626
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
2727

2828
// MarklogicClusterSpec defines the desired state of MarklogicCluster
29+
30+
// +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"
2931
type MarklogicClusterSpec struct {
3032
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
3133
// Important: Run "make" to regenerate code after modifying this file

config/crd/bases/database.marklogic.com_marklogicclusters.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ spec:
3737
metadata:
3838
type: object
3939
spec:
40-
description: MarklogicClusterSpec defines the desired state of MarklogicCluster
4140
properties:
4241
affinity:
4342
description: Affinity is a group of affinity scheduling rules.
@@ -2048,8 +2047,6 @@ spec:
20482047
secretName:
20492048
type: string
20502049
type: object
2051-
required:
2052-
- image
20532050
type: object
20542051
hugePages:
20552052
default:
@@ -4200,8 +4197,6 @@ spec:
42004197
secretName:
42014198
type: string
42024199
type: object
4203-
required:
4204-
- image
42054200
type: object
42064201
hugePages:
42074202
properties:
@@ -9391,6 +9386,12 @@ spec:
93919386
required:
93929387
- image
93939388
type: object
9389+
x-kubernetes-validations:
9390+
- message: HAProxy and Pathbased Routing is enabled. PathBasedRouting
9391+
is only supported for MarkLogic 11.1 and above
9392+
rule: '!(self.haproxy.enabled == true && self.haproxy.pathBasedRouting
9393+
== true) || int(self.image.split('':'')[1].split(''.'')[0] + self.image.split('':'')[1].split(''.'')[1])
9394+
>= 111'
93949395
status:
93959396
description: MarklogicClusterStatus defines the observed state of MarklogicCluster
93969397
properties:

0 commit comments

Comments
 (0)