-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This CI job builds the CLI and Kardinal manager. The manager is deployed in Minikube with Istio installed. The boutique demo is deployed, the pods verified and the manager logs checked for errors. A dev flow is created and validated the same way before being deleted. The dev app access is not validated yet since I hit some issues with the port forwarding. I will continue to work on that with a new PR. Template operations are performed but with no validation yet.
- Loading branch information
1 parent
45807a3
commit b65a916
Showing
5 changed files
with
578 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
name: E2E tests | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "v*.*.*" | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
e2e_tests: | ||
name: E2E tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Nix | ||
uses: cachix/install-nix-action@v27 | ||
|
||
- name: Magic cache | ||
uses: DeterminateSystems/magic-nix-cache-action@v7 | ||
|
||
- name: Start Kardinal Kontrol service and Postgres | ||
run: | | ||
docker version | ||
docker compose -f ci/docker-compose.yml up -d | ||
docker ps | ||
- name: Wait for docker network to be ready | ||
run: sleep 10s | ||
shell: bash | ||
|
||
- name: Start minikube | ||
uses: manusa/[email protected] | ||
id: minikube | ||
with: | ||
minikube version: "v1.33.0" | ||
kubernetes version: "v1.30.0" | ||
driver: docker | ||
start args: --embed-certs --addons=ingress,metrics-server | ||
|
||
- name: Install Istio | ||
run: | | ||
ISTIO_VERSION="1.23.0" | ||
echo "Installing Istio ..." | ||
mkdir istio_tmp | ||
pushd istio_tmp >/dev/null | ||
curl -L https://istio.io/downloadIstio | ISTIO_VERSION=${ISTIO_VERSION} sh - | ||
cd istio-${ISTIO_VERSION} | ||
export PATH=$PWD/bin:$PATH | ||
istioctl install --set profile=demo -y | ||
popd | ||
- name: Build Kardinal manager and load image | ||
run: | | ||
eval $(minikube docker-env) | ||
docker load < $(nix build ./#containers.x86_64-linux.kardinal-manager.amd64 --no-link --print-out-paths) | ||
docker tag kurtosistech/kardinal-manager:latest-amd64 kurtosistech/kardinal-manager:latest | ||
docker image ls | ||
- name: Build Kardinal CLI | ||
run: | | ||
result=$(nix build ./#kardinal-cli --no-link --print-out-paths) | ||
path=$(find $result -name 'kardinal.cli*' -type f | head -n 1) | ||
binout="/tmp/kardinal-cli" | ||
ln -s $path $binout | ||
if /tmp/kardinal-cli | grep -q "Kardinal CLI"; then exit 0; else exit 1; fi | ||
- name: Retrieve the tenant UUID | ||
id: tenant | ||
run: | | ||
tenant_id=$(/tmp/kardinal-cli tenant show) | ||
echo "id=${tenant_id}" >> "$GITHUB_OUTPUT" | ||
- name: Deploy Kardinal manager | ||
run: | | ||
KARDINAL_CLI_DEV_MODE=TRUE /tmp/kardinal-cli manager deploy local-minikube | ||
- name: Deploy boutique demo manifest | ||
run: | | ||
KARDINAL_CLI_DEV_MODE=TRUE /tmp/kardinal-cli deploy -k ci/obd-demo.yaml | ||
- name: Validate that Kardinal manager applied the changes | ||
run: | | ||
# Check that the four prod service pods are running and ready | ||
while [ $(kubectl get pods -n prod -o custom-columns=NAMESPACE:metadata.namespace,POD:metadata.name,PodIP:status.podIP,READY-true:status.containerStatuses[*].ready | grep "true,true" | wc -l) -ne 4 ] | ||
do | ||
echo "Waiting for prod pods to run..." | ||
kubectl get pods -n prod -o custom-columns=NAMESPACE:metadata.namespace,POD:metadata.name,PodIP:status.podIP,READY-true:status.containerStatuses[*].ready | ||
((c++)) && ((c==12)) && exit 1 | ||
sleep 10 | ||
done | ||
kubectl get pods -n prod | ||
# Check the right services are running. | ||
apps=$(kubectl get pods -n prod -o custom-columns=:metadata.labels.app | tr " " "\n" | sort -g | tr "\n" " " | xargs) | ||
echo ${apps} | ||
if [ "${apps}" != "cartservice frontend postgres productcatalogservice" ]; then exit 1; fi | ||
# Check for errors in the kardinal manager logs | ||
if kubectl logs -n default -l dev.kardinal.app-id=kardinal-manager | grep "ERRO" | ||
then | ||
echo "Errors found in the kardinal manager" | ||
kubectl logs -n default -l dev.kardinal.app-id=kardinal-manager | grep "ERRO" | ||
fi | ||
- name: Create, validate and delete flow | ||
run: | | ||
KARDINAL_CLI_DEV_MODE=TRUE /tmp/kardinal-cli flow create frontend kurtosistech/frontend:demo-frontend > kardinal.out | ||
cat kardinal.out | ||
flow_id=$(grep "Flow.*created" kardinal.out | cut -d ' ' -f2 | tr -d "\"") | ||
KARDINAL_CLI_DEV_MODE=TRUE /tmp/kardinal-cli flow ls | grep ${flow_id} | ||
# Check that the dev service pod is running and ready | ||
while ! kubectl get pods -n prod -o custom-columns=NAMESPACE:metadata.namespace,POD:metadata.name,PodIP:status.podIP,READY-true:status.containerStatuses[*].ready | grep true | grep "frontend-${flow_id}" | ||
do | ||
echo "Waiting for dev frontend pod to run..." | ||
kubectl get pods -n prod -o custom-columns=NAMESPACE:metadata.namespace,POD:metadata.name,PodIP:status.podIP,READY-true:status.containerStatuses[*].ready | ||
((c++)) && ((c==12)) && exit 1 | ||
sleep 10 | ||
done | ||
kubectl get pods -n prod | ||
KARDINAL_CLI_DEV_MODE=TRUE /tmp/kardinal-cli flow delete ${flow_id} | ||
# Check for errors in the kardinal manager logs | ||
if kubectl logs -n default -l dev.kardinal.app-id=kardinal-manager | grep "ERRO" | ||
then | ||
echo "Errors found in the kardinal manager" | ||
kubectl logs -n default -l dev.kardinal.app-id=kardinal-manager | grep "ERRO" | ||
fi | ||
- name: Create template | ||
run: | | ||
KARDINAL_CLI_DEV_MODE=TRUE /tmp/kardinal-cli template create extra-item-shared --template-yaml ci/template.yaml --description "Extra item and postgres is shared" | ||
KARDINAL_CLI_DEV_MODE=TRUE /tmp/kardinal-cli template ls | grep "extra-item-shared" | ||
- name: Create flow with template and delete flow | ||
run: | | ||
KARDINAL_CLI_DEV_MODE=TRUE /tmp/kardinal-cli flow create frontend kurtosistech/frontend:demo-frontend --template-args ci/template_args.yaml --template extra-item-shared > kardinal.out | ||
cat kardinal.out | ||
flow_id=$(grep "Flow.*created" kardinal.out | cut -d ' ' -f2 | tr -d "\"") | ||
KARDINAL_CLI_DEV_MODE=TRUE /tmp/kardinal-cli flow ls | grep ${flow_id} | ||
# Check that the dev service pod is running and ready | ||
while ! kubectl get pods -n prod -o custom-columns=NAMESPACE:metadata.namespace,POD:metadata.name,PodIP:status.podIP,READY-true:status.containerStatuses[*].ready | grep true | grep "frontend-${flow_id}" | ||
do | ||
echo "Waiting for dev frontend pod to run..." | ||
kubectl get pods -n prod -o custom-columns=NAMESPACE:metadata.namespace,POD:metadata.name,PodIP:status.podIP,READY-true:status.containerStatuses[*].ready | ||
((c++)) && ((c==12)) && exit 1 | ||
sleep 10 | ||
done | ||
kubectl get pods -n prod | ||
KARDINAL_CLI_DEV_MODE=TRUE /tmp/kardinal-cli flow delete ${flow_id} | ||
# Check for errors in the kardinal manager logs | ||
if kubectl logs -n default -l dev.kardinal.app-id=kardinal-manager | grep "ERRO" | ||
then | ||
echo "Errors found in the kardinal manager" | ||
kubectl logs -n default -l dev.kardinal.app-id=kardinal-manager | grep "ERRO" | ||
fi | ||
- name: Delete template | ||
run: | | ||
KARDINAL_CLI_DEV_MODE=TRUE /tmp/kardinal-cli template delete extra-item-shared |
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,38 @@ | ||
networks: | ||
kardinal: | ||
driver: bridge | ||
enable_ipv6: false | ||
|
||
services: | ||
kontrol-service: | ||
image: kurtosistech/kontrol-service:latest-amd64 | ||
restart: always | ||
environment: | ||
- DB_HOSTNAME=postgres | ||
- DB_PORT=5432 | ||
- DB_NAME=kardinal | ||
- DB_USERNAME=postgres | ||
- DB_PASSWORD=kurtosis | ||
- DEV_MODE=true | ||
ports: | ||
- '8080:8080' | ||
networks: | ||
- kardinal | ||
depends_on: | ||
- postgres | ||
postgres: | ||
image: postgres:13-alpine | ||
restart: always | ||
environment: | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=kurtosis | ||
- POSTGRES_DB=kardinal | ||
ports: | ||
- '5432:5432' | ||
networks: | ||
- kardinal | ||
volumes: | ||
- postgres:/var/lib/postgresql/data | ||
volumes: | ||
postgres: | ||
driver: local |
Oops, something went wrong.