From eeaa1b45174451edadb8c72ddcb17bf45abbd1a4 Mon Sep 17 00:00:00 2001 From: kklinch0 Date: Tue, 22 Apr 2025 12:38:46 +0300 Subject: [PATCH] [platform]: add migration for kube-rbac-proxy daemonset Signed-off-by: kklinch0 --- scripts/installer.sh | 2 +- scripts/migrations/11 | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 scripts/migrations/11 diff --git a/scripts/installer.sh b/scripts/installer.sh index d7667d5a..47dc965c 100755 --- a/scripts/installer.sh +++ b/scripts/installer.sh @@ -3,7 +3,7 @@ set -o pipefail set -e BUNDLE=$(set -x; kubectl get configmap -n cozy-system cozystack -o 'go-template={{index .data "bundle-name"}}') -VERSION=10 +VERSION=12 run_migrations() { if ! kubectl get configmap -n cozy-system cozystack-version; then diff --git a/scripts/migrations/11 b/scripts/migrations/11 new file mode 100644 index 00000000..7ef9486a --- /dev/null +++ b/scripts/migrations/11 @@ -0,0 +1,18 @@ +#!/bin/sh +# Migration 11 --> 12 + +# Recreate daemonset kube-rbac-proxy + +if kubectl get daemonset kube-rbac-proxy -n cozy-monitoring; then + kubectl delete daemonset kube-rbac-proxy --cascade=orphan -n cozy-monitoring +fi + +if kubectl get helmrelease monitoring-agents -n cozy-monitoring; then + timestamp=$(date --rfc-3339=ns) + kubectl annotate helmrelease monitoring-agents -n cozy-monitoring \ + reconcile.fluxcd.io/forceAt="$timestamp" \ + reconcile.fluxcd.io/requestedAt="$timestamp" \ + --overwrite +fi + +kubectl delete pods -l app.kubernetes.io/component=kube-rbac-proxy -n cozy-monitoring