kolla-kubernetes/helm/microservice/neutron-dhcp-agent-daemonset/templates/dhcp-agent-daemonset.yaml

125 lines
5.1 KiB
YAML

{{- $searchPath := ":global.kolla.neutron.dhcp_agent.daemonset:global.kolla.neutron.dhcp_agent.all:global.kolla.neutron.all:global.kolla.all" }}
{{- $c := dict "searchPath" $searchPath "Values" .Values }}
{{- $_ := set $c "contName" "neutron-dhcp-agent" }}
{{- $_ := set $c "imageName" "image_full" }}
{{- $_ := set $c "tagName" "image_tag" }}
{{- $imageFull := include "kolla_build_image_full" $c }}
{{- $localVals := dict }}
{{- $c1 := dict "key" "openvswitch_tcp" "searchPath" $searchPath "Values" .Values }}
{{- $_ := set $c1 "retDict" $localVals }}
{{- $_ := set $c1 "retKey" "openvswitch_tcp" }}
{{- $_ := include "kolla_val_get_raw" $c1 }}
{{- $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 ) }}
{{- $tunnelInterface := include "kolla_val_get_str" (dict "key" "tunnel_interface" "searchPath" $searchPath "Values" .Values ) }}
{{- $resourceName := printf "neutron-dhcp-agent" }}
{{- $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: neutron-dhcp-agent
labels:
component: neutron
system: dhcp-agent
spec:
template:
metadata:
labels:
component: neutron
system: dhcp-agent
spec:
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: True
hostIPC: True
hostPID: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
#FIXME Its unclear if ovsdb_connection, local_ip, and/or hostPID required. Try removing them once we have a working gate to test with.
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: update-config
image: {{ include "kolla_toolbox_image_full" $env | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- /bin/sh
- -c
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
{{- if $localVals.openvswitch_tcp }}
TUNNEL_INTERFACE={{ $tunnelInterface }};
F=/var/lib/kolla-kubernetes/neutron-openvswitch-agent/tunnel_interface;
[ -f $F ] && TUNNEL_INTERFACE=$(<$F);
IP=$(ip addr list "$TUNNEL_INTERFACE" | grep 'inet ' |cut -d' ' -f6|cut -d/ -f1);
crudini --set /srv/pod-main-config/ml2_conf.ini ovs ovsdb_connection tcp:$IP:6640;
{{- end }}
crudini --set /srv/pod-main-config/ml2_conf.ini ovs local_ip $IP;
volumeMounts:
- name: neutron-dhcp-agent-configmap
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
- name: "update-permissions"
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
securityContext:
runAsUser: 0
command:
- /bin/sh
- -c
- chown --recursive neutron.kolla /var/log/kolla;
volumeMounts:
- name: kolla-logs
mountPath: /var/log/kolla
containers:
- image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
name: main
securityContext:
privileged: true
volumeMounts:
{{- include "common_volume_mounts" $env | indent 12 }}
- mountPath: {{ $containerConfigDirectory }}
name: pod-main-config
readOnly: true
- mountPath: /var/lib/neutron/kolla/
name: neutron-metadata-socket
- mountPath: /var/run
name: host-run
- mountPath: /run/netns/
name: host-run-netns
# shared: true # This seems not support in K8s yet :(
env:
{{- include "common_env_vars" $env | indent 12 }}
volumes:
{{- include "common_volumes" $env | indent 8 }}
- name: pod-main-config
emptyDir: {}
- name: neutron-dhcp-agent-configmap
configMap:
name: neutron-dhcp-agent
items:
- key: neutron.conf
path: neutron.conf
- key: config.json
path: config.json
- key: ml2-conf.ini
path: ml2_conf.ini
- key: dhcp-agent.ini
path: dhcp_agent.ini
- key: dnsmasq.conf
path: dnsmasq.conf
- name: host-run-netns
hostPath:
path: /run/netns
- name: host-run
hostPath:
path: /var/run
- name: neutron-metadata-socket
hostPath:
path: /var/lib/neutron/kolla/metadata_proxy
{{- end }}