-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path3-deploy.sh
executable file
·40 lines (28 loc) · 1.18 KB
/
3-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
#!/bin/bash
set -eu
. common.sh
load-images() {
local kind_name=$1; shift
local container_images=("$@")
for image in "${container_images[@]}"; do
${KIND_PATH} load docker-image --name $kind_name "${image}"
done
}
# Load builded images
container_images=("spiffe-helper:latest-local" "client-service:latest-local" "api-service:latest-local")
load-images ${CLUSTER_NAME} "${container_images[@]}"
# Deploy SPIRE Server
log-info "Deploying SPIRE Server"
${KUBECTL_PATH} create namespace spire
${KUBECTL_PATH} apply -k ./k8s/spire/server
log-info "Waiting for SPIRE Server"
${KUBECTL_PATH} wait --for=condition=Ready --timeout=300s pod/spire-server-0 -n spire
log-info "Creating entries"
cat entries.json | ${KUBECTL_PATH} exec -n spire spire-server-0 -c spire-server -i -- /opt/spire/bin/spire-server entry create -data -
log-info "Deploying SPIRE Agent"
${KUBECTL_PATH} apply -k ./k8s/spire/agent
log-info "Waiting for SPIRE Agent"
agentName=$(${KUBECTL_PATH} get pod -n spire -l app=spire-agent -o jsonpath="{.items[0].metadata.name}")
${KUBECTL_PATH} wait --for=condition=Ready --timeout=300s pod/${agentName} -n spire
log-info "Deploy pods"
${KUBECTL_PATH} apply -k ./k8s/demo