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

fix: Don't create namespace on startup unless needed #110

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

arsenetar
Copy link
Contributor

@arsenetar arsenetar commented Dec 8, 2023

This changes the startup code for the secret store to not try to create the namespace as a way to check if it exists. Now it will only attempt if the namespace does not already exist. Submitting a create request can trigger admission webhooks. If there are namespace policies for jspolicy already deployed this can cause jspolicy to not be able to come back up if the deployment were scaled down or if no pods are running for some other reason. Without this change, the only way to recover is to delete any mutating/validating webhooks on namespaces* pointing to jspolicy and then the jspolicy pods will be able to start.

NOTE: In some cases namespae webhooks might exclude or only include certain namespaces. However the jspolicy namespace creation has no labels applied at submission time so label filters cannot exclude it appropriately if that is how the policies were set up. Inclusion filters of course would be less likely to be a problem.

This changes the startup code for the secret store to not try to create
the namespace as a way to check if it exists.  Now it will only attempt
if the namespace does not already exist.  Submitting a create request
can trigger admission webhooks.  If there are namespace policies for
jspolicy already deployed this can cause jspolicy to not be able to come
back up if the deployment were scaled down or if no pods are running for
some other reason.  Without this change, the only way to recover is to
delete any mutating/validating webhooks on namespaces* and then the
jspolicy pods will be able to start.

NOTE: In some cases namespae webhooks might exclude or only include
certain namespaces.  However the jspolicy namespace creation has no
labels applied at submission time so label filters cannot exclude it
appropriately if that is how the policies were set up.  Inclusion
filters of course would be less likely to be a problem.
Copy link

netlify bot commented Dec 8, 2023

👷 Deploy request for jspolicy-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 55ac4d1

@FabianKramm
Copy link
Member

@arsenetar thanks for the PR! LGTM!

@FabianKramm FabianKramm merged commit 3b396e5 into loft-sh:main Dec 12, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants