Skip to content

Commit 26ba364

Browse files
committed
Keep .Values.executor.securityContext, to prevent making a potentially breaking change
1 parent 5d3b274 commit 26ba364

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

charts/sourcegraph-executor/k8s/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ In addition to the documented values, the `executor` and `private-docker-registr
5454
|-----|------|---------|-------------|
5555
| executor.affinity | object | `{}` | Affinity, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) |
5656
| executor.configureRbac | bool | `true` | Whether to configure the necessary RBAC resources. Required only once for all executor deployments. |
57+
| executor.containerSecurityContext | object | `{}` | Override container security context for the executor container. learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) |
5758
| executor.debug.keepJobs | string | `"false"` | If true, Kubernetes jobs will not be deleted after they complete. Not recommended for production use as it can hit cluster limits. |
5859
| executor.debug.keepWorkspaces | string | `"false"` | |
5960
| executor.defaultContainerSecurityContext | object | `{"privileged":false}` | Default container security context for the executor container |
@@ -97,7 +98,7 @@ In addition to the documented values, the `executor` and `private-docker-registr
9798
| executor.resources.limits.memory | string | `"1Gi"` | |
9899
| executor.resources.requests.cpu | string | `"500m"` | |
99100
| executor.resources.requests.memory | string | `"200Mi"` | |
100-
| executor.securityContext | object | `{}` | Override container security context for the executor container. learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) |
101+
| executor.securityContext | object | `{}` | (DEPRECATED) Legacy override for container security context. Use containerSecurityContext instead. Kept for backwards compatibility; containerSecurityContext takes precedence if both are set. |
101102
| executor.storageSize | string | `"10Gi"` | The storage size of the PVC attached to the executor deployment. |
102103
| executor.tolerations | list | `[]` | Tolerations, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) |
103104
| sourcegraph.affinity | object | `{}` | Affinity, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) |

charts/sourcegraph-executor/k8s/templates/_helpers/_securityContext.tpl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ Security context helpers for container and pod security contexts.
55
These helpers implement a 3-tier merge precedence:
66
1. Component default (e.g., .Values.executor.defaultContainerSecurityContext)
77
2. Global override (e.g., .Values.sourcegraph.containerSecurityContext)
8-
3. Component override (e.g., .Values.executor.securityContext for container, .Values.executor.podSecurityContext for pod)
8+
3. Component override (e.g., .Values.executor.containerSecurityContext for container, .Values.executor.podSecurityContext for pod)
9+
10+
For backwards compatibility, .Values.<component>.securityContext is also supported for container
11+
security context and merged before containerSecurityContext (so containerSecurityContext takes precedence).
912
1013
Later values override earlier ones, allowing customers to:
1114
- Set global security context settings that apply to all components
@@ -37,8 +40,9 @@ Parameters:
3740
{{- end -}}
3841
{{- $default := $component.defaultContainerSecurityContext | default dict -}}
3942
{{- $global := $root.Values.sourcegraph.containerSecurityContext | default dict -}}
40-
{{- $override := $component.securityContext | default dict -}}
41-
{{- $merged := mustMergeOverwrite (deepCopy $default) $global $override -}}
43+
{{- $legacyOverride := $component.securityContext | default dict -}}
44+
{{- $override := $component.containerSecurityContext | default dict -}}
45+
{{- $merged := mustMergeOverwrite (deepCopy $default) $global $legacyOverride $override -}}
4246
{{- if $merged | keys | len | ne 0 }}
4347
{{ "securityContext:" | indent $indent }}
4448
{{ toYaml $merged | indent (int (add $indent 2)) -}}

charts/sourcegraph-executor/k8s/values.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,12 @@ executor:
112112
# -- Default container security context for the executor container
113113
defaultContainerSecurityContext:
114114
privileged: false
115+
# -- (DEPRECATED) Legacy override for container security context. Use containerSecurityContext instead.
116+
# Kept for backwards compatibility; containerSecurityContext takes precedence if both are set.
117+
securityContext: {}
115118
# -- Override container security context for the executor container.
116119
# learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container)
117-
securityContext: {}
120+
containerSecurityContext: {}
118121
# -- Default pod security context for the executor pod
119122
defaultPodSecurityContext: {}
120123
# -- Override pod security context for the executor pod

0 commit comments

Comments
 (0)