Skip to content

Commit b7a21fb

Browse files
committed
add cis to the cis-profile enum
Signed-off-by: Ashley Dumaine <[email protected]>
1 parent 4756c2a commit b7a21fb

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

@@ -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/config/crd/bases/bootstrap.cluster.x-k8s.io_rke2configs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ spec:
7474
description: CISProfile activates CIS compliance of RKE2 for a
7575
certain profile
7676
enum:
77+
- cis
7778
- cis-1.23
7879
- cis-1.5
7980
- cis-1.6
@@ -632,6 +633,7 @@ spec:
632633
description: CISProfile activates CIS compliance of RKE2 for a
633634
certain profile
634635
enum:
636+
- cis
635637
- cis-1.23
636638
- cis-1.5
637639
- 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
@@ -88,6 +88,7 @@ spec:
8888
description: CISProfile activates CIS compliance of RKE2
8989
for a certain profile
9090
enum:
91+
- cis
9192
- cis-1.23
9293
- cis-1.5
9394
- cis-1.6
@@ -635,6 +636,7 @@ spec:
635636
description: CISProfile activates CIS compliance of RKE2
636637
for a certain profile
637638
enum:
639+
- cis
638640
- cis-1.23
639641
- cis-1.5
640642
- 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
@@ -74,6 +74,7 @@ spec:
7474
description: CISProfile activates CIS compliance of RKE2 for a
7575
certain profile
7676
enum:
77+
- cis
7778
- cis-1.23
7879
- cis-1.5
7980
- cis-1.6
@@ -1254,6 +1255,7 @@ spec:
12541255
description: CISProfile activates CIS compliance of RKE2 for a
12551256
certain profile
12561257
enum:
1258+
- cis
12571259
- cis-1.23
12581260
- cis-1.5
12591261
- 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
@@ -120,6 +120,7 @@ spec:
120120
description: CISProfile activates CIS compliance of RKE2
121121
for a certain profile
122122
enum:
123+
- cis
123124
- cis-1.23
124125
- cis-1.5
125126
- 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
@@ -192,6 +192,8 @@ func ProfileCompliant(profile bootstrapv1.CISProfile, version string) bool {
192192
}
193193

194194
switch profile {
195+
case bootstrapv1.CIS:
196+
return isAtLeastv125
195197
case bootstrapv1.CIS1_23:
196198
return isAtLeastv125
197199
case bootstrapv1.CIS1_5:

0 commit comments

Comments
 (0)