summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Zegan <m.zegan@samsung.com>2019-06-03 14:58:20 +0200
committerMichal Zegan <m.zegan@samsung.com>2019-06-03 16:54:32 +0200
commit2f97acdcc45c70ee2fa022fdeb27b68a0f7e458b (patch)
treecf106a6d5403b98367c603fb21e64849a9ada296
parentbfbb6e193f28e7e503e4c94e46017d40fd613872 (diff)
Add etcd group support to rke role
Etcd cluster is now placed in members of kubernetes-etcd group instead of kubernetes-node. Due to defaults, it means infra is the only etcd by default. Change-Id: Iae05a42442849e4a248d73c2d78f5e2b0eae7255 Issue-ID: OOM-1778 Signed-off-by: Michal Zegan <m.zegan@samsung.com>
-rw-r--r--ansible/roles/rke/molecule/default/molecule.yml1
-rw-r--r--ansible/roles/rke/molecule/default/tests/test_etcd.py13
-rw-r--r--ansible/roles/rke/molecule/default/tests/test_nodes.py2
-rw-r--r--ansible/roles/rke/templates/cluster.yml.j22
4 files changed, 17 insertions, 1 deletions
diff --git a/ansible/roles/rke/molecule/default/molecule.yml b/ansible/roles/rke/molecule/default/molecule.yml
index 444a7519..6ae613a9 100644
--- a/ansible/roles/rke/molecule/default/molecule.yml
+++ b/ansible/roles/rke/molecule/default/molecule.yml
@@ -19,6 +19,7 @@ platforms:
container: docker
groups:
- infrastructure
+ - kubernetes-etcd
- kubernetes-control-plane
- kubernetes
networks:
diff --git a/ansible/roles/rke/molecule/default/tests/test_etcd.py b/ansible/roles/rke/molecule/default/tests/test_etcd.py
new file mode 100644
index 00000000..0f4b6f12
--- /dev/null
+++ b/ansible/roles/rke/molecule/default/tests/test_etcd.py
@@ -0,0 +1,13 @@
+import os
+import pytest
+
+import testinfra.utils.ansible_runner
+
+testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
+ os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('kubernetes-etcd')
+
+
+@pytest.mark.parametrize('container_name', [
+ 'etcd'])
+def test_container_running(host, container_name):
+ assert host.docker(container_name).is_running
diff --git a/ansible/roles/rke/molecule/default/tests/test_nodes.py b/ansible/roles/rke/molecule/default/tests/test_nodes.py
index fcc5e7e6..60413018 100644
--- a/ansible/roles/rke/molecule/default/tests/test_nodes.py
+++ b/ansible/roles/rke/molecule/default/tests/test_nodes.py
@@ -8,6 +8,6 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
@pytest.mark.parametrize('container_name', [
- 'etcd', 'kubelet', 'kube-proxy'])
+ 'kubelet', 'kube-proxy'])
def test_container_running(host, container_name):
assert host.docker(container_name).is_running
diff --git a/ansible/roles/rke/templates/cluster.yml.j2 b/ansible/roles/rke/templates/cluster.yml.j2
index f28cff80..2012ab92 100644
--- a/ansible/roles/rke/templates/cluster.yml.j2
+++ b/ansible/roles/rke/templates/cluster.yml.j2
@@ -9,6 +9,8 @@ nodes:
{% endif %}
{% if node in groups['kubernetes-node'] %}
- worker
+{% endif %}
+{% if node in groups['kubernetes-etcd'] %}
- etcd
{% endif %}
hostname_override: ""