kolla-kubernetes/helm/microservice/ceph-rbd-daemonset/templates/ceph-rbd-daemonset.yaml

93 lines
3.3 KiB
YAML

{{- $resourceName := "ceph-rbd" }}
{{- $searchPath := ":global.kolla.ceph.rbd.daemonset:global.kolla.ceph.rbd.all:global.kolla.ceph.all:global.kolla.all" }}
{{- $c := dict "searchPath" $searchPath "Values" .Values }}
{{- $_ := set $c "contName" "ceph-mon" }}
{{- $_ := set $c "imageName" "image_full" }}
{{- $_ := set $c "tagName" "image_tag" }}
{{- $imageFull := include "kolla_build_image_full" $c }}
{{- $imagePullPolicy := include "kolla_val_get_str" (dict "key" "image_pull_policy" "searchPath" $searchPath "Values" .Values ) }}
{{- $selectorKey := include "kolla_val_get_str" (dict "key" "selector_key" "searchPath" $searchPath "Values" .Values ) }}
{{- $selectorValue := include "kolla_val_get_str" (dict "key" "selector_value" "searchPath" $searchPath "Values" .Values ) }}
{{- $netHostTrue := true }}
{{- $podTypeBootstrap := false }}
{{- with $env := dict "netHostTrue" $netHostTrue "podTypeBootstrap" false "resourceName" $resourceName "Values" .Values "Release" .Release "searchPath" $searchPath }}
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: ceph-rbd
labels:
component: ceph
system: rbd
spec:
template:
metadata:
labels:
component: ceph
system: rbd
spec:
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: True
hostPID: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}
name: main
securityContext:
privileged: true
command:
- /bin/bash
- -xec
- |
modprobe rbd;
if [ -x /host/rbd ]; then
grep label=io.kubernetes.pod.namespace /host/rbd > /dev/null && rm -f /host/rbd
fi
if [ ! -x /host/rbd ]; then
echo IyEvYmluL2Jhc2gKCg== | base64 -d > /host/rbd;
echo 'ID=$(docker ps -q -f label=io.kubernetes.pod.namespace='$POD_NAMESPACE' -f label=io.kubernetes.pod.name='$POD_NAME' -f label=io.kubernetes.container.name=main);' >> /host/rbd;
echo 'docker exec --privileged -u 0 -i $ID /usr/bin/rbd "$@"' >> /host/rbd;
chmod +x /host/rbd;
fi;
while true; do sleep 1000; done
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
volumeMounts:
{{- include "common_volume_mounts" $env | indent 12 }}
- mountPath: /host/
name: host-usr-bin
- mountPath: /dev
name: host-dev
- mountPath: /sys
name: host-sys
- mountPath: /etc
name: host-etc
- mountPath: /lib/modules
name: lib-modules
volumes:
{{- include "common_volumes" . | indent 8 }}
- name: host-usr-bin
hostPath:
path: /usr/bin
- name: host-dev
hostPath:
path: /dev
- name: host-sys
hostPath:
path: /sys
- name: host-etc
hostPath:
path: /etc
- name: lib-modules
hostPath:
path: /lib/modules
{{- end }}