mirror of
https://github.com/outbackdingo/cozystack.git
synced 2026-01-27 10:18:39 +00:00
fix CSI label for tenant Kubernetes clusters (#291)
This commit is contained in:
@@ -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=4
|
||||
VERSION=5
|
||||
|
||||
run_migrations() {
|
||||
if ! kubectl get configmap -n cozy-system cozystack-version; then
|
||||
|
||||
15
scripts/migrations/4
Executable file
15
scripts/migrations/4
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
# Migration 4 --> 5
|
||||
|
||||
# Fix tenant-kubernetes PVCs
|
||||
kubectl get secret -l kamaji.clastix.io/project=kamaji,kamaji.clastix.io/component=admin-kubeconfig -A --output=go-template='{{ range .items }}{{ printf "%s %s %s %s\n" .metadata.namespace .metadata.name (index .metadata.labels "kamaji.clastix.io/name") (index .data "super-admin.conf") }}{{ end }}' | while read NAMESPACE NAME CLUSTER CONFIGB64; do
|
||||
config=$(mktemp)
|
||||
echo "$CONFIGB64" | base64 -d > "$config"
|
||||
kubectl get pv --kubeconfig="$config" --output=go-template='{{ range .items }}{{ printf "%s\n" .metadata.name }}{{ end }}' | while read PVC; do
|
||||
(set -x; kubectl label pvc --overwrite -n "$NAMESPACE" "$PVC" "cluster.x-k8s.io/cluster-name=$CLUSTER")
|
||||
done
|
||||
rm -f "$config"
|
||||
done
|
||||
|
||||
# Write version to cozystack-version config
|
||||
kubectl create configmap -n cozy-system cozystack-version --from-literal=version=5 --dry-run=client -o yaml | kubectl apply -f-
|
||||
Reference in New Issue
Block a user