Skip to content

Commit

Permalink
Merge pull request #120 from shafeeqes/enh/podsecurity
Browse files Browse the repository at this point in the history
Don't deploy `PSP`s when `PodSecurityPolicy` plugin is disabled
  • Loading branch information
ScheererJ authored Aug 22, 2022
2 parents 4f3fce1 + e698579 commit 6995f1a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions charts/internal/cilium/charts/agent/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,10 @@ spec:
{{- if and (eq .Release.Namespace "kube-system") (or (gt .Capabilities.KubeVersion.Minor "10") (gt .Capabilities.KubeVersion.Major "1"))}}
priorityClassName: system-node-critical
{{- end }}
securityContext:
fsGroup: 1
supplementalGroups:
- 1
serviceAccount: "cilium"
serviceAccountName: "cilium"
terminationGracePeriodSeconds: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ spec:
topologyKey: kubernetes.io/hostname
nodeSelector:
kubernetes.io/os: linux
securityContext:
fsGroup: 1
supplementalGroups:
- 1
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
containers:
- name: cilium-operator
command:
Expand Down
9 changes: 7 additions & 2 deletions pkg/charts/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,17 @@ func generateChartValues(config *ciliumv1alpha1.NetworkConfig, network *extensio
globalConfig.LocalRedirectPolicy.Enabled = true
}

// disable PSPs if it's disabled in the shoot
if helper.IsPSPDisabled(cluster.Shoot) {
globalConfig.Psp.Enabled = false
}

if config == nil {
return requirementsConfig, globalConfig, nil
}

// check if PSPs are enabled
if config.PSPEnabled != nil {
// do not overwrite if it's set to false before, otherwise use the value from the config
if globalConfig.Psp.Enabled && config.PSPEnabled != nil {
globalConfig.Psp.Enabled = *config.PSPEnabled
}

Expand Down

0 comments on commit 6995f1a

Please sign in to comment.