What happened?
The v1alpha1 Instrumentation CRD schema does not include securityContext on the language-specific specs (e.g. spec.java.securityContext). This means there is no way to explicitly set the security context on auto-instrumentation init containers via the Instrumentation CR.
Relationship with #4848
This issue is related to but separate from #4848:
With the operator pinned to pre-v0.146.0, the implicit inheritance works as a workaround. But the CRD should support explicit configuration for:
- Deployments where the app container security context differs from what the init container needs
- GitOps workflows where the desired state should be fully declarative in the CR
- Validation tooling that checks CRD manifests against the schema
Steps to reproduce
- Create a namespace with
pod-security.kubernetes.io/enforce: restricted
- Apply an Instrumentation CR with
spec.java.securityContext set:
spec:
java:
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
seccompProfile:
type: RuntimeDefault
kubectl apply fails: strict decoding error: unknown field "spec.java.securityContext"
kubectl apply --server-side also fails: field not declared in schema
Expected behavior
The securityContext field should be included in the Instrumentation CRD schema for all language specs, so that the init container security context can be set explicitly.
Environment
Workaround
Pin the operator to pre-v0.146.0. The init container security context is inherited from the app container automatically. This breaks in v0.146.0+ due to #4848.
What happened?
The
v1alpha1Instrumentation CRD schema does not includesecurityContexton the language-specific specs (e.g.spec.java.securityContext). This means there is no way to explicitly set the security context on auto-instrumentation init containers via the Instrumentation CR.Relationship with #4848
This issue is related to but separate from #4848:
sdk.go).With the operator pinned to pre-v0.146.0, the implicit inheritance works as a workaround. But the CRD should support explicit configuration for:
Steps to reproduce
pod-security.kubernetes.io/enforce: restrictedspec.java.securityContextset:kubectl applyfails:strict decoding error: unknown field "spec.java.securityContext"kubectl apply --server-sidealso fails:field not declared in schemaExpected behavior
The
securityContextfield should be included in the Instrumentation CRD schema for all language specs, so that the init container security context can be set explicitly.Environment
0.108.0(latest)0.145.0(pinned to avoid Auto-instrumentation init container security context no longer inherited from app container #4848)restricted(enforce)Workaround
Pin the operator to pre-v0.146.0. The init container security context is inherited from the app container automatically. This breaks in v0.146.0+ due to #4848.