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 sysctls to the ouput of describe on PSPs #65218

Merged
merged 1 commit into from
Jun 22, 2018

Conversation

stlaz
Copy link
Member

@stlaz stlaz commented Jun 19, 2018

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 commit
adds the AllowedUnsafeSysctls and ForbiddenSysctls fields
to the output of that command.

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

Release notes:

NONE

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 19, 2018
@k8s-ci-robot k8s-ci-robot requested review from rootfs and soltysh June 19, 2018 13:03
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jun 19, 2018
@php-coder
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 19, 2018
Copy link
Contributor

@php-coder php-coder left a 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"},
Copy link
Contributor

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?

Copy link
Contributor

@php-coder php-coder Jun 19, 2018

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?

Copy link
Member Author

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",
Copy link
Contributor

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:

  1. replace \\s by \\s*
  2. quote . and * that are part of the expected output rather than a regexp itself

Copy link
Member Author

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!

@php-coder
Copy link
Contributor

/sig auth
/sig cli

@k8s-ci-robot k8s-ci-robot added sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/cli Categorizes an issue or PR as relevant to SIG CLI. labels Jun 19, 2018
@stlaz stlaz force-pushed the sysctls_describe branch 2 times, most recently from cc5573d to 2d6c640 Compare June 19, 2018 13:41
@@ -2248,6 +2249,7 @@ func TestDescribePodSecurityPolicy(t *testing.T) {
Name: "mypsp",
},
Spec: policy.PodSecurityPolicySpec{
AllowedUnsafeSysctls: []string{"kernel.*", "net.ipv4.ip_local_port_range"},
Copy link
Contributor

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?

Copy link
Member Author

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.
@stlaz stlaz force-pushed the sysctls_describe branch from 2d6c640 to dd667ec Compare June 20, 2018 06:09
@stlaz
Copy link
Member Author

stlaz commented Jun 20, 2018

The latest patch now also includes the test for "Forbidden Sysctls"

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jun 20, 2018

@stlaz: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-kubemark-e2e-gce 2d6c640892e8c4ac83eab6cd97f44c3667b6fdf4 link /test pull-kubernetes-kubemark-e2e-gce

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.

@php-coder
Copy link
Contributor

PTAL @kubernetes/sig-cli-maintainers

/retest
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 20, 2018
Copy link
Contributor

@soltysh soltysh 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

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 21, 2018
@k8s-github-robot
Copy link

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.

@k8s-github-robot k8s-github-robot merged commit b5ea862 into kubernetes:master Jun 22, 2018
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make kubectl describe psp describe the new sysctl field
6 participants