Skip to content

Commit

Permalink
Merge branch 'feature/nix-config' into 'devel'
Browse files Browse the repository at this point in the history
Rework configuration

Closes #573 and #469

See merge request yaook/k8s!1265
  • Loading branch information
sstrk committed Oct 29, 2024
2 parents 018412d + c0be6c5 commit b442e02
Show file tree
Hide file tree
Showing 219 changed files with 6,177 additions and 5,685 deletions.
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ build-docs-check:
- export PATH="$VIRTUAL_ENV/bin:$PATH"
script:
- towncrier build --version x.x.x --keep
- nix build .#docsRST -o docs/user/reference/options
- sphinx-build -W docs _build/html
- mv _build/html public
artifacts:
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
- id: trailing-whitespace
exclude: '.*(\.drawio|\.svg)$'
- id: end-of-file-fixer
exclude: '.*(\.drawio|\.svg)$'
exclude: '.*(\.drawio|\.svg|\.nix)$' # Nix files are fixed by nix-fmt
- id: mixed-line-ending
- id: check-executables-have-shebangs
- id: check-merge-conflict
Expand All @@ -36,13 +36,13 @@ repos:
stages: [pre-commit, pre-push, manual]
- id: check-flake
name: check flake
files: "^flake.nix$"
files: .*\.nix$'
entry: ci/lint/check-flake.sh
language: script
stages: [pre-commit, pre-push, manual]
- id: nix-fmt
name: nix-fmt
files: "^flake.nix$"
files: '.*\.nix$'
entry: ci/lint/format-flake.sh
language: script
stages: [pre-commit, pre-push, manual]
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ Breaking changes
rather than across separate lists for each type of value.

Furthermore you now have control over the whole name of Terraform nodes,
see :ref:`the documentation <cluster-configuration.configuring-terraform>`
see :ref:`the documentation <configuration-options.yk8s.terraform>`
for further details.

.. code:: diff
Expand Down
4 changes: 4 additions & 0 deletions actions/apply-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ actions_dir="$(dirname "$0")"

# shellcheck source=actions/lib.sh
. "$actions_dir/lib.sh"

# Ensure that the latest config is deployed to the inventory
"$actions_dir/update-inventory.sh"

load_conf_vars

check_venv
Expand Down
7 changes: 4 additions & 3 deletions actions/apply-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ actions_dir="$(dirname "$0")"

# shellcheck source=actions/lib.sh
. "$actions_dir/lib.sh"

# Ensure that the latest config is deployed to the inventory
"$actions_dir/update-inventory.sh"

load_conf_vars

check_venv
Expand All @@ -14,9 +18,6 @@ require_vault_token

install_prerequisites

# Ensure that the latest config is deployed to the inventory
python3 "$actions_dir/update_inventory.py"

# Bring the wireguard interface up if configured so
"$actions_dir/wg-up.sh"

Expand Down
7 changes: 3 additions & 4 deletions actions/apply-k8s-core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,18 @@ execute_playbook() {
local playbook="$1"
notef "Executing playbook $playbook\n"

# Ensure that the latest config is deployed to the inventory
"$actions_dir/update-inventory.sh"

load_conf_vars
check_venv
check_conf_sanity
require_vault_token
install_prerequisites

# Ensure that the latest config is deployed to the inventory
python3 "$actions_dir/update_inventory.py"
# Bring the wireguard interface up if configured so
"$actions_dir/wg-up.sh"

set_kubeconfig

pushd "$ansible_k8s_core_dir"
# Include k8s-core roles
ANSIBLE_ROLES_PATH="$ansible_k8s_core_dir/roles" \
Expand Down
5 changes: 3 additions & 2 deletions actions/apply-k8s-supplements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ execute_playbook() {
local playbook="$1"
notef "Executing playbook $playbook\n"

# Ensure that the latest config is deployed to the inventory
"$actions_dir/update-inventory.sh"

load_conf_vars
check_conf_sanity
check_venv
require_vault_token
install_prerequisites

# Ensure that the latest config is deployed to the inventory
python3 "$actions_dir/update_inventory.py"
# Bring the wireguard interface up if configured so
"$actions_dir/wg-up.sh"

Expand Down
7 changes: 4 additions & 3 deletions actions/apply-prepare-gw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ actions_dir="$(dirname "$0")"

# shellcheck source=actions/lib.sh
. "$actions_dir/lib.sh"

# Ensure that the latest config is deployed to the inventory
"$actions_dir/update-inventory.sh"

load_conf_vars

check_venv
Expand All @@ -14,9 +18,6 @@ require_vault_token

install_prerequisites

# Ensure that the latest config is deployed to the inventory
python3 "$actions_dir/update_inventory.py"

if [ "${tf_usage:-true}" == 'false' ]; then
errorf "It seems like you're not running on top of OpenStack,"
errorf "because terraform.enabled is false."
Expand Down
9 changes: 5 additions & 4 deletions actions/apply-terraform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ actions_dir="$(realpath "$(dirname "$0")")"

# shellcheck source=actions/lib.sh
. "$actions_dir/lib.sh"

# Ensure that the latest config is deployed to the inventory
"$actions_dir/update-inventory.sh"

load_conf_vars

check_venv

# Ensure that the latest config is deployed to the inventory
python3 "$actions_dir/update_inventory.py"

if [ "$("$actions_dir/helpers/semver2.sh" "$(terraform -v -json | jq -r '.terraform_version')" "$terraform_min_version")" -lt 0 ]; then
errorf 'Please upgrade Terraform to at least v'"$terraform_min_version"
exit 5
Expand Down Expand Up @@ -166,7 +167,7 @@ if [ $rc == $RC_DISRUPTION ]; then
# shellcheck disable=SC2016
errorf 'terraform would delete or recreate a resource, but not all of the following is set' >&2
errorf ' - MANAGED_K8S_DISRUPT_THE_HARBOUR=true' >&2
errorf " - ${terraform_disruption_setting}=false in ${config_file}" >&2
errorf " - terraform.prevent_disruption = false in the config" >&2
errorf 'aborting due to destructive change without approval.' >&2
exit 3
fi
Expand Down
7 changes: 6 additions & 1 deletion actions/destroy.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail
actions_dir="$(realpath "$(dirname "$0")")"

# shellcheck source=actions/lib.sh
. "$actions_dir/lib.sh"

# Ensure that the latest config is deployed to the inventory
"$actions_dir/update-inventory.sh"

load_conf_vars

check_venv
Expand Down Expand Up @@ -92,4 +97,4 @@ if [ "$(jq -r .backend.type "$terraform_state_dir/.terraform/terraform.tfstate")
fi

# Purge the remaining terraform directory. Its existence is a condition for additional disruption checks.
rm -f "$terraform_state_dir/config.tfvars.json"
rm -fr "$terraform_state_dir"
Loading

0 comments on commit b442e02

Please sign in to comment.