redpanda-data / helm-charts

Redpanda Helm Chart
http://redpanda.com
Apache License 2.0
73 stars 96 forks source link

`statefulset.{podS,s}ecurityContext` do not work as expected #1463

Open chrisseto opened 1 month ago

chrisseto commented 1 month ago

The statefulset.podSecurityContext and statefulset.securityContext fields have not work as one would expect for quite sometime. In the conversion to go, we preserved this behavior (and introduced other issues #1413).

The broken semantics are (roughly): podSecurityContext and securityContext are intermixed and partially applied (FSGroup, FSChangePolicy, RunAsUser, RunAsGroup, AllowPrivilegeEscalation, RunAsNonRoot) to all SecurityContexts and some PodSecurityContexts.

This is clearly less than ideal as:

This has left us in a bit of a bind as the most ideal field names are taken.

I'm currently leaning towards:

If any of these fields are provided, statefulset.podSecurityContext and statefulset.securityContext will be ignored. Then in a few releases, we'll remove these fields entirely.

JIRA Link: K8S-309

chrisseto commented 1 month ago

A large chunk of this has been fixed in https://github.com/redpanda-data/helm-charts/pull/1477 by deprecating these fields in favor of a the podTemplate fields.

We'll need to add support for setting the security context(s) of init containers and side cars before full closing this out.