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

Added manual CSR approval flow #558

Merged

Conversation

sachinkumarsingh092
Copy link
Contributor

Signed-off-by: Sachin Kumar Singh [email protected]

What this PR does / why we need it:
It should be possible to approve CSR manually. For that, we will disable the ByoAdmission controller by applying it behind an environment variable. Now user can apply the variable MANUAL_CSR_APPROVAL=true to manually approve the CSR. By default, the controller will approve the CSRs.

File changes:

  • main.go: Put the ByoAdmission controller setup behind the MANUAL_CSR_APPROVAL environment variable.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #557

Additional information
I've disabled the cyclometric complexity form main() due to lots of inevitable if conditions that might even increase in the future and thus increase the complexity further.
Another way is to refactor the controller and webhook setup out of the main.

main.go Outdated Show resolved Hide resolved
@sachinkumarsingh092 sachinkumarsingh092 force-pushed the add-manual-csr-approval-flow branch from dc52a0b to 70d5eba Compare May 22, 2022 17:09
@sachinkumarsingh092 sachinkumarsingh092 force-pushed the add-manual-csr-approval-flow branch from 70d5eba to 9daecee Compare May 22, 2022 17:11
Copy link
Contributor

@dharmjit dharmjit left a comment

Choose a reason for hiding this comment

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

LGTM, we need to update docs for this environment variable and bootstrap kubeconfig flow in general. Could we add some tests for this behavior?

@sachinkumarsingh092
Copy link
Contributor Author

Should I write an e2e test for this? I don’t see any tests for the manager otherwise.

Copy link
Contributor

@anusha94 anusha94 left a comment

Choose a reason for hiding this comment

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

lgtm

@anusha94 anusha94 merged commit b09a31d into vmware-tanzu:main May 26, 2022
@sachinkumarsingh092 sachinkumarsingh092 deleted the add-manual-csr-approval-flow branch May 26, 2022 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow manual CSR approval
5 participants