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 <gdeleeuw@leeuwit.nl>
Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
Gerard de Leeuw 2022-03-26 20:44:17 +01:00 committed by Andrey Smirnov
parent 3be5e6e817
commit 54f896dd67
No known key found for this signature in database
GPG Key ID: 7B26396447AB6DFD
6 changed files with 7 additions and 1 deletions

View File

@ -49,6 +49,8 @@ spec:
matchLabels:
control-plane: sidero-controller-manager
replicas: 1
strategy:
type: ${SIDERO_CONTROLLER_MANAGER_DEPLOYMENT_STRATEGY:=RollingUpdate}
template:
metadata:
labels:

View File

@ -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))

View File

@ -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

View File

@ -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
```

View File

@ -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:

View File

@ -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