Created
September 26, 2021 14:46
-
-
Save hef/1c085f03b6dee42be52620534cd7683e to your computer and use it in GitHub Desktop.
Bash script to help convert longhorn from manually installed to managed by helm-operator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
kind=$1 | |
name=$2 | |
if [ -n "$kind" ]; then | |
if [ ${kind} == "CustomResourceDefinition" ] || [ ${kind} == Cluster* ]; then | |
kubectl label ${kind} ${name} app.kubernetes.io/managed-by=Helm | |
kubectl annotate ${kind} ${name} meta.helm.sh/release-name=longhorn | |
kubectl annotate ${kind} ${name} meta.helm.sh/release-namespace=longhorn-system | |
else | |
kubectl label ${kind} ${name} -n longhorn-system app.kubernetes.io/managed-by=Helm | |
kubectl annotate ${kind} ${name} -n longhorn-system meta.helm.sh/release-name=longhorn | |
kubectl annotate ${kind} ${name} -n longhorn-system meta.helm.sh/release-namespace=longhorn-system | |
fi | |
fi | |
flux suspend helmrelease longhorn -n longhorn-system | |
flux resume helmrelease longhorn -n longhorn-system | |
#kubectl describe HelmRelease longhorn -n longhorn-system | |
#kubectl get HelmRelease longhorn -n longhorn-system -o jsonpath='{.Status.Message}' | |
kubectl get HelmRelease longhorn -n longhorn-system -o jsonpath='{.status.conditions[*].message}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment