Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preflight_facts: fixing inability to disable kubernetes #1346

Merged
merged 3 commits into from
Jun 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-0.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixed

- [#1154](https://github.com/epiphany-platform/epiphany/issues/1154) - Node exporter is not installed on logging vms
- [#1183](https://github.com/epiphany-platform/epiphany/issues/1183) - Task 'Check if /etc/kubernetes/admin.conf file exists' fails when kubernetes\_master.count = 0

## [0.6.0] 2020-04-06

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG-0.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- [#1181](https://github.com/epiphany-platform/epiphany/issues/1181) - Configure Ignite to use fixed ports
- [#1182](https://github.com/epiphany-platform/epiphany/issues/1182) - Re-run single machine installation may fail
- [#1209](https://github.com/epiphany-platform/epiphany/issues/1209) - Can not apply cluster, "sudo: a password is required"
- [#1183](https://github.com/epiphany-platform/epiphany/issues/1183) - Task 'Check if /etc/kubernetes/admin.conf file exists' fails when kubernetes\_master.count = 0

### Known Issues

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
- name: Produce final list of hosts to deploy image registries on
set_fact:
target_image_registry_hostnames: >-
{{ groups.image_registry | difference(groups.kubernetes_master) | union([resolved_image_registry_hostname]) | unique }}
{{ groups.image_registry | difference(available_masters) | union([resolved_image_registry_hostname]) | unique }}
vars:
available_masters: >-
{{ groups.kubernetes_master | default([]) }}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
fail_msg: "When promote_to_ha is enabled, use_ha_control_plane must be enabled as well."

- assert:
that: not promote_to_ha or ((groups.kubernetes_master | length) == 1)
that: not promote_to_ha or ((available_masters | length) == 1)
fail_msg: "When promote_to_ha is enabled, control plane must contain exactly one master."

- assert:
Expand All @@ -25,5 +25,5 @@
fail_msg: "When kubernetes is HA already, use_ha_control_plane must be enabled (downgrade is not supported)."

- assert:
that: use_ha_control_plane or not ((groups.kubernetes_master | length) > 1)
that: use_ha_control_plane or not ((available_masters | length) > 1)
fail_msg: "When use_ha_control_plane is disabled, number of masters must not be bigger than one."
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
- when: inventory_hostname in groups.kubernetes_master
- name: Collect available masters
set_fact:
available_masters: >-
{{ groups.kubernetes_master | default([]) }}

- when: inventory_hostname in available_masters
block:
- name: Check if /etc/kubernetes/admin.conf file exists
stat:
Expand Down Expand Up @@ -37,8 +42,8 @@
- name: Collect registered masters
set_fact:
registered_masters: >-
{{ groups.kubernetes_master | map('extract', hostvars, ['master_already_joined'])
| zip(groups.kubernetes_master)
{{ available_masters | map('extract', hostvars, ['master_already_joined'])
| zip(available_masters)
| selectattr(0)
| map(attribute=1)
| list }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
- name: Produce final list of hosts to deploy repositories on
set_fact:
target_repository_hostnames: >-
{{ groups.repository | difference(groups.kubernetes_master) | union([resolved_repository_hostname]) | unique }}
{{ groups.repository | difference(available_masters) | union([resolved_repository_hostname]) | unique }}
vars:
available_masters: >-
{{ groups.kubernetes_master | default([]) }}
242 changes: 126 additions & 116 deletions core/src/epicli/data/common/validation/epiphany-cluster.yml
Original file line number Diff line number Diff line change
@@ -1,116 +1,126 @@
"$id": "#/specification"
title: "Cluster specification schema"
description: "The main cluster specification"
type: object
required:
- name
- admin_user
- components
properties:
prefix:
"$id": "#/properties/prefix"
title: "Cluster prefix"
description: "A prefix the can be prepended to the cluster name"
examples:
- prod01
- dev02
- test03
- cust04
type: string
pattern: "^[a-z0-9]{2,8}$"
name:
"$id": "#/properties/name"
title: "Cluster name"
description: "The name of the cluster"
examples:
- clustername01
type: string
pattern: "^[a-z0-9\\-]{3,20}$"
admin_user:
"$id": "#/properties/admin_user"
title: "The admin_user Schema"
description: "Settings needed for the SSH connection to the cluster machines or VM's"
type: object
cloud:
"$id": "#/properties/specification/properties/cloud"
type: object
title: The Cloud Schema
properties:
subscription_name:
"$id": "#/properties/specification/properties/cloud/properties/subscription_name"
type: string
title: The Subscription_name Schema
default: ''
examples:
- subsciptionname
pattern: "^(.*)$"
vnet_address_pool:
"$id": "#/properties/specification/properties/cloud/properties/vnet_address_pool"
type: string
title: The Vnet_address_pool Schema
default: ''
examples:
- 10.1.0.0/20
pattern: "^(.*)$"
use_public_ips:
"$id": "#/properties/specification/properties/cloud/properties/use_public_ips"
type: boolean
title: The Use_public_ips Schema
default: false
examples:
- false
use_service_principal:
"$id": "#/properties/specification/properties/cloud/properties/use_service_principal"
type: boolean
title: The Use_service_principal Schema
default: false
examples:
- false
region:
"$id": "#/properties/specification/properties/cloud/properties/region"
type: string
title: The Region Schema
default: ''
examples:
- eu-west-2
pattern: "^(.*)$"
credentials:
"$id": "#/properties/specification/properties/cloud/properties/credentials"
type: object
title: The Credentials Schema
required:
- key
- secret
properties:
key:
"$id": "#/properties/specification/properties/cloud/properties/credentials/properties/key"
type: string
title: The Key Schema
pattern: "^(.*)$"
secret:
"$id": "#/properties/specification/properties/cloud/properties/credentials/properties/secret"
type: string
title: The Secret Schema
pattern: "^(.*)$"
network:
"$id": "#/properties/specification/properties/cloud/properties/network"
type: object
title: The Network Schema
properties:
use_network_security_groups:
"$id": "#/properties/specification/properties/cloud/properties/network/properties/use_network_security_groups"
type: boolean
title: The Use_network_security_groups Schema
default: false
examples:
- true
components:
"$id": "#/properties/components"
title: "Components schema"
description: "Cluster component layout specification"
type: object





"$id": "#/specification"
title: "Cluster specification schema"
description: "The main cluster specification"
type: object
required:
- name
- admin_user
- components
properties:
prefix:
"$id": "#/properties/prefix"
title: "Cluster prefix"
description: "A prefix the can be prepended to the cluster name"
examples:
- prod01
- dev02
- test03
- cust04
type: string
pattern: "^[a-z0-9]{2,8}$"
name:
"$id": "#/properties/name"
title: "Cluster name"
description: "The name of the cluster"
examples:
- clustername01
type: string
pattern: "^[a-z0-9\\-]{3,20}$"
admin_user:
"$id": "#/properties/admin_user"
title: "The admin_user Schema"
description: "Settings needed for the SSH connection to the cluster machines or VM's"
type: object
cloud:
"$id": "#/properties/specification/properties/cloud"
type: object
title: The Cloud Schema
properties:
subscription_name:
"$id": "#/properties/specification/properties/cloud/properties/subscription_name"
type: string
title: The Subscription_name Schema
default: ''
examples:
- subsciptionname
pattern: "^(.*)$"
vnet_address_pool:
"$id": "#/properties/specification/properties/cloud/properties/vnet_address_pool"
type: string
title: The Vnet_address_pool Schema
default: ''
examples:
- 10.1.0.0/20
pattern: "^(.*)$"
use_public_ips:
"$id": "#/properties/specification/properties/cloud/properties/use_public_ips"
type: boolean
title: The Use_public_ips Schema
default: false
examples:
- false
use_service_principal:
"$id": "#/properties/specification/properties/cloud/properties/use_service_principal"
type: boolean
title: The Use_service_principal Schema
default: false
examples:
- false
region:
"$id": "#/properties/specification/properties/cloud/properties/region"
type: string
title: The Region Schema
default: ''
examples:
- eu-west-2
pattern: "^(.*)$"
credentials:
"$id": "#/properties/specification/properties/cloud/properties/credentials"
type: object
title: The Credentials Schema
required:
- key
- secret
properties:
key:
"$id": "#/properties/specification/properties/cloud/properties/credentials/properties/key"
type: string
title: The Key Schema
pattern: "^(.*)$"
secret:
"$id": "#/properties/specification/properties/cloud/properties/credentials/properties/secret"
type: string
title: The Secret Schema
pattern: "^(.*)$"
network:
"$id": "#/properties/specification/properties/cloud/properties/network"
type: object
title: The Network Schema
properties:
use_network_security_groups:
"$id": "#/properties/specification/properties/cloud/properties/network/properties/use_network_security_groups"
type: boolean
title: The Use_network_security_groups Schema
default: false
examples:
- true
components:
"$id": "#/properties/components"
type: object
title: "Components schema"
description: "Cluster component layout specification"
# When "kubernetes_node" property exists, "kubernetes_master" must exist as well
dependencies:
kubernetes_node: [kubernetes_master]
allOf:
# When no master is deployed, there must be no nodes deployed as well
- if:
properties:
kubernetes_master:
properties:
count: { type: integer, enum: [0] }
then:
properties:
kubernetes_node:
properties:
count: { type: integer, enum: [0] }