Add 1.10 version support
- Changed version determination
- Updated hyperkube version getter
Change-Id: I73708bfbf902f38d84ad46e6989c8f36718b50cb
diff --git a/kubernetes/files/kubelet/default.master b/kubernetes/files/kubelet/default.master
index 2740e53..adf0f64 100644
--- a/kubernetes/files/kubelet/default.master
+++ b/kubernetes/files/kubelet/default.master
@@ -13,7 +13,7 @@
--hostname-override={{ master.host.name }} \
--v={{ master.get('verbosity', 2) }} \
--node-labels=node-role.kubernetes.io/master=true \
-{%- if version|float >= 1.8 %}
+{%- if salt['pkg.version_cmp'](version,'1.8') >= 0 %}
--fail-swap-on={{ master.kubelet.fail_on_swap }} \
{%- if common.addons.get('virtlet', {}).get('enabled') %}
--feature-gates=MountPropagation=true \
diff --git a/kubernetes/files/kubelet/default.pool b/kubernetes/files/kubelet/default.pool
index a4ddf31..19bb8f6 100644
--- a/kubernetes/files/kubelet/default.pool
+++ b/kubernetes/files/kubelet/default.pool
@@ -12,7 +12,7 @@
--cluster_domain={{ common.addons.dns.domain|replace('_', '-') }} \
--hostname-override={{ pool.host.name }} \
--v={{ pool.get('verbosity', 2) }} \
-{%- if version|float >= 1.8 %}
+{%- if salt['pkg.version_cmp'](version,'1.8') >= 0 %}
--fail-swap-on={{ pool.kubelet.fail_on_swap }} \
{%- if common.addons.get('virtlet', {}).get('enabled') %}
--feature-gates=MountPropagation=true \
@@ -39,7 +39,7 @@
{%- endif %}
{%- if common.addons.get('virtlet', {}).get('enabled') %}
--container-runtime={{ pool.get('container-runtime', 'remote') }} \
-{%- if version|float < 1.7 %}
+{%- if salt['pkg.version_cmp'](version,'1.7') < 0 %}
--container-runtime-endpoint={{ pool.get('container-runtime-endpoint', '/var/run/criproxy.sock') }} \
--image-service-endpoint={{ pool.get('image-service-endpoint', '/var/run/criproxy.sock') }} \
{%- else %}
diff --git a/kubernetes/files/manifest/kube-apiserver.manifest b/kubernetes/files/manifest/kube-apiserver.manifest
index d00f9eb..dddf336 100644
--- a/kubernetes/files/manifest/kube-apiserver.manifest
+++ b/kubernetes/files/manifest/kube-apiserver.manifest
@@ -47,7 +47,7 @@
--v={{ master.get('verbosity', 2) }}
--allow-privileged=True
{%- if common.addons.get('virtlet', {}).get('enabled') %}
- {%- if version|float >= 1.8 %}
+ {%- if salt['pkg.version_cmp'](version,'1.8') >= 0 %}
--feature-gates=MountPropagation=true
{%- endif %}
{%- endif %}
diff --git a/kubernetes/files/systemd/criproxy.service b/kubernetes/files/systemd/criproxy.service
index 9d89b4e..894070e 100644
--- a/kubernetes/files/systemd/criproxy.service
+++ b/kubernetes/files/systemd/criproxy.service
@@ -15,7 +15,7 @@
-listen /var/run/criproxy.sock \
-v 3 \
-alsologtostderr \
-{%- if version|float < 1.8 %}
+{%- if salt['pkg.version_cmp'](version,'1.8') < 0 %}
-apiVersion {{ version }} \
{%- endif %}
{%- if pool.get('enabled', False) %}
diff --git a/kubernetes/map.jinja b/kubernetes/map.jinja
index e243a77..99e33cc 100644
--- a/kubernetes/map.jinja
+++ b/kubernetes/map.jinja
@@ -1,4 +1,4 @@
-{% set version = salt['cmd.shell']("(hyperkube --version 2> /dev/null || echo '0.0') | sed -e 's/-.*//g' -e 's/v//g' -e 's/Kubernetes //g' | awk -F'.' '{print $1 \".\" $2}'") %}
+{% set version = salt['cmd.shell']("(hyperkube --version kubelet 2> /dev/null || echo '0.0') | sed -e 's/-.*//g' -e 's/v//g' -e 's/Kubernetes //g' | awk -F'.' '{print $1 \".\" $2}'") %}
{% set common = salt['grains.filter_by']({
'Debian': {
diff --git a/kubernetes/master/controller.sls b/kubernetes/master/controller.sls
index fbfdd46..720302d 100644
--- a/kubernetes/master/controller.sls
+++ b/kubernetes/master/controller.sls
@@ -145,7 +145,7 @@
{%- endif %}
{%- endif %}
{%- if common.addons.get('virtlet', {}).get('enabled') %}
-{%- if version|float >= 1.8 %}
+{%- if salt['pkg.version_cmp'](version,'1.8') >= 0 %}
--feature-gates=MountPropagation=true
{%- endif %}
{%- endif %}