-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Just uses `spin kube deploy …` to deploy an existing sample app and verify that it works. Uses traefik ingress because the port_forwarding API still has some unresolved challenges. Signed-off-by: Jan Dubois <[email protected]>
- Loading branch information
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
load '../helpers/load' | ||
|
||
local_setup() { | ||
if using_docker; then | ||
skip "this test only works on containerd right now" | ||
fi | ||
} | ||
|
||
# Get the host name to use to reach Traefik | ||
get_host() { | ||
if is_windows; then | ||
local jsonpath='jsonpath={.status.loadBalancer.ingress[0].ip}' | ||
run --separate-stderr kubectl get service traefik --namespace kube-system --output "$jsonpath" | ||
assert_success || return | ||
assert_output || return | ||
echo "$output.sslip.io" | ||
else | ||
echo "localhost" | ||
fi | ||
} | ||
|
||
@test 'start k8s with spinkube' { | ||
factory_reset | ||
start_kubernetes \ | ||
--experimental.container-engine.web-assembly.enabled \ | ||
--experimental.kubernetes.options.spinkube | ||
wait_for_kubelet | ||
} | ||
|
||
@test 'deploy app to kubernetes' { | ||
spin kube deploy --from ghcr.io/deislabs/containerd-wasm-shims/examples/spin-rust-hello:v0.10.0 | ||
} | ||
|
||
# TODO replace ingress with port-forwarding | ||
@test 'deploy ingress' { | ||
kubectl apply --filename - <<EOF | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: spin-rust-hello | ||
annotations: | ||
traefik.ingress.kubernetes.io/router.entrypoints: web | ||
spec: | ||
rules: | ||
- host: $(get_host) | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: spin-rust-hello | ||
port: | ||
number: 80 | ||
EOF | ||
} | ||
|
||
@test 'connect to app on localhost' { | ||
run try curl --silent --fail --connect-timeout 5 "http://$(get_host)/hello" | ||
assert_success | ||
assert_output "Hello world from Spin!" | ||
} |