-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcommodore_command.sh
More file actions
executable file
·43 lines (37 loc) · 1.72 KB
/
commodore_command.sh
File metadata and controls
executable file
·43 lines (37 loc) · 1.72 KB
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
#!/usr/bin/env bash
# renovate: datasource=docker depName=projectsyn/commodore
COMMODORE_VERSION="v1.31.0"
commodore() {
LIEUTENANT_URL=$(curl http://localhost:4040/api/tunnels --silent | jq -r '.["tunnels"][0]["public_url"]')
LIEUTENANT_TOKEN=$(kubectl --context minikube --namespace lieutenant get secret "$(kubectl --context minikube --namespace lieutenant get sa api-access-synkickstart -o go-template='{{(index .secrets 0).name}}')" -o go-template='{{.data.token | base64decode}}')
interactive=${COMMODORE_INTERACTIVE:-"--interactive=true"}
tty=${COMMODORE_TTY:-"--tty"}
docker run $interactive $tty \
--rm \
--user="$(id -u)" \
--env COMMODORE_API_URL="$LIEUTENANT_URL" \
--env COMMODORE_API_TOKEN="$LIEUTENANT_TOKEN" \
--env SSH_AUTH_SOCK=/tmp/ssh_agent.sock \
--volume "${SSH_AUTH_SOCK}:/tmp/ssh_agent.sock" \
--volume "${HOME}/.ssh/config:/app/.ssh/config:ro" \
--volume "${HOME}/.ssh/known_hosts:/app/.ssh/known_hosts:ro" \
--volume "${HOME}/.gitconfig:/app/.gitconfig:ro" \
--volume "${PWD}:/app/data" \
--workdir /app/data \
projectsyn/commodore:${COMMODORE_VERSION:=latest} \
$*
}
commodore_push_all() {
CLUSTERS=($(kubectl --context minikube -n lieutenant get cluster -o jsonpath="{$.items[*].metadata.name}"))
for CLUSTER in "${CLUSTERS[@]}"; do
echo "===> Compiling and pushing catalog for cluster $CLUSTER"
commodore catalog compile --push "$CLUSTER"
done
}
commodore_compile_all() {
CLUSTERS=($(kubectl --context minikube -n lieutenant get cluster -o jsonpath="{$.items[*].metadata.name}"))
for CLUSTER in "${CLUSTERS[@]}"; do
echo "===> Compiling catalog for cluster $CLUSTER"
commodore catalog compile "$CLUSTER"
done
}