Skip to content

Commit

Permalink
fix existing media pvc issues
Browse files Browse the repository at this point in the history
Signed-off-by: Bernard Gütermann <[email protected]>
  • Loading branch information
bernardgut committed Sep 21, 2024
1 parent bb5e52b commit f715b5c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ transmission:

See the chart [values.yaml](charts/k8s-mediamanager/values.yaml) for more details on available parameters.

If you already have pre-existing volumes you can patch them using the `helm-adopt.sh` script to avoid having the
`error : resources already exist` issue when running the install script

## Usage

Upon deploying the chart with the command above the following endpoints will become available externally:
Expand Down
2 changes: 2 additions & 0 deletions charts/k8s-mediamanager/templates/sharedStorage.pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- with .Values.general.sharedStorage }}
{{- if not (lookup "v1" "persistentVolumeClaim" "" .persistentVolumeClaim.claimName) }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand All @@ -22,4 +23,5 @@ spec:
selector:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
14 changes: 14 additions & 0 deletions helm-adopt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

# This script is used to adopt pre-existing pvcs into a Helm release. It is used in the
# following way:
# helm-adpot.sh <namespace> <release-name>

[ "$#" -eq 2 ] || { echo "Usage: $0 <namespace> <release-name>"; exit 1; }

NAMESPACE=$1
RELEASE_NAME=$2
kubectl get -n $NAMESPACE pvc -o name | xargs -I % kubectl label -n $NAMESPACE % app.kubernetes.io/managed-by=Helm
kubectl get -n $NAMESPACE pvc -o name | xargs -I % kubectl annotate -n $NAMESPACE % meta.helm.sh/release-name=$RELEASE_NAME
kubectl get -n $NAMESPACE pvc -o name | xargs -I % kubectl annotate -n $NAMESPACE % meta.helm.sh/release-namespace=$NAMESPACE
kubectl get -n $NAMESPACE pvc -o name | xargs -I % kubectl annotate -n $NAMESPACE % helm.sh/resource-policy=keep

0 comments on commit f715b5c

Please sign in to comment.