-
Notifications
You must be signed in to change notification settings - Fork 424
/
Copy pathupdate-templates.sh
executable file
·64 lines (54 loc) · 1.87 KB
/
update-templates.sh
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
dropin_yaml() {
local service=$1
local name=$2
local source=$3
echo "# Autogenerated by hack/update-templates.sh; do not edit"
echo "name: $service"
echo "dropins:"
echo " - name: $name"
echo " contents: |"
sed 's/^/ /' $source
}
write_dropin_yaml() {
local service=$1
local name=$2
local source=$3
local dst=$4
echo "Generating template for drop-in $service::$name => $dst" >&2
dropin_yaml "$service" "$name" "$source" > "$dst"
}
service_yaml() {
local name=$1
local enabled=$2
local source=$3
echo "# Autogenerated by hack/update-templates.sh; do not edit"
echo "name: $name"
echo "enabled: $enabled"
echo "contents: |"
sed 's/^/ /' $source
}
write_service_yaml() {
local name=$1
local enabled=$2
local source=$3
local dst=$4
echo "Generating template for service $name (enabled=$enabled) => $dst" >&2
service_yaml "$name" "$enabled" "$source" > "$dst"
}
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
UNITS=${SCRIPT_ROOT}/templates/common/_base/units
KUBENS_VENDOR=${SCRIPT_ROOT}/vendor/github.com/containers/kubensmnt/utils/systemd
echo "Updating templates from vendor/github.com/containers/kubensmnt/utils/systemd..." >&2
write_service_yaml kubens.service "false" ${KUBENS_VENDOR}/kubens.service ${UNITS}/kubens.service.yaml
write_dropin_yaml kubelet.service 01-kubens.conf ${KUBENS_VENDOR}/kubens-dropin.conf ${UNITS}/kubelet.service-kubens.yaml
write_dropin_yaml crio.service 01-kubens.conf ${KUBENS_VENDOR}/kubens-dropin.conf ${UNITS}/crio.service-kubens.yaml
log_cp() {
echo "Copying $1 => $2"
cp $1 $2
}
echo "Copying worker templates from equivalent master templates"
log_cp templates/master/01-master-kubelet/_base/files/kubenswrapper.yaml templates/worker/01-worker-kubelet/_base/files/kubenswrapper.yaml