Skip to content

Commit 7c4fe7f

Browse files
committed
charts: Permit setting hostUsers for deployment
Signed-off-by: Pat Riehecky <riehecky@fnal.gov>
1 parent 85e434d commit 7c4fe7f

24 files changed

+160
-0
lines changed

charts/headlamp/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ config:
150150
| clusterRoleBinding.create | bool | `true` | Create cluster role binding |
151151
| clusterRoleBinding.clusterRoleName | string | `"cluster-admin"` | Kubernetes ClusterRole name |
152152
| clusterRoleBinding.annotations | object | `{}` | Cluster role binding annotations |
153+
| hostUsers | bool | `true` | Run in host uid namespace |
153154
| podSecurityContext | object | `{}` | Pod security context (e.g., fsGroup: 2000) |
154155
| securityContext.runAsNonRoot | bool | `true` | Run container as non-root |
155156
| securityContext.privileged | bool | `false` | Run container in privileged mode |
@@ -158,6 +159,8 @@ config:
158159
| securityContext.capabilities | object | `{}` | Container capabilities (e.g., drop: [ALL]) |
159160
| securityContext.readOnlyRootFilesystem | bool | `false` | Mount root filesystem as read-only |
160161

162+
NOTE: for `hostUsers=false` user namespaces must be supported. See: https://kubernetes.io/docs/concepts/workloads/pods/user-namespaces/
163+
161164
### Storage Configuration
162165

163166
| Key | Type | Default | Description |

charts/headlamp/templates/deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ spec:
8181
{{- end }}
8282
serviceAccountName: {{ include "headlamp.serviceAccountName" . }}
8383
automountServiceAccountToken: {{ .Values.automountServiceAccountToken }}
84+
hostUsers: {{ .Values.hostUsers }}
8485
securityContext:
8586
{{- toYaml .Values.podSecurityContext | nindent 8 }}
8687
{{- with .Values.initContainers }}

charts/headlamp/tests/expected_templates/azure-oidc-with-validators.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ spec:
8585
spec:
8686
serviceAccountName: headlamp
8787
automountServiceAccountToken: true
88+
hostUsers: true
8889
securityContext:
8990
{}
9091
containers:

charts/headlamp/tests/expected_templates/default.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ spec:
9494
spec:
9595
serviceAccountName: headlamp
9696
automountServiceAccountToken: true
97+
hostUsers: true
9798
securityContext:
9899
{}
99100
containers:

charts/headlamp/tests/expected_templates/extra-args.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ spec:
9494
spec:
9595
serviceAccountName: headlamp
9696
automountServiceAccountToken: true
97+
hostUsers: true
9798
securityContext:
9899
{}
99100
containers:

charts/headlamp/tests/expected_templates/extra-manifests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ spec:
111111
spec:
112112
serviceAccountName: headlamp
113113
automountServiceAccountToken: true
114+
hostUsers: true
114115
securityContext:
115116
{}
116117
containers:
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
# Source: headlamp/templates/serviceaccount.yaml
3+
apiVersion: v1
4+
kind: ServiceAccount
5+
metadata:
6+
name: headlamp
7+
namespace: default
8+
labels:
9+
helm.sh/chart: headlamp-0.39.0
10+
app.kubernetes.io/name: headlamp
11+
app.kubernetes.io/instance: headlamp
12+
app.kubernetes.io/version: "0.39.0"
13+
app.kubernetes.io/managed-by: Helm
14+
---
15+
# Source: headlamp/templates/secret.yaml
16+
apiVersion: v1
17+
kind: Secret
18+
metadata:
19+
name: oidc
20+
namespace: default
21+
type: Opaque
22+
data:
23+
---
24+
# Source: headlamp/templates/clusterrolebinding.yaml
25+
apiVersion: rbac.authorization.k8s.io/v1
26+
kind: ClusterRoleBinding
27+
metadata:
28+
name: headlamp-admin
29+
labels:
30+
helm.sh/chart: headlamp-0.39.0
31+
app.kubernetes.io/name: headlamp
32+
app.kubernetes.io/instance: headlamp
33+
app.kubernetes.io/version: "0.39.0"
34+
app.kubernetes.io/managed-by: Helm
35+
roleRef:
36+
apiGroup: rbac.authorization.k8s.io
37+
kind: ClusterRole
38+
name: cluster-admin
39+
subjects:
40+
- kind: ServiceAccount
41+
name: headlamp
42+
namespace: default
43+
---
44+
# Source: headlamp/templates/service.yaml
45+
apiVersion: v1
46+
kind: Service
47+
metadata:
48+
name: headlamp
49+
namespace: default
50+
labels:
51+
helm.sh/chart: headlamp-0.39.0
52+
app.kubernetes.io/name: headlamp
53+
app.kubernetes.io/instance: headlamp
54+
app.kubernetes.io/version: "0.39.0"
55+
app.kubernetes.io/managed-by: Helm
56+
spec:
57+
type: ClusterIP
58+
59+
ports:
60+
- port: 80
61+
targetPort: http
62+
protocol: TCP
63+
name: http
64+
selector:
65+
app.kubernetes.io/name: headlamp
66+
app.kubernetes.io/instance: headlamp
67+
---
68+
# Source: headlamp/templates/deployment.yaml
69+
# This block of code is used to extract the values from the env.
70+
# This is done to check if the values are non-empty and if they are, they are used in the deployment.yaml.
71+
72+
apiVersion: apps/v1
73+
kind: Deployment
74+
metadata:
75+
name: headlamp
76+
namespace: default
77+
labels:
78+
helm.sh/chart: headlamp-0.39.0
79+
app.kubernetes.io/name: headlamp
80+
app.kubernetes.io/instance: headlamp
81+
app.kubernetes.io/version: "0.39.0"
82+
app.kubernetes.io/managed-by: Helm
83+
spec:
84+
replicas: 1
85+
selector:
86+
matchLabels:
87+
app.kubernetes.io/name: headlamp
88+
app.kubernetes.io/instance: headlamp
89+
template:
90+
metadata:
91+
labels:
92+
app.kubernetes.io/name: headlamp
93+
app.kubernetes.io/instance: headlamp
94+
spec:
95+
serviceAccountName: headlamp
96+
automountServiceAccountToken: true
97+
hostUsers: false
98+
securityContext:
99+
{}
100+
containers:
101+
- name: headlamp
102+
securityContext:
103+
privileged: false
104+
runAsGroup: 101
105+
runAsNonRoot: true
106+
runAsUser: 100
107+
image: "ghcr.io/headlamp-k8s/headlamp:v0.39.0"
108+
imagePullPolicy: IfNotPresent
109+
110+
env:
111+
args:
112+
- "-in-cluster"
113+
- "-plugins-dir=/headlamp/plugins"
114+
# Check if externalSecret is disabled
115+
ports:
116+
- name: http
117+
containerPort: 4466
118+
protocol: TCP
119+
livenessProbe:
120+
httpGet:
121+
path: "/"
122+
port: http
123+
readinessProbe:
124+
httpGet:
125+
path: "/"
126+
port: http
127+
resources:
128+
{}

charts/headlamp/tests/expected_templates/me-user-info-url-directly.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ spec:
9494
spec:
9595
serviceAccountName: headlamp
9696
automountServiceAccountToken: true
97+
hostUsers: true
9798
securityContext:
9899
{}
99100
containers:

charts/headlamp/tests/expected_templates/me-user-info-url.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ spec:
9494
spec:
9595
serviceAccountName: headlamp
9696
automountServiceAccountToken: true
97+
hostUsers: true
9798
securityContext:
9899
{}
99100
containers:

charts/headlamp/tests/expected_templates/namespace-override-oidc-create-secret.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ spec:
9898
spec:
9999
serviceAccountName: headlamp
100100
automountServiceAccountToken: true
101+
hostUsers: true
101102
securityContext:
102103
{}
103104
containers:

0 commit comments

Comments
 (0)