-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-helmfile-app.sh
More file actions
41 lines (32 loc) · 905 Bytes
/
create-helmfile-app.sh
File metadata and controls
41 lines (32 loc) · 905 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -e
CHART_DIR="charts/$1"
APPNAME="$(basename ${CHART_DIR})"
NAMESPACE="${2:-${APPNAME}}"
APP_VERSION=$(awk '/appVersion: / {print $2}' ${CHART_DIR}/Chart.yaml)
function log {
echo -e "[$(date +'%F %T')] \033[36m$@\033[0m"
}
log "Create release file for ${APPNAME}"
cat > helmfile/releases/${APPNAME}.yaml <<EOF
bases:
- ../envs/environments.yaml
---
releases:
- chart: ../../${CHART_DIR}
version: ${APP_VERSION}
wait: true
installed: true
name: ${APPNAME}
namespace: ${NAMESPACE}
skipDeps: true
labels:
app: ${APPNAME}
values:
- ../values/${APPNAME}.yaml.gotmpl
EOF
log "Create value file for ${APPNAME}"
cp -fv ${CHART_DIR}/values.yaml helmfile/values/${APPNAME}.yaml.gotmpl
log "----------------------"
log "Image list for ${APPNAME}:"
helmfile -f ./helmfile/releases/${APPNAME}.yaml template | grep "image:" | awk '{print $NF}' | tr -d '\"' | sort -u