Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TT-11578] Use bitnami charts for redis and mongo #262

Merged
merged 28 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1be2168
Use bitnami charts for redis and mongo
komalsukhani Apr 5, 2024
e8c48e8
Fix command to install of Tyk OSS
komalsukhani Apr 12, 2024
c3da898
Fix command
komalsukhani Apr 12, 2024
61561fe
Use bitnami redis and mongodb to test Tyk Stack
komalsukhani Apr 12, 2024
d07311e
Remove mongo version
komalsukhani Apr 12, 2024
aab89f9
Use bitnami redis for Tyk Data Plane chart
komalsukhani Apr 12, 2024
dd6d5a4
Try bitnami mongo version 13.18.5
komalsukhani Apr 12, 2024
fa51fb0
Print logs of dashboard and bootstrap job in case of failure
komalsukhani Apr 15, 2024
f80fbed
Ignore logs of test pod
komalsukhani Apr 15, 2024
3b26201
Fix mongo url
komalsukhani Apr 15, 2024
69fe73a
Update mongo chart version
komalsukhani Apr 15, 2024
7748633
Differentiate between deploy and test failures
komalsukhani Apr 15, 2024
17da5c5
Induce failure
komalsukhani Apr 15, 2024
93d030e
Fix condition
komalsukhani Apr 15, 2024
b6ef34d
Add back ct install command for Tyk OSS
komalsukhani Apr 15, 2024
ff5cc4f
Induce error
komalsukhani Apr 15, 2024
f4b2ddc
Move out integration tests in different workflow
komalsukhani Apr 15, 2024
13c1886
Add step for kind cluster creation
komalsukhani Apr 15, 2024
6c154bd
Rename workflow files
komalsukhani Apr 15, 2024
46f9797
Use bitnami redis for smoke tests too
komalsukhani Apr 22, 2024
4d66637
Upgrade github actions
komalsukhani Apr 22, 2024
aae5851
Run integration tests against k8s v1.21
komalsukhani Apr 22, 2024
a9e685d
Fix command
komalsukhani Apr 22, 2024
bd26efa
Merge branch 'main' into TT-11578/set_db_versions
komalsukhani Apr 23, 2024
4031c33
Add back integration tests to same workflow
komalsukhani Apr 25, 2024
f115b4e
Rename workflow
komalsukhani Apr 25, 2024
822c0a5
Use helm install and helm test for OSS
komalsukhani Apr 25, 2024
07d8c93
Merge branch 'main' into TT-11578/set_db_versions
buraksekili Apr 29, 2024
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
180 changes: 180 additions & 0 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
name: Integration Test

on:
pull_request:
paths-ignore:
- '**.md'
push:
branches:
- master

env:
TIMEOUT: 15m
TYK_OSS_NS: tyk-oss
TYK_DATAPLANE_NS: tyk-dataplane
TYK_STACK_NS: tyk-stack

jobs:
tyk-oss:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v4

- uses: actions/setup-python@v4
with:
python-version: '3.9'
check-latest: true

- name: Set up chart-testing
uses: helm/[email protected]

- name: Create kind cluster
uses: helm/[email protected]
with:
node_image: "kindest/node:v1.29.1"

- name: Deploy OSS Dependencies
run: |
kubectl create namespace ${{ env.TYK_OSS_NS }}

# Do not change the name
helm install redis redis --wait --repo 'https://charts.bitnami.com/bitnami' -n ${{ env.TYK_OSS_NS }} --timeout ${{ env.TIMEOUT }} --version 19.0.2

helm dependency update ./tyk-oss

- name: Run chart-testing (install)
run: ct install --namespace ${{ env.TYK_OSS_NS }} --charts ./tyk-oss --helm-extra-set-args "--wait=true" --helm-extra-set-args "--set=global.redis.addrs={redis-master.${{ env.TYK_OSS_NS }}.svc:6379},global.redis.passSecret.name=redis,global.redis.passSecret.keyName=redis-password"

- if: failure()
name: Check logs in case of failure
run: kubectl logs -n ${{ env.TYK_OSS_NS}} tyk-oss-test-tyk-oss
komalsukhani marked this conversation as resolved.
Show resolved Hide resolved

- name: Uninstall Tyk OSS Dependencies
run: |
helm uninstall redis -n ${{ env.TYK_OSS_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env.TYK_OSS_NS }}

tyk-stack:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v4

- name: Create kind cluster
uses: helm/[email protected]
with:
node_image: "kindest/node:v1.29.1"
komalsukhani marked this conversation as resolved.
Show resolved Hide resolved

- name: Deploy Tyk Stack and dependencies
id: deploy-stack
run: |
kubectl create namespace ${{ env.TYK_STACK_NS }}

# Do not change the name
# Install redis
helm install redis redis --wait --repo 'https://charts.bitnami.com/bitnami' -n ${{ env.TYK_STACK_NS }} --timeout ${{ env.TIMEOUT }} --version 19.0.2

# Install mongo
helm install mongo mongodb --wait --repo 'https://charts.bitnami.com/bitnami' -n ${{ env.TYK_STACK_NS }} --timeout ${{ env.TIMEOUT }} --version 15.1.2

MONGODB_ROOT_PASSWORD=$(kubectl get secret -n ${{ env.TYK_STACK_NS }} mongo-mongodb -o jsonpath="{.data.mongodb-root-password}" | base64 -d)

helm dependency update ./tyk-stack

helm install --namespace ${{ env.TYK_STACK_NS }} tyk-stack ./tyk-stack \
--set "global.mongo.mongoURL=mongodb://root:$MONGODB_ROOT_PASSWORD@mongo-mongodb.${{ env.TYK_STACK_NS }}.svc:27017/tyk_analytics?authSource=admin" \
--set "global.redis.addrs={redis-master.${{ env.TYK_STACK_NS }}.svc:6379"} \
--set "global.redis.passSecret.name=redis" \
--set "global.redis.passSecret.keyName=redis-password" \
--set "global.license.dashboard=${{ secrets.DASH_LICENSE }}" \
--set "global.storageType=mongo" \
--timeout=${{ env.TIMEOUT }}

- name: Run integration tests for Tyk Stack
id: test-stack
run: helm test -n ${{ env.TYK_STACK_NS }} tyk-stack

- if: failure()
name: Check logs in case of failure
run: |
if [ ${{ steps.deploy-stack.conclusion }} == 'failure' ]; then
kubectl logs -n ${{ env.TYK_STACK_NS }} deployment/dashboard-tyk-stack-tyk-dashboard
kubectl logs -n ${{ env.TYK_STACK_NS }} job.batch/bootstrap-post-install-tyk-stack-tyk-bootstrap
elif [ ${{ steps.test-stack.conclusion }} == 'failure' ]; then
kubectl logs -n ${{ env.TYK_STACK_NS }} tyk-stack-test-tyk-stack
fi

- name: Uninstall Tyk Stack Dependencies
run: |
helm uninstall redis -n ${{ env.TYK_STACK_NS }} --timeout ${{ env.TIMEOUT }}
helm uninstall mongo -n ${{ env.TYK_STACK_NS }} --timeout ${{ env.TIMEOUT }}
helm uninstall tyk-stack -n ${{ env.TYK_STACK_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env.TYK_STACK_NS }}

tyk-data-plane:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v4

- name: Create kind cluster
uses: helm/[email protected]
with:
node_image: "kindest/node:v1.29.1"

- name: Deploy Tyk Data Plane and Dependencies
id: deploy-data-plane
run: |
kubectl create namespace ${{ env. TYK_DATAPLANE_NS }}

# Do not change the name
helm install redis redis --wait --repo 'https://charts.bitnami.com/bitnami' -n ${{ env.TYK_DATAPLANE_NS }} --timeout ${{ env.TIMEOUT }} --version 19.0.2

helm dependency update ./tyk-data-plane

helm install --namespace ${{ env. TYK_DATAPLANE_NS }} tyk-data-plane ./tyk-data-plane --wait \
--set "global.redis.addrs={redis-master.${{ env. TYK_DATAPLANE_NS }}.svc:6379"} \
--set "global.redis.passSecret.name=redis" \
--set "global.redis.passSecret.keyName=redis-password" \
--set global.remoteControlPlane.orgId=${{ secrets.HYBRID_RPC_KEY }} \
--set global.remoteControlPlane.userApiKey=${{ secrets.HYBRID_API_KEY }} \
--set global.remoteControlPlane.connectionString=${{ secrets.HYBRID_MDCB_HOST }}

- name: Run integration tests for Tyk Data Plane
id: test-data-plane
run: helm test -n ${{ env. TYK_DATAPLANE_NS }} tyk-data-plane

- if: failure()
name: Check logs in case of failure
run: |
if [ ${{ steps.deploy-data-plane.conclusion }} == 'failure' ]; then
kubectl logs -n ${{ env. TYK_DATAPLANE_NS }} deployment/gateway-tyk-data-plane-tyk-gateway
elif [ ${{ steps.test-data-plane.conclusion }} == 'failure' ]; then
kubectl logs -n ${{ env. TYK_DATAPLANE_NS }} tyk-data-plane-test-tyk-data-plane
fi

- name: Uninstall Tyk Data Plane Dependencies
run: |
helm uninstall tyk-data-plane -n ${{ env. TYK_DATAPLANE_NS }}
helm uninstall redis -n ${{ env. TYK_DATAPLANE_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env. TYK_DATAPLANE_NS }}




102 changes: 102 additions & 0 deletions .github/workflows/link-smoke-tests.yaml
komalsukhani marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Lint and Smoke Tests

on:
pull_request:
paths-ignore:
- '**.md'
push:
branches:
- master

env:
TIMEOUT: 15m
TYK_OSS_NS: tyk-oss
TYK_DATAPLANE_NS: tyk-dataplane

jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/[email protected]
with:
version: v3.3.0

- name: Run chart-testing (lint)
run: ct lint --config ct.yaml --all

smoke-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
k8s_version: ["v1.26.13", "v1.27.10","v1.28.6","v1.29.1"]
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Create Kind Cluster
uses: helm/[email protected]
with:
node_image: "kindest/node:${{ matrix.k8s_version }}"

- name: Install helm
uses: azure/setup-helm@v4

- name: Deploy Tyk OSS and Dependencies
run: |
kubectl create namespace ${{ env.TYK_OSS_NS }}

# Do not change the name
helm install redis redis --wait --repo 'https://charts.bitnami.com/bitnami' -n ${{ env.TYK_OSS_NS }} --timeout ${{ env.TIMEOUT }}

helm dependency update ./tyk-oss
helm install tyk-oss ./tyk-oss -n ${{ env.TYK_OSS_NS }} --timeout ${{ env.TIMEOUT }} \
--set global.redis.addrs={redis-master.${{ env.TYK_OSS_NS }}.svc:6379} \
--set global.redis.passSecret.name=redis \
--set global.redis.passSecret.keyName=redis-password

- name: Upgrade Tyk OSS
run: |
helm upgrade -n ${{ env.TYK_OSS_NS }} tyk-oss ./tyk-oss --set tyk-gateway.gateway.kind=DaemonSet

- name: Uninstall Tyk OSS
run: |
helm uninstall tyk-oss -n ${{ env.TYK_OSS_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env.TYK_OSS_NS }}

- name: Deploy Tyk Data Plane
run: |
kubectl create namespace ${{ env. TYK_DATAPLANE_NS }}

# Do not change the name
helm install redis redis --wait --repo 'https://charts.bitnami.com/bitnami' -n ${{ env. TYK_DATAPLANE_NS }} --timeout ${{ env.TIMEOUT }}

helm dependency update ./tyk-data-plane

helm install --namespace ${{ env. TYK_DATAPLANE_NS }} tyk-data-plane ./tyk-data-plane --wait \
--set global.remoteControlPlane.orgId=${{ secrets.HYBRID_RPC_KEY }} \
--set global.remoteControlPlane.userApiKey=${{ secrets.HYBRID_API_KEY }} \
--set global.remoteControlPlane.connectionString=${{ secrets.HYBRID_MDCB_HOST }} \
--set global.redis.addrs={redis-master.${{ env.TYK_DATAPLANE_NS }}.svc:6379} \
--set global.redis.passSecret.name=redis \
--set global.redis.passSecret.keyName=redis-password

- name: Upgrade Tyk Data Plane
run: |
helm upgrade -n ${{ env. TYK_DATAPLANE_NS }} tyk-data-plane ./tyk-data-plane --set tyk-gateway.gateway.kind=DaemonSet

- name: Uninstall Tyk Data Plane
run: |
helm uninstall tyk-data-plane -n ${{ env. TYK_DATAPLANE_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env. TYK_DATAPLANE_NS }}
Loading
Loading