Skip to content

Commit

Permalink
salt: Skip etcd role when calling highstate downgrade
Browse files Browse the repository at this point in the history
When downgrading we need to first downgrade all the nodes and after take
care of the etcd cluster, that why we need to skip `etcd` role when
calling highstate on nodes
  • Loading branch information
TeddyAndrieux committed Dec 11, 2019
1 parent 9c221cf commit 2429dfa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions salt/metalk8s/orchestrate/deploy_node.sls
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{%- set node_name = pillar.orchestrate.node_name %}
{%- set version = pillar.metalk8s.nodes[node_name].version %}

{%- set skip_roles = pillar.metalk8s.nodes[node_name].get('skip_roles', []) %}

{%- if node_name not in salt.saltutil.runner('manage.up') %}
Deploy salt-minion on a new node:
salt.state:
Expand Down Expand Up @@ -116,6 +118,15 @@ Run the highstate:
- tgt: {{ node_name }}
- highstate: True
- saltenv: metalk8s-{{ version }}
{#- Add ability to skip node roles to not apply all the highstate
e.g.: Skipping etcd when downgrading #}
{%- if skip_roles %}
- pillar:
metalk8s:
nodes:
{{ node_name }}:
skip_roles: {{ skip_roles }}
{%- endif %}
- require:
- salt: Set grains
- salt: Refresh the mine
Expand Down
6 changes: 6 additions & 0 deletions salt/metalk8s/orchestrate/downgrade/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ Deploy node {{ node }}:
{#- Do not drain if we are in single node cluster #}
skip_draining: True
{%- endif %}
metalk8s:
nodes:
{{ node }}:
# Skip `etcd` role as we take care of etcd cluster after
skip_roles:
- etcd
- require:
- metalk8s_kubernetes: Set node {{ node }} version to {{ dest_version }}
- require_in:
Expand Down

0 comments on commit 2429dfa

Please sign in to comment.