108 lines
4.3 KiB
YAML
108 lines
4.3 KiB
YAML
{{- $resourceName := "tgtd" }}
|
|
{{- $netHostTrue := true }}
|
|
{{- $podTypeBootstrap := false }}
|
|
{{- $elementName := .Values.element_name | default $resourceName }}
|
|
{{- $searchPath := printf ":global.kolla.%s.daemonset:global.kolla.tgtd.daemonset:global.kolla.%s.all:global.kolla.tgtd.all:global.kolla.all" $elementName $elementName }}
|
|
{{- $c := dict "searchPath" $searchPath "Values" .Values }}
|
|
{{- $_ := set $c "contName" "tgtd" }}
|
|
{{- $_ := 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 ) }}
|
|
{{- $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 ) }}
|
|
{{- $storageInterface := include "kolla_val_get_str" (dict "key" "storage_interface" "searchPath" $searchPath "Values" .Values ) }}
|
|
{{- 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: tgtd
|
|
system: tgtd
|
|
spec:
|
|
template:
|
|
metadata:
|
|
labels:
|
|
component: tgtd
|
|
system: tgtd
|
|
spec:
|
|
dnsPolicy: ClusterFirstWithHostNet
|
|
hostNetwork: True
|
|
hostIPC: True
|
|
nodeSelector:
|
|
{{ $selectorKey }}: {{ $selectorValue | quote }}
|
|
initContainers:
|
|
{{- include "common_dependency_container" $env | indent 8 }}
|
|
- name: initialize-tgtd
|
|
image: {{ include "kolla_toolbox_image_full" . | quote }}
|
|
imagePullPolicy: {{ $imagePullPolicy | quote }}
|
|
command:
|
|
- sh
|
|
- -ce
|
|
- |
|
|
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
|
|
STORAGE_INTERFACE={{ $storageInterface }};
|
|
F=/var/lib/kolla-kubernetes/tgtd/storage_interface;
|
|
[ -f $F ] && STORAGE_INTERFACE=$(<$F);
|
|
storage_ip=$(ip addr list "$STORAGE_INTERFACE" | grep 'inet ' |cut -d' ' -f6|cut -d/ -f1);
|
|
jq '.command = "tgtd -d 1 -f --iscsi portal='$storage_ip':3260"' /srv/configmap/..data/config.json > /srv/pod-main-config/config.json;
|
|
volumeMounts:
|
|
- name: tgtd-configmap
|
|
mountPath: /srv/configmap
|
|
- name: pod-main-config
|
|
mountPath: /srv/pod-main-config
|
|
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: /var/lib/cinder
|
|
name: cinder-volumes
|
|
- mountPath: /etc/iscsi
|
|
name: iscsi-info
|
|
{{- include "common_containers" . | indent 8 }}
|
|
volumes:
|
|
{{- include "common_volumes" . | indent 8 }}
|
|
- name: pod-main-config
|
|
emptyDir: {}
|
|
- name: tgtd-configmap
|
|
configMap:
|
|
name: {{ $elementName }}
|
|
- name: cinder-volumes
|
|
hostPath:
|
|
path: /var/lib/cinder
|
|
- 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: /etc/iscsi
|
|
{{- end }}
|