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

Added kubelet config parameter 'seccompDefault' #6741

Merged
merged 8 commits into from
Oct 7, 2022

Conversation

AleksandarSavchev
Copy link
Contributor

@AleksandarSavchev AleksandarSavchev commented Sep 26, 2022

How to categorize this PR?

/area security
/kind enhancement

What this PR does / why we need it:
This PR adds a new config parameter seccompDefault to kubelet which enhances the securityContext of shoot pods by setting their seccomp profiles to "RuntimeDefault". This new parameter is available for k8s versions >= 1.25 and can be enabled only when kubelet's 'SeccompDefault' feature gate is enabled (it is enabled by default). Added tests for new parameter.

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

Special notes for your reviewer:
Please see the comment below.

Release note:

It is now possible to configure the `seccompDefault` field for the kubelet configuration in the `Shoot` API via `.spec.{provider.workers[]}.kubernetes.kubelet.seccompDefault`. This configuration is only available for k8s version >= 1.25 and it is not turned on by default.
Function `ValidateWorker()` in `pkg/apis/core/validation` now accepts `core.Kubernetes` struct instead of `string` as second argument.
Shoot worker definitions are now validated using `.spec.kubernetes.kubelet` when `.spec.provider.workers[].kubernetes.kubelet` is not specified.

@gardener-prow gardener-prow bot added area/security Security related kind/enhancement Enhancement, improvement, extension cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. labels Sep 26, 2022
@gardener-prow gardener-prow bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 26, 2022
pkg/apis/core/v1beta1/defaults_test.go Outdated Show resolved Hide resolved
pkg/apis/core/v1alpha1/defaults_test.go Outdated Show resolved Hide resolved
pkg/apis/core/validation/shoot_test.go Outdated Show resolved Hide resolved
pkg/apis/core/validation/shoot_test.go Outdated Show resolved Hide resolved
@AleksandarSavchev
Copy link
Contributor Author

There is a problem with inheritance of kubelet config for workers, meaning that the seccomp configuration is not validated correctly.
/hold until I resolve this

@gardener-prow gardener-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 27, 2022
@AleksandarSavchev
Copy link
Contributor Author

The ValidateWorker function did not validate worker's kubelet config when it was missing. When it is missing the worker would inherit the shoot's kubelet config. Added validation for the shoot's kubelet config when the worker's config is missing.

Removed the default value for seccompDefault config since it does not change the functionality and it would have been inherited by the worker node even when the worker node's k8s version is <= 1.24. In such a case there would have been a validation error which would have been hard to understand since the user has not set seccompDefault.

@AleksandarSavchev
Copy link
Contributor Author

/unhold

@gardener-prow gardener-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 27, 2022
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.

Thanks!
/lgtm

@gardener-prow gardener-prow bot added the lgtm Indicates that a PR is ready to be merged. label Sep 29, 2022
@rfranzke
Copy link
Member

rfranzke commented Oct 4, 2022

/assign

Copy link
Member

@rfranzke rfranzke left a comment

Choose a reason for hiding this comment

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

Nice PR.

Are you addressing https://github.com/gardener/gardener/blob/2c5074415de457e9609f51850e62991c3cdb4f0d/docs/usage/default_seccomp_profile.md#future-steps here?
Independent of this, does it make sense to adapt the documentation/this file with information about this new feature?

pkg/apis/core/validation/shoot.go Outdated Show resolved Hide resolved
pkg/apis/core/validation/shoot.go Show resolved Hide resolved
pkg/apis/core/validation/shoot_test.go Outdated Show resolved Hide resolved
@gardener-prow gardener-prow bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 5, 2022
@AleksandarSavchev
Copy link
Contributor Author

Nice PR.

Are you addressing https://github.com/gardener/gardener/blob/2c5074415de457e9609f51850e62991c3cdb4f0d/docs/usage/default_seccomp_profile.md#future-steps here? Independent of this, does it make sense to adapt the documentation/this file with information about this new feature?

Thank you for pointing this out. I have now updated this file with new information about the feature.

Copy link
Member

@rfranzke rfranzke left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@gardener-prow gardener-prow bot added the lgtm Indicates that a PR is ready to be merged. label Oct 6, 2022
@gardener-prow
Copy link
Contributor

gardener-prow bot commented Oct 6, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dimityrmirchev, rfranzke

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gardener-prow gardener-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 6, 2022
@acumino acumino added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Oct 6, 2022
@gardener-prow gardener-prow bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 6, 2022
@gardener-prow gardener-prow bot removed lgtm Indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Oct 7, 2022
@rfranzke
Copy link
Member

rfranzke commented Oct 7, 2022

@AleksandarSavchev: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-gardener-e2e-kind 779e103 link true /test pull-gardener-e2e-kind
pull-gardener-check-vulnerabilities 2d9fe99 link false /test pull-gardener-check-vulnerabilities
Full PR test history. Your PR dashboard. Command help for this repository. Please help us cut down on flakes by linking this test failure to an open flake report or filing a new flake report if you can't find an existing one. Also see our testing guideline for how to avoid and hunt flakes.

Looks like #6766
/retest

Copy link
Member

@rfranzke rfranzke 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-prow gardener-prow bot added the lgtm Indicates that a PR is ready to be merged. label Oct 7, 2022
@gardener-prow
Copy link
Contributor

gardener-prow bot commented Oct 7, 2022

@AleksandarSavchev: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-gardener-check-vulnerabilities 2d9fe99 link false /test pull-gardener-check-vulnerabilities

Full PR test history. Your PR dashboard. Command help for this repository.
Please help us cut down on flakes by linking this test failure to an open flake report or filing a new flake report if you can't find an existing one. Also see our testing guideline for how to avoid and hunt flakes.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/security Security related cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. kind/enhancement Enhancement, improvement, extension lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to configure cluster-wide default seccomp profile RuntimeDefault for shoots
4 participants