Skip to content

Commit 82cb059

Browse files
committed
Example of deploying "hello world" with Shipyard
This exemplifies how the deployment on top of shipyard would work. This would probably be best put in the example repo itself, but I drafted it to make it clear how using Shipyard looks like. Signed-off-by: Mike Kolesnik <mkolesni@redhat.com>
1 parent 029c867 commit 82cb059

3 files changed

Lines changed: 49 additions & 0 deletions

File tree

.example.hello-world.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
nodes: control-plane worker
3+
clusters:
4+
west:
5+
east:

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ ifneq (,$(DAPPER_HOST_ARCH))
157157

158158
include $(SHIPYARD_DIR)/Makefile.clusters
159159

160+
deploy-example-hello-world: SETTINGS=.example.hello-world.yml
161+
deploy-example-hello-world: build-cmd clusters
162+
./scripts/$@.sh
163+
164+
.PHONY: deploy-example-hello-world
165+
160166
else
161167

162168
# Not running in Shipyard's container
@@ -168,6 +174,7 @@ endif
168174
@curl -sfLO $(SHIPYARD_URL)/$@
169175

170176
ONLY_SHIPYARD_GOALS = true
177+
SHIPYARD_GOALS = deploy-example-hello-world
171178
include Makefile.shipyard
172179

173180
endif
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
3+
set -em
4+
5+
source "${SCRIPTS_DIR}/lib/utils"
6+
source "${SCRIPTS_DIR}/lib/debug_functions"
7+
8+
print_env SETTINGS
9+
declare_kubeconfig
10+
11+
on_ctx() {
12+
"$2" --context "$1" "${@:3}"
13+
}
14+
15+
# Create namespaces
16+
on_ctx west kubectl create namespace west
17+
kubectl config set-context west --namespace west
18+
on_ctx east kubectl create namespace east
19+
kubectl config set-context east --namespace east
20+
21+
# Initialize and link
22+
on_ctx west ./skupper init --enable-console --enable-flow-collector
23+
on_ctx east ./skupper init
24+
on_ctx west ./skupper token create ${DAPPER_OUTPUT}/secret.token
25+
on_ctx east ./skupper link create ${DAPPER_OUTPUT}/secret.token
26+
27+
# Deploy and expose services
28+
on_ctx west kubectl create deployment frontend --image quay.io/skupper/hello-world-frontend
29+
on_ctx west kubectl expose deployment/frontend --port 8080 --type LoadBalancer
30+
on_ctx east kubectl create deployment backend --image quay.io/skupper/hello-world-backend --replicas 3
31+
on_ctx east ./skupper expose deployment/backend --port 8080
32+
33+
# Wait for service to become healthy
34+
svc_ip=$(on_ctx west kubectl get service/frontend -o jsonpath={.status.loadBalancer.ingress[0].ip})
35+
with_retries 30 sleep_on_fail 5s curl "http://${svc_ip}:8080/api/health"
36+
37+
echo "Success! You can access the web UI at http://${svc_ip}:8080"

0 commit comments

Comments
 (0)