From bb319a0c4b72074ffd8c79d0d240c86939be2d9d Mon Sep 17 00:00:00 2001 From: Pavan-Gunda Date: Mon, 13 May 2024 13:23:50 +0200 Subject: [PATCH] config: added a migration step to filter interfaces --- .../group_vars/k8s_cluster/ck8s-k8s-cluster.yaml | 7 +++++++ migration/v2.25/README.md | 3 +++ .../v2.25/prepare/30-ntp-filter-interfaces.sh | 16 ++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100755 migration/v2.25/prepare/30-ntp-filter-interfaces.sh diff --git a/config/common/group_vars/k8s_cluster/ck8s-k8s-cluster.yaml b/config/common/group_vars/k8s_cluster/ck8s-k8s-cluster.yaml index bb4da2d..55fad5c 100644 --- a/config/common/group_vars/k8s_cluster/ck8s-k8s-cluster.yaml +++ b/config/common/group_vars/k8s_cluster/ck8s-k8s-cluster.yaml @@ -751,3 +751,10 @@ local_volume_provisioner_storage_classes: # Installation via kubespray has no su local_volume_provisioner_nodelabels: [] local_volume_provisioner_tolerations: [] + +ntp_filter_interface: true +# Specify the interfaces +# Only takes effect when ntp_filter_interface is true +ntp_interfaces: + - ignore wildcard + - listen ens3 diff --git a/migration/v2.25/README.md b/migration/v2.25/README.md index c216881..d45705c 100644 --- a/migration/v2.25/README.md +++ b/migration/v2.25/README.md @@ -33,6 +33,9 @@ > bin/ck8s-kubespray upgrade wc v2.25 prepare > ``` +> [!NOTE] +> The prepare step ran earlier will set the `ntp_filter_interface` to `true` and the default interface ntp listens on is `ens3` but if the underlying host uses a different interface, add that instead of ens3 under `ntp_interfaces` + 1. Download the required files on the nodes ```bash diff --git a/migration/v2.25/prepare/30-ntp-filter-interfaces.sh b/migration/v2.25/prepare/30-ntp-filter-interfaces.sh new file mode 100755 index 0000000..24ef41c --- /dev/null +++ b/migration/v2.25/prepare/30-ntp-filter-interfaces.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +HERE="$(dirname "$(readlink -f "${0}")")" +ROOT="$(readlink -f "${HERE}/../../../")" + +# shellcheck source=scripts/migration/lib.sh +source "${ROOT}/scripts/migration/lib.sh" + +if [[ "${CK8S_CLUSTER}" =~ ^(sc|both)$ ]]; then + yq_add sc k8s_cluster/ck8s-k8s-cluster .ntp_filter_interface "load(\"${ROOT}/config/common/group_vars/k8s_cluster/ck8s-k8s-cluster.yaml\").ntp_filter_interface" + yq_add sc k8s_cluster/ck8s-k8s-cluster .ntp_interfaces "load(\"${ROOT}/config/common/group_vars/k8s_cluster/ck8s-k8s-cluster.yaml\").ntp_interfaces" +fi +if [[ "${CK8S_CLUSTER}" =~ ^(wc|both)$ ]]; then + yq_add wc k8s_cluster/ck8s-k8s-cluster .ntp_filter_interface "load(\"${ROOT}/config/common/group_vars/k8s_cluster/ck8s-k8s-cluster.yaml\").ntp_filter_interface" + yq_add wc k8s_cluster/ck8s-k8s-cluster .ntp_interfaces "load(\"${ROOT}/config/common/group_vars/k8s_cluster/ck8s-k8s-cluster.yaml\").ntp_interfaces" +fi