-
Notifications
You must be signed in to change notification settings - Fork 40.2k
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 sysctls to the ouput of describe
on PSPs
#65218
Conversation
/ok-to-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A handful comments from me. Looks good overall!
@@ -2248,6 +2249,7 @@ func TestDescribePodSecurityPolicy(t *testing.T) { | |||
Name: "mypsp", | |||
}, | |||
Spec: policy.PodSecurityPolicySpec{ | |||
AllowedUnsafeSysctls: []string{"kernel.*", ",net.ipv4.ip_local_port_range"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's about forbidden sysctls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
",net.ipv4.ip_local_port_range"
Why it's started from a comma?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I'd test only one of those two since many of the other attributes seem to be left out as well (e.g. FlexVolume
) and forbidden sysctls have the same display method as allowed unsafe ones. I can add them if you want, though.
@@ -2228,6 +2228,7 @@ func TestDescribePodSecurityPolicy(t *testing.T) { | |||
"Required Drop Capabilities:\\s*<none>", | |||
"Allowed Capabilities:\\s*<none>", | |||
"Allowed Volume Types:\\s*<none>", | |||
"Allowed Unsafe Sysctls:\\skernel.*,net.ipv4.ip_local_port_range", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because these are not just a plain string but regexps, I'd suggest to:
- replace
\\s
by\\s*
- quote
.
and*
that are part of the expected output rather than a regexp itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you're right, I completely missed the dot and the asterisk somehow got left out as well. Thanks!
/sig auth |
cc5573d
to
2d6c640
Compare
@@ -2248,6 +2249,7 @@ func TestDescribePodSecurityPolicy(t *testing.T) { | |||
Name: "mypsp", | |||
}, | |||
Spec: policy.PodSecurityPolicySpec{ | |||
AllowedUnsafeSysctls: []string{"kernel.*", "net.ipv4.ip_local_port_range"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add test for ForbiddenSysctls
field as well? Just in case it gets removed by accident?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do.
When promoting the sysctls feature for PSPs, the output of the `kubectl describe` command was forgotten about. This commit adds the `AllowedUnsafeSysctls` and `ForbiddenSysctls` fields to the output of that command.
The latest patch now also includes the test for "Forbidden Sysctls" |
@stlaz: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. |
PTAL @kubernetes/sig-cli-maintainers /retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: php-coder, soltysh, stlaz 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 |
Automatic merge from submit-queue (batch tested with PRs 65064, 65218, 65260, 65241, 64372). If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
When promoting the sysctls feature for PSPs, the output of the
kubectl describe
command was forgotten about. This commitadds the
AllowedUnsafeSysctls
andForbiddenSysctls
fieldsto the output of that command.
Which issue(s) this PR fixes :
Fixes #65181
Release notes: