166 lines
7.5 KiB
YAML
166 lines
7.5 KiB
YAML
{{- $searchPath := ":global.kolla.ironic.dnsmasq.daemonset:global.kolla.ironic.dnsmasq.all:global.kolla.ironic.all:global.kolla.all" }}
|
|
{{- $resourceName := "ironic-dnsmasq" }}
|
|
{{- $netHostTrue := true }}
|
|
{{- $podTypeBootstrap := false }}
|
|
{{- $serviceName := "ironic" }}
|
|
{{- $serviceType := "dnsmasq" }}
|
|
{{- $privileged := true }}
|
|
{{- $c := dict "searchPath" $searchPath "Values" .Values }}
|
|
{{- $_ := set $c "contName" "dnsmasq" }}
|
|
{{- $_ := 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" "image_full" }}
|
|
{{- $_ := set $c "tagName" "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 ) }}
|
|
{{- $ironicInterface := include "kolla_val_get_str" (dict "key" "ironic_interface" "searchPath" $searchPath "Values" .Values ) }}
|
|
{{- $elementName := .Values.element_name | default $resourceName }}
|
|
{{- $url1 := include "kolla_val_get_str" (dict "key" "initramfs_url" "searchPath" $searchPath "Values" .Values )}}
|
|
{{- $url2 := include "kolla_val_get_str" (dict "key" "kernel_url" "searchPath" $searchPath "Values" .Values )}}
|
|
{{- $ironicInterface := include "kolla_val_get_str" (dict "key" "ironic_interface" "searchPath" $searchPath "Values" .Values )}}
|
|
{{- $ironicInspectionCIDR := include "kolla_val_get_str" (dict "key" "ironic_inspection_cidr" "searchPath" $searchPath "Values" .Values )}}
|
|
{{- $ironicDHCPrange := include "kolla_val_get_str" (dict "key" "ironic_dhcp_range" "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 }}
|
|
annotations:
|
|
pod.beta.kubernetes.io/init-containers: '[
|
|
{{- include "common_dependency_container_multi" $env | indent 10 }}
|
|
{
|
|
"name": "initialize-ironic-dnsmasq",
|
|
"image": {{ include "kolla_toolbox_image_full" . | quote }},
|
|
"imagePullPolicy": {{ $imagePullPolicy | quote }},
|
|
"command": [
|
|
"sh",
|
|
"-xec",
|
|
"IP=$(ip addr show dev {{ $ironicInterface }} to {{ $ironicInspectionCIDR }} | grep -m1 -G ''inet'' | awk ''{print $2}'' | cut -d ''/'' -f 1);
|
|
if test -z $IP; then exit 1; fi;
|
|
cp -a /config/dnsmasq/..data/* /dnsmasq/;
|
|
cp -a /config/pxe/..data/* /pxe/;
|
|
curl -L {{ $url1 }} -o /tftpboot/ironic-agent.initramfs;
|
|
curl -L {{ $url2 }} -o /tftpboot/ironic-agent.kernel;
|
|
jq ''.command = \"in.tftpd -v -L -u root -a ''$IP'':69 --map-file /map-file /tftpboot\"'' /config/pxe/..data/config.json > /pxe/config.json;
|
|
sed -i ''s|ironic-inspector|''$IP''|g'' /pxe/default;
|
|
sed -i ''s|interface=.*|interface={{ $ironicInterface }}|g'' /dnsmasq/dnsmasq.conf;
|
|
sed -i ''s|dhcp-option=option:tftp-server,.*|dhcp-option=option:tftp-server,''$IP''|g'' /dnsmasq/dnsmasq.conf;
|
|
sed -i ''s|dhcp-option=option:server-ip-address,.*|dhcp-option=option:server-ip-address,''$IP''|g'' /dnsmasq/dnsmasq.conf;
|
|
sed -i ''s|dhcp-range=.*|dhcp-range={{ $ironicDHCPrange }}|g'' /dnsmasq/dnsmasq.conf;
|
|
"],
|
|
"volumeMounts": [
|
|
{
|
|
"name": "kolla-logs",
|
|
"mountPath": "/var/log/kolla/"
|
|
},
|
|
{
|
|
"name": "dnsmasq-config",
|
|
"mountPath": "/config/dnsmasq"
|
|
},
|
|
{
|
|
"name": "ironic-pxe-config",
|
|
"mountPath": "/pxe/"
|
|
},
|
|
{
|
|
"name": "pxe-config",
|
|
"mountPath": "/config/pxe"
|
|
},
|
|
{
|
|
"name": "ironic-dnsmasq-config",
|
|
"mountPath": "/dnsmasq/"
|
|
},
|
|
{
|
|
"name": "tftpboot",
|
|
"mountPath": "/tftpboot/"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"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;
|
|
"],
|
|
"volumeMounts": [
|
|
{
|
|
"name": "tftpboot",
|
|
"mountPath": "/tftpboot/"
|
|
}
|
|
]
|
|
}
|
|
]'
|
|
spec:
|
|
hostNetwork: True
|
|
nodeSelector:
|
|
{{ $selectorKey }}: {{ $selectorValue | quote }}
|
|
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-dnsmasq-config
|
|
- 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: dnsmasq-config
|
|
configMap:
|
|
name: {{ $elementName }}
|
|
- name: ironic-dnsmasq-config
|
|
emptyDir: {}
|
|
- name: tftpboot
|
|
emptyDir: {}
|
|
- name: pxe-config
|
|
configMap:
|
|
name: ironic-pxe
|
|
- name: ironic-pxe-config
|
|
emptyDir: {}
|
|
{{- end }}
|