199 lines
8.0 KiB
YAML
199 lines
8.0 KiB
YAML
{{- $restype := .Values.type }}
|
|
{{- $searchPath := printf ":global.kolla.neutron.openvswitch_agent_%s.daemonset:global.kolla.neutron.openvswitch_agent_%s.all:global.kolla.neutron.openvswitch_agent.all:global.kolla.neutron.all:global.kolla.all" $restype $restype }}
|
|
{{- $c := dict "searchPath" $searchPath "Values" .Values }}
|
|
{{- $_ := set $c "contName" "neutron-openvswitch-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 }}
|
|
{{- $c2 := dict "key" "openvswitch_no_kernel_module" "searchPath" $searchPath "Values" .Values }}
|
|
{{- $_ := set $c2 "retDict" $localVals }}
|
|
{{- $_ := set $c2 "retKey" "openvswitch_no_kernel_module" }}
|
|
{{- $_ := include "kolla_val_get_raw" $c2 }}
|
|
{{- $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-openvswitch-agent-%s" $restype }}
|
|
{{- $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-openvswitch-agent-{{ $restype }}
|
|
labels:
|
|
component: neutron
|
|
system: openvswitch-agent-{{ $restype }}
|
|
spec:
|
|
template:
|
|
metadata:
|
|
labels:
|
|
component: neutron
|
|
system: openvswitch-agent-{{ $restype }}
|
|
spec:
|
|
dnsPolicy: ClusterFirstWithHostNet
|
|
hostNetwork: True
|
|
hostIPC: True
|
|
hostPID: True #needed for openvswitch pid file
|
|
nodeSelector:
|
|
{{ $selectorKey }}: {{ $selectorValue | quote }}
|
|
initContainers:
|
|
{{- include "common_dependency_container" $env | indent 8 }}
|
|
- name: update-config
|
|
image: {{ include "kolla_toolbox_image_full" . | quote }}
|
|
imagePullPolicy: {{ $imagePullPolicy | quote }}
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- |
|
|
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
|
|
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);
|
|
{{- if $localVals.openvswitch_tcp }}
|
|
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-openvswitch-agent-configmap
|
|
mountPath: /srv/configmap
|
|
- name: pod-main-config
|
|
mountPath: /srv/pod-main-config
|
|
- name: host-var-lib-kk
|
|
mountPath: /var/lib/kolla-kubernetes
|
|
- name: deps-and-update-permissions
|
|
image: {{ $imageFull | quote }}
|
|
imagePullPolicy: {{ $imagePullPolicy | quote }}
|
|
securityContext:
|
|
runAsUser: 0
|
|
privileged: true
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- |
|
|
chown --recursive neutron.kolla /var/log/kolla;
|
|
{{- if $localVals.openvswitch_no_kernel_module }}
|
|
echo Waiting for openvswitch to be available;
|
|
{{- else }}
|
|
echo Waiting for openvswitch kernel module to load;
|
|
{{- end }}
|
|
while true; do
|
|
{{- if $localVals.openvswitch_no_kernel_module }}
|
|
loaded=$(timeout 5s ovs-vsctl show >/dev/null 2>&1 && echo 1 || echo 0);
|
|
{{- else }}
|
|
loaded=$(lsmod | grep openvswitch | wc -l);
|
|
{{- end }}
|
|
[ $loaded -ne 0 ] && break;
|
|
sleep 1;
|
|
done;
|
|
echo Done.;
|
|
timeout 5s ovs-dpctl show;
|
|
echo Waiting for openvswitch daemon to be responsive;
|
|
while true; do
|
|
timeout 5s ovs-appctl version;
|
|
[ $? -eq 0 ] && break;
|
|
sleep 1;
|
|
echo Trying again.;
|
|
done;
|
|
echo Done.;
|
|
volumeMounts:
|
|
- name: kolla-logs
|
|
mountPath: /var/log/kolla
|
|
- name: host-run
|
|
mountPath: /run
|
|
containers:
|
|
- image: "{{ $imageFull }}"
|
|
imagePullPolicy: {{ $imagePullPolicy | quote }}
|
|
name: main
|
|
securityContext:
|
|
privileged: true
|
|
env:
|
|
- name: KOLLA_CONFIG_STRATEGY
|
|
value: COPY_ONCE
|
|
volumeMounts:
|
|
{{- include "common_volume_mounts" $env | indent 12 }}
|
|
- mountPath: {{ $containerConfigDirectory }}
|
|
name: pod-main-config
|
|
readOnly: true
|
|
- mountPath: /var/lib/kolla-kubernetes/neutron-openvswitch-agent
|
|
name: openvswitch-config
|
|
readOnly: true
|
|
- mountPath: /var/run
|
|
name: host-run
|
|
- mountPath: /dev
|
|
name: host-dev
|
|
- mountPath: /lib/modules
|
|
name: host-lib-modules
|
|
readOnly: true
|
|
{{- include "common_containers" . | indent 8 }}
|
|
# NOTE: (sbezverk) Linux bridge will be moved to its own file at the time of development
|
|
# keeping it here just for future reference.
|
|
#
|
|
# - image: "{{ $imageFull }}"
|
|
# name: neutron-linuxbridge-agent
|
|
# securityContext:
|
|
# privileged: true
|
|
# volumeMounts:
|
|
# - mountPath: {{ $containerConfigDirectory }}/neutron-linuxbridge-agent/
|
|
# name: neutron-linuxbridge-agent-config
|
|
# readOnly: true
|
|
# - mountPath: /var/run
|
|
# name: host-run
|
|
# - mountPath: /etc/localtime
|
|
# name: host-etc-localtime
|
|
# readOnly: true
|
|
# - mountPath: /lib/modules
|
|
# name: host-lib-modules
|
|
# readOnly: true
|
|
# - mountPath: /var/log/kolla/
|
|
# name: kolla-logs
|
|
# env:
|
|
# - name: KOLLA_CONFIG_STRATEGY
|
|
# value: COPY_ONCE
|
|
# - name: NEUTRON_BRIDGE
|
|
# value: "br-ex"
|
|
# - name: NEUTRON_INTERFACE
|
|
# value: FIXME{ neutron_external_interface }
|
|
volumes:
|
|
{{- include "common_volumes" . | indent 8 }}
|
|
- name: neutron-openvswitch-agent-configmap
|
|
configMap:
|
|
name: neutron-openvswitch-agent
|
|
items:
|
|
- key: neutron.conf
|
|
path: neutron.conf
|
|
- key: config.json
|
|
path: config.json
|
|
- key: ml2-conf.ini
|
|
path: ml2_conf.ini
|
|
- name: pod-main-config
|
|
emptyDir: {}
|
|
# NOTE: (sbezverk) Linux bridge will be moved to its own file at the time of development
|
|
# keeping it here just for future reference.
|
|
# - name: neutron-linuxbridge-agent-config
|
|
# configMap:
|
|
# name: neutron-linuxbridge-agent-configmap
|
|
- name: openvswitch-config
|
|
hostPath:
|
|
path: /var/lib/kolla-kubernetes/neutron-openvswitch-agent
|
|
- name: host-run
|
|
hostPath:
|
|
path: /var/run
|
|
- name: host-dev
|
|
hostPath:
|
|
path: /dev
|
|
- name: host-lib-modules
|
|
hostPath:
|
|
path: /lib/modules
|
|
- name: host-var-lib-kk
|
|
hostPath:
|
|
path: /var/lib/kolla-kubernetes
|
|
{{- end }}
|