Skip to content

Commit 3706cba

Browse files
Merge pull request #132 from numtide/feat/cel-validation
feat(api): enforce overrides validation and expand tests
2 parents 6ba8b4e + 6d0ffb7 commit 3706cba

File tree

3 files changed

+406
-0
lines changed

3 files changed

+406
-0
lines changed

api/v1alpha1/multigrescluster_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ type MultiAdminConfig struct {
165165

166166
// CellConfig defines a cell in the cluster.
167167
// +kubebuilder:validation:XValidation:rule="!(has(self.spec) && has(self.cellTemplate))",message="cannot specify both 'spec' and 'cellTemplate'"
168+
// +kubebuilder:validation:XValidation:rule="!(has(self.spec) && has(self.overrides))",message="cannot specify both 'spec' and 'overrides'"
168169
// +kubebuilder:validation:XValidation:rule="has(self.zone) != has(self.region)",message="must specify either 'zone' or 'region', but not both"
169170
type CellConfig struct {
170171
// Name is the logical name of the cell.
@@ -262,6 +263,7 @@ type TableGroupConfig struct {
262263

263264
// ShardConfig defines a specific shard.
264265
// +kubebuilder:validation:XValidation:rule="!(has(self.spec) && has(self.shardTemplate))",message="cannot specify both 'spec' and 'shardTemplate'"
266+
// +kubebuilder:validation:XValidation:rule="!(has(self.spec) && has(self.overrides))",message="cannot specify both 'spec' and 'overrides'"
265267
type ShardConfig struct {
266268
// Name is the identifier of the shard (e.g., "0", "1").
267269
// +kubebuilder:validation:MinLength=1

config/crd/bases/multigres.com_multigresclusters.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2293,6 +2293,8 @@ spec:
22932293
x-kubernetes-validations:
22942294
- message: cannot specify both 'spec' and 'cellTemplate'
22952295
rule: '!(has(self.spec) && has(self.cellTemplate))'
2296+
- message: cannot specify both 'spec' and 'overrides'
2297+
rule: '!(has(self.spec) && has(self.overrides))'
22962298
- message: must specify either 'zone' or 'region', but not both
22972299
rule: has(self.zone) != has(self.region)
22982300
maxItems: 50
@@ -6941,6 +6943,8 @@ spec:
69416943
x-kubernetes-validations:
69426944
- message: cannot specify both 'spec' and 'shardTemplate'
69436945
rule: '!(has(self.spec) && has(self.shardTemplate))'
6946+
- message: cannot specify both 'spec' and 'overrides'
6947+
rule: '!(has(self.spec) && has(self.overrides))'
69446948
maxItems: 32
69456949
type: array
69466950
x-kubernetes-list-map-keys:

0 commit comments

Comments
 (0)