Skip to content

Commit

Permalink
salt: Remove all logic to ensure salt-minion ready from Salt state
Browse files Browse the repository at this point in the history
As suggested by Salt to restart Salt-minion process we should just
`service.restart` in Background and then wait for the Salt-minion to be
ready, in our case as part of the orchestrate

Sees: https://docs.saltproject.io/en/latest/faq.html#restart-using-states
Fixes: #3247
  • Loading branch information
TeddyAndrieux committed Apr 9, 2021
1 parent 7a8d005 commit db42501
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 33 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
- Add bootstrap and solutions configuration files
(PR [#3222](https://github.com/scality/metalk8s/pull/3222))

### Bug fixes
- [#3247](https://github.com/scality/metalk8s/issues/3247) - Fix a bug where
Salt minion process may fail to restart during upgrade or downgrade process
(PR [#3281](https://github.com/scality/metalk8s/pull/3281))

## Release 2.5.2

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion buildchain/buildchain/salt_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ def _get_parts(self) -> Iterator[str]:
Path('salt/metalk8s/salt/minion/init.sls'),
Path('salt/metalk8s/salt/minion/installed.sls'),
Path('salt/metalk8s/salt/minion/local.sls'),
Path('salt/metalk8s/salt/minion/running.sls'),
Path('salt/metalk8s/salt/minion/restart.sls'),

Path('salt/metalk8s/solutions/available.sls'),
Path('salt/metalk8s/solutions/init.sls'),
Expand Down
8 changes: 7 additions & 1 deletion salt/metalk8s/orchestrate/deploy_node.sls
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,17 @@ Reconfigure salt-minion:
- salt: Check pillar before salt-minion configuration

Wait minion available:
test.configurable_test_state:
- changes: False
- result: __slot__:salt:test.sleep(10)
- comment: Wait a bit for 'salt-minion' to restart before checking status
- onchanges:
- salt: Reconfigure salt-minion
salt.runner:
- name: metalk8s_saltutil.wait_minions
- tgt: {{ node_name }}
- require:
- salt: Reconfigure salt-minion
- test: Wait minion available
- require_in:
- http: Wait for API server to be available before highstate

Expand Down
2 changes: 1 addition & 1 deletion salt/metalk8s/salt/minion/configured.sls
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
include:
- .installed
- .running
- .restart
Configure salt minion:
file.managed:
Expand Down
5 changes: 2 additions & 3 deletions salt/metalk8s/salt/minion/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
# Available states
# ================
#
# * running -> Ensure salt minion running
# * restart -> Restart salt Minion if required `watch_in` set
#

include:
- .installed
- .running
- .configured
10 changes: 8 additions & 2 deletions salt/metalk8s/salt/minion/installed.sls
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
include :
- metalk8s.repo
- .running
- .restart
Install salt-minion:
{{ pkg_installed('salt-minion') }}
Expand All @@ -11,5 +11,11 @@ Install salt-minion:
- order: last
- require:
- test: Repositories configured
- require_in:
- watch_in:
- cmd: Restart salt-minion
Enable Salt minion:
service.enabled:
- name: salt-minion
- require:
- metalk8s_package_manager: Install salt-minion
4 changes: 4 additions & 0 deletions salt/metalk8s/salt/minion/restart.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Restart salt-minion:
cmd.wait:
- name: 'salt-call --local service.restart salt-minion > /dev/null'
- bg: True
25 changes: 0 additions & 25 deletions salt/metalk8s/salt/minion/running.sls

This file was deleted.

0 comments on commit db42501

Please sign in to comment.