Merge "Merge ovs 'ensure' logic into the caller"

This commit is contained in:
Jenkins 2017-06-27 14:27:53 +00:00 committed by Gerrit Code Review
commit efa8293e54
5 changed files with 32 additions and 56 deletions

View File

@ -1,41 +0,0 @@
#!/bin/bash
# Copyright 2017 The Openstack-Helm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{{- if not .Values.ml2 -}}{{- set . "Values.ml2" dict -}}{{- end -}}
{{- if not .Values.ml2.ovs -}}{{- set . "Values.ml2.ovs" dict -}}{{- end -}}
{{- if not .Values.ml2.ovs.auto_bridge_add -}}{{- set . "Values.ml2.ovs.auto_bridge_add" dict -}}{{- end -}}
set -x
bridge="{{ .Values.network.external_bridge }}"
port="{{ .Values.network.interface.external }}"
# create bridge device
ovs-vsctl --no-wait --may-exist add-br "$bridge"
if [ ! -z "$port" ] ; then
ovs-vsctl --no-wait --may-exist add-port "$bridge" "$port"
ip link set dev "$port" up
fi
# handle any bridge mappings
{{ range $br, $phys := .Values.ml2.ovs.auto_bridge_add }}
# create {{ $br }}{{ if $phys }} and add port {{ $phys }}{{ end }}
ovs-vsctl --no-wait --may-exist add-br {{ $br }}
{{ if $phys }}
ovs-vsctl --no-wait --may-exist add-port {{ $br }} {{ $phys }}
ip link set dev {{ $phys }} up
{{ end }}
{{ end -}}

View File

@ -23,5 +23,29 @@ modprobe gre
modprobe vxlan
ovs-vsctl --no-wait show
bash -x /tmp/openvswitch-ensure-configured.sh
external_bridge="{{- .Values.network.external_bridge -}}"
external_interface="{{- .Values.network.interface.external -}}"
if [ -n "${external_bridge}" ] ; then
# create bridge device
ovs-vsctl --no-wait --may-exist add-br $external_bridge
if [ -n "$external_interface" ] ; then
# add external interface to the bridge
ovs-vsctl --no-wait --may-exist add-port $external_bridge $external_interface
ip link set dev $external_interface up
fi
fi
# handle any bridge mappings
{{- range $br, $phys := .Values.network.auto_bridge_add }}
if [ -n "{{- $br -}}" ] ; then
# create {{ $br }}{{ if $phys }} and add port {{ $phys }}{{ end }}
ovs-vsctl --no-wait --may-exist add-br "{{ $br }}"
if [ -n "{{- $phys -}}" ] ; then
ovs-vsctl --no-wait --may-exist add-port "{{ $br }}" "{{ $phys }}"
ip link set dev "{{ $phys }}" up
fi
fi
{{- end }}
exec /usr/sbin/ovs-vswitchd unix:/run/openvswitch/db.sock --mlockall -vconsole:emer -vconsole:err -vconsole:info

View File

@ -43,7 +43,5 @@ data:
{{ tuple "bin/_neutron-server.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
openvswitch-db-server.sh: |+
{{ tuple "bin/_openvswitch-db-server.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
openvswitch-ensure-configured.sh: |+
{{ tuple "bin/_openvswitch-ensure-configured.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
openvswitch-vswitchd.sh: |+
{{ tuple "bin/_openvswitch-vswitchd.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}

View File

@ -60,10 +60,6 @@ spec:
mountPath: /tmp/openvswitch-vswitchd.sh
subPath: openvswitch-vswitchd.sh
readOnly: true
- name: neutron-bin
mountPath: /tmp/openvswitch-ensure-configured.sh
subPath: openvswitch-ensure-configured.sh
readOnly: true
- name: libmodules
mountPath: /lib/modules
readOnly: true

View File

@ -90,6 +90,13 @@ network:
# fallback mechanism to search for interface with default routing.
external: null
tunnel: null
# To automatically add a physical interface to a specific bridge using,
# for example eth3 to bridge br-physnet1 define the following key/value
# in auto_bridge_add:
# br-physnet1: eth3
auto_bridge_add:
# br0: if0
# br1: iface_two
server:
name: "neutron-server"
port: 9696
@ -120,14 +127,6 @@ keystone:
metadata:
workers: 4
ml2:
ovs:
auto_bridge_add:
# To automatically add a physical interface to a specific bridge using,
# for example eth3 to bridge br-physnet1 define the following key/value
# in auto_bridge_add:
# br-physnet1: eth3
dependencies:
db_init:
services: