Skip to content

Commit

Permalink
single-machine: downscale assert fix (#1216)
Browse files Browse the repository at this point in the history
* single-machine: disabling downscale assert (fix)

* docs/CLUSTER: markdown fix + adding "any" provider example with haproxy

* updating changelog for v0.6.1
  • Loading branch information
sk4zuzu authored Apr 28, 2020
1 parent c23cd7e commit 16c4861
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-0.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 13 additions & 6 deletions core/src/epicli/cli/engine/ApplyEngine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
78 changes: 78 additions & 0 deletions docs/home/howto/CLUSTER.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 16c4861

Please sign in to comment.