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

pkg/securitycontextconstraints/sccadmission: simplify retrieving SCCs #108

Conversation

s-urbaniak
Copy link
Contributor

This is scavanging a small portion of #107 where FindApplicableSCCs is invoked with the requested namespace but without a user. Hence, the current logic returns all SCCs. This indirection makes the current code hard to read.

This PR suggests to simplify it and list all SCCs instead which is the same logic.

/cc @stlaz

@openshift-ci openshift-ci bot requested a review from stlaz May 8, 2023 13:41
@s-urbaniak
Copy link
Contributor Author

/hold

@openshift-ci openshift-ci bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 8, 2023
@s-urbaniak
Copy link
Contributor Author

holding for final review

}
if len(sccs) == 0 {
return nil, "", nil, admission.NewForbidden(a, fmt.Errorf("no SecurityContextConstraints found in cluster"))
}
return nil, "", nil, admission.NewForbidden(a, fmt.Errorf("no SecurityContextConstraints found in namespace %s", a.GetNamespace()))
Copy link
Member

Choose a reason for hiding this comment

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

This error might be misleading in this case, as we're not really searching in the namespace but rather we list everything available to the cluster. Wouldn't this error (deleted above) be more appropriate?

return nil, "", nil, admission.NewForbidden(a, fmt.Errorf("no SecurityContextConstraints found in cluster"))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great suggestion, fixed 👍

@s-urbaniak s-urbaniak force-pushed the simplify-compute-security-context branch from 5770582 to 806f568 Compare May 8, 2023 14:37
@liouk
Copy link
Member

liouk commented May 8, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 8, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 8, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liouk, s-urbaniak

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

@stlaz
Copy link
Contributor

stlaz commented Jun 21, 2023

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 21, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 21, 2023

@s-urbaniak: all tests passed!

Full PR test history. Your PR dashboard.

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.

@openshift-merge-robot openshift-merge-robot merged commit a994128 into openshift:master Jun 21, 2023
4 checks passed
@s-urbaniak s-urbaniak deleted the simplify-compute-security-context branch June 26, 2023 09:09
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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants