Files
feedc0de 35ae5557b9
Validate and deploy Plex / Validate manifests and scripts (push) Successful in 12s
Validate and deploy Plex / Deploy to Kubernetes (push) Successful in 18s
Initial commit with the existing deployment files
2026-10-09 09:09:31 +02:00

35 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
set -eu
project_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
expected_context=kubernetes-admin@kubernetes
context=$(kubectl config current-context)
if [ "${context}" != "${expected_context}" ]; then
echo "Expected Kubernetes context ${expected_context}, found ${context}." >&2
exit 1
fi
if [ "$(findmnt -T /komposthaufen/multimedia -n -o FSTYPE)" != bcachefs ]; then
echo '/komposthaufen/multimedia is not backed by bcachefs.' >&2
exit 1
fi
test -d /komposthaufen/multimedia/Videos
kubectl apply --filename "${project_dir}/namespace.yaml"
kubectl --namespace plex wait --for=condition=complete \
job/plex-archlinux-migration --timeout=5s
kubectl apply --dry-run=server --filename "${project_dir}/plex.yaml"
kubectl apply --filename "${project_dir}/plex.yaml"
kubectl --namespace plex rollout status deployment/plex --timeout=30m
pod=$(kubectl --namespace plex get pod \
--selector=app.kubernetes.io/name=plex,app.kubernetes.io/component=server \
--output=jsonpath='{.items[0].metadata.name}')
node=$(kubectl --namespace plex get pod "${pod}" --output=jsonpath='{.spec.nodeName}')
image=$(kubectl --namespace plex get deployment plex --output=jsonpath='{.spec.template.spec.containers[?(@.name=="plex")].image}')
test "${node}" = arschrock
kubectl --namespace plex get pod "${pod}" --output=wide
printf 'Plex is ready on %s with image %s.\n' "${node}" "${image}"