Change the way of disabling ovs container

For the case vswitch_type!='none', ovs doesn't run in container. So ovs
pod/container should not run. We controlled ovs container by label, but
a patch[1] broke it.
This patch is to change the method in which we control ovs container.
With this patch, we remove openvswitch chart from compute-kit chart
group so that no ovs container created. If we need to run ovs in
container, we add the openvswitch chart.

[1]
https://review.opendev.org/#/c/651380/2/kubernetes/applications/stx-openstack/stx-openstack-helm/stx-openstack-helm/manifests/manifest.yaml

Change-Id: I3ba8a3ab45a6e6c1a67b78d335656ed5c0d654a7
Closes-bug: #1824829
Signed-off-by: chengli3 <cheng1.li@intel.com>
This commit is contained in:
chengli3 2019-04-19 17:02:40 +08:00
parent 95b946469a
commit f6fb3cd53e
2 changed files with 44 additions and 25 deletions

View File

@ -653,12 +653,10 @@ data:
chart_name: openvswitch
release: openstack-openvswitch
namespace: openstack
# If we deploy ovs-dpdk on the host, ovs pod will not be created.
# commenting out the wait block until a solution can be implemented
# wait:
# timeout: 1800
# labels:
# release_group: osh-openstack-openvswitch
wait:
timeout: 1800
labels:
release_group: osh-openstack-openvswitch
install:
no_hooks: false
upgrade:
@ -3017,7 +3015,6 @@ data:
sequenced: false
chart_group:
- openstack-libvirt
- openstack-openvswitch
- openstack-nova
- openstack-nova-api-proxy
- openstack-neutron

View File

@ -19,20 +19,48 @@ class OpenvswitchHelm(openstack.OpenstackBaseHelm):
CHART = constants.HELM_CHART_OPENVSWITCH
def get_overrides(self, namespace=None):
# helm has an issue with installing release of no pod
# https://github.com/helm/helm/issues/4295
# once this is fixed, we can use 'manifests' instead of 'label' to
# control ovs enable or not
overrides = {
common.HELM_NS_OPENSTACK: {
'labels': {
'ovs': {
'node_selector_key': 'openvswitch',
'node_selector_value': self._ovs_label_value(),
# There are already two places at where we generate chartgroup overrides.
# If more chartgroup overrides are needed in future, it's better to do it
# at a fixed place. Distributing the overrides in the chart plugins makes
# it hard to manage chartgroup overrides.
def get_meta_overrides(self, namespace, app_name=None, mode=None):
def _meta_overrides():
if utils.get_vswitch_type(self.dbapi) == \
constants.VSWITCH_TYPE_NONE:
# add the openvswitch chart into computekit chart group
return {
'schema': 'armada/ChartGroup/v1',
'metadata': {
'schema': 'metadata/Document/v1',
'name': 'openstack-compute-kit',
},
'data': {
'chart_group': [
'openstack-libvirt',
'openstack-openvswitch',
'openstack-nova',
'openstack-nova-api-proxy',
'openstack-neutron',
]
}
}
}
else:
return {}
overrides = {
common.HELM_NS_OPENSTACK: _meta_overrides()
}
if namespace in self.SUPPORTED_NAMESPACES:
return overrides[namespace]
elif namespace:
raise exception.InvalidHelmNamespace(chart=self.CHART,
namespace=namespace)
else:
return overrides
def get_overrides(self, namespace=None):
overrides = {
common.HELM_NS_OPENSTACK: {}
}
if namespace in self.SUPPORTED_NAMESPACES:
@ -42,9 +70,3 @@ class OpenvswitchHelm(openstack.OpenstackBaseHelm):
namespace=namespace)
else:
return overrides
def _ovs_label_value(self):
if utils.get_vswitch_type(self.dbapi) == constants.VSWITCH_TYPE_NONE:
return "enabled"
else:
return "none"