-
Notifications
You must be signed in to change notification settings - Fork 11
/
deploy.sh
executable file
·52 lines (46 loc) · 1.22 KB
/
deploy.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
#!/bin/bash
# Runs through all manifests and applies them in kubernetes
# Expects a directory structure of "environment/$environment/applications/$appname/...
# Run with "environment" directory as first parameter and "namespace" as second parameter and server url as third.
# The output is intended to be piped into kubectl, e.g.
# ./deploy.sh my-dir development "https://8.8.8.8" | kubectl apply -f -
set -eup
ROOT="$1"
NAMESPACE="$2"
URL="$3"
cd "$ROOT"
for env in $(ls); do
if $(test -d "$env"/applications); then
cd "$env"/applications
for appname in $(ls); do
if $(test -d $appname); then
echo "Applying manifest for $appname ..." > /dev/stderr
manifestsDir="environments/$env/applications/$appname/manifests"
cat << EOF
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: "$NAMESPACE-$appname"
namespace: tools
spec:
destination:
name: ""
namespace: $NAMESPACE
server: "$URL"
source:
path: $manifestsDir
repoURL: "[email protected]:freiheit-com/nmww-manifests.git"
targetRevision: kuberpult
project: default
syncPolicy:
automated:
prune: false
selfHeal: false
---
EOF
fi
done
fi
done
echo "$0 done" > /dev/stderr
exit 0