Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Security Hardened Kubernetes Cluster ruleset to managedk8s provider #359

Conversation

AleksandarSavchev
Copy link
Member

What this PR does / why we need it:
This PR adds the Security Hardened Kubernetes Cluster ruleset v0.1.0 to the managedk8s provider.

Which issue(s) this PR fixes:
Part of #356

Special notes for your reviewer:

Release note:

NONE

@AleksandarSavchev AleksandarSavchev requested a review from a team as a code owner November 15, 2024 13:13
@gardener-robot gardener-robot added needs/review Needs review size/l Size of pull request is large (see gardener-robot robot/bots/size.py) needs/second-opinion Needs second review by someone else labels Nov 15, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 15, 2024
@AleksandarSavchev AleksandarSavchev changed the title Add Security Hardened Kubernetes Cluster ruleset to managedk8s provider Add Security Hardened Kubernetes Cluster ruleset to managedk8s provider Nov 15, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 added needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 15, 2024
Copy link
Member

@dimityrmirchev dimityrmirchev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, some small change requests.

@@ -10,6 +10,8 @@ The `Managed Kubernetes` provider implements the following `rulesets`:
- [DISA Kubernetes Security Technical Implementation Guide](../rulesets/disa-k8s-stig/ruleset.md)
- v2r1
- v1r11
- [Security Hardened Shoot Cluster](../rulesets/security-hardened-k8s-cluster/ruleset.md)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [Security Hardened Shoot Cluster](../rulesets/security-hardened-k8s-cluster/ruleset.md)
- [Security Hardened Kubernetes Cluster](../rulesets/security-hardened-k8s-cluster/ruleset.md)

@@ -170,6 +170,14 @@ providers: # contains information about known providers
# foo: bar
# nodeGroupByLabels:
# - foo
- id: security-hardened-k8s-cluster
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- id: security-hardened-k8s-cluster
- id: security-hardened-k8s

@@ -12,6 +12,7 @@ import (
"github.com/gardener/diki/pkg/provider"
"github.com/gardener/diki/pkg/provider/managedk8s"
"github.com/gardener/diki/pkg/provider/managedk8s/ruleset/disak8sstig"
"github.com/gardener/diki/pkg/provider/managedk8s/ruleset/securityhardenedcluster"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"github.com/gardener/diki/pkg/provider/managedk8s/ruleset/securityhardenedcluster"
"github.com/gardener/diki/pkg/provider/managedk8s/ruleset/securityhardenedk8s"


const (
// RulesetID is a constant containing the id of a Security Hardened Kubernetes Cluster Ruleset
RulesetID = "security-hardened-k8s-cluster"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
RulesetID = "security-hardened-k8s-cluster"
RulesetID = "security-hardened-k8s"


func (r *Ruleset) registerV01Rules(ruleOptions map[string]config.RuleOptionsConfig) error { // TODO: add to FromGenericConfig
_, err := client.New(r.Config, client.Options{
Scheme: gardenerk8s.GardenScheme,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scheme should be the same as the other managed k8s ruleset

)

const (
// RulesetID is a constant containing the id of a Security Hardened Kubernetes Cluster Ruleset
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// RulesetID is a constant containing the id of a Security Hardened Kubernetes Cluster Ruleset
// RulesetID is a constant containing the id of the Security Hardened Kubernetes Cluster Ruleset.

@gardener-robot gardener-robot added the needs/changes Needs (more) changes label Nov 15, 2024
@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 18, 2024
Copy link
Member

@dimityrmirchev dimityrmirchev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@dimityrmirchev dimityrmirchev merged commit 515bf20 into gardener:main Nov 18, 2024
9 checks passed
@gardener-robot gardener-robot added reviewed/lgtm Has approval for merging status/closed Issue is closed (either delivered or triaged) and removed needs/changes Needs (more) changes needs/review Needs review needs/second-opinion Needs second review by someone else labels Nov 18, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) reviewed/lgtm Has approval for merging reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) size/l Size of pull request is large (see gardener-robot robot/bots/size.py) status/closed Issue is closed (either delivered or triaged)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants