Skip to content

Commit

Permalink
Add helm value to disable securityContext (#2981)
Browse files Browse the repository at this point in the history
The securityContext needs to be disabled to allow for debugging with a
debugger.
However it should be possible to run debug logs with security contexts enabled.
  • Loading branch information
manno authored Oct 23, 2024
1 parent bf50628 commit ba017fc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions charts/fleet/ci/debug-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ metrics:
debug: true
debugLevel: 4
propagateDebugSettingsToAgents: true
disableSecurityContext: true

cpuPprof:
period: "60s"
Expand Down
11 changes: 7 additions & 4 deletions charts/fleet/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ spec:
- --debug
- --debug-level
- {{ quote $.Values.debugLevel }}
{{- else }}
{{- end }}
{{- if not $.Values.disableSecurityContext }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
Expand Down Expand Up @@ -149,7 +150,8 @@ spec:
- --debug
- --debug-level
- {{ quote $.Values.debugLevel }}
{{- else }}
{{- end }}
{{- if not $.Values.disableSecurityContext }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
Expand Down Expand Up @@ -194,7 +196,8 @@ spec:
- --debug
- --debug-level
- {{ quote $.Values.debugLevel }}
{{- else }}
{{- end }}
{{- if not $.Values.disableSecurityContext }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
Expand Down Expand Up @@ -226,7 +229,7 @@ spec:
priorityClassName: "{{$.Values.priorityClassName}}"
{{- end }}

{{- if not $.Values.debug }}
{{- if not $.Values.disableSecurityContext }}
securityContext:
runAsNonRoot: true
runAsUser: 1000
Expand Down
5 changes: 3 additions & 2 deletions charts/fleet/templates/deployment_gitjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ spec:
{{- if $.Values.debug }}
- name: CATTLE_DEV_MODE
value: "true"
{{- else }}
{{- end }}
{{- if not $.Values.disableSecurityContext }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
Expand Down Expand Up @@ -122,7 +123,7 @@ spec:
priorityClassName: "{{$.Values.priorityClassName}}"
{{- end }}

{{- if not $.Values.debug }}
{{- if not $.Values.disableSecurityContext }}
securityContext:
runAsNonRoot: true
runAsUser: 1000
Expand Down
1 change: 1 addition & 0 deletions charts/fleet/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ metrics:
debug: false
debugLevel: 0
propagateDebugSettingsToAgents: true
disableSecurityContext: false

migrations:
clusterRegistrationCleanup: true
Expand Down

0 comments on commit ba017fc

Please sign in to comment.