2024-05-03 15:16:30 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
function kapply() {
|
|
|
|
for f in "$@"; do
|
|
|
|
kubectl apply -f \
|
|
|
|
<(envsubst "$(env | xargs printf '$%s ')" < "manifests/$f")
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
function kcreatesec() {
|
|
|
|
kubectl create secret generic --save-config --dry-run=client -oyaml "$@" | kubectl apply -f-
|
|
|
|
}
|
|
|
|
|
|
|
|
function kcreatecm() {
|
|
|
|
kubectl create configmap --dry-run=client -oyaml "$@" | kubectl apply -f-
|
|
|
|
}
|
|
|
|
|
|
|
|
function kgseckey() {
|
|
|
|
local sec="$1"; shift
|
|
|
|
local key="$1"; shift
|
|
|
|
|
|
|
|
kubectl get secret "$sec" -o jsonpath="{.data.$key}" | base64 -d
|
|
|
|
}
|
|
|
|
|
|
|
|
function kgcmkey() {
|
|
|
|
local cm="$1"; shift
|
|
|
|
local key="$1"; shift
|
|
|
|
|
|
|
|
kubectl get configmap "$cm" -o jsonpath="{.data.$key}"
|
|
|
|
}
|
|
|
|
|
2024-05-15 17:51:19 +00:00
|
|
|
(cd config
|
|
|
|
cmd=(kcreatecm homepage-config)
|
|
|
|
for f in *; do
|
|
|
|
cmd+=("--from-file=$f=<(envsubst \"\$(env | xargs printf '$%s ')\" < $f)")
|
|
|
|
done
|
|
|
|
eval "${cmd[*]}"
|
|
|
|
)
|
2024-05-03 15:16:30 +00:00
|
|
|
|
|
|
|
kapply common/clusterrole.yaml common/app.yaml
|
|
|
|
|
|
|
|
kubectl rollout restart deployment app
|