Skip to content

Commit 184f6bf

Browse files
authored
Integration gh workflow for test install and uninstall (#6)
1 parent 1905fe1 commit 184f6bf

11 files changed

Lines changed: 288 additions & 7 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: 'Smoke Test'
2+
description: 'Install, verify, uninstall, and debug the developer quickstart'
3+
4+
inputs:
5+
timeout:
6+
description: 'Timeout for install/uninstall scripts'
7+
required: false
8+
default: '300s'
9+
overlay:
10+
description: 'Overlay name for component verification (matches .github/config/overlays/<name>.env)'
11+
required: false
12+
default: 'base'
13+
14+
runs:
15+
using: 'composite'
16+
steps:
17+
- name: Run install script
18+
shell: bash
19+
env:
20+
LOCAL_DIR: .
21+
TIMEOUT: ${{ inputs.timeout }}
22+
run: ./install.sh
23+
24+
- name: Verify deployments
25+
shell: bash
26+
env:
27+
OVERLAY: ${{ inputs.overlay }}
28+
run: .github/scripts/verify-install.sh
29+
30+
- name: Run uninstall script
31+
shell: bash
32+
env:
33+
LOCAL_DIR: .
34+
TIMEOUT: ${{ inputs.timeout }}
35+
run: ./uninstall.sh
36+
37+
- name: Verify uninstall
38+
shell: bash
39+
run: .github/scripts/verify-uninstall.sh
40+
41+
- name: Debug on failure
42+
if: failure()
43+
shell: bash
44+
env:
45+
OVERLAY: ${{ inputs.overlay }}
46+
run: .github/scripts/debug.sh

.github/config/kind-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
kind: Cluster
2+
apiVersion: kind.x-k8s.io/v1alpha4
3+
nodes:
4+
- role: control-plane
5+
kubeadmConfigPatches:
6+
- |
7+
kind: InitConfiguration
8+
nodeRegistration:
9+
kubeletExtraArgs:
10+
node-labels: "ingress-ready=true"
11+
extraPortMappings:
12+
- containerPort: 80
13+
hostPort: 80
14+
protocol: TCP
15+
- containerPort: 443
16+
hostPort: 443
17+
protocol: TCP

.github/config/overlays/base.env

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Components expected in the base (default) deployment.
2+
# Used by verify-install.sh, verify-uninstall.sh, and debug.sh.
3+
#
4+
# Format:
5+
# OPERATORS - "namespace:deployment" pairs (space-separated)
6+
# CUSTOM_RESOURCES - "namespace:resource" pairs (space-separated)
7+
# NAMESPACES - namespaces to inspect on failure (space-separated)
8+
9+
OPERATORS="strimzi:strimzi-cluster-operator apicurio-registry:apicurio-registry-operator streamshub-console:streamshub-console-operator"
10+
CUSTOM_RESOURCES="kafka:kafka/dev-cluster apicurio-registry:apicurioregistry3/apicurio-registry streamshub-console:console.console.streamshub.github.com/streamshub-console"
11+
NAMESPACES="strimzi kafka apicurio-registry streamshub-console"

.github/scripts/debug.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Dump diagnostic information for debugging failed smoke tests.
4+
# Reads component definitions from an overlay config file.
5+
#
6+
# Environment variables:
7+
# OVERLAY - overlay name (default: "base")
8+
#
9+
10+
set +e
11+
12+
OVERLAY="${OVERLAY:-base}"
13+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
14+
CONFIG_FILE="${SCRIPT_DIR}/../config/overlays/${OVERLAY}.env"
15+
16+
if [ ! -f "${CONFIG_FILE}" ]; then
17+
echo "ERROR: Overlay config not found: ${CONFIG_FILE}"
18+
exit 1
19+
fi
20+
21+
# shellcheck disable=SC1090
22+
source "${CONFIG_FILE}"
23+
24+
echo "=== CR status ==="
25+
for entry in ${CUSTOM_RESOURCES}; do
26+
ns="${entry%%:*}"
27+
resource="${entry#*:}"
28+
kubectl get "${resource}" -n "${ns}" -o yaml 2>/dev/null || true
29+
done
30+
echo ""
31+
echo "=== Events (all namespaces) ==="
32+
kubectl get events --all-namespaces --sort-by='.lastTimestamp' | tail -50
33+
echo ""
34+
echo "=== Pods (all namespaces) ==="
35+
kubectl get pods --all-namespaces
36+
echo ""
37+
for ns in ${NAMESPACES}; do
38+
echo "=== Pods in ${ns} ==="
39+
kubectl get pods -n "${ns}" -o wide 2>/dev/null || true
40+
echo "=== Pod logs in ${ns} ==="
41+
for pod in $(kubectl get pods -n "${ns}" -o name 2>/dev/null); do
42+
echo "--- ${pod} ---"
43+
kubectl logs "${pod}" -n "${ns}" --tail=30 2>/dev/null || true
44+
done
45+
done

.github/scripts/verify-install.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Verify that all expected deployments and custom resources are ready.
4+
# Reads component definitions from an overlay config file.
5+
#
6+
# Environment variables:
7+
# OVERLAY - overlay name (default: "base")
8+
# TIMEOUT - kubectl wait timeout (default: "600s")
9+
#
10+
11+
set -euo pipefail
12+
13+
OVERLAY="${OVERLAY:-base}"
14+
TIMEOUT="${TIMEOUT:-600s}"
15+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
16+
CONFIG_FILE="${SCRIPT_DIR}/../config/overlays/${OVERLAY}.env"
17+
18+
if [ ! -f "${CONFIG_FILE}" ]; then
19+
echo "ERROR: Overlay config not found: ${CONFIG_FILE}"
20+
exit 1
21+
fi
22+
23+
# shellcheck disable=SC1090
24+
source "${CONFIG_FILE}"
25+
26+
echo "=== Verifying install (overlay: ${OVERLAY}) ==="
27+
echo ""
28+
29+
for entry in ${OPERATORS}; do
30+
ns="${entry%%:*}"
31+
deploy="${entry#*:}"
32+
echo "--- ${deploy} (${ns}) ---"
33+
kubectl get deployment -n "${ns}" "${deploy}"
34+
done
35+
36+
echo ""
37+
38+
for entry in ${CUSTOM_RESOURCES}; do
39+
ns="${entry%%:*}"
40+
resource="${entry#*:}"
41+
echo "--- ${resource} (${ns}) ---"
42+
kubectl wait "${resource}" --for=condition=Ready -n "${ns}" --timeout="${TIMEOUT}"
43+
done
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Verify that all quick-start resources have been removed after uninstall.
4+
#
5+
6+
set -euo pipefail
7+
8+
QUICKSTART_LABEL="app.kubernetes.io/part-of=streamshub-developer-quickstart"
9+
10+
echo "--- Checking for remaining quick-start resources ---"
11+
remaining=$(kubectl get all -A -l "${QUICKSTART_LABEL}" --no-headers 2>/dev/null | wc -l | tr -d ' ')
12+
if [ "$remaining" -gt 0 ]; then
13+
echo "ERROR: Found $remaining remaining resources after uninstall:"
14+
kubectl get all -A -l "${QUICKSTART_LABEL}"
15+
exit 1
16+
fi
17+
echo "All quick-start resources successfully removed"

.github/workflows/integration.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Integration Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
smoke-minikube:
11+
name: smoke-minikube
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
15+
16+
- name: Start Minikube
17+
id: minikube
18+
uses: medyagh/setup-minikube@e9e035a86bbc3caea26a450bd4dbf9d0c453682e # v0.0.21
19+
with:
20+
minikube-version: 'latest'
21+
addons: registry,ingress,ingress-dns
22+
insecure-registry: 'localhost:5000,10.0.0.0/24'
23+
start-args: '--extra-config=kubeadm.ignore-preflight-errors=SystemVerification --extra-config=apiserver.authorization-mode=RBAC,Node'
24+
25+
- name: Smoke test
26+
uses: ./.github/actions/smoke-test
27+
28+
smoke-kind:
29+
name: smoke-kind
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
33+
34+
- name: Create Kind cluster
35+
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
36+
with:
37+
config: .github/config/kind-config.yaml
38+
39+
- name: Deploy ingress-nginx
40+
run: |
41+
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.12.1/deploy/static/provider/kind/deploy.yaml
42+
kubectl wait --namespace ingress-nginx \
43+
--for=condition=Ready pod \
44+
--selector=app.kubernetes.io/component=controller \
45+
--timeout=120s
46+
47+
- name: Smoke test
48+
uses: ./.github/actions/smoke-test

.github/workflows/validate.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@ name: Validate
22

33
on:
44
push:
5-
branches: [main]
5+
branches:
6+
- main
67
pull_request:
78

89
jobs:
910
kustomize-build:
1011
name: Validate Kustomize configs
1112
runs-on: ubuntu-latest
1213
steps:
13-
- uses: actions/checkout@v6
14+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1415

1516
- name: Set up kubectl
16-
uses: azure/setup-kubectl@v4
17+
uses: azure/setup-kubectl@776406bce94f63e41d621b960d78ee25c8b76ede # v4.0.1
1718

1819
- name: Build base layer
1920
run: kubectl kustomize base/
@@ -33,10 +34,10 @@ jobs:
3334
name: Lint shell scripts
3435
runs-on: ubuntu-latest
3536
steps:
36-
- uses: actions/checkout@v6
37+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3738

3839
- name: Run ShellCheck
39-
uses: ludeeus/action-shellcheck@2.0.0
40+
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0
4041
with:
4142
version: v0.11.0
4243
scandir: "."
@@ -46,7 +47,7 @@ jobs:
4647
name: Lint YAML files
4748
runs-on: ubuntu-latest
4849
steps:
49-
- uses: actions/checkout@v6
50+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5051

5152
- name: Install yamllint
5253
run: |

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# VSCode
2+
.vscode
3+
4+
# IntelliJ IDEA specific
5+
.idea/
6+
*.iml
7+
8+
### Mac OS ###
9+
**.DS_Store

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,50 @@ kubectl port-forward -n streamshub-console svc/streamshub-console-console-servic
9090

9191
Open [http://localhost:8080](http://localhost:8080) in your browser.
9292

93+
### Kind
94+
95+
When using Kind, create the cluster with ingress-ready port mappings:
96+
97+
```bash
98+
cat <<EOF | kind create cluster --config=-
99+
kind: Cluster
100+
apiVersion: kind.x-k8s.io/v1alpha4
101+
nodes:
102+
- role: control-plane
103+
kubeadmConfigPatches:
104+
- |
105+
kind: InitConfiguration
106+
nodeRegistration:
107+
kubeletExtraArgs:
108+
node-labels: "ingress-ready=true"
109+
extraPortMappings:
110+
- containerPort: 80
111+
hostPort: 80
112+
protocol: TCP
113+
- containerPort: 443
114+
hostPort: 443
115+
protocol: TCP
116+
EOF
117+
```
118+
119+
Then deploy an ingress controller (e.g. ingress-nginx):
120+
121+
```bash
122+
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.12.1/deploy/static/provider/kind/deploy.yaml
123+
kubectl wait --namespace ingress-nginx \
124+
--for=condition=Ready pod \
125+
--selector=app.kubernetes.io/component=controller \
126+
--timeout=120s
127+
```
128+
129+
Use port-forwarding to access the console:
130+
131+
```bash
132+
kubectl port-forward -n streamshub-console svc/streamshub-console-console-service 8080:80
133+
```
134+
135+
Open [http://localhost:8080](http://localhost:8080) in your browser.
136+
93137
## Teardown
94138

95139
### Using the Uninstall Script

0 commit comments

Comments
 (0)