-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkedge.sh
executable file
·60 lines (49 loc) · 975 Bytes
/
kedge.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
#!/bin/bash
set -eu
usage() {
cat << EOF
This plugin provides integration with the kedge project.
Available Commands:
build Build the Kedge files into Kubernetes artifacts, but don't package.
package Generated a packaged Helm chart.
Typical usage:
$ helm create mychart
$ mkdir -p mychart/kedge
$ place kedge files in mychart/kedge/
$ helm kedge package mychart
$ helm install ./mychart-0.1.0.tgz
EOF
}
build() {
kedge generate -f $1/kedge/ > $1/templates/kedge-generated.yaml
}
package() {
build $1
helm package $1
}
if [[ $# < 1 ]]; then
echo "===> ERROR: Subcommand required. Try 'helm kedge help'"
exit 1
elif [[ $# < 2 && $1 != "help" ]]; then
echo "===> ERROR: Missing chart path. Use '.' for the present directory."
exit 1
fi
case "${1:-"help"}" in
"package")
package $2
;;
"show")
show $2
;;
"build")
build $2
;;
"help")
usage
;;
*)
echo $1
usage
exit 1
;;
esac