From 54f896dd6750874a2d065dc00ec96a56494a3f9d Mon Sep 17 00:00:00 2001 From: Gerard de Leeuw Date: Sat, 26 Mar 2022 20:44:17 +0100 Subject: [PATCH] feat: allow configuring Sidero deployment strategy Upgrading Sidero on a single-node cluster with host networking enabled fails because the used ports can only be bound once. By setting the deployment strategy to `Recreate` in these cases upgrades can succeed (but with a small amount of downtime). Signed-off-by: Gerard de Leeuw Signed-off-by: Andrey Smirnov --- app/sidero-controller-manager/config/manager/manager.yaml | 2 ++ sfyra/pkg/capi/capi.go | 1 + website/content/v0.5/Getting Started/install-clusterapi.md | 1 + website/content/v0.5/Guides/bootstrapping.md | 1 + website/content/v0.5/Guides/sidero-on-rpi4.md | 2 +- website/content/v0.5/Overview/installation.md | 1 + 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/sidero-controller-manager/config/manager/manager.yaml b/app/sidero-controller-manager/config/manager/manager.yaml index 62f556d13..389af613b 100644 --- a/app/sidero-controller-manager/config/manager/manager.yaml +++ b/app/sidero-controller-manager/config/manager/manager.yaml @@ -49,6 +49,8 @@ spec: matchLabels: control-plane: sidero-controller-manager replicas: 1 + strategy: + type: ${SIDERO_CONTROLLER_MANAGER_DEPLOYMENT_STRATEGY:=RollingUpdate} template: metadata: labels: diff --git a/sfyra/pkg/capi/capi.go b/sfyra/pkg/capi/capi.go index 71074a4c4..164f0b069 100644 --- a/sfyra/pkg/capi/capi.go +++ b/sfyra/pkg/capi/capi.go @@ -123,6 +123,7 @@ func (clusterAPI *Manager) Install(ctx context.Context) error { // set template environment variables os.Setenv("SIDERO_CONTROLLER_MANAGER_HOST_NETWORK", "true") + os.Setenv("SIDERO_CONTROLLER_MANAGER_DEPLOYMENT_STRATEGY", "Recreate") os.Setenv("SIDERO_CONTROLLER_MANAGER_API_ENDPOINT", clusterAPI.cluster.SideroComponentsIP().String()) os.Setenv("SIDERO_CONTROLLER_MANAGER_SERVER_REBOOT_TIMEOUT", "30s") // wiping/reboot is fast in the test environment os.Setenv("SIDERO_CONTROLLER_MANAGER_TEST_POWER_EXPLICIT_FAILURE", fmt.Sprintf("%f", clusterAPI.options.PowerSimulatedExplicitFailureProb)) diff --git a/website/content/v0.5/Getting Started/install-clusterapi.md b/website/content/v0.5/Getting Started/install-clusterapi.md index 0dfca1698..8cc17e02e 100644 --- a/website/content/v0.5/Getting Started/install-clusterapi.md +++ b/website/content/v0.5/Getting Started/install-clusterapi.md @@ -24,6 +24,7 @@ options. ```bash export SIDERO_CONTROLLER_MANAGER_HOST_NETWORK=true +export SIDERO_CONTROLLER_MANAGER_DEPLOYMENT_STRATEGY=Recreate export SIDERO_CONTROLLER_MANAGER_API_ENDPOINT=192.168.1.150 export SIDERO_CONTROLLER_MANAGER_SIDEROLINK_ENDPOINT=192.168.1.150 diff --git a/website/content/v0.5/Guides/bootstrapping.md b/website/content/v0.5/Guides/bootstrapping.md index 418f10641..bbb56fb3b 100644 --- a/website/content/v0.5/Guides/bootstrapping.md +++ b/website/content/v0.5/Guides/bootstrapping.md @@ -147,6 +147,7 @@ To install Sidero and the other Talos providers, simply issue: ```bash SIDERO_CONTROLLER_MANAGER_HOST_NETWORK=true \ + SIDERO_CONTROLLER_MANAGER_DEPLOYMENT_STRATEGY=Recreate \ SIDERO_CONTROLLER_MANAGER_API_ENDPOINT=$PUBLIC_IP \ clusterctl init -b talos -c talos -i sidero ``` diff --git a/website/content/v0.5/Guides/sidero-on-rpi4.md b/website/content/v0.5/Guides/sidero-on-rpi4.md index da0be73b6..96c095efe 100644 --- a/website/content/v0.5/Guides/sidero-on-rpi4.md +++ b/website/content/v0.5/Guides/sidero-on-rpi4.md @@ -104,7 +104,7 @@ kubectl get nodes Install Sidero with host network mode, exposing the endpoints on the node's address: ```bash -SIDERO_CONTROLLER_MANAGER_HOST_NETWORK=true SIDERO_CONTROLLER_MANAGER_API_ENDPOINT=${SIDERO_IP} clusterctl init -i sidero -b talos -c talos +SIDERO_CONTROLLER_MANAGER_HOST_NETWORK=true SIDERO_CONTROLLER_MANAGER_DEPLOYMENT_STRATEGY=Recreate SIDERO_CONTROLLER_MANAGER_API_ENDPOINT=${SIDERO_IP} clusterctl init -i sidero -b talos -c talos ``` Watch the progress of installation with: diff --git a/website/content/v0.5/Overview/installation.md b/website/content/v0.5/Overview/installation.md index f7ffce91a..82d5e3f3c 100644 --- a/website/content/v0.5/Overview/installation.md +++ b/website/content/v0.5/Overview/installation.md @@ -14,6 +14,7 @@ Sidero supports several variables to configure the installation, these variables variables or as variables in the `clusterctl` configuration: - `SIDERO_CONTROLLER_MANAGER_HOST_NETWORK` (`false`): run `sidero-controller-manager` on host network +- `SIDERO_CONTROLLER_MANAGER_DEPLOYMENT_STRATEGY` (`RollingUpdate`): strategy to use when updating `sidero-controller-manager`, use `Recreate` when using a single node and `SIDERO_CONTROLLER_MANAGER_HOST_NETWORK` is `true` - `SIDERO_CONTROLLER_MANAGER_API_ENDPOINT` (empty): specifies the IP address controller manager API service can be reached on, defaults to the node IP (TCP) - `SIDERO_CONTROLLER_MANAGER_API_PORT` (8081): specifies the port controller manager can be reached on - `SIDERO_CONTROLLER_MANAGER_CONTAINER_API_PORT` (8081): specifies the controller manager internal container port