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

Check for valid CA minion at the beginning of the bootstrap #3065

Merged
merged 2 commits into from
Feb 3, 2021
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
MetalK8s UI node page
(PR [#3045](https://github.com/scality/metalk8s/pull/3045))

- Improve error handling when providing invalid CA minion in Bootstrap
configuration file
(PR [#3065](https://github.com/scality/metalk8s/pull/3065))

### Bug fixes
- [#3022](https://github.com/scality/metalk8s/issues/3022) - Ensure salt-master
container can start at reboot even if local salt-minion is down
Expand Down
4 changes: 2 additions & 2 deletions scripts/bootstrap.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ bootstrap_file_is_present() {
main() {
run "Determine the OS" determine_os
if [ -z "${PYTHON:-}" ]; then
run "Installing Python3 package" install_packages python3
PYTHON=${PYTHON:-$(command -v python3)}
run "Installing Python3 package" install_packages python3
PYTHON=${PYTHON:-$(command -v python3)}
fi
run "Checking that BootstrapConfiguration is present" bootstrap_file_is_present
run "Pre-minion system tests" pre_minion_checks
Expand Down
11 changes: 11 additions & 0 deletions scripts/common.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,17 @@ configure_salt_minion_local_mode() {
}

check_local_node() {
# NOTE: Today using bootstrap script, bootstrap node is also the CA
# minion, so check for minion id equal to CA minion
minion_id="$("$SALT_CALL" --out txt --local grains.get id | cut -c 8-)"
ca_minion="$("$SALT_CALL" --out txt --local pillar.get metalk8s:ca:minion | cut -c 8-)"
if [ "$minion_id" != "$ca_minion" ]; then
echo "CA minion \"$ca_minion\" from bootstrap configuration is not equal" \
"to the local minion ID \"$minion_id\", you need to change" \
"the local minion ID, or update the bootstrap configuration." 1>&2
return 1
fi

"$SALT_CALL" --local --retcode-passthrough metalk8s_checks.node \
saltenv=metalk8s-@@VERSION
}
Expand Down