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

Make webhooks' failurePolicy and namespaceSelector configurable #883

Merged
merged 1 commit into from
Apr 6, 2022

Conversation

jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Apr 4, 2022

What type of PR is this?

/kind feature

What this PR does / why we need it:

By default, our webhooks target all namespaces. While from a security
standpointm this is OK, because the webhooks react to our CRs and
therefore an explicit RBAC rule must be added to manage them, there is
still a risk that if there is a bug in the webhooks, the function of
critical namespaces might be affected.

This patch exposes the failureMode and the namespaceSelector as
configurable through a newly added webhookOptions object in the spod CR
to enable admins to select which namespaces should be watched by the
webhook and what should happen on failure.

In addition, namespace runlevels 0 and 1 are ignored by defualt on OCP.

Which issue(s) this PR fixes:

Fixes #672

Does this PR have test?

Yes, an e2e test was added.

Special notes for your reviewer:

I'll point a question inline.

Does this PR introduce a user-facing change?

The spod CR gains a new field webhookOptions which allows the webhooks' failurePolicy and namespaceSelector to be configurable.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 4, 2022
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 4, 2022
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 4, 2022
@jhrozek jhrozek force-pushed the webhook-ns branch 2 times, most recently from bb5aae4 to d6b6d11 Compare April 4, 2022 20:07
installation-usage.md Outdated Show resolved Hide resolved
installation-usage.md Show resolved Hide resolved
@jhrozek
Copy link
Contributor Author

jhrozek commented Apr 5, 2022

/test pull-security-profiles-operator-test-e2e

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

Great, thank you!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 5, 2022
@saschagrunert
Copy link
Member

/test pull-security-profiles-operator-test-e2e

@jhrozek
Copy link
Contributor Author

jhrozek commented Apr 5, 2022

hmm, changing the verbosity seems to be flaky lately..not sure if it's related to this PR though...

@jhrozek
Copy link
Contributor Author

jhrozek commented Apr 5, 2022

/test pull-security-profiles-operator-test-e2e

@jhrozek
Copy link
Contributor Author

jhrozek commented Apr 5, 2022

oops, I can reproduce the issue locally. Stupid tests, finding issues in my code..

@jhrozek
Copy link
Contributor Author

jhrozek commented Apr 5, 2022

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 5, 2022
By default, our webhooks target all namespaces. While from a security
standpointm this is OK, because the webhooks react to our CRs and
therefore an explicit RBAC rule must be added to manage them, there is
still a risk that if there is a bug in the webhooks, the function of
critical namespaces might be affected.

This patch exposes the failureMode and the namespaceSelector as
configurable through a newly added webhookOptions object in the spod CR
to enable admins to select which namespaces should be watched by the
webhook and what should happen on failure.

In addition, namespace runlevels 0 and 1 are ignored by defualt on OCP.

Signed-off-by: Jakub Hrozek <jhrozek@redhat.com>
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 5, 2022
@jhrozek
Copy link
Contributor Author

jhrozek commented Apr 6, 2022

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 6, 2022
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 6, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jhrozek, saschagrunert

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:
  • OWNERS [jhrozek,saschagrunert]

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 merged commit de3017a into kubernetes-sigs:main Apr 6, 2022
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. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider restricting webhook namespaces to a subset
3 participants