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

securityContext for containers is ignored if useStrictSecurity is not defined. #1184

Closed
f41gh7 opened this issue Dec 7, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@f41gh7
Copy link
Collaborator

f41gh7 commented Dec 7, 2024

Currently, operator ignores securityContext for containers. But it adds securityContext to the pods. Which caused by improper check for useStrictSecurity

https://github.com/VictoriaMetrics/operator/blob/master/internal/controller/operator/factory/build/security.go#L44

Current workaround is to set useStrictSecurity: true.

@f41gh7 f41gh7 added the bug Something isn't working label Dec 7, 2024
@f41gh7 f41gh7 self-assigned this Dec 7, 2024
f41gh7 added a commit that referenced this issue Dec 8, 2024
 Previously, with `useStrictSecurity: false` or undefined, explicitly configured
`spec.securityContext` options were ignored for `containers`.

 This commit takes in account `useStrictSecurity` setting and properly
add explicit `securityContext` configuration.

 It improves code readibilty by removing unneded
`container.securityContext != nil` checks and makes
configuration more obvious.

 Commit also adds `privileged: false` as default `container`
`securityContext` setting. It's applied with `useStrictSecurity: true`.
It's needed to pass various security rules checks at `AKS`.

Related issue:
#1184

Signed-off-by: f41gh7 <[email protected]>
@f41gh7 f41gh7 added the waiting for release The change was merged to upstream, but wasn't released yet. label Dec 8, 2024
@f41gh7
Copy link
Collaborator Author

f41gh7 commented Dec 19, 2024

The issue was fixed at v0.51.1 release

@f41gh7 f41gh7 closed this as completed Dec 19, 2024
@f41gh7 f41gh7 removed the waiting for release The change was merged to upstream, but wasn't released yet. label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant