add ovs section to dhcp_agent
Closes-Bug: ATMOSPHERE-612
Change-Id: I921f9968225847bd2d215c7f28cbf7a2ddbb6cc6
diff --git a/charts/neutron/templates/bin/_neutron-dhcp-agent.sh.tpl b/charts/neutron/templates/bin/_neutron-dhcp-agent.sh.tpl
index 0f73e5a..b6296f4 100644
--- a/charts/neutron/templates/bin/_neutron-dhcp-agent.sh.tpl
+++ b/charts/neutron/templates/bin/_neutron-dhcp-agent.sh.tpl
@@ -17,6 +17,9 @@
set -x
exec neutron-dhcp-agent \
--config-file /etc/neutron/neutron.conf \
+{{- if ( has "ovn" .Values.network.backend ) }}
+ --config-file /tmp/pod-shared/ovn.ini \
+{{- end }}
{{- if and ( empty .Values.conf.neutron.DEFAULT.host ) ( .Values.pod.use_fqdn.neutron_agent ) }}
--config-file /tmp/pod-shared/neutron-agent.ini \
{{- end }}
diff --git a/charts/neutron/templates/configmap-etc.yaml b/charts/neutron/templates/configmap-etc.yaml
index 82865c0..9d00130 100644
--- a/charts/neutron/templates/configmap-etc.yaml
+++ b/charts/neutron/templates/configmap-etc.yaml
@@ -155,7 +155,7 @@
{{- if empty $envAll.Values.conf.dhcp_agent.DEFAULT.interface_driver -}}
{{- $_ := set $envAll.Values "__interface_driver" ( list ) }}
-{{- if ( has "openvswitch" $envAll.Values.network.backend ) -}}
+{{- if or ( has "openvswitch" $envAll.Values.network.backend ) ( has "ovn" $envAll.Values.network.backend ) -}}
{{ $__interface_driver := append $envAll.Values.__interface_driver "openvswitch" }}
{{- $_ := set $envAll.Values "__interface_driver" $__interface_driver }}
{{- end -}}
@@ -165,6 +165,9 @@
{{- end -}}
{{- $_ := set $envAll.Values.conf.dhcp_agent.DEFAULT "interface_driver" $envAll.Values.__interface_driver -}}
{{- end -}}
+{{- if and (has "ovn" $envAll.Values.network.backend) (empty $envAll.Values.conf.dhcp_agent.ovs.ovsdb_connection) -}}
+{{- $_ := set $envAll.Values.conf.dhcp_agent.ovs "ovsdb_connection" "unix:/run/openvswitch/db.sock" -}}
+{{- end -}}
{{- if empty $envAll.Values.conf.l3_agent.DEFAULT.interface_driver -}}
{{- $_ := set $envAll.Values "__interface_driver" ( list ) }}
diff --git a/charts/neutron/templates/daemonset-dhcp-agent.yaml b/charts/neutron/templates/daemonset-dhcp-agent.yaml
index 17e15f8..af72487 100644
--- a/charts/neutron/templates/daemonset-dhcp-agent.yaml
+++ b/charts/neutron/templates/daemonset-dhcp-agent.yaml
@@ -94,6 +94,19 @@
{{- end }}
initContainers:
{{ tuple $envAll "pod_dependency" $mounts_neutron_dhcp_agent_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
+ {{- if ( has "ovn" .Values.network.backend ) }}
+ - name: ovn-neutron-init
+{{ tuple $envAll "neutron_dhcp" | include "helm-toolkit.snippets.image" | indent 10 }}
+ command:
+ - /tmp/neutron-ovn-init.sh
+ volumeMounts:
+ - name: pod-shared
+ mountPath: /tmp/pod-shared
+ - name: neutron-bin
+ mountPath: /tmp/neutron-ovn-init.sh
+ subPath: neutron-ovn-init.sh
+ readOnly: true
+ {{- end }}
- name: neutron-dhcp-agent-init
{{ tuple $envAll "neutron_dhcp" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.agent.dhcp | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
@@ -245,6 +258,10 @@
mountPath: /run/netns
mountPropagation: Bidirectional
{{- end }}
+ {{- if ( has "ovn" .Values.network.backend ) }}
+ - name: run-openvswitch
+ mountPath: /run/openvswitch
+ {{- end }}
{{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_messaging.auth.admin.secret.tls.internal "path" "/etc/rabbitmq/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
{{ if $mounts_neutron_dhcp_agent.volumeMounts }}{{ toYaml $mounts_neutron_dhcp_agent.volumeMounts | indent 12 }}{{ end }}
volumes:
@@ -274,6 +291,11 @@
hostPath:
path: /run/netns
{{- end }}
+ {{- if ( has "ovn" .Values.network.backend ) }}
+ - name: run-openvswitch
+ hostPath:
+ path: /run/openvswitch
+ {{- end }}
{{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_messaging.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
{{ if $mounts_neutron_dhcp_agent.volumes }}{{ toYaml $mounts_neutron_dhcp_agent.volumes | indent 8 }}{{ end }}
{{- end }}
diff --git a/charts/neutron/values.yaml b/charts/neutron/values.yaml
index b1ff456..83e34c0 100644
--- a/charts/neutron/values.yaml
+++ b/charts/neutron/values.yaml
@@ -2149,6 +2149,8 @@
interface_driver: null
dnsmasq_config_file: /etc/neutron/dnsmasq.conf
force_metadata: True
+ # NOTE(mnaser): This has to be here in order for the DHCP agent to work with OVN.
+ ovs: {}
dnsmasq: |
#no-hosts
#port=5353
diff --git a/charts/patches/neutron/0004-add-support-for-ovn-dhcp-agent.patch b/charts/patches/neutron/0004-add-support-for-ovn-dhcp-agent.patch
new file mode 100644
index 0000000..1146298
--- /dev/null
+++ b/charts/patches/neutron/0004-add-support-for-ovn-dhcp-agent.patch
@@ -0,0 +1,97 @@
+diff --git a/neutron/templates/bin/_neutron-dhcp-agent.sh.tpl b/neutron/templates/bin/_neutron-dhcp-agent.sh.tpl
+index 0f73e5a3..b6296f48 100644
+--- a/neutron/templates/bin/_neutron-dhcp-agent.sh.tpl
++++ b/neutron/templates/bin/_neutron-dhcp-agent.sh.tpl
+@@ -17,6 +17,9 @@ limitations under the License.
+ set -x
+ exec neutron-dhcp-agent \
+ --config-file /etc/neutron/neutron.conf \
++{{- if ( has "ovn" .Values.network.backend ) }}
++ --config-file /tmp/pod-shared/ovn.ini \
++{{- end }}
+ {{- if and ( empty .Values.conf.neutron.DEFAULT.host ) ( .Values.pod.use_fqdn.neutron_agent ) }}
+ --config-file /tmp/pod-shared/neutron-agent.ini \
+ {{- end }}
+diff --git a/neutron/templates/configmap-etc.yaml b/neutron/templates/configmap-etc.yaml
+index 82865c09..9d001304 100644
+--- a/neutron/templates/configmap-etc.yaml
++++ b/neutron/templates/configmap-etc.yaml
+@@ -155,7 +155,7 @@ limitations under the License.
+
+ {{- if empty $envAll.Values.conf.dhcp_agent.DEFAULT.interface_driver -}}
+ {{- $_ := set $envAll.Values "__interface_driver" ( list ) }}
+-{{- if ( has "openvswitch" $envAll.Values.network.backend ) -}}
++{{- if or ( has "openvswitch" $envAll.Values.network.backend ) ( has "ovn" $envAll.Values.network.backend ) -}}
+ {{ $__interface_driver := append $envAll.Values.__interface_driver "openvswitch" }}
+ {{- $_ := set $envAll.Values "__interface_driver" $__interface_driver }}
+ {{- end -}}
+@@ -165,6 +165,9 @@ limitations under the License.
+ {{- end -}}
+ {{- $_ := set $envAll.Values.conf.dhcp_agent.DEFAULT "interface_driver" $envAll.Values.__interface_driver -}}
+ {{- end -}}
++{{- if and (has "ovn" $envAll.Values.network.backend) (empty $envAll.Values.conf.dhcp_agent.ovs.ovsdb_connection) -}}
++{{- $_ := set $envAll.Values.conf.dhcp_agent.ovs "ovsdb_connection" "unix:/run/openvswitch/db.sock" -}}
++{{- end -}}
+
+ {{- if empty $envAll.Values.conf.l3_agent.DEFAULT.interface_driver -}}
+ {{- $_ := set $envAll.Values "__interface_driver" ( list ) }}
+diff --git a/neutron/templates/daemonset-dhcp-agent.yaml b/neutron/templates/daemonset-dhcp-agent.yaml
+index 17e15f8e..af724875 100644
+--- a/neutron/templates/daemonset-dhcp-agent.yaml
++++ b/neutron/templates/daemonset-dhcp-agent.yaml
+@@ -94,6 +94,19 @@ spec:
+ {{- end }}
+ initContainers:
+ {{ tuple $envAll "pod_dependency" $mounts_neutron_dhcp_agent_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
++ {{- if ( has "ovn" .Values.network.backend ) }}
++ - name: ovn-neutron-init
++{{ tuple $envAll "neutron_dhcp" | include "helm-toolkit.snippets.image" | indent 10 }}
++ command:
++ - /tmp/neutron-ovn-init.sh
++ volumeMounts:
++ - name: pod-shared
++ mountPath: /tmp/pod-shared
++ - name: neutron-bin
++ mountPath: /tmp/neutron-ovn-init.sh
++ subPath: neutron-ovn-init.sh
++ readOnly: true
++ {{- end }}
+ - name: neutron-dhcp-agent-init
+ {{ tuple $envAll "neutron_dhcp" | include "helm-toolkit.snippets.image" | indent 10 }}
+ {{ tuple $envAll $envAll.Values.pod.resources.agent.dhcp | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
+@@ -245,6 +258,10 @@ spec:
+ mountPath: /run/netns
+ mountPropagation: Bidirectional
+ {{- end }}
++ {{- if ( has "ovn" .Values.network.backend ) }}
++ - name: run-openvswitch
++ mountPath: /run/openvswitch
++ {{- end }}
+ {{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_messaging.auth.admin.secret.tls.internal "path" "/etc/rabbitmq/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
+ {{ if $mounts_neutron_dhcp_agent.volumeMounts }}{{ toYaml $mounts_neutron_dhcp_agent.volumeMounts | indent 12 }}{{ end }}
+ volumes:
+@@ -274,6 +291,11 @@ spec:
+ hostPath:
+ path: /run/netns
+ {{- end }}
++ {{- if ( has "ovn" .Values.network.backend ) }}
++ - name: run-openvswitch
++ hostPath:
++ path: /run/openvswitch
++ {{- end }}
+ {{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_messaging.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
+ {{ if $mounts_neutron_dhcp_agent.volumes }}{{ toYaml $mounts_neutron_dhcp_agent.volumes | indent 8 }}{{ end }}
+ {{- end }}
+diff --git a/neutron/values.yaml b/neutron/values.yaml
+index b1ff4569..83e34c08 100644
+--- a/neutron/values.yaml
++++ b/neutron/values.yaml
+@@ -2149,6 +2149,8 @@ conf:
+ interface_driver: null
+ dnsmasq_config_file: /etc/neutron/dnsmasq.conf
+ force_metadata: True
++ # NOTE(mnaser): This has to be here in order for the DHCP agent to work with OVN.
++ ovs: {}
+ dnsmasq: |
+ #no-hosts
+ #port=5353
\ No newline at end of file
diff --git a/releasenotes/notes/ovn-dhcp-agent-6da645f88a2c39c3.yaml b/releasenotes/notes/ovn-dhcp-agent-6da645f88a2c39c3.yaml
new file mode 100644
index 0000000..a92726e
--- /dev/null
+++ b/releasenotes/notes/ovn-dhcp-agent-6da645f88a2c39c3.yaml
@@ -0,0 +1,5 @@
+---
+features:
+ - |
+ Neutron now supports using the built-in DHCP agent when using OVN (Open Virtual Network)
+ for cases when DHCP relay is necessary.