-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add restrictive security context to registry pod and init containers #7040
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
base: master
Are you sure you want to change the base?
Add restrictive security context to registry pod and init containers #7040
Conversation
Fixes operator-framework#7039 Signed-off-by: Tiger Kaovilai <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]> Signed-off-by: Tiger Kaovilai <[email protected]>
79fd63e to
e9a876b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances security by applying restrictive security contexts to init containers in the FBC registry pod, addressing issue #7039. Previously, only the main container received the restrictive security context when the --security-context-config=restricted flag was used.
Changes:
- Refactored security context creation into a reusable variable
- Added security context application to all init containers in the FBC registry pod
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Update all init containers with the same restrictive security context | ||
| for i := range f.pod.Spec.InitContainers { | ||
| f.pod.Spec.InitContainers[i].SecurityContext = restrictedSecurityContext | ||
| } |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new functionality that applies the restrictive security context to init containers lacks test coverage. The test file fbc_registry_pod_test.go has comprehensive tests for other functionality but does not verify that init containers receive the security context when SecurityContext is set to 'restricted'. Consider adding a test case that creates an FBCRegistryPod with SecurityContext: 'restricted' and verifies that both the main container and init containers have the expected security context settings.
Fixes #7039
Signed-off-by: Tiger Kaovilai [email protected]
Description of the change:
Motivation for the change:
Checklist
If the pull request includes user-facing changes, extra documentation is required:
changelog/fragments(seechangelog/fragments/00-template.yaml)website/content/en/docs