Skip to content

Commit e21d6f8

Browse files
committed
Revert "fix: add CEL validation rule to require one of volume configs"
This reverts commit b02fa6e.
1 parent b02fa6e commit e21d6f8

File tree

6 files changed

+0
-136
lines changed

6 files changed

+0
-136
lines changed

api/v1alpha1/aws_node_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ type AMILookup struct {
114114
BaseOS string `json:"baseOS,omitempty"`
115115
}
116116

117-
// +kubebuilder:validation:XValidation:rule="has(self.root) || size(self.nonroot) > 0",message="either root or nonroot must be specified"
118117
type AWSVolumes struct {
119118
// Configuration options for the root storage volume.
120119
// +kubebuilder:validation:Optional

api/v1alpha1/crds/caren.nutanix.com_awsclusterconfigs.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,6 @@ spec:
498498
type: string
499499
type: object
500500
type: object
501-
x-kubernetes-validations:
502-
- message: either root or nonroot must be specified
503-
rule: has(self.root) || size(self.nonroot) > 0
504501
type: object
505502
nodeRegistration:
506503
default: {}

api/v1alpha1/crds/caren.nutanix.com_awsworkernodeconfigs.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,6 @@ spec:
200200
type: string
201201
type: object
202202
type: object
203-
x-kubernetes-validations:
204-
- message: either root or nonroot must be specified
205-
rule: has(self.root) || size(self.nonroot) > 0
206203
type: object
207204
nodeRegistration:
208205
default: {}

api/v1alpha1/crds/caren.nutanix.com_eksworkernodeconfigs.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,6 @@ spec:
200200
type: string
201201
type: object
202202
type: object
203-
x-kubernetes-validations:
204-
- message: either root or nonroot must be specified
205-
rule: has(self.root) || size(self.nonroot) > 0
206203
type: object
207204
taints:
208205
description: Taints specifies the taints the Node API object should

pkg/handlers/aws/mutation/volumes/variables_test.go

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -53,72 +53,5 @@ func TestVariableValidation(t *testing.T) {
5353
},
5454
},
5555
},
56-
capitest.VariableTestDef{
57-
Name: "Root volume only",
58-
Vals: v1alpha1.AWSClusterConfigSpec{
59-
ControlPlane: &v1alpha1.AWSControlPlaneSpec{
60-
AWS: &v1alpha1.AWSControlPlaneNodeSpec{
61-
AWSGenericNodeSpec: v1alpha1.AWSGenericNodeSpec{
62-
Volumes: &v1alpha1.AWSVolumes{
63-
Root: &v1alpha1.AWSVolume{
64-
Size: 100,
65-
Type: capav1.VolumeTypeGP3,
66-
},
67-
},
68-
},
69-
},
70-
},
71-
},
72-
},
73-
capitest.VariableTestDef{
74-
Name: "Non-root volumes only",
75-
Vals: v1alpha1.AWSClusterConfigSpec{
76-
ControlPlane: &v1alpha1.AWSControlPlaneSpec{
77-
AWS: &v1alpha1.AWSControlPlaneNodeSpec{
78-
AWSGenericNodeSpec: v1alpha1.AWSGenericNodeSpec{
79-
Volumes: &v1alpha1.AWSVolumes{
80-
NonRoot: []v1alpha1.AWSVolume{
81-
{
82-
DeviceName: "/dev/sdf",
83-
Size: 200,
84-
Type: capav1.VolumeTypeGP3,
85-
},
86-
},
87-
},
88-
},
89-
},
90-
},
91-
},
92-
},
93-
capitest.VariableTestDef{
94-
Name: "Error when neither root nor non-root volumes",
95-
Vals: v1alpha1.AWSClusterConfigSpec{
96-
ControlPlane: &v1alpha1.AWSControlPlaneSpec{
97-
AWS: &v1alpha1.AWSControlPlaneNodeSpec{
98-
AWSGenericNodeSpec: v1alpha1.AWSGenericNodeSpec{
99-
Volumes: &v1alpha1.AWSVolumes{
100-
// Both Root and NonRoot are nil/empty
101-
},
102-
},
103-
},
104-
},
105-
},
106-
ExpectError: true,
107-
},
108-
capitest.VariableTestDef{
109-
Name: "Error when empty non-root volumes array",
110-
Vals: v1alpha1.AWSClusterConfigSpec{
111-
ControlPlane: &v1alpha1.AWSControlPlaneSpec{
112-
AWS: &v1alpha1.AWSControlPlaneNodeSpec{
113-
AWSGenericNodeSpec: v1alpha1.AWSGenericNodeSpec{
114-
Volumes: &v1alpha1.AWSVolumes{
115-
NonRoot: []v1alpha1.AWSVolume{},
116-
},
117-
},
118-
},
119-
},
120-
},
121-
ExpectError: true,
122-
},
12356
)
12457
}

pkg/handlers/eks/mutation/volumes/variables_test.go

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -51,64 +51,5 @@ func TestVariableValidation(t *testing.T) {
5151
},
5252
},
5353
},
54-
capitest.VariableTestDef{
55-
Name: "Root volume only",
56-
Vals: v1alpha1.EKSWorkerNodeConfigSpec{
57-
EKS: &v1alpha1.AWSWorkerNodeSpec{
58-
AWSGenericNodeSpec: v1alpha1.AWSGenericNodeSpec{
59-
Volumes: &v1alpha1.AWSVolumes{
60-
Root: &v1alpha1.AWSVolume{
61-
Size: 100,
62-
Type: capav1.VolumeTypeGP3,
63-
},
64-
},
65-
},
66-
},
67-
},
68-
},
69-
capitest.VariableTestDef{
70-
Name: "Non-root volumes only",
71-
Vals: v1alpha1.EKSWorkerNodeConfigSpec{
72-
EKS: &v1alpha1.AWSWorkerNodeSpec{
73-
AWSGenericNodeSpec: v1alpha1.AWSGenericNodeSpec{
74-
Volumes: &v1alpha1.AWSVolumes{
75-
NonRoot: []v1alpha1.AWSVolume{
76-
{
77-
DeviceName: "/dev/sdf",
78-
Size: 200,
79-
Type: capav1.VolumeTypeGP3,
80-
},
81-
},
82-
},
83-
},
84-
},
85-
},
86-
},
87-
capitest.VariableTestDef{
88-
Name: "Error when neither root nor non-root volumes",
89-
Vals: v1alpha1.EKSWorkerNodeConfigSpec{
90-
EKS: &v1alpha1.AWSWorkerNodeSpec{
91-
AWSGenericNodeSpec: v1alpha1.AWSGenericNodeSpec{
92-
Volumes: &v1alpha1.AWSVolumes{
93-
// Both Root and NonRoot are nil/empty
94-
},
95-
},
96-
},
97-
},
98-
ExpectError: true,
99-
},
100-
capitest.VariableTestDef{
101-
Name: "Error when empty non-root volumes array",
102-
Vals: v1alpha1.EKSWorkerNodeConfigSpec{
103-
EKS: &v1alpha1.AWSWorkerNodeSpec{
104-
AWSGenericNodeSpec: v1alpha1.AWSGenericNodeSpec{
105-
Volumes: &v1alpha1.AWSVolumes{
106-
NonRoot: []v1alpha1.AWSVolume{},
107-
},
108-
},
109-
},
110-
},
111-
ExpectError: true,
112-
},
11354
)
11455
}

0 commit comments

Comments
 (0)