2024-05-01 08:36:34 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
function kapply() {
|
|
|
|
for f in "$@"; do
|
2024-12-23 03:06:06 +00:00
|
|
|
kubectl apply -f <(envsubst < "manifests/$f")
|
2024-05-01 08:36:34 +00:00
|
|
|
done
|
2024-12-23 03:06:06 +00:00
|
|
|
}; export -f kapply
|
2024-05-01 08:36:34 +00:00
|
|
|
|
|
|
|
function kcreatesec() {
|
2024-12-23 03:06:06 +00:00
|
|
|
kubectl create secret generic --dry-run=client -oyaml "$@" | kubectl replace -f-
|
|
|
|
}; export -f kcreatesec
|
2024-05-01 08:36:34 +00:00
|
|
|
|
|
|
|
function kcreatecm() {
|
2024-12-23 03:06:06 +00:00
|
|
|
kubectl create configmap --dry-run=client -oyaml "$@" | kubectl replace -f-
|
|
|
|
}; export -f kcreatecm
|
2024-05-01 08:36:34 +00:00
|
|
|
|
|
|
|
function kgseckey() {
|
|
|
|
local sec="$1"; shift
|
|
|
|
local key="$1"; shift
|
|
|
|
|
2024-12-23 03:06:06 +00:00
|
|
|
if ! kubectl get secret "$sec" -ojson | jq -re ".data.\"$key\" // empty" | base64 -d; then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}; export -f kgseckey
|
2024-05-01 08:36:34 +00:00
|
|
|
|
|
|
|
function kgcmkey() {
|
2024-12-23 03:06:06 +00:00
|
|
|
local cm="$1"; shift
|
2024-05-01 08:36:34 +00:00
|
|
|
local key="$1"; shift
|
|
|
|
|
2024-12-23 03:06:06 +00:00
|
|
|
if ! kubectl get configmap "$cm" -ojson | jq -re ".data.\"$key\" // empty"; then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}; export -f kgcmkey
|
2024-05-01 08:36:34 +00:00
|
|
|
|
|
|
|
|
2024-05-15 23:33:29 +00:00
|
|
|
kcreatesec searxng \
|
|
|
|
--from-literal=SEARXNG_SECRET="$(kgseckey searxng SEARXNG_SECRET || openssl rand -hex 32)"
|
2024-05-01 08:36:34 +00:00
|
|
|
|
2024-12-23 03:06:06 +00:00
|
|
|
opts=()
|
|
|
|
for f in config/*; do
|
|
|
|
opts+=(--from-file="$f")
|
|
|
|
done
|
|
|
|
kcreatecm searxng "${opts[@]}"
|
2024-05-01 08:36:34 +00:00
|
|
|
|
2024-07-30 10:21:28 +00:00
|
|
|
kapply common/valkey.yaml common/app.yaml
|
2024-05-01 08:36:34 +00:00
|
|
|
|
|
|
|
kubectl rollout restart deployment app
|