Skip to content

[Security Hardened Shoot Cluster] Rule 1001 Implementation #462

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

Merged

Conversation

georgibaltiev
Copy link
Contributor

What this PR does / why we need it:
This PR implements and registers rule 1001 of the Security Hardened Shoot ruleset for the Garden provider. The rule checks the shoot spec for it's Kubernetes version and evaluates it's support based on the CloudProfile/NamespacedCloudProfile in the project

Which issue(s) this PR fixes:
Fixes #432

Special notes for your reviewer:

Release note:

Implementation for rule `1001` from the `security-hardened-shoot-cluster` ruleset for provider `garden`.

@georgibaltiev georgibaltiev requested a review from a team as a code owner March 24, 2025 13:14
@gardener-robot gardener-robot added needs/review Needs review size/xl Size of pull request is huge (see gardener-robot robot/bots/size.py) needs/second-opinion Needs second review by someone else labels Mar 24, 2025
@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) 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 Mar 24, 2025
Copy link
Member

@AleksandarSavchev AleksandarSavchev left a comment

Choose a reason for hiding this comment

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

Thanks! Just some nits.

@gardener-robot gardener-robot added the needs/changes Needs (more) changes label Mar 24, 2025
@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 Mar 24, 2025
@gardener-robot-ci-1 gardener-robot-ci-1 removed 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 Mar 24, 2025
@gardener-robot-ci-1 gardener-robot-ci-1 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 Mar 24, 2025
Copy link
Member

@AleksandarSavchev AleksandarSavchev left a comment

Choose a reason for hiding this comment

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

/lgtm

@gardener-robot gardener-robot added reviewed/lgtm Has approval for merging and removed needs/changes Needs (more) changes needs/review Needs review labels Mar 24, 2025
@gardener-robot gardener-robot removed the needs/second-opinion Needs second review by someone else label Mar 24, 2025
@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 Mar 24, 2025
return rule.Result(r, checkResult), nil
}
return rule.Result(r, rule.ErroredCheckResult("kubernetes version not found in cloudProfile", target)), nil
} else {
Copy link
Member

Choose a reason for hiding this comment

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

No need for additional nesting here - else can be removed

case slices.Contains(r.acceptedClassifications(), *version.Classification):
return rule.PassedCheckResult("Shoot uses a Kubernetes version with an allowed classification.", target.With("classification", string(*version.Classification))), true
default:
return rule.FailedCheckResult("Shoot uses a Kubernetes version with a non-allowed classification.", target.With("classification", string(*version.Classification))), true
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
return rule.FailedCheckResult("Shoot uses a Kubernetes version with a non-allowed classification.", target.With("classification", string(*version.Classification))), true
return rule.FailedCheckResult("Shoot uses a Kubernetes version with a forbidden classification.", target.With("classification", string(*version.Classification))), true

@gardener-robot gardener-robot added needs/changes Needs (more) changes needs/review Needs review needs/second-opinion Needs second review by someone else and removed needs/review Needs review reviewed/lgtm Has approval for merging labels Mar 25, 2025
@gardener-robot-ci-2 gardener-robot-ci-2 removed 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 Mar 25, 2025
Copy link
Member

@AleksandarSavchev AleksandarSavchev left a comment

Choose a reason for hiding this comment

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

/lgtm

@gardener-robot gardener-robot added reviewed/lgtm Has approval for merging and removed needs/changes Needs (more) changes needs/second-opinion Needs second review by someone else labels Mar 25, 2025
@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 Mar 25, 2025
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 9a93a68 into gardener:main Mar 25, 2025
9 checks passed
@gardener-robot gardener-robot added the status/closed Issue is closed (either delivered or triaged) label Mar 25, 2025
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/xl Size of pull request is huge (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.

[Security Hardened Shoot Cluster] Add rule 1001 to check k8s version
6 participants