Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code to ensure start order between controller/satellite/csi-node #33

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions helm/kube-linstor/templates/csi-node-daemonset.yaml
Expand Up @@ -16,6 +16,29 @@ spec:
app: {{ $fullName }}-csi-node
role: linstor-csi
spec:

initContainers:
## Wait for the satellite pod on this node to be ready -- it must be before the CSI node attempts
## to connect to it
- name: wait-for-satellite
image: bitnami/kubectl
imagePullPolicy: {{ .PullPolicy }}
command:
- /bin/sh
- -exc
- |
echo "[info] waiting for a pod with label [${SATELLITE_LABEL_SELECTOR}] in namespace [${SATELLITE_NAMESPACE}], on node [${NODE_NAME}]"
kubectl wait pod -n ${SATELLITE_NAMESPACE} -l ${SATELLITE_LABEL_SELECTOR} --field-selector spec.nodeName=${NODE_NAME} --for=condition=ready
env:
- name: SATELLITE_LABEL_SELECTOR
value: "app={{ $fullName }}-satellite"
- name: SATELLITE_NAMESPACE
value: {{ .Release.Namespace }}
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName

containers:
- name: csi-node-driver-registrar
{{- with .Values.csi.image.csiNodeDriverRegistrar }}
Expand Down
3 changes: 3 additions & 0 deletions helm/kube-linstor/templates/csi-node-rbac.yaml
Expand Up @@ -9,6 +9,9 @@ rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list"]
{{- if .Values.podSecurityPolicy.enabled }}
- apiGroups: ["extensions"]
resources: ["podsecuritypolicies"]
Expand Down
29 changes: 29 additions & 0 deletions helm/kube-linstor/templates/satellite-daemonset.yaml
Expand Up @@ -15,8 +15,34 @@ spec:
labels:
app: {{ $fullName }}-satellite
spec:

{{- if or .Values.satellite.ssl.enabled .Values.satellite.overwriteDrbdConf .Values.satellite.autoJoinNodes }}
initContainers:

## Wait for at least one controller to be ready -- a controller must be running for satellite to register with
- name: wait-for-controller
image: bitnami/kubectl
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -exc
- |
n=0
until [ $n -ge 30 ]; do
REPLICA_COUNT=$(kubectl get deploy/${CONTROLLER_DEPLOYMENT_NAME} -n ${CONTROLLER_NAMESPACE} -o template --template='{{ .status.availableReplicas }}')
if [ "${REPLICA_COUNT}" -gt "0" ] ; then
echo "[info] found ${REPLICA_COUNT} available replicas."
break
fi
echo -n "[info] waiting 10 seconds before trying again..."
sleep 10
done
env:
- name: CONTROLLER_DEPLOYMENT_NAME
value: "{{ $fullName }}-controller"
- name: CONTROLLER_NAMESPACE
value: {{ .Release.Namespace }}

{{- if .Values.satellite.ssl.enabled }}
- name: load-certs
{{- with .Values.satellite.image }}
Expand All @@ -42,6 +68,7 @@ spec:
- name: satellite-tls
mountPath: /tls/satellite
{{- end }}

{{- if .Values.satellite.overwriteDrbdConf }}
- command:
- /bin/sh
Expand All @@ -66,6 +93,7 @@ spec:
- name: usr-local-sbin
mountPath: /host-bin
{{- end }}

{{- if .Values.satellite.autoJoinNodes }}
- name: join-cluster
{{- with .Values.satellite.image }}
Expand Down Expand Up @@ -110,6 +138,7 @@ spec:
{{- end }}
{{- end }}
{{- end }}

containers:
- name: linstor-satellite
{{- with .Values.satellite.image }}
Expand Down
4 changes: 4 additions & 0 deletions helm/kube-linstor/templates/satellite-rbac.yaml
Expand Up @@ -15,6 +15,10 @@ rules:
resources: ["podsecuritypolicies"]
resourceNames: ["{{ $fullName }}"]
verbs: ["use"]
- apiGroups: ["apps"]
resources: ["deployments"]
resourceNames: ["{{ $fullName }}-controller"]
verbs: ["get"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
Expand Down