44 lines
1.3 KiB
Bash
Executable File
44 lines
1.3 KiB
Bash
Executable File
#!/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}"
|
|
}
|
|
|
|
kcreatecm homepage \
|
|
--from-file=bookmarks.yaml =<(envsubst "$(env | xargs printf '$%s ')" < bookmarks.yaml) \
|
|
--from-file=custom.css =<(envsubst "$(env | xargs printf '$%s ')" < custom.css) \
|
|
--from-file=custom.js =<(envsubst "$(env | xargs printf '$%s ')" < custom.js) \
|
|
--from-file=kubernetes.yaml=<(envsubst "$(env | xargs printf '$%s ')" < kubernetes.yaml) \
|
|
--from-file=settings.yaml =<(envsubst "$(env | xargs printf '$%s ')" < settings.yaml) \
|
|
--from-file=widgets.yaml =<(envsubst "$(env | xargs printf '$%s ')" < widgets.yaml)
|
|
|
|
kapply common/clusterrole.yaml common/app.yaml
|
|
|
|
kubectl rollout restart deployment app
|