Skip to content

Commit 8f370dc

Browse files
geroplroboquat
authored andcommitted
[helm] registry-facade, ws-daemon: Add postStart and preStop lifecycle hooks akin to installer
Also, fix cluster-level bindings and roles
1 parent e4746d2 commit 8f370dc

File tree

5 files changed

+43
-4
lines changed

5 files changed

+43
-4
lines changed

chart/templates/registry-facade-clusterrole.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,11 @@ rules:
1717
verbs: ["use"]
1818
resourceNames:
1919
- {{ .Release.Namespace }}-ns-registry-facade
20+
- apiGroups: [""]
21+
resources: ["nodes"]
22+
verbs:
23+
- get
24+
- list
25+
- update
26+
- patch
2027
{{- end -}}

chart/templates/registry-facade-daemonset.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ spec:
5353
{{ include "gitpod.container.tracingEnv" $this | indent 8 }}
5454
- name: GRPC_GO_RETRY
5555
value: "on"
56+
- name: NODENAME
57+
valueFrom:
58+
fieldRef:
59+
fieldPath: spec.nodeName
5660
volumeMounts:
5761
- name: cache
5862
mountPath: "/mnt/cache"
@@ -71,6 +75,19 @@ spec:
7175
- name: https-certificates
7276
mountPath: "/mnt/certificates"
7377
{{- end }}
78+
lifecycle:
79+
postStart:
80+
exec:
81+
command:
82+
- /bin/bash
83+
- -c
84+
- kubectl label --overwrite nodes ${NODENAME} gitpod.io/registry-facade_ready_ns_${KUBE_NAMESPACE}=true
85+
preStop:
86+
exec:
87+
command:
88+
- /bin/bash
89+
- -c
90+
- kubectl label nodes ${NODENAME} gitpod.io/registry-facade_ready_ns_${KUBE_NAMESPACE}-
7491
{{ include "gitpod.kube-rbac-proxy" $this | indent 6 }}
7592
volumes:
7693
- name: cache

chart/templates/registry-facade-rolebinding.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Copyright (c) 2020 Gitpod GmbH. All rights reserved.
22
# Licensed under the MIT License. See License-MIT.txt in the project root for license information.
33

4-
kind: RoleBinding
4+
kind: ClusterRoleBinding
55
apiVersion: rbac.authorization.k8s.io/v1
66
metadata:
7-
name: registry-facade
7+
name: {{ .Release.Namespace }}-ns-registry-facade
88
labels:
99
app: {{ template "gitpod.fullname" . }}
1010
component: registry-facade
@@ -13,6 +13,7 @@ metadata:
1313
subjects:
1414
- kind: ServiceAccount
1515
name: registry-facade
16+
namespace: {{ .Release.Namespace }}
1617
roleRef:
1718
kind: ClusterRole
1819
name: {{ .Release.Namespace }}-ns-registry-facade

chart/templates/ws-daemon-daemonset.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,19 @@ spec:
288288
path: "/"
289289
initialDelaySeconds: 5
290290
periodSeconds: 10
291+
lifecycle:
292+
postStart:
293+
exec:
294+
command:
295+
- /bin/bash
296+
- -c
297+
- kubectl label --overwrite nodes ${NODENAME} gitpod.io/ws-daemon_ready_ns_${KUBE_NAMESPACE}=true
298+
preStop:
299+
exec:
300+
command:
301+
- /bin/bash
302+
- -c
303+
- kubectl label nodes ${NODENAME} gitpod.io/ws-daemon_ready_ns_${KUBE_NAMESPACE}-
291304
livenessProbe:
292305
httpGet:
293306
port: 9999

chart/templates/ws-daemon-rolebinding.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Copyright (c) 2020 Gitpod GmbH. All rights reserved.
22
# Licensed under the MIT License. See License-MIT.txt in the project root for license information.
33

4-
kind: RoleBinding
4+
kind: ClusterRoleBinding
55
apiVersion: rbac.authorization.k8s.io/v1
66
metadata:
7-
name: ws-daemon-rb
7+
name: {{ .Release.Namespace }}-ns-ws-daemon-rb
88
labels:
99
app: {{ template "gitpod.fullname" . }}
1010
component: ws-daemon
@@ -13,6 +13,7 @@ metadata:
1313
subjects:
1414
- kind: ServiceAccount
1515
name: ws-daemon
16+
namespace: {{ .Release.Namespace }}
1617
roleRef:
1718
kind: ClusterRole
1819
name: {{ .Release.Namespace }}-ns-ws-daemon

0 commit comments

Comments
 (0)