feat(sec) add securitycontext restrictions #909
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Updates the container security context defaults with various settings.
Didn't stick the whole thing in the readme since it'd look a bit silly.
Which issue this PR fixes
Part of Kong/kubernetes-ingress-controller#4102
Special notes for your reviewer:
These settings apply the restricted pod security standard. Namespaces with restricted standards enforced will accept chart Pods with these settings in place.
The
containerSecurityContext
from values.yaml applies to all chart-managed containers equally. We do not support different security contexts for KIC and Kong containers.The
runAsUser
setting is set to align with the current proxy image user ID, though I am basing this off partial knowledge of the build process and waiting on gateway team confirmation. The controller currently uses a different UID, but I intend to change that in Kong/kubernetes-ingress-controller#4911.Basic testing suggested a mismatch between the controller image and
runAsUser
ID doesn't actually matter, which makes sense--our executable is world-executable and doesn't need to do anything on the filesystem. The Kong image has many more relevant files, though anything it writes all goes in emptydirs.AFAIK there is no reason we should need any of the restricted capabilities under normal circumstances. As the context settings are part of values.yaml, they can be adjusted if you need to.
Checklist
[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]
main
branch.