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 addon : pod-security-policy #8454

Merged
merged 3 commits into from
Jul 7, 2020

Conversation

colvin
Copy link
Contributor

@colvin colvin commented Jun 11, 2020

Create a new addon, podsecuritypolicies that applies the
PodSecurityPolicy and related RBAC configuration from the
https://minikube.sigs.k8s.io/docs/tutorials/using_psp/ tutorial.
Apparently, recent work on the addons system has invalidated the
procedure shown in that tutorial, as the configuration is no longer
automatically applied. The last known working version is 1.6.2.

This allows clusters started with
--extra-configs=apiserver.enable-admission-plugins=PodSecurityPolicy
to succeed, so long as they also include --addons=podsecuritypolicies.

Fixes #7314
Fixes #6686

@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please sign in with your organization's credentials at https://identity.linuxfoundation.org/projects/cncf to be authorized.
  • If you have done the above and are still having issues with the CLA being reported as unsigned, please log a ticket with the Linux Foundation Helpdesk: https://support.linuxfoundation.org/
  • Should you encounter any issues with the Linux Foundation Helpdesk, send a message to the backup e-mail support address at: [email protected]

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.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not 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 11, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @colvin!

It looks like this is your first PR to kubernetes/minikube 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/minikube has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @colvin. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 11, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: colvin
To complete the pull request process, please assign sharifelgamal
You can assign the PR to them by writing /assign @sharifelgamal in a comment when ready.

The full list of commands accepted by this bot can be found 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

@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

Create a new addon, `podsecuritypolicies` that applies the
PodSecurityPolicy and related RBAC configuration from the
https://minikube.sigs.k8s.io/docs/tutorials/using_psp/ tutorial.
Apparently, recent work on the addons system has invalidated the
procedure shown in that tutorial, as the configuration is no longer
automatically applied. The last known working version is `1.6.2`.

This allows clusters started with
`--extra-configs=apiserver.enable-admission-plugins=PodSecurityPolicy`
to succeed, so long as they also include `--addons=podsecuritypolicies`.
@colvin colvin force-pushed the addon-podsecuritypolicies branch from 38e15d6 to b32cb5e Compare June 11, 2020 13:51
@codecov-commenter
Copy link

Codecov Report

Merging #8454 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #8454   +/-   ##
=======================================
  Coverage   34.05%   34.05%           
=======================================
  Files         153      153           
  Lines        9840     9840           
=======================================
  Hits         3351     3351           
  Misses       6086     6086           
  Partials      403      403           

@colvin
Copy link
Contributor Author

colvin commented Jun 11, 2020

I signed it

@colvin
Copy link
Contributor Author

colvin commented Jun 11, 2020

This time I actually did sign it

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jun 11, 2020
@colvin
Copy link
Contributor Author

colvin commented Jun 11, 2020

/assign @sharifelgamal

@colvin
Copy link
Contributor Author

colvin commented Jun 11, 2020

/test ?

@k8s-ci-robot
Copy link
Contributor

@colvin: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test ?

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.

Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

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

@colvin thank you for making contribution to minikube, could you please justify an example of using this addon, and why this needs to be an addon (maybe with an end to end scenario )

and also the name chosen for this addon is hard to read, could you please choose a better name that is better typed and read

for example of minikube addons
run: minikbue addons list

@colvin
Copy link
Contributor Author

colvin commented Jun 16, 2020

@medyagh
The PodSecurityPolicy admission controller must be specified when the apiserver starts (--enable-admission-plugins=PodSecurityPolicy), however in doing so the core services are prevented from being provisioned with a "no providers available to validate pod request" error. A policy allowing the creation of the core services must also be applied when the cluster starts.

Recent changes to the addons system prevents arbitrary user-supplied files from being applied to the cluster when provisioned, instead only applying those that are specified as an addon. Therefore, unless I'm incorrect, the only way to apply the policy that allows the cluster to start with the PodSecurityPolicy admission plugin is to implement an addon.

The name of the addon directly reflects the name of the API (policy/v1beta1/podsecuritypolicy) as well as the policy resource and admission controller (PodSecurityPolicy). That said, I'm open to suggestions on a better name.

@medyagh
Copy link
Member

medyagh commented Jun 18, 2020

@medyagh
The PodSecurityPolicy admission controller must be specified when the apiserver starts (--enable-admission-plugins=PodSecurityPolicy), however in doing so the core services are prevented from being provisioned with a "no providers available to validate pod request" error. A policy allowing the creation of the core services must also be applied when the cluster starts.

Recent changes to the addons system prevents arbitrary user-supplied files from being applied to the cluster when provisioned, instead only applying those that are specified as an addon. Therefore, unless I'm incorrect, the only way to apply the policy that allows the cluster to start with the PodSecurityPolicy admission plugin is to implement an addon.

The name of the addon directly reflects the name of the API (policy/v1beta1/podsecuritypolicy) as well as the policy resource and admission controller (PodSecurityPolicy). That said, I'm open to suggestions on a better name.

how about a name format that could be read and typed better maybe pod_security_policy

could you please an example for this addon maybe as docs in the site or as a tutorial in the site?
https://minikube.sigs.k8s.io/docs/tutorials/

@colvin
Copy link
Contributor Author

colvin commented Jun 18, 2020

Thanks for the suggestion @medyagh. I've renamed the addon to pod-security-policy.

I'll take a look at updating the tutorial here. It has been out of date and not working since version 1.6.2, which is what inspired me to do this work.

@Chili-Man
Copy link

@medyagh hey can we get some more movement on this , it seems that @colvin has addressed your comments. It would be great if we can get this fix merged in sooner so that the documentation isn't misleading

@medyagh
Copy link
Member

medyagh commented Jul 7, 2020

@colvin @Chili-Man thanks for your patience and sorry for the delay in this PR review.

it looks good it will be included in the next release v1.1.2.0

thank you for this contribution and I hope you contribute again

@medyagh medyagh merged commit d8106f7 into kubernetes:master Jul 7, 2020
@medyagh medyagh changed the title Include a podsecuritypolicies addon Add addon : pod-security-policy Jul 7, 2020
@Chili-Man
Copy link

thanks @medyagh , we appreciate it!

@colvin
Copy link
Contributor Author

colvin commented Jul 8, 2020

Thanks @medyagh, @Chili-Man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
7 participants