From 16c486125055add6ca4755a16f348a5c5d7f0a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Opala?= Date: Tue, 28 Apr 2020 10:39:03 +0200 Subject: [PATCH] single-machine: downscale assert fix (#1216) * single-machine: disabling downscale assert (fix) * docs/CLUSTER: markdown fix + adding "any" provider example with haproxy * updating changelog for v0.6.1 --- CHANGELOG-0.6.md | 1 + core/src/epicli/cli/engine/ApplyEngine.py | 19 ++++-- docs/home/howto/CLUSTER.md | 78 +++++++++++++++++++++++ 3 files changed, 92 insertions(+), 6 deletions(-) diff --git a/CHANGELOG-0.6.md b/CHANGELOG-0.6.md index 87b229ec8e..ee9afb240d 100644 --- a/CHANGELOG-0.6.md +++ b/CHANGELOG-0.6.md @@ -7,6 +7,7 @@ - [#1154](https://github.com/epiphany-platform/epiphany/issues/1154) - Node exporter is not installed on logging vms - [#1135](https://github.com/epiphany-platform/epiphany/issues/1135) - 2ndquadrant yum repos remain enabled on repository host after teardown - [#1169](https://github.com/epiphany-platform/epiphany/issues/1169) - Task 'Get token from master' fails on-prem when calico plugin is used +- [#1182](https://github.com/epiphany-platform/epiphany/issues/1182) - Re-run single machine installation may fail ### Updates diff --git a/core/src/epicli/cli/engine/ApplyEngine.py b/core/src/epicli/cli/engine/ApplyEngine.py index 430dd6aa6e..877f21aee6 100644 --- a/core/src/epicli/cli/engine/ApplyEngine.py +++ b/core/src/epicli/cli/engine/ApplyEngine.py @@ -93,22 +93,29 @@ def validate(self): return 0 def assert_no_master_downscale(self): + components = self.cluster_model.specification.components + + # Skip downscale assertion for single machine clusters + if ('single_machine' in components) and (int(components['single_machine']['count']) > 0): + return + cluster_name = self.cluster_model.specification.name inventory_path = get_inventory_path(cluster_name) - if os.path.exists(inventory_path): + if os.path.isfile(inventory_path): existing_inventory = InventoryManager(loader=DataLoader(), sources=inventory_path) - sanity_check = all([ + both_present = all([ 'kubernetes_master' in existing_inventory.list_groups(), - 'kubernetes_master' in self.cluster_model.specification.components, + 'kubernetes_master' in components, ]) - if sanity_check: + + if both_present: prev_master_count = len(existing_inventory.list_hosts(pattern='kubernetes_master')) - next_master_count = int(self.cluster_model.specification.components['kubernetes_master']['count']) + next_master_count = int(components['kubernetes_master']['count']) if prev_master_count > next_master_count: - raise Exception("ControlPlane downscale is not supported yet. Please revert your kubernetes_master count to previous value or increase it to scale up kubernetes.") + raise Exception("ControlPlane downscale is not supported yet. Please revert your 'kubernetes_master' count to previous value or increase it to scale up kubernetes.") def apply(self): self.process_input_docs() diff --git a/docs/home/howto/CLUSTER.md b/docs/home/howto/CLUSTER.md index bc358002f6..c0c3eb49a2 100644 --- a/docs/home/howto/CLUSTER.md +++ b/docs/home/howto/CLUSTER.md @@ -358,6 +358,84 @@ specification: - name: auth-service enabled: yes # set to yest to enable authentication service ... # add other authentication service configuration as needed +``` + +To create a single machine cluster using the "any" provider (with extra load\_balancer config included) use the following template below: + +```yaml +kind: epiphany-cluster +title: "Epiphany cluster Config" +provider: any +name: single +specification: + name: single + admin_user: + name: ubuntu + key_path: /shared/id_rsa + components: + kubernetes_master: + count: 0 + kubernetes_node: + count: 0 + logging: + count: 0 + monitoring: + count: 0 + kafka: + count: 0 + postgresql: + count: 0 + load_balancer: + count: 1 + configuration: default + machines: [single-machine] + rabbitmq: + count: 0 + single_machine: + count: 1 + configuration: default + machines: [single-machine] +--- +kind: configuration/haproxy +title: HAProxy +provider: any +name: default +specification: + version: '1.8' + service_port: 30001 + logs_max_days: 60 + self_signed_certificate_name: self-signed-fullchain.pem + self_signed_private_key_name: self-signed-privkey.pem + self_signed_concatenated_cert_name: self-signed-test.tld.pem + haproxy_log_path: /var/log/haproxy.log + stats: + enable: true + bind_address: 127.0.0.1:9000 + uri: /haproxy?stats + user: operations + password: your-haproxy-stats-pwd + frontend: + - name: https_front + port: 443 + https: yes + backend: + - http_back1 + backend: # example backend config below + - name: http_back1 + server_groups: + - kubernetes_master + # servers: # Definition for server to that hosts the application. + # - name: "node1" + # address: "epiphany-vm1.domain.com" + port: 30104 +--- +kind: infrastructure/machine +provider: any +name: single-machine +specification: + hostname: x1a1 + ip: 10.20.2.10 +``` ## How to create custom cluster components