136 lines
4.9 KiB
YAML
136 lines
4.9 KiB
YAML
{{- $searchPath := ":global.kolla.iscsid.daemonset:global.kolla.iscsid.all:global.kolla.all" }}
|
|
{{- $imagePullPolicy := include "kolla_val_get_str" (dict "key" "image_pull_policy" "searchPath" $searchPath "Values" .Values ) }}
|
|
{{- $containerConfigDirectory := include "kolla_val_get_str" (dict "key" "container_config_directory" "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 ) }}
|
|
{{- $c := dict "searchPath" $searchPath "Values" .Values }}
|
|
{{- $_ := set $c "contName" "iscsid" }}
|
|
{{- $_ := set $c "imageName" "image_full" }}
|
|
{{- $_ := set $c "tagName" "image_tag" }}
|
|
{{- $imageFull := include "kolla_build_image_full" $c }}
|
|
{{- $resourceName := "iscsid" }}
|
|
{{- $netHostTrue := true }}
|
|
{{- $podTypeBootstrap := false }}
|
|
{{- $elementName := .Values.element_name | default $resourceName }}
|
|
{{- with $env := dict "netHostTrue" $netHostTrue "podTypeBootstrap" $podTypeBootstrap "resourceName" $resourceName "Values" .Values "Release" .Release "searchPath" $searchPath }}
|
|
apiVersion: extensions/v1beta1
|
|
kind: DaemonSet
|
|
metadata:
|
|
name: {{ $elementName }}
|
|
labels:
|
|
component: iscsid
|
|
system: iscsid
|
|
spec:
|
|
template:
|
|
metadata:
|
|
labels:
|
|
component: iscsid
|
|
system: iscsid
|
|
annotations:
|
|
pod.beta.kubernetes.io/init-containers: '[
|
|
{{- include "common_dependency_container_multi" $env | indent 10 }}
|
|
{
|
|
"name": "initialize-iscsid",
|
|
"image": "{{ $imageFull }}",
|
|
"imagePullPolicy": {{ $imagePullPolicy | quote }},
|
|
"command": [
|
|
"bash",
|
|
"-ce",
|
|
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
|
|
ls -l /etc/iscsi || true;
|
|
cp -a /etc/iscsi/iscsid.conf /srv/pod-main-config/;
|
|
"],
|
|
"volumeMounts": [
|
|
{
|
|
"name": "iscsid-configmap",
|
|
"mountPath": "/srv/configmap"
|
|
},
|
|
{
|
|
"name": "pod-main-config",
|
|
"mountPath": "/srv/pod-main-config"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "initialize-iscsi-iqn",
|
|
"image": "{{ $imageFull }}",
|
|
"imagePullPolicy": {{ $imagePullPolicy | quote }},
|
|
"securityContext": {
|
|
"runAsUser": 0,
|
|
"privileged": true
|
|
},
|
|
"command": [
|
|
"bash",
|
|
"-ce",
|
|
"cp -a /srv/pod-main-config/iscsid.conf /etc/iscsi/iscsid.conf;
|
|
if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then
|
|
iqn=$( cat /dev/urandom | tr -dc ''a-f0-9'' | head -c 12 );
|
|
echo InitiatorName=iqn.2010-10.org.openstack:$iqn > /etc/iscsi/initiatorname.iscsi;
|
|
chmod 640 /etc/iscsi/initiatorname.iscsi;
|
|
fi;
|
|
"],
|
|
"volumeMounts": [
|
|
{
|
|
"name": "iscsi-info",
|
|
"mountPath": "/etc/iscsi"
|
|
},
|
|
{
|
|
"name": "pod-main-config",
|
|
"mountPath": "/srv/pod-main-config"
|
|
}
|
|
]
|
|
}
|
|
]'
|
|
spec:
|
|
hostNetwork: True
|
|
hostIPC: True
|
|
nodeSelector:
|
|
{{ $selectorKey }}: {{ $selectorValue | quote }}
|
|
containers:
|
|
- image: "{{ $imageFull }}"
|
|
imagePullPolicy: {{ $imagePullPolicy | quote }}
|
|
name: main
|
|
securityContext:
|
|
privileged: true
|
|
env:
|
|
{{- include "common_env_vars" $env | indent 12 }}
|
|
volumeMounts:
|
|
{{- include "common_volume_mounts" $env | indent 12 }}
|
|
- mountPath: {{ $containerConfigDirectory }}
|
|
name: pod-main-config
|
|
readOnly: true
|
|
- mountPath: /run
|
|
name: run
|
|
- mountPath: /dev
|
|
name: dev
|
|
- mountPath: /sys/fs/cgroup
|
|
name: sys-fs-cgroup
|
|
- mountPath: /lib/modules
|
|
name: lib-modules
|
|
- mountPath: /etc/iscsi
|
|
name: iscsi-info
|
|
{{- include "common_containers" . | indent 8 }}
|
|
volumes:
|
|
{{- include "common_volumes" . | indent 8 }}
|
|
- name: pod-main-config
|
|
emptyDir: {}
|
|
- name: iscsid-configmap
|
|
configMap:
|
|
name: {{ $elementName }}
|
|
- name: lib-modules
|
|
hostPath:
|
|
path: /lib/modules
|
|
- name: run
|
|
hostPath:
|
|
path: /run
|
|
- name: dev
|
|
hostPath:
|
|
path: /dev
|
|
- name: sys-fs-cgroup
|
|
hostPath:
|
|
path: /sys/fs/cgroup
|
|
- name: iscsi-info
|
|
hostPath:
|
|
path: /var/lib/kolla/iscsi
|
|
{{- end }}
|