Skip to content

Commit c05cc45

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 b197389 commit c05cc45

3 files changed

Lines changed: 48 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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ ifneq (,$(DAPPER_HOST_ARCH))
138138

139139
include $(SHIPYARD_DIR)/Makefile.clusters
140140

141+
deploy-example-hello-world: SETTINGS=.example.hello-world.yml
142+
deploy-example-hello-world: build-cmd clusters
143+
./scripts/$@.sh
144+
145+
.PHONY: deploy-example-hello-world
146+
141147
else
142148

143149
# Not running in Shipyard's container
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)