Skip to content
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
12 changes: 9 additions & 3 deletions .github/workflows/offline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ jobs:
run: nix-env -f default.nix -iA env

- name: Install terraform
id: install-terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "^1.3.7"
Expand All @@ -109,7 +110,8 @@ jobs:
HCLOUD_TOKEN: '${{ secrets.HCLOUD_TOKEN }}'

- name: Clean up hetzner environment; just in case
if: always()
# Skip when terraform was never installed (earlier step failed): nothing was deployed.
if: always() && steps.install-terraform.outcome == 'success'
run: (cd terraform/examples/wire-server-deploy-offline-hetzner ; terraform init && terraform destroy -auto-approve)
env:
HCLOUD_TOKEN: '${{ secrets.HCLOUD_TOKEN }}'
Expand Down Expand Up @@ -138,6 +140,7 @@ jobs:
run: nix-env -f default.nix -iA env

- name: Install terraform
id: install-terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "^1.3.7"
Expand All @@ -149,7 +152,8 @@ jobs:
HCLOUD_TOKEN: '${{ secrets.HCLOUD_TOKEN }}'

- name: Clean up hetzner wiab-staging environment; just in case
if: always()
# Skip when terraform was never installed (earlier step failed): nothing was deployed.
if: always() && steps.install-terraform.outcome == 'success'
run: (cd terraform/examples/wiab-staging-hetzner ; terraform init && terraform destroy -auto-approve)
env:
HCLOUD_TOKEN: '${{ secrets.HCLOUD_TOKEN }}'
Expand Down Expand Up @@ -221,6 +225,7 @@ jobs:
AWS_REGION: "eu-west-1"

- name: Install terraform
id: install-terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "^1.3.7"
Expand All @@ -232,7 +237,8 @@ jobs:
HCLOUD_TOKEN: '${{ secrets.HCLOUD_TOKEN }}'

- name: Clean up hetzner wiab environment; just in case
if: always()
# Skip when terraform was never installed (earlier step failed): nothing was deployed.
if: always() && steps.install-terraform.outcome == 'success'
run: (cd terraform/examples/wiab-demo-hetzner ; terraform init && terraform destroy -auto-approve)
env:
HCLOUD_TOKEN: '${{ secrets.HCLOUD_TOKEN }}'
Expand Down
2 changes: 1 addition & 1 deletion bin/helm-operations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,4 @@ fi
deploy_calling_services
}

#main
main
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Changed: ingress-nginx controller upgraded to v1.13.9. Update `values/ingress-nginx-controller/values.yaml` before upgrading: set `controller.image.tag: "v1.13.9"`, `controller.admissionWebhooks.patch.image.tag: "v1.6.9"` and `controller.config.annotations-risk-level: Critical` (under `ingress-nginx:`), see `values/ingress-nginx-controller/prod-values.example.yaml`. Without `annotations-risk-level: Critical`, controller >= v1.12 rejects the nginx-ingress-services ingresses that use `*-snippet` annotations (`annotation group ServerSnippet contains risky annotation`). Upgrade `ingress-nginx-controller` before `nginx-ingress-services`. See `offline/upgrades/ingress-nginx-controller-v1.13.md` (WPB-26631)
1 change: 1 addition & 0 deletions changelog.d/2-wire-builds/WPB-26631-ingress-nginx-4.13.9
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed: CVEs in the ingress-nginx controller. The bundled ingress-nginx-controller chart now uses ingress-nginx 4.13.9 (controller v1.13.9, Kubernetes 1.29 - 1.33) instead of 4.11.5 (controller v1.10.6 via values), and the admission webhook image is updated to kube-webhook-certgen v1.6.9 (WPB-26631)
1 change: 1 addition & 0 deletions changelog.d/5-bug-fixes/cd-default-wait-for-adminhost
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed: wait for SSH on the adminhost private IP before running setup_nodes.yml in the default Hetzner CD environment (same as wiab-staging, #919)
1 change: 1 addition & 0 deletions changelog.d/5-bug-fixes/fix-minio-image
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed: use mirror for fetching unavailable Minio images
1 change: 1 addition & 0 deletions changelog.d/5-bug-fixes/helm-operations-main
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed: re-enable `main` in `bin/helm-operations.sh` (commented out for 5.25-R2), so the default CD verify deploys the charts again; `offline/cd_staging.sh` no longer appends it (WPB-26631)
1 change: 1 addition & 0 deletions changelog.d/5-bug-fixes/hetzner-datacenters-removed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed: Replace removed Hetzner `hcloud_datacenters` data source (HTTP 410 since 2026-10-01) with `hcloud_locations` in the CD terraform modules and pin the hcloud provider to `~> 1.70`
6 changes: 4 additions & 2 deletions offline/cd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ COMMIT_HASH="${GITHUB_SHA}"
ARTIFACT="wire-server-deploy-static-${COMMIT_HASH}"

# Retry matrix
# Locations are tried in order and exhaust all server types before moving on.
# Prefer hel1: German locations rarely have capacity.
LOCATIONS=("hel1" "fsn1" "nbg1")
SMALL_SERVER_TYPES=("cx23" "cx33" "cpx22")
MEDIUM_SERVER_TYPES=("cx33" "cx43" "cpx32")
Expand Down Expand Up @@ -68,8 +70,8 @@ echo "Retry plan: ${location_count} locations x ${server_type_count} server type
attempt=1
deployment_succeeded=false

for server_type_index in $(seq 0 $((server_type_count - 1))); do
for location_index in $(seq 0 $((location_count - 1))); do
for location_index in $(seq 0 $((location_count - 1))); do
for server_type_index in $(seq 0 $((server_type_count - 1))); do
attempt_location="${LOCATIONS[$location_index]}"
attempt_small_server_type="${SMALL_SERVER_TYPES[$server_type_index]}"
attempt_medium_server_type="${MEDIUM_SERVER_TYPES[$server_type_index]}"
Expand Down
6 changes: 4 additions & 2 deletions offline/cd_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ TEST_USER="demo"
COMMIT_HASH="${GITHUB_SHA}"

# Retry matrix
# Locations are tried in order and exhaust all server types before moving on.
# Prefer hel1: German locations rarely have capacity.
LOCATIONS=("hel1" "fsn1" "nbg1")
SERVER_TYPES=("cx53" "cpx62")

Expand Down Expand Up @@ -62,8 +64,8 @@ echo "Retry plan: ${location_count} locations x ${server_type_count} server type
attempt=1
deployment_succeeded=false

for server_type_index in $(seq 0 $((server_type_count - 1))); do
for location_index in $(seq 0 $((location_count - 1))); do
for location_index in $(seq 0 $((location_count - 1))); do
for server_type_index in $(seq 0 $((server_type_count - 1))); do
attempt_location="${LOCATIONS[$location_index]}"
attempt_server_type="${SERVER_TYPES[$server_type_index]}"

Expand Down
10 changes: 4 additions & 6 deletions offline/cd_staging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ COMMIT_HASH="${GITHUB_SHA}"
ARTIFACT="wire-server-deploy-static-${COMMIT_HASH}"

# Retry matrix
# Locations are tried in order and exhaust all server types before moving on.
# Prefer hel1: German locations rarely have capacity.
LOCATIONS=("hel1" "nbg1" "fsn1")
SMALL_SERVER_TYPES=("cpx22" "cpx32" "cpx42")
MEDIUM_SERVER_TYPES=("cpx42" "cpx52" "cpx62")
Expand Down Expand Up @@ -67,8 +69,8 @@ echo "Starting deployment with automatic retry on resource unavailability..."
attempt=1
deployment_succeeded=false

for server_type_index in $(seq 0 $((server_type_count - 1))); do
for location_index in $(seq 0 $((location_count - 1))); do
for location_index in $(seq 0 $((location_count - 1))); do
for server_type_index in $(seq 0 $((server_type_count - 1))); do
attempt_location="${LOCATIONS[$location_index]}"
attempt_small_server_type="${SMALL_SERVER_TYPES[$server_type_index]}"
attempt_medium_server_type="${MEDIUM_SERVER_TYPES[$server_type_index]}"
Expand Down Expand Up @@ -231,10 +233,6 @@ scp $SSH_OPTS "$TARGET" "demo@$adminhost":./ansible/inventory/offline/inventory.

ssh $SSH_OPTS "demo@$adminhost" cat ./ansible/inventory/offline/inventory.yml || true

ssh $SSH_OPTS "demo@$adminhost" 'printf "\nmain\n\n" >> ./bin/helm-operations.sh' || true

ssh $SSH_OPTS "demo@$adminhost" cat ./bin/helm-operations.sh || true

# NOTE: Agent is forwarded; so that the adminhost can provision the other boxes
ssh $SSH_OPTS -A "demo@$adminhost" ./bin/offline-deploy.sh

Expand Down
2 changes: 1 addition & 1 deletion offline/default-build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ TASKS_DIR="${SCRIPT_DIR}/../tasks"
# --------------------------

# pulling the charts based on builds.json, charts to be skipped are passed as arguments HELM_CHART_EXCLUDE_LIST
"${TASKS_DIR}"/proc_pull_charts.sh OUTPUT_DIR="${OUTPUT_DIR}" HELM_CHART_EXCLUDE_LIST="inbucket,wire-server-enterprise,postgresql,rust-sft,fluent-bit"
"${TASKS_DIR}"/proc_pull_charts.sh OUTPUT_DIR="${OUTPUT_DIR}" HELM_CHART_EXCLUDE_LIST="inbucket,wire-server-enterprise,postgresql,rust-sft,fluent-bit,fake-aws-s3,nginx-ingress-controller"

# pulling the charts from helm-charts repo, charts to be included are passed as arguments HELM_CHART_INCLUDE_LIST
# "${TASKS_DIR}"/proc_pull_ext_charts.sh OUTPUT_DIR="${OUTPUT_DIR}" HELM_CHART_INCLUDE_LIST="postgresql-external"
Expand Down
20 changes: 20 additions & 0 deletions offline/tasks/pre_chart_process_0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,23 @@ sed -i -Ee 's/useSharedFederatorSecret: false/useSharedFederatorSecret: true/' "
# drop step-certificates/.../test-connection.yaml because it lacks an image tag
# cf. https://github.com/smallstep/helm-charts/pull/196/files
rm -v "${OUTPUT_DIR}"/charts/step-certificates/charts/step-certificates/templates/tests/*

# Replace the ingress-nginx subchart of ingress-nginx-controller (WPB-26631).
# The ingress-nginx-controller chart from wire-builds bundles ingress-nginx
# 4.11.5, whose controller images have known CVEs. 4.13.9 is the latest
# release that supports the Kubernetes version installed by this bundle
# (kube_version v1.29.10, see ansible/inventory/offline/group_vars/all/offline.yml).
# Controller >= 1.12 needs `annotations-risk-level: Critical`, see
# values/ingress-nginx-controller/*.example.yaml.
INGRESS_NGINX_CHART_VERSION="4.13.9"
ingress_controller_chart="${OUTPUT_DIR}/charts/ingress-nginx-controller"
if [[ -d "$ingress_controller_chart" ]]; then
rm -rf "$ingress_controller_chart/charts/ingress-nginx"
helm pull ingress-nginx \
--repo https://kubernetes.github.io/ingress-nginx \
--version "$INGRESS_NGINX_CHART_VERSION" \
--untar --untardir "$ingress_controller_chart/charts"
# only the indented dependency version, not the chart's own version
sed -i -Ee "s/^( version: )[0-9.]+$/\1${INGRESS_NGINX_CHART_VERSION}/" "$ingress_controller_chart/Chart.yaml"
rm -f "$ingress_controller_chart/Chart.lock"
fi
172 changes: 172 additions & 0 deletions offline/upgrades/ingress-nginx-controller-v1.13.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
# Upgrade ingress-nginx controller to v1.13.9 (wire-server 5.25)

Fixes known CVEs in the ingress-nginx controller image shipped with wire-server-deploy 5.25 (WPB-26631).

## Scope

| Component | Before | After |
|---|---|---|
| `ingress-nginx` subchart of `charts/ingress-nginx-controller` | `4.11.5` | `4.13.9` |
| Controller image (`registry.k8s.io/ingress-nginx/controller`) | `v1.10.6` (values) | `v1.13.9` |
| Admission webhook image (`registry.k8s.io/ingress-nginx/kube-webhook-certgen`) | `v20220916-gd32f8c343` | `v1.6.9` |
| `controller.config.annotations-risk-level` | not set (controller default) | `Critical` |

- No other chart or image changes. wire-server stays on 5.25.0.
- Supported Kubernetes versions: 1.29 – 1.33. The 5.25 bundle installs Kubernetes v1.29.10.
- Expected impact: rolling restart of the ingress controller pods. Ingress service, node ports and DNS do not change.

## Background

- Controller v1.12 changed the default of `annotations-risk-level` from `Critical` to `High`.
- `nginx-ingress-services` uses `*-snippet` annotations (risk `Critical`):
- `nginx.ingress.kubernetes.io/server-snippet` (minio / fake S3 ingress)
- `nginx.ingress.kubernetes.io/configuration-snippet` (nginz ingress, federator ingress)
- Without `annotations-risk-level: Critical`:
- with admission webhook: `helm upgrade nginx-ingress-services` fails with `admission webhook "validate.nginx.ingress.kubernetes.io" denied the request: annotation group ServerSnippet contains risky annotation based on ingress configuration`.
- without admission webhook: the controller ignores these ingresses and serves its fake default certificate.
- `annotations-risk-level` is a setting of the **ingress-nginx-controller** release (`ingress-nginx.controller.config`). Setting it on the `nginx-ingress-services` release (e.g. `--set controller.config.annotations-risk-level=...`) has no effect.

## Prerequisites

| Check | Command | Expected |
|---|---|---|
| Kubernetes version | `d kubectl version` | Server `v1.29.x` or later. Older: stop and contact Wire. |
| Release names and namespaces | `d helm list -A \| grep -E 'ingress-nginx-controller\|nginx-ingress-services'` | Both releases listed. Note `NAMESPACE` (below: `<NS>`, usually `default`). |
| Current revisions | `d helm history ingress-nginx-controller -n <NS>` and `d helm history nginx-ingress-services -n <NS>` | Note last `deployed` revision of each (for rollback). |
| Admin host workspace with current values | `ls <OLD_PACKAGE_DIR>/values/ingress-nginx-controller/values.yaml` | File exists |

## Warning

- Do **not** run `bin/offline-deploy.sh` or `bin/helm-operations.sh` on an existing installation.
- Both run a full fresh-install flow: existing `values.yaml` / `secrets.yaml` are moved to `*.bak.<timestamp>`, replaced with the `prod-*.example.yaml` files, and all charts are re-deployed with them.
- Use only the commands in this document.

## 1. Prepare the new bundle

```bash
wget https://s3-eu-west-1.amazonaws.com/public.wire.com/artifacts/wire-server-deploy-static-<HASH>.tgz
mkdir New-Wire-Server && cd New-Wire-Server
tar xvzf ../wire-server-deploy-static-<HASH>.tgz
source ./bin/offline-env.sh
```

- `<HASH>`: provided by Wire.
- Copy your inventory and values from the old workspace:

```bash
cp ../<OLD_PACKAGE_DIR>/ansible/inventory/offline/hosts.ini ansible/inventory/offline/hosts.ini
for chart in ingress-nginx-controller nginx-ingress-services; do
cp ../<OLD_PACKAGE_DIR>/values/$chart/values.yaml values/$chart/values.yaml
done
cp ../<OLD_PACKAGE_DIR>/values/nginx-ingress-services/secrets.yaml values/nginx-ingress-services/secrets.yaml
```

## 2. Seed the new container images

```bash
d ansible-playbook -i ./ansible/inventory/offline/hosts.ini ansible/setup-offline-sources.yml
d ansible-playbook -i ./ansible/inventory/offline/hosts.ini ansible/seed-offline-containerd.yml
```

Verify on one Kubernetes node:

```bash
sudo crictl images | grep -E 'ingress-nginx/(controller|kube-webhook-certgen)'
```

Expected: `controller` tag `v1.13.9`, `kube-webhook-certgen` tag `v1.6.9`.

## 3. Update ingress-nginx-controller values

Edit `values/ingress-nginx-controller/values.yaml`. Required keys:

```yaml
ingress-nginx:
controller:
config:
annotations-risk-level: Critical
image:
tag: "v1.13.9"
digest: ""
digestChroot: ""
admissionWebhooks:
patch:
image:
tag: "v1.6.9"
digest: ""
```

- Keep all other existing keys (`kind`, `service`, `metrics`, ...).
- Remove any other `annotations-risk-level` setting (e.g. `Warning`).
- Reference: `values/ingress-nginx-controller/prod-values.example.yaml`.

Compare:

```bash
diff -u values/ingress-nginx-controller/prod-values.example.yaml values/ingress-nginx-controller/values.yaml
```

Expected: only your environment-specific differences.

## 4. Dry run

```bash
d helm template ingress-nginx-controller ./charts/ingress-nginx-controller -n <NS> \
-f values/ingress-nginx-controller/values.yaml \
| grep -E 'image: |annotations-risk-level|allow-snippet-annotations'
```

Expected:

```
allow-snippet-annotations: "true"
annotations-risk-level: "Critical"
image: registry.k8s.io/ingress-nginx/controller:v1.13.9
image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.6.9
image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.6.9
```

## 5. Upgrade

Order: `ingress-nginx-controller` first, then `nginx-ingress-services`.

```bash
d helm upgrade --install ingress-nginx-controller ./charts/ingress-nginx-controller -n <NS> \
-f values/ingress-nginx-controller/values.yaml --wait --timeout 15m

d helm upgrade --install nginx-ingress-services ./charts/nginx-ingress-services -n <NS> \
-f values/nginx-ingress-services/values.yaml \
-f values/nginx-ingress-services/secrets.yaml --wait --timeout 15m
```

- Do not pass `--set controller.config.*` to `nginx-ingress-services`.

## 6. Verify

```bash
SEL="app.kubernetes.io/instance=ingress-nginx-controller,app.kubernetes.io/component=controller"
```

| # | Check | Command | Expected |
|---|---|---|---|
| 1 | Pods ready | `d kubectl get pods -n <NS> -l "$SEL"` | All `Running`, `READY` 1/1 |
| 2 | Controller version | `d kubectl exec -n <NS> $(d kubectl get pod -n <NS> -l "$SEL" -o name \| head -1) -- /nginx-ingress-controller --version` | `Release: v1.13.9` |
| 3 | Risk level active | `d kubectl get cm -n <NS> ingress-nginx-controller-controller -o jsonpath='{.data.annotations-risk-level}'` | `Critical` |
| 4 | No rejected ingresses | `d kubectl logs -n <NS> -l "$SEL" --tail=-1 \| grep -Ei 'risky\|too risky\|cannot be used'` | No output |
| 5 | Ingresses | `d kubectl get ingress -n <NS>` | `ADDRESS` populated for all ingresses |
| 6 | API | `curl -s https://nginz-https.<DOMAIN>/api-version` | JSON with `supported` versions |
| 7 | TLS certificate | `openssl s_client -connect nginz-https.<DOMAIN>:443 -servername nginz-https.<DOMAIN> </dev/null 2>/dev/null \| openssl x509 -noout -subject -issuer` | Your certificate. **Not** `Kubernetes Ingress Controller Fake Certificate` |
| 8 | Assets (fake S3 / minio ingress) | Upload and download an image in a conversation | Works |
| 9 | Clients | Log in via webapp, team settings, mobile client | Works |

- Federation enabled: repeat check 7 for the federator host and verify federated search / messaging.

## 7. Rollback

```bash
d helm rollback nginx-ingress-services <REVISION> -n <NS> --wait --timeout 15m
d helm rollback ingress-nginx-controller <REVISION> -n <NS> --wait --timeout 15m
```

- `<REVISION>`: revisions noted in the prerequisites.
- Restores the previous chart and controller image. Re-run checks 1, 5, 6, 7.
4 changes: 2 additions & 2 deletions terraform/examples/wiab-demo-hetzner/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ variable "server_type" {

# Get available server types and locations
data "hcloud_server_types" "available" {}
data "hcloud_datacenters" "available" {}
data "hcloud_locations" "available" {}

locals {
available_server_type_names = [for st in data.hcloud_server_types.available.server_types : st.name]
available_location_names = [for dc in data.hcloud_datacenters.available.datacenters : dc.location.name]
available_location_names = [for l in data.hcloud_locations.available.locations : l.name]
}

resource "null_resource" "location_validation" {
Expand Down
3 changes: 2 additions & 1 deletion terraform/examples/wiab-demo-hetzner/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
terraform {
required_providers {
hcloud = {
source = "hetznercloud/hcloud"
source = "hetznercloud/hcloud"
version = "~> 1.70"
}
}
required_version = "~> 1.1"
Expand Down
4 changes: 2 additions & 2 deletions terraform/examples/wiab-staging-hetzner/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ variable "medium_server_type" {

# Get available server types and locations
data "hcloud_server_types" "available" {}
data "hcloud_datacenters" "available" {}
data "hcloud_locations" "available" {}

# Validate the exact combination requested by the deployment script.
locals {
available_server_type_names = [for st in data.hcloud_server_types.available.server_types : st.name]
available_location_names = [for dc in data.hcloud_datacenters.available.datacenters : dc.location.name]
available_location_names = [for l in data.hcloud_locations.available.locations : l.name]
}

resource "null_resource" "location_validation" {
Expand Down
3 changes: 2 additions & 1 deletion terraform/examples/wiab-staging-hetzner/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
terraform {
required_providers {
hcloud = {
source = "hetznercloud/hcloud"
source = "hetznercloud/hcloud"
version = "~> 1.70"
}
}
required_version = "~> 1.1"
Expand Down
Loading
Loading