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

feat: Consume policy-server-root-ca Secret in auditScanner Cronjob #265

Merged
merged 3 commits into from
Jul 31, 2023

Conversation

viccuad
Copy link
Member

@viccuad viccuad commented Jul 27, 2023

Description

Partial implementation of kubewarden/audit-scanner#64
Needs an audit-scanner image with kubewarden/audit-scanner#75

This is done with a volumeMount. The policy-server-root-ca is created by the kubewarden-controller deployment, but only when there is a policy-server. This means that the first installation of kubewarden-controller chart will deploy an audit-scanner cronjob that will continously fail, until there's a policy-server instantiated (normally when one installs the kubewarden-default chart).

This doesn't need to be this way, we can change the kubewarden-controller reconcile loop so it creates the ca secret without needing a policy-server first.

Test

Tested locally, needs kubewarden/audit-scanner#75

Additional Information

Tradeoff

Potential improvement

This is done with a volumeMount. The `policy-server-root-ca` is created
by the kubewarden-controller deployment, but only when there is a
policy-server. This means that the first installation of
kubearden-controller chart will deploy an audit-scanner cronjob that
will continously fail, until there's a policy-server instantiated.

This doesn't need to be this way, we can change the
kubewarden-controller reconcile loop so it creates the ca secret without
needing a policy-server first.

Signed-off-by: Víctor Cuadrado Juan <[email protected]>
@viccuad viccuad requested a review from a team as a code owner July 27, 2023 17:04
@viccuad viccuad self-assigned this Jul 27, 2023
@viccuad
Copy link
Member Author

viccuad commented Jul 28, 2023

e2e tests fail expectedly, as they aren't consuming the yet unmerged changes needed for audit-scanner.

Copy link
Member

@flavio flavio left a comment

Choose a reason for hiding this comment

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

This mounts the contents of the entire secret into the Pod, that includes also the private key used by the CA, which is dangerous.

Please, project only the policy-server-root-ca.policy-server-root-ca-pem into the pod.
This describes how to do that.

Signed-off-by: Víctor Cuadrado Juan <[email protected]>
@viccuad
Copy link
Member Author

viccuad commented Jul 28, 2023

Consumed the root-ca via the new --extra-ca flag, removed the env var setting.
Mounted the secret by mounting only the coresponding key.

@viccuad viccuad requested a review from flavio July 28, 2023 15:02
@viccuad
Copy link
Member Author

viccuad commented Jul 31, 2023

Tested to be working with kubewarden/audit-scanner:latest.

Copy link
Member

@flavio flavio left a comment

Choose a reason for hiding this comment

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

Thanks for having done the changes I requested. LGTM

@viccuad viccuad merged commit 4f4b9f9 into kubewarden:main Jul 31, 2023
2 of 3 checks passed
@viccuad viccuad deleted the audit-certs branch July 31, 2023 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants