Make operator security contexts configurable and restricted Pod Security compliant#45
Open
alexandergott-afk wants to merge 4 commits into
Open
Make operator security contexts configurable and restricted Pod Security compliant#45alexandergott-afk wants to merge 4 commits into
alexandergott-afk wants to merge 4 commits into
Conversation
|
Hi, thank you for submitting this pull request. In order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at https://oca.opensource.oracle.com/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR makes the MySQL Operator Helm chart compatible with namespaces enforcing the Kubernetes restricted Pod Security Standard.
The operator Deployment previously hardcoded both pod-level and container-level securityContext values, but did not set seccompProfile.type. This causes pod creation to fail in namespaces labeled with:
pod-security.kubernetes.io/enforce=restrictedThe Kubernetes restricted profile requires workloads to use an allowed seccomp profile such as RuntimeDefault or Localhost, and also requires settings such as non-root execution, disabled privilege escalation, and dropped capabilities. [kubernetes.io]
This change adds configurable Helm values for:
and sets secure defaults including:
Problem
When installing the chart into a namespace enforcing the restricted Pod Security Standard, the operator pod is rejected with an error similar to:
The chart currently hardcodes security contexts in the Deployment template:
and:
However, seccompProfile.type is missing.
Additionally, because these security contexts are not exposed through values.yaml, users cannot fix the issue through Helm values.
Solution
This PR:
Adds podSecurityContext to values.yaml
Adds containerSecurityContext to values.yaml
Uses these values in the Deployment template
Sets
seccompProfile.type: RuntimeDefaultby defaultThis keeps the chart secure by default while allowing users to override security context settings through Helm.