Add conditional logic for opencontrail 3.0 and 4.0
Opencontrail 4.0 doesn't use contrail-network-controller as it has
different CNI. This patch adds conditional logic to address this.
Change-Id: I51b8b226d9f485024e148030487e3ce1485a3be0
diff --git a/kubernetes/master/kube-addons.sls b/kubernetes/master/kube-addons.sls
index ee8890c..8440409 100644
--- a/kubernetes/master/kube-addons.sls
+++ b/kubernetes/master/kube-addons.sls
@@ -8,7 +8,7 @@
- group: root
- mode: 0755
-{%- if master.network.engine == "opencontrail" %}
+{%- if master.network.engine == "opencontrail" and master.network.version < 4.0 %}
/etc/kubernetes/addons/contrail_network_controller/contrail-network-controller-configmap.yml:
file.managed:
- source: salt://kubernetes/files/kube-addons/contrail_network_controller/contrail-network-controller-configmap.yml
diff --git a/kubernetes/master/opencontrail.sls b/kubernetes/master/opencontrail.sls
index 246b216..82a5559 100644
--- a/kubernetes/master/opencontrail.sls
+++ b/kubernetes/master/opencontrail.sls
@@ -1,6 +1,6 @@
{%- from "kubernetes/map.jinja" import master with context %}
{%- if master.enabled %}
-{%- if master.network.get('version', '3.0') != '3.0' %}
+{%- if master.network.get('version', 3.0) != 3.0 %}
opencontrail_kube_manager_package:
pkg.installed:
diff --git a/tests/pillar/master_contrail.sls b/tests/pillar/master_contrail.sls
index c237389..991cb32 100644
--- a/tests/pillar/master_contrail.sls
+++ b/tests/pillar/master_contrail.sls
@@ -61,6 +61,7 @@
allow_privileged: true
network:
engine: opencontrail
+ version: 3.0
config:
api:
host: 10.0.170.70
diff --git a/tests/pillar/master_contrail4_0.sls b/tests/pillar/master_contrail4_0.sls
index 8cf9c36..0d780c3 100644
--- a/tests/pillar/master_contrail4_0.sls
+++ b/tests/pillar/master_contrail4_0.sls
@@ -31,10 +31,6 @@
server_image: image
agent_image: image
agent_probeurls: "http://ipinfo.io"
- contrail_network_controller:
- enabled: true
- namespace: kube-system
- image: yashulyak/contrail-controller:latest
admin:
password: password
username: admin