kolla-kubernetes/helm/microservice/ironic-conductor-daemonset/templates/ironic-conductor.yaml

156 lines
6.4 KiB
YAML

{{- $searchPath := ":global.kolla.ironic.conductor.daemonset:global.kolla.ironic.conductor.all:global.kolla.ironic.all:global.kolla.all" }}
{{- $resourceName := "ironic-conductor" }}
{{- $netHostTrue := true }}
{{- $podTypeBootstrap := false }}
{{- $serviceName := "ironic" }}
{{- $serviceType := "conductor" }}
{{- $privileged := true }}
{{- $c := dict "searchPath" $searchPath "Values" .Values }}
{{- $_ := set $c "contName" "ironic-conductor" }}
{{- $_ := set $c "imageName" "image_full" }}
{{- $_ := set $c "tagName" "image_tag" }}
{{- $imageFull := include "kolla_build_image_full" $c }}
{{- $c := dict "searchPath" $searchPath "Values" .Values }}
{{- $_ := set $c "contName" "ironic-pxe" }}
{{- $_ := set $c "imageName" "ironic_pxe_image_full" }}
{{- $_ := set $c "tagName" "ironic_pxe_image_tag" }}
{{- $imageFullPXE := 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 ) }}
{{- $elementName := .Values.element_name | default $resourceName }}
{{- $ironicAPI := include "kolla_val_get_str" (dict "key" "ironic_api_ip" "searchPath" $searchPath "Values" .Values )}}
{{- $ironicProvisionCIDR := include "kolla_val_get_str" (dict "key" "ironic_provision_cidr" "searchPath" $searchPath "Values" .Values )}}
{{- with $env := dict "netHostTrue" $netHostTrue "podTypeBootstrap" $podTypeBootstrap "imageFull" $imageFull "resourceName" $resourceName "serviceName" $serviceName "serviceType" $serviceType "privileged" $privileged "Values" .Values "Release" .Release "searchPath" $searchPath }}
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: {{ $elementName }}
labels:
component: {{ $serviceName }}
system: {{ $elementName }}
spec:
template:
metadata:
labels:
component: {{ $serviceName }}
system: {{ $elementName }}
spec:
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: True
hostIPC: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: initialize-ironic-conductor
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- sh
- -xec
- |
IP=$(ip addr show to {{ $ironicProvisionCIDR }} | grep -m1 -G 'inet' | awk '{print $2}' | cut -d '/' -f 1);
if test -z $IP; then exit 1; fi;
cp -a /config/ironic/..data/* /ironic/;
cp -a /config/pxe/..data/* /pxe/;
jq '.command = "in.tftpd -v -L -u root -a '$IP':69 --map-file /map-file /tftpboot"' /config/pxe/..data/config.json > /pxe/config.json;
crudini --set /ironic/ironic.conf conductor api_url http://{{ $ironicAPI }}:6385;
crudini --set /ironic/ironic.conf pxe tftp_server $IP;
volumeMounts:
- name: kolla-logs
mountPath: /var/log/kolla/
- name: conductor-config
mountPath: /config/ironic
- name: pxe-config
mountPath: /config/pxe
- name: ironic-conductor-config
mountPath: /ironic/
- name: ironic-pxe-config
mountPath: /pxe/
- name: pxelinux
image: {{ $imageFullPXE | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- sh
- -xec
- |
if [ -f /var/lib/tftpboot/pxelinux.0 ]; then
cp /var/lib/tftpboot/pxelinux.0 /tftpboot;
fi;
if [ -f /usr/share/syslinux/chain.c32 ]; then
cp /usr/share/syslinux/chain.c32 /tftpboot;
fi;
if [ -f /usr/lib/PXELINUX/pxelinux.0 ]; then
cp /usr/lib/PXELINUX/pxelinux.0 /tftpboot;
fi;
if [ -f /usr/lib/syslinux/modules/bios/chain.c32 ]; then
cp /usr/lib/syslinux/modules/bios/chain.c32 /tftpboot;
fi;
mkdir -p /tftpboot/pxelinux.cfg;
volumeMounts:
- name: tftpboot
mountPath: /tftpboot/
containers:
- name: pxe
imagePullPolicy: {{ $imagePullPolicy | quote }}
image: "{{ $imageFullPXE }}"
volumeMounts:
{{- include "common_volume_mounts" $env | indent 12 }}
- mountPath: {{ $containerConfigDirectory }}
name: ironic-pxe-config
- mountPath: /tftpboot
name: tftpboot
env:
{{- include "common_env_vars" $env | indent 12 }}
- name: main
securityContext:
privileged: true
imagePullPolicy: {{ $imagePullPolicy | quote }}
image: "{{ $imageFull }}"
volumeMounts:
{{- include "common_volume_mounts" $env | indent 12 }}
- mountPath: {{ $containerConfigDirectory }}
name: ironic-conductor-config
- mountPath: /var/lib/ironic
name: ironic-persistent-storage
- mountPath: /var/run
name: run
- mountPath: /dev
name: dev
- mountPath: /sys
name: sys
- mountPath: /tftpboot
name: tftpboot
env:
{{- include "common_env_vars" $env | indent 12 }}
{{- include "common_containers" $env | indent 8 }}
volumes:
{{- include "common_volumes" $env | indent 8 }}
- name: conductor-config
configMap:
name: {{ $elementName }}
- name: pxe-config
configMap:
name: ironic-conductor-tftp
- name: ironic-pxe-config
emptyDir: {}
- name: ironic-conductor-config
emptyDir: {}
- name: ironic-persistent-storage
hostPath:
path: /var/lib/ironic
- name: run
hostPath:
path: /var/run
- name: dev
hostPath:
path: /dev
- name: sys
hostPath:
path: /sys
- name: tftpboot
emptyDir: {}
{{- end }}