Skip to content

Commit 60fa0cd

Browse files
committed
add cis to the cis-profile enum
Signed-off-by: Ashley Dumaine <[email protected]>
1 parent 310f415 commit 60fa0cd

8 files changed

+18
-3
lines changed

bootstrap/api/v1alpha1/rke2config_types.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ type RKE2AgentConfig struct {
102102
Snapshotter string `json:"snapshotter,omitempty"`
103103

104104
// CISProfile activates CIS compliance of RKE2 for a certain profile
105-
// +kubebuilder:validation:Enum=cis-1.23;cis-1.5;cis-1.6
105+
// +kubebuilder:validation:Enum=cis;cis-1.23;cis-1.5;cis-1.6
106106
//+optional
107107
CISProfile CISProfile `json:"cisProfile,omitempty"`
108108

@@ -256,6 +256,9 @@ type RKE2ConfigList struct {
256256
type CISProfile string
257257

258258
const (
259+
// CIS references RKE2's CIS Profile "cis".
260+
CIS CISProfile = "cis"
261+
259262
// CIS1_23 references RKE2's CIS Profile "cis-1.23".
260263
CIS1_23 CISProfile = "cis-1.23"
261264

bootstrap/api/v1beta1/rke2config_types.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ type RKE2AgentConfig struct {
102102
Snapshotter string `json:"snapshotter,omitempty"`
103103

104104
// CISProfile activates CIS compliance of RKE2 for a certain profile
105-
// +kubebuilder:validation:Enum=cis-1.23;cis-1.5;cis-1.6
105+
// +kubebuilder:validation:Enum=cis;cis-1.23;cis-1.5;cis-1.6
106106
//+optional
107107
CISProfile CISProfile `json:"cisProfile,omitempty"`
108108

@@ -257,6 +257,9 @@ type RKE2ConfigList struct {
257257
type CISProfile string
258258

259259
const (
260+
// CIS references RKE2's CIS Profile "cis".
261+
CIS CISProfile = "cis"
262+
260263
// CIS1_23 references RKE2's CIS Profile "cis-1.23".
261264
CIS1_23 CISProfile = "cis-1.23"
262265

bootstrap/config/crd/bases/bootstrap.cluster.x-k8s.io_rke2configs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ spec:
7878
description: CISProfile activates CIS compliance of RKE2 for a
7979
certain profile
8080
enum:
81+
- cis
8182
- cis-1.23
8283
- cis-1.5
8384
- cis-1.6
@@ -665,6 +666,7 @@ spec:
665666
description: CISProfile activates CIS compliance of RKE2 for a
666667
certain profile
667668
enum:
669+
- cis
668670
- cis-1.23
669671
- cis-1.5
670672
- cis-1.6

bootstrap/config/crd/bases/bootstrap.cluster.x-k8s.io_rke2configtemplates.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ spec:
9090
description: CISProfile activates CIS compliance of RKE2
9191
for a certain profile
9292
enum:
93+
- cis
9394
- cis-1.23
9495
- cis-1.5
9596
- cis-1.6
@@ -640,6 +641,7 @@ spec:
640641
description: CISProfile activates CIS compliance of RKE2
641642
for a certain profile
642643
enum:
644+
- cis
643645
- cis-1.23
644646
- cis-1.5
645647
- cis-1.6

controlplane/config/crd/bases/controlplane.cluster.x-k8s.io_rke2controlplanes.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ spec:
7878
description: CISProfile activates CIS compliance of RKE2 for a
7979
certain profile
8080
enum:
81+
- cis
8182
- cis-1.23
8283
- cis-1.5
8384
- cis-1.6
@@ -1310,6 +1311,7 @@ spec:
13101311
description: CISProfile activates CIS compliance of RKE2 for a
13111312
certain profile
13121313
enum:
1314+
- cis
13131315
- cis-1.23
13141316
- cis-1.5
13151317
- cis-1.6

controlplane/config/crd/bases/controlplane.cluster.x-k8s.io_rke2controlplanetemplates.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ spec:
133133
description: CISProfile activates CIS compliance of RKE2
134134
for a certain profile
135135
enum:
136+
- cis
136137
- cis-1.23
137138
- cis-1.5
138139
- cis-1.6

pkg/rke2/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ var _ = Describe("RKE2 Agent Config", func() {
280280
LoadBalancerPort: 1234,
281281
NodeLabels: []string{"testlabel"},
282282
NodeTaints: []string{"testtaint"},
283-
CISProfile: bootstrapv1.CIS1_23, //nolint:nosnakecase
283+
CISProfile: bootstrapv1.CIS, //nolint:nosnakecase
284284
ProtectKernelDefaults: true,
285285
ResolvConf: &corev1.ObjectReference{
286286
Name: "test",

pkg/util/util.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ func ProfileCompliant(profile bootstrapv1.CISProfile, version string) bool {
201201
}
202202

203203
switch profile {
204+
case bootstrapv1.CIS:
205+
return isAtLeastv125
204206
case bootstrapv1.CIS1_23:
205207
return isAtLeastv125
206208
case bootstrapv1.CIS1_5:

0 commit comments

Comments
 (0)