chart: make the default deployment ready to install
Use the CI-published :latest tag with pullPolicy Always, since the chart previously defaulted to appVersion 0.1.0, which is not published as an image. Add ingress annotations with a cert-manager ClusterIssuer so the TLS secret is issued instead of having to exist beforehand. Extend release.sh --deploy to create the registry image pull secret from the local Docker config and pass it to the release, and document both the scripted and manual deployment paths.
This commit is contained in:
1 parent
96d704f192
commit
441fa056ba
5 files changed
+58
-12
No files matched your search
@@ -653,31 +653,53 @@ scripts/release.sh --deploy # also apply the users secret and helm upgrad
|
|||||||
|
|
||||||
`charts/musicmanager` renders:
|
`charts/musicmanager` renders:
|
||||||
|
|
||||||
- image repository/tag and `imagePullSecrets`
|
- image repository/tag (defaults to `:latest` with `pullPolicy: Always`) and `imagePullSecrets`
|
||||||
- `library.folders` into a ConfigMap (`/etc/musicmanager/library.yaml`)
|
- `library.folders` into a ConfigMap (`/etc/musicmanager/library.yaml`)
|
||||||
- `users.existingSecret` + key (Vault-managed; never put passwords in values)
|
- `users.existingSecret` + key (Vault-managed; never put passwords in values)
|
||||||
- ingress host `subsonic.tap-tap.win`, ingress class and TLS secret
|
- ingress host `subsonic.tap-tap.win`, ingress class, annotations and TLS secret;
|
||||||
|
cert-manager issues the certificate with the `letsencrypt-issuer` ClusterIssuer
|
||||||
|
by default
|
||||||
- `/data` PVC (size, storage class)
|
- `/data` PVC (size, storage class)
|
||||||
- `hostPath` mounts for music and long-form roots, both read-only
|
- `hostPath` mounts for music and long-form roots, both read-only
|
||||||
- resource requests/limits, non-root security context, probes on `/health`
|
- resource requests/limits, non-root security context, probes on `/health`
|
||||||
- optional `nodeSelector`, `tolerations` and `affinity`
|
- optional `nodeSelector`, `tolerations` and `affinity`
|
||||||
|
|
||||||
The secret is not created by the chart. Create it from the Vault-managed file:
|
The registry is private, so the cluster needs an image pull secret, and the users
|
||||||
|
secret must contain the Vault-managed file. `scripts/release.sh --deploy` creates
|
||||||
|
both from the local `~/.docker/config.json` and `config/users.yaml`, then runs
|
||||||
|
`helm upgrade --install`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker login gitea.tap-tap.win
|
||||||
|
scripts/release.sh --tag latest --deploy
|
||||||
|
```
|
||||||
|
|
||||||
|
To deploy by hand:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
kubectl create namespace musicmanager
|
kubectl create namespace musicmanager
|
||||||
|
|
||||||
kubectl -n musicmanager create secret generic musicmanager-users \
|
kubectl -n musicmanager create secret generic musicmanager-users \
|
||||||
--from-file=users.yaml=config/users.yaml
|
--from-file=users.yaml=config/users.yaml
|
||||||
|
|
||||||
|
kubectl -n musicmanager create secret generic musicmanager-registry \
|
||||||
|
--type=kubernetes.io/dockerconfigjson \
|
||||||
|
--from-file=.dockerconfigjson="$HOME/.docker/config.json"
|
||||||
|
|
||||||
helm upgrade --install musicmanager charts/musicmanager \
|
helm upgrade --install musicmanager charts/musicmanager \
|
||||||
--namespace musicmanager \
|
--namespace musicmanager \
|
||||||
--set image.tag=dev \
|
--set image.tag=latest \
|
||||||
--set users.existingSecret=musicmanager-users
|
--set users.existingSecret=musicmanager-users \
|
||||||
|
--set imagePullSecrets[0].name=musicmanager-registry
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Pin a specific build with `--set image.tag=sha-<commit>`; CI publishes that tag for
|
||||||
|
every push to `main`.
|
||||||
|
|
||||||
Adjust `library.folders`, `media.music.hostPath` and `media.longform.hostPath` for
|
Adjust `library.folders`, `media.music.hostPath` and `media.longform.hostPath` for
|
||||||
the cluster. Every schedulable node must expose the same host paths; the chart
|
the cluster. Every schedulable node must expose the same host paths; the chart
|
||||||
deliberately does not pin the pod to a node.
|
deliberately does not pin the pod to a node. The `/data` PVC must be writable by
|
||||||
|
UID 10001 (the chart sets `fsGroup: 10001`).
|
||||||
|
|
||||||
The server exits at startup if a configured root path is missing or unreadable, so
|
The server exits at startup if a configured root path is missing or unreadable, so
|
||||||
the pod will not pass its readiness probe in that case.
|
the pod will not pass its readiness probe in that case.
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ apiVersion: v2
|
|||||||
name: musicmanager
|
name: musicmanager
|
||||||
description: Self-hosted OpenSubsonic music server
|
description: Self-hosted OpenSubsonic music server
|
||||||
type: application
|
type: application
|
||||||
version: 0.1.0
|
version: 0.1.1
|
||||||
appVersion: "0.1.0"
|
appVersion: "0.1.0"
|
||||||
@@ -5,6 +5,10 @@ metadata:
|
|||||||
name: {{ include "musicmanager.fullname" . }}
|
name: {{ include "musicmanager.fullname" . }}
|
||||||
labels:
|
labels:
|
||||||
{{- include "musicmanager.labels" . | nindent 4 }}
|
{{- include "musicmanager.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.ingress.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
{{- with .Values.ingress.className }}
|
{{- with .Values.ingress.className }}
|
||||||
ingressClassName: {{ . }}
|
ingressClassName: {{ . }}
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ replicaCount: 1
|
|||||||
|
|
||||||
image:
|
image:
|
||||||
repository: gitea.tap-tap.win/taptap/audiomanager
|
repository: gitea.tap-tap.win/taptap/audiomanager
|
||||||
tag: "" # defaults to appVersion
|
# CI publishes :latest and :sha-<commit> for every push to main.
|
||||||
pullPolicy: IfNotPresent
|
tag: latest
|
||||||
|
pullPolicy: Always
|
||||||
|
|
||||||
imagePullSecrets: []
|
imagePullSecrets: []
|
||||||
nameOverride: ""
|
nameOverride: ""
|
||||||
@@ -51,6 +52,8 @@ service:
|
|||||||
ingress:
|
ingress:
|
||||||
enabled: true
|
enabled: true
|
||||||
className: traefik
|
className: traefik
|
||||||
|
annotations:
|
||||||
|
cert-manager.io/cluster-issuer: letsencrypt-issuer
|
||||||
host: subsonic.tap-tap.win
|
host: subsonic.tap-tap.win
|
||||||
path: /
|
path: /
|
||||||
pathType: Prefix
|
pathType: Prefix
|
||||||
|
|||||||
+20
-3
@@ -14,6 +14,8 @@ NAMESPACE="${NAMESPACE:-musicmanager}"
|
|||||||
RELEASE="${RELEASE:-musicmanager}"
|
RELEASE="${RELEASE:-musicmanager}"
|
||||||
USERS_SECRET="${USERS_SECRET:-musicmanager-users}"
|
USERS_SECRET="${USERS_SECRET:-musicmanager-users}"
|
||||||
USERS_FILE="${USERS_FILE:-$ROOT/config/users.yaml}"
|
USERS_FILE="${USERS_FILE:-$ROOT/config/users.yaml}"
|
||||||
|
PULL_SECRET="${PULL_SECRET:-musicmanager-registry}"
|
||||||
|
DOCKER_CONFIG_FILE="${DOCKER_CONFIG_FILE:-$HOME/.docker/config.json}"
|
||||||
|
|
||||||
TAG=""
|
TAG=""
|
||||||
DEPLOY=0
|
DEPLOY=0
|
||||||
@@ -35,6 +37,9 @@ Environment:
|
|||||||
RELEASE Helm release name (default: musicmanager)
|
RELEASE Helm release name (default: musicmanager)
|
||||||
USERS_SECRET Secret holding users.yaml (default: musicmanager-users)
|
USERS_SECRET Secret holding users.yaml (default: musicmanager-users)
|
||||||
USERS_FILE Path to users.yaml for --deploy (default: config/users.yaml)
|
USERS_FILE Path to users.yaml for --deploy (default: config/users.yaml)
|
||||||
|
PULL_SECRET Image pull secret name (default: musicmanager-registry)
|
||||||
|
DOCKER_CONFIG_FILE Docker config used for the pull secret
|
||||||
|
(default: ~/.docker/config.json)
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,8 +70,9 @@ fi
|
|||||||
if [[ $DEPLOY -eq 1 ]]; then
|
if [[ $DEPLOY -eq 1 ]]; then
|
||||||
echo "Deploying $RELEASE to namespace $NAMESPACE with image tag $TAG"
|
echo "Deploying $RELEASE to namespace $NAMESPACE with image tag $TAG"
|
||||||
|
|
||||||
|
kubectl create namespace "$NAMESPACE" --dry-run=client -o yaml | kubectl apply -f -
|
||||||
|
|
||||||
if [[ -f "$USERS_FILE" ]]; then
|
if [[ -f "$USERS_FILE" ]]; then
|
||||||
kubectl create namespace "$NAMESPACE" --dry-run=client -o yaml | kubectl apply -f -
|
|
||||||
kubectl -n "$NAMESPACE" create secret generic "$USERS_SECRET" \
|
kubectl -n "$NAMESPACE" create secret generic "$USERS_SECRET" \
|
||||||
--from-file=users.yaml="$USERS_FILE" \
|
--from-file=users.yaml="$USERS_FILE" \
|
||||||
--dry-run=client -o yaml | kubectl apply -f -
|
--dry-run=client -o yaml | kubectl apply -f -
|
||||||
@@ -74,8 +80,19 @@ if [[ $DEPLOY -eq 1 ]]; then
|
|||||||
echo "No users file at $USERS_FILE; assuming secret $USERS_SECRET already exists."
|
echo "No users file at $USERS_FILE; assuming secret $USERS_SECRET already exists."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
helm_args=(--set image.tag="$TAG" --set users.existingSecret="$USERS_SECRET")
|
||||||
|
|
||||||
|
if [[ -f "$DOCKER_CONFIG_FILE" ]]; then
|
||||||
|
kubectl -n "$NAMESPACE" create secret generic "$PULL_SECRET" \
|
||||||
|
--type=kubernetes.io/dockerconfigjson \
|
||||||
|
--from-file=.dockerconfigjson="$DOCKER_CONFIG_FILE" \
|
||||||
|
--dry-run=client -o yaml | kubectl apply -f -
|
||||||
|
helm_args+=(--set "imagePullSecrets[0].name=$PULL_SECRET")
|
||||||
|
else
|
||||||
|
echo "No Docker config at $DOCKER_CONFIG_FILE; assuming an image pull secret is configured."
|
||||||
|
fi
|
||||||
|
|
||||||
helm upgrade --install "$RELEASE" "$ROOT/charts/musicmanager" \
|
helm upgrade --install "$RELEASE" "$ROOT/charts/musicmanager" \
|
||||||
--namespace "$NAMESPACE" \
|
--namespace "$NAMESPACE" \
|
||||||
--set image.tag="$TAG" \
|
"${helm_args[@]}"
|
||||||
--set users.existingSecret="$USERS_SECRET"
|
|
||||||
fi
|
fi
|
||||||
Reference in new issue
Block a user