searxng/manifests/bin/deploy.sh
ange eb9a111664
All checks were successful
/ deploy (push) Successful in 5s
bump: 2024.12.20-19ee529b7
2024-12-22 07:33:37 +00:00

47 lines
1.1 KiB
Bash
Executable File

#!/bin/bash -e
set -o pipefail
function kapply() {
for f in "$@"; do
kubectl apply -f <(envsubst < "manifests/$f")
done
}; export -f kapply
function kcreatesec() {
kubectl create secret generic --save-config --dry-run=client -oyaml "$@" | kubectl apply -f-
}; export -f kcreatesec
function kcreatecm() {
kubectl create configmap --dry-run=client -oyaml "$@" | kubectl apply -f-
}; export -f kcreatecm
function kgseckey() {
local sec="$1"; shift
local key="$1"; shift
if ! kubectl get secret "$sec" -ojson | jq -re ".data.\"$key\" // empty" | base64 -d; then
return 1
fi
}; export -f kgseckey
function kgcmkey() {
local cm="$1"; shift
local key="$1"; shift
if ! kubectl get configmap "$cm" -ojson | jq -re ".data.\"$key\" // empty"; then
return 1
fi
}; export -f kgcmkey
kcreatesec searxng \
--from-literal=SEARXNG_SECRET="$(kgseckey searxng SEARXNG_SECRET || openssl rand -hex 32)"
kcreatecm searxng \
--from-file=config/settings.yml \
--from-file=config/limiter.toml
kapply common/valkey.yaml common/app.yaml
kubectl rollout restart deployment app