forked from Crossbell-Box/xLog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapply.sh
More file actions
26 lines (21 loc) · 675 Bytes
/
apply.sh
File metadata and controls
26 lines (21 loc) · 675 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
set -e # exit on error
set -x # show command before execute
apply_one() {
envsubst < $1 > temp.yaml && mv temp.yaml $1
kubectl apply -f $1
}
apply() {
for filename in $@; do
apply_one $filename
done
# rollout status / annotation
for filename in $@; do
yaml_kind=$(yq '.kind' $filename)
if [ "$yaml_kind" = "Deployment" ]; then
ns=$(yq '.metadata.namespace' $filename)
name=$(yq '.metadata.name' $filename)
kubectl -n $ns rollout status -w deploy.apps/$name
fi
done
}
apply $@