Skip to content

Commit 83d31d8

Browse files
committed
charts: Permit setting hostUsers for deployment
Signed-off-by: Pat Riehecky <riehecky@fnal.gov>
1 parent 187805e commit 83d31d8

25 files changed

+162
-0
lines changed

charts/headlamp/README.md

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

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

164167
| 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: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
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+
- "-in-cluster-context-name=main"
114+
- "-plugins-dir=/headlamp/plugins"
115+
# Check if externalSecret is disabled
116+
ports:
117+
- name: http
118+
containerPort: 4466
119+
protocol: TCP
120+
livenessProbe:
121+
httpGet:
122+
path: "/"
123+
port: http
124+
readinessProbe:
125+
httpGet:
126+
path: "/"
127+
port: http
128+
resources:
129+
{}

charts/headlamp/tests/expected_templates/httproute-enabled.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-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
@@ -95,6 +95,7 @@ spec:
9595
spec:
9696
serviceAccountName: headlamp
9797
automountServiceAccountToken: true
98+
hostUsers: true
9899
securityContext:
99100
{}
100101
containers:

0 commit comments

Comments
 (0)