Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ application._
- in wasmCloud on VMs [example](./platform-wasmcloud/README.md)
- in wasmCloud on Kubernetes, with the wasmCloud Operator
[example](./platform-wasmcloud/README.md)
- in Spin on VMs — to be added
- in Spin on Kubernetes, with SpinKube — to be added
- in Spin on VMs — to be added
- in Spin on Kubernetes, with SpinKube — to be added

<!-- prettier-ignore -->
> [!CAUTION]
Expand Down
4 changes: 2 additions & 2 deletions java-containers-k8s/kubernetes/local_k3d/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
1. Create the cluster with a registry

```fish
./create.fish
../../../local_k3d/create.fish
```

1. Add the registry to your local /etc/hosts
Expand Down Expand Up @@ -47,7 +47,7 @@
1. Delete the cluster

```fish
./destroy.fish
../../../local_k3d/destroy.fish
```

## Test
Expand Down
12 changes: 0 additions & 12 deletions java-containers-k8s/kubernetes/local_k3d/destroy.fish

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env fish

set --local SCRIPT_DIR (dirname (realpath (status -f)))

function section
echo
string pad --right --char=— -w$COLUMNS "———— $argv ————"
Expand All @@ -8,7 +10,7 @@ end
section "starting registry"
k3d registry create platform-poc.localhost --port 5001

section "starting platform-poc cluster"
section "starting cluster"
k3d cluster create platform-poc \
--agents 2 \
--registry-use k3d-platform-poc.localhost:5001 \
Expand All @@ -17,3 +19,6 @@ k3d cluster create platform-poc \

section configuration
kubectl cluster-info

section "deploying prometheus"
./deploy_prometheus.fish
61 changes: 61 additions & 0 deletions local_k3d/deploy_prometheus.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env fish

set --local SCRIPT_DIR (dirname (realpath (status -f)))

function section
echo
string pad --right --char=— -w$COLUMNS "———— $argv ————"
end

rm -rf $SCRIPT_DIR/kube-prometheus
mkdir -p $SCRIPT_DIR/kube-prometheus
pushd $SCRIPT_DIR/kube-prometheus
echo "*" >.gitignore

curl -L https://github.com/prometheus-operator/kube-prometheus/archive/main.zip -o kube-prometheus-main.zip
tar -xvf kube-prometheus-main.zip
rm kube-prometheus-main.zip

mv kube-prometheus-main/manifests/setup .
mv kube-prometheus-main/manifests .
rm -rf kube-prometheus-main

kubectl create -f setup
while not kubectl get servicemonitors --all-namespaces
date
sleep 1
end
kubectl create -f manifests

function daemon
pushd /tmp
status job-control full
set -l name $argv[1]
if test -f {$name}.pid
set -l PID (cat {$name}.pid)
rm -f {$name}.pid {$name}.out
if test -n "$PID"
echo "Killing $name with PID $PID"
kill $PID
end
end
set -l command $argv[2..-1]
command nohup $command >{$name}.out 2>&1 &
echo {$name}...
echo $last_pid >{$name}.pid
sleep 0.5
cat {$name}.out
popd
end

section "forwarding ports"
kubectl \
--namespace monitoring \
wait \
--for condition=ready \
--timeout 60s \
pod \
--selector app.kubernetes.io/part-of=kube-prometheus
daemon prometheus kubectl --namespace monitoring port-forward svc/prometheus-k8s 9090
daemon grafana kubectl --namespace monitoring port-forward svc/grafana 3000
daemon alertmanager kubectl --namespace monitoring port-forward svc/alertmanager-main 9093
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ function section
string pad --right --char=— -w$COLUMNS "———— $argv ————"
end

section "removing kube-prometheus"
./undeploy_prometheus.fish

section "deleting platform-poc cluster"
k3d cluster delete platform-poc

Expand Down
36 changes: 36 additions & 0 deletions local_k3d/undeploy_prometheus.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env fish

set --local SCRIPT_DIR (dirname (realpath (status -f)))

function section
echo
string pad --right --char=— -w$COLUMNS "———— $argv ————"
end

function stop
set -l name $argv[1]
pushd /tmp
if test -f {$name}.pid
set -l PID (cat {$name}.pid)
rm -f {$name}.pid {$name}.out
if test -n "$PID"
echo "Killing $name with PID $PID"
kill $PID
end
end
popd
end

section "stopping port forwarding"
stop prometheus
stop grafana
stop alertmanager

section "removing kube-prometheus"
if test -d $SCRIPT_DIR/kube-prometheus
pushd $SCRIPT_DIR/kube-prometheus
kubectl delete --ignore-not-found=true -f manifests/ -f setup/
popd
end

rm -rf $SCRIPT_DIR/kube-prometheus
10 changes: 5 additions & 5 deletions platform-wasmcloud/k3d/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
1. Create the cluster and local registry

```fish
./create.fish
../../local_k3d/create.fish
```

1. Install the wasmCloud operator
Expand All @@ -15,7 +15,7 @@
1. Start redis, postgres, wash ui and port forwarding

```fish
../up.fish
./up.fish
```

1. Build the platform-poc application
Expand All @@ -27,13 +27,13 @@
1. Install our platform-poc application

```fish
kubectl apply -f ./wadm.yaml
./deploy.fish
```

1. Delete the application

```fish
kubectl delete -f ./wadm.yaml
./undeploy.fish
```

1. Stop the cluster
Expand All @@ -45,5 +45,5 @@
1. Delete the cluster and registry

```fish
./destroy.fish
../../local_k3d/destroy.fish
```
19 changes: 0 additions & 19 deletions platform-wasmcloud/k3d/create.fish

This file was deleted.

9 changes: 9 additions & 0 deletions platform-wasmcloud/k3d/deploy.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env fish

function section
echo
string pad --right --char=— -w$COLUMNS "———— $argv ————"
end

section "deploying components"
kubectl apply -f ./wadm.yaml
12 changes: 0 additions & 12 deletions platform-wasmcloud/k3d/destroy.fish

This file was deleted.

11 changes: 11 additions & 0 deletions platform-wasmcloud/k3d/undeploy.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env fish

set --local SCRIPT_DIR (dirname (realpath (status -f)))

function section
echo
string pad --right --char=— -w$COLUMNS "———— $argv ————"
end

section "deploying components"
kubectl delete -f ./wadm.yaml
2 changes: 1 addition & 1 deletion platform-wasmcloud/k3d/up.fish
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ set wasmcloud_host (
)

section "forwarding ports"
daemon http kubectl port-forward $wasmcloud_host 8080
daemon http kubectl port-forward $wasmcloud_host 8081
daemon nats kubectl port-forward svc/nats 4222 4223

section "starting wash UI"
Expand Down
Loading