-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from backguynn/main
add base CICD
- Loading branch information
Showing
4 changed files
with
175 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
name: check kube-loxilb base sanity | ||
on: [push] | ||
jobs: | ||
test-kube-loxilb: | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
packages: write | ||
steps: | ||
- name: install k3d | ||
run: wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash | ||
|
||
- name: make k3d single node | ||
run: k3d cluster create test-cluster --k3s-arg "--disable=traefik@server:*" --k3s-arg "--disable=servicelb@server:*" --k3s-arg "--kubelet-arg=cloud-provider=external@server:*" | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '>=1.19.0' | ||
|
||
- name: build kube-loxilb's new image | ||
run: make docker | ||
|
||
- name: install gateway api | ||
run: kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.0.0/experimental-install.yaml | ||
|
||
- name: deploy kube-loxilb & loxilb & gateway resources | ||
run: | | ||
kubectl apply -f manifest/gateway-api/kube-loxilb.yaml | ||
kubectl apply -f manifest/gateway-api/loxilb.yaml | ||
kubectl apply -f manifest/gateway-api/gatewayclass.yaml | ||
kubectl apply -f manifest/gateway-api/gateway.yaml | ||
kubectl apply -f manifest/gateway-api/tcpRoute.yaml | ||
kubectl apply -f manifest/gateway-api/udpRoute.yaml | ||
- name: wait to deploy kube-loxilb pod | ||
id: deploy_kube_loxilb | ||
run: | | ||
kubectl -n kube-system wait --for=condition=ready pod -l app=kube-loxilb-app --timeout=300s | ||
KUBE_LOXILB=`kubectl get pods -A -o json | jq -r '.items[] | select(.metadata.name | test("kube-loxilb")).metadata.name'` | ||
echo "KUBE_LOXILB=$KUBE_LOXILB" >> $GITHUB_OUTPUT | ||
- if: failure() | ||
run: | | ||
kubectl -n kube-system get pods | ||
exit 1 | ||
- name: Sleep for 60 seconds for kube-loxilb | ||
run: sleep 60s | ||
|
||
- name: check status of gateway resources | ||
id: get_results_json | ||
run: | | ||
GC_PASSED=$(kubectl get gatewayclass -o json | jq -r '.items[0].status.conditions[0] | select(.type | test("Accepted")).status') | ||
echo "GC_PASSED=$GC_PASSED" >> $GITHUB_OUTPUT | ||
GW_PASSED=$(kubectl get gateway -o json | jq -r '.items[0].status.conditions[] | select(.type | test("Programmed")).status') | ||
echo "GW_PASSED=$GW_PASSED" >> $GITHUB_OUTPUT | ||
TCPROUTE_PASSED=$(kubectl get svc tcproute-lb-service -o json | jq -r '.status.loadBalancer.ingress[0].hostname') | ||
echo "TCPROUTE_PASSED=$TCPROUTE_PASSED" >> $GITHUB_OUTPUT | ||
UDPROUTE_PASSED=$(kubectl get svc udproute-lb-service -o json | jq -r '.status.loadBalancer.ingress[0].hostname') | ||
echo "UDPROUTE_PASSED=$UDPROUTE_PASSED" >> $GITHUB_OUTPUT | ||
- if: ${{ steps.get_results_json.outputs.GC_PASSED != 'True' }} | ||
run: | | ||
echo "gatewayClass passed: $steps.get_results_json.outputs.GC_PASSED" | ||
kubectl get gatewayclass | ||
kubectl -n kube-system logs "${{ steps.deploy_kube_loxilb.outputs.KUBE_LOXILB }}" | ||
exit 1 | ||
- if: ${{ steps.get_results_json.outputs.GW_PASSED != 'True' }} | ||
run: | | ||
echo "gateway passed: $steps.get_results_json.outputs.GW_PASSED" | ||
kubectl get gateway | ||
kubectl -n kube-system logs "${{ steps.deploy_kube_loxilb.outputs.KUBE_LOXILB }}" | ||
exit 1 | ||
- if: ${{ steps.get_results_json.outputs.TCPROUTE_PASSED != 'llb-123.123.123.1' }} | ||
run: | | ||
echo "tcpRoute external IP: $steps.get_results_json.outputs.TCPROUTE_PASSED" | ||
kubectl get tcproute | ||
kubectl get svc tcproute-lb-service -o wide | ||
kubectl -n kube-system logs "${{ steps.deploy_kube_loxilb.outputs.KUBE_LOXILB }}" | ||
exit 1 | ||
- if: ${{ steps.get_results_json.outputs.UDPROUTE_PASSED != 'llb-123.123.123.1' }} | ||
run: | | ||
echo "udpRoute external IP: $steps.get_results_json.outputs.UDPROUTE_PASSED" | ||
kubectl get udproute | ||
kubectl get svc udproute-lb-service -o wide | ||
kubectl -n kube-system logs "${{ steps.deploy_kube_loxilb.outputs.KUBE_LOXILB }}" | ||
exit 1 | ||
- name: deploy services & pod resources | ||
run: | | ||
kubectl apply -f manifest/workloads/iperf.yaml | ||
kubectl apply -f manifest/workloads/sctp-no-secips.yml | ||
kubectl apply -f manifest/workloads/udp-echo-svc-lb.yml | ||
- name: Sleep for 60 seconds for wait to deploy pod | ||
run: sleep 60s | ||
|
||
- name: check status of service resources | ||
id: get_svc_results_json | ||
run: | | ||
IPERF_PASSED=$(kubectl get svc iperf-service -o json | jq -r '.status.loadBalancer.ingress[0].hostname') | ||
echo "IPERF_PASSED=$IPERF_PASSED" >> $GITHUB_OUTPUT | ||
SCTP_PASSED=$(kubectl get svc sctp-lb1 -o json | jq -r '.status.loadBalancer.ingress[0].hostname') | ||
echo "SCTP_PASSED=$SCTP_PASSED" >> $GITHUB_OUTPUT | ||
UDP_PASSED=$(kubectl get svc udp-lb1 -o json | jq -r '.status.loadBalancer.ingress[0].hostname') | ||
echo "UDP_PASSED=$UDP_PASSED" >> $GITHUB_OUTPUT | ||
- if: ${{ steps.get_svc_results_json.outputs.IPERF_PASSED != 'llb-123.123.123.1' }} | ||
run: | | ||
echo "iperf-service external IP: $steps.get_results_json.outputs.IPERF_PASSED" | ||
kubectl get svc -o wide | ||
kubectl -n kube-system logs "${{ steps.deploy_kube_loxilb.outputs.KUBE_LOXILB }}" | ||
exit 1 | ||
- if: ${{ steps.get_svc_results_json.outputs.SCTP_PASSED != 'llb-123.123.123.1' }} | ||
run: | | ||
echo "iperf-service external IP: $steps.get_results_json.outputs.SCTP_PASSED" | ||
kubectl get svc -o wide | ||
kubectl -n kube-system logs "${{ steps.deploy_kube_loxilb.outputs.KUBE_LOXILB }}" | ||
exit 1 | ||
- if: ${{ steps.get_svc_results_json.outputs.UDP_PASSED != 'llb-123.123.123.1' }} | ||
run: | | ||
echo "iperf-service external IP: $steps.get_results_json.outputs.UDP_PASSED" | ||
kubectl get svc -o wide | ||
kubectl -n kube-system logs "${{ steps.deploy_kube_loxilb.outputs.KUBE_LOXILB }}" | ||
exit 1 | ||
test-k3s-base-sanity: | ||
needs: test-kube-loxilb | ||
uses: loxilb-io/loxilb/.github/workflows/__k3s-base-sanity-module.yml@main |
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,28 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: sctp-lb1 | ||
spec: | ||
loadBalancerClass: loxilb.io/loxilb | ||
selector: | ||
what: sctp-test | ||
ports: | ||
- port: 55002 | ||
protocol: SCTP | ||
targetPort: 9999 | ||
type: LoadBalancer | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: sctp-test | ||
labels: | ||
what: sctp-test | ||
spec: | ||
terminationGracePeriodSeconds: 0 | ||
containers: | ||
- name: sctp-test | ||
image: aweimeow/sctp-server | ||
command: ["/bin/sh", "-ec", "while :; do echo '.'; sleep 6 ; done"] | ||
ports: | ||
- containerPort: 9999 |
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