forked from elastic/cloud-on-k8s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manifest-gen.sh
executable file
·58 lines (48 loc) · 1.54 KB
/
manifest-gen.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
#!/usr/bin/env bash
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License;
# you may not use this file except in compliance with the Elastic License.
# Script to generate an ECK installation manifest
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CHART_DIR="${SCRIPT_DIR}/assets/charts/eck"
update_chart() {
local ALL_CRDS="${SCRIPT_DIR}/../../config/crds/all-crds.yaml"
local VERSION
VERSION=$(cat "${SCRIPT_DIR}/../../VERSION")
cp -f "$ALL_CRDS" "${CHART_DIR}/crds/all-crds.yaml"
sed -i -E "s#version: [0-9]+\.[0-9]+\.[0-9]+#version: $VERSION#" "${CHART_DIR}/values.yaml"
sed -i -E "s#appVersion: [0-9]+\.[0-9]+\.[0-9]+#appVersion: $VERSION#" "${CHART_DIR}/Chart.yaml"
}
usage() {
echo "Usage: $0 [-u | -g <args>]"
echo " '-u'"
echo " Update the chart and exit"
echo " '-g'"
echo " Generate manifest using the given arguments"
echo ""
echo "Example: $0 -g --profile=restricted --set=operator.namespace=myns"
exit 2
}
while getopts "ug" OPT; do
case "$OPT" in
u)
update_chart
exit 0
;;
g)
update_chart
shift $((OPTIND-1))
ARGS=("$@")
(
cd "$SCRIPT_DIR"
go run main.go --source="$CHART_DIR" generate "${ARGS[@]}"
)
exit 0
;;
*)
usage
;;
esac
done
usage