mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-04-05 12:22:18 +08:00
* First commit - made manifests for test deployments, made manifests for i tests for other deployment strategies * broke down blue/green * added latest tags to test manifests for new tags * remade tester * ready to test bgi * using all but first index of argv * careless error with dicts * added test to namespace * realized i was silencing error * indexing containers * keyerror * logging bc python errors are weird * expected still string * parsed args behaving weirdly * test seems to be working now, applying changes to other YAMLs now * blue/green ready to test * oops * oops * Added additional labels to check * hyphen * Added our annotations * lol * added our labels to services too * nonetype issue' * nonetype issue' * narrowing down parameter * fixed annotations issue with promote * adding debhug statement to figure out why services aren't getting annotations * this should fix annotations issue for service * not sure why this wasn't caught by intellisense * should be fixed with removing comma but adding logs in case * added linkerd install * verification * upgraded kubernetes version * removing crds * proxy option * Added smi extension * logging service * smi svcs also getting labeled now * matching ts type * not sure where stable service is going * remaining svc and deployment should match * keeping stable service and ts object * updated tests to reflect keeping ts object * no green svc after promote * duh * lol * canary work * canary test ready * logging for ing, filename for canary * changed ingress svc key and returning svc files from smi canary deployment * ts name * forgot about baseline in first deploy * * * * * smi canary should annotate, fixed cleanup * typescript issue plus percentage * forgot to type extra method * removed cleaned up objects from annotate list * logging because services aren't getting removed * moving to try/catch strategy of annotation since deletion can fail silently/with warnings * moved label to individual * removing canary service check after promote * pod ready for testing * set weights to 1000 * selectors * * * percentage * * * typing * mixed up pod and smi * fixed tests * prettier * forgot to remove canary * cleanup * Added oliver's feedback + more cleanup * ncc as dev dependency * npx * going back to global ncc install bc npm is being weird * prettier * removed unnecessary post step
216 lines
16 KiB
YAML
216 lines
16 KiB
YAML
name: Minikube Integration Tests - canary SMI
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- 'releases/*'
|
|
push:
|
|
branches:
|
|
- main
|
|
- 'releases/*'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
run-integration-test:
|
|
name: Run Minikube Integration Tests
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
KUBECONFIG: /home/runner/.kube/config
|
|
NAMESPACE: test-${{ github.run_id }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
rm -rf node_modules/
|
|
npm install
|
|
- name: Install ncc
|
|
run: npm i -g @vercel/ncc
|
|
- name: Build
|
|
run: ncc build src/run.ts -o lib
|
|
|
|
- uses: Azure/setup-kubectl@v3
|
|
name: Install Kubectl
|
|
|
|
- id: setup-minikube
|
|
name: Setup Minikube
|
|
uses: manusa/actions-setup-minikube@v2.4.2
|
|
with:
|
|
minikube version: 'v1.24.0'
|
|
kubernetes version: 'v1.21.0'
|
|
driver: 'none'
|
|
timeout-minutes: 3
|
|
|
|
- name: Install linkerd and add controlplane to cluster
|
|
run: |
|
|
curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/install | sh
|
|
curl -sL https://linkerd.github.io/linkerd-smi/install | sh
|
|
export PATH=$PATH:/home/runner/.linkerd2/bin
|
|
|
|
linkerd install --crds | kubectl apply -f -
|
|
linkerd install --set proxyInit.runAsRoot=true | kubectl apply -f -
|
|
linkerd smi install | kubectl apply -f -
|
|
|
|
- name: Create namespace to run tests
|
|
run: kubectl create ns ${{ env.NAMESPACE }}
|
|
|
|
- uses: actions/setup-python@v2
|
|
name: Install Python
|
|
with:
|
|
python-version: '3.x'
|
|
|
|
- name: Cleaning any previously created items
|
|
run: |
|
|
python test/integration/k8s-deploy-delete.py 'Service' 'all' ${{ env.NAMESPACE }}
|
|
python test/integration/k8s-deploy-delete.py 'Deployment' 'all' ${{ env.NAMESPACE }}
|
|
python test/integration/k8s-deploy-delete.py 'Ingress' 'all' ${{ env.NAMESPACE }}
|
|
python test/integration/k8s-deploy-delete.py 'TrafficSplit' 'all' ${{ env.NAMESPACE }}
|
|
|
|
- name: Executing deploy action for smi
|
|
uses: ./
|
|
with:
|
|
namespace: ${{ env.NAMESPACE }}
|
|
images: nginx:1.14.2
|
|
manifests: |
|
|
test/integration/manifests/test.yml
|
|
strategy: canary
|
|
percentage: 50
|
|
traffic-split-method: smi
|
|
action: deploy
|
|
|
|
- name: Checking if deployments, services, and ts objects were created with canary labels and original tag
|
|
run: |
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Deployment name=nginx-deployment-canary containerName=nginx:1.14.2 labels=workflow/version:canary,app:nginx,workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI selectorLabels=app:nginx,workflow/version:canary
|
|
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI selectorLabels=app:nginx
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service-canary labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI,workflow/version:canary selectorLabels=app:nginx,workflow/version:canary
|
|
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=TrafficSplit name=nginx-service-workflow-rollout tsServices=nginx-service-stable:0,nginx-service-canary:1000,nginx-service-baseline:0
|
|
|
|
- name: Executing promote action for smi
|
|
uses: ./
|
|
with:
|
|
namespace: ${{ env.NAMESPACE }}
|
|
images: nginx:1.14.2
|
|
manifests: |
|
|
test/integration/manifests/test.yml
|
|
strategy: canary
|
|
percentage: 50
|
|
traffic-split-method: smi
|
|
action: promote
|
|
|
|
# another good place for anti-test - ensure old deps are deleted after promote
|
|
- name: Checking if deployments, services, and ts objects were created with stable labels after first promote
|
|
run: |
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Deployment name=nginx-deployment-stable containerName=nginx:1.14.2 labels=workflow/version:stable,app:nginx,workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI selectorLabels=app:nginx,workflow/version:stable
|
|
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI selectorLabels=app:nginx
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service-stable labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI,workflow/version:stable selectorLabels=app:nginx,workflow/version:stable
|
|
|
|
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=TrafficSplit name=nginx-service-workflow-rollout tsServices=nginx-service-stable:1000,nginx-service-canary:0,nginx-service-baseline:0
|
|
|
|
- name: Executing second deploy action for smi with new tag
|
|
uses: ./
|
|
with:
|
|
namespace: ${{ env.NAMESPACE }}
|
|
images: nginx:latest
|
|
manifests: |
|
|
test/integration/manifests/test.yml
|
|
strategy: canary
|
|
percentage: 50
|
|
traffic-split-method: smi
|
|
action: deploy
|
|
|
|
- name: Checking if deployments (with new tag) and services were created with canary labels after deploy, and old deployment persists
|
|
run: |
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Deployment name=nginx-deployment-stable containerName=nginx:1.14.2 labels=workflow/version:stable,app:nginx,workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI selectorLabels=app:nginx,workflow/version:stable
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Deployment name=nginx-deployment-canary containerName=nginx:latest labels=workflow/version:canary,app:nginx,workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI selectorLabels=app:nginx,workflow/version:canary
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Deployment name=nginx-deployment-baseline containerName=nginx:1.14.2 labels=workflow/version:baseline,app:nginx,workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI selectorLabels=app:nginx,workflow/version:baseline
|
|
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI selectorLabels=app:nginx
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service-stable labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI,workflow/version:stable selectorLabels=app:nginx,workflow/version:stable
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service-canary labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI,workflow/version:canary selectorLabels=app:nginx,workflow/version:canary
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service-baseline labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI,workflow/version:baseline selectorLabels=app:nginx,workflow/version:baseline
|
|
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=TrafficSplit name=nginx-service-workflow-rollout tsServices=nginx-service-stable:500,nginx-service-canary:250,nginx-service-baseline:250
|
|
|
|
- name: Executing second promote action for smi now using new image tag
|
|
uses: ./
|
|
with:
|
|
namespace: ${{ env.NAMESPACE }}
|
|
images: nginx:latest
|
|
manifests: |
|
|
test/integration/manifests/test.yml
|
|
strategy: canary
|
|
percentage: 50
|
|
traffic-split-method: smi
|
|
action: promote
|
|
|
|
- name: Checking if deployments and services were created with stable labels after promote for new tag, ts is stable
|
|
run: |
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Deployment name=nginx-deployment-stable containerName=nginx:latest labels=workflow/version:stable,app:nginx,workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI selectorLabels=app:nginx,workflow/version:stable
|
|
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI selectorLabels=app:nginx
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service-stable labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI,workflow/version:stable selectorLabels=app:nginx,workflow/version:stable
|
|
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=TrafficSplit name=nginx-service-workflow-rollout tsServices=nginx-service-stable:1000,nginx-service-canary:0,nginx-service-baseline:0
|
|
|
|
- name: Executing deploy action for smi to be rejected using old tag
|
|
uses: ./
|
|
with:
|
|
namespace: ${{ env.NAMESPACE }}
|
|
images: nginx:1.14.2
|
|
manifests: |
|
|
test/integration/manifests/test.yml
|
|
strategy: canary
|
|
percentage: 50
|
|
traffic-split-method: smi
|
|
action: deploy
|
|
|
|
- name: Checking if new deployments (with old tag) and services were created with canary and baseline labels after deploy, and stable deployment (with latest tag) persists
|
|
run: |
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Deployment name=nginx-deployment-canary containerName=nginx:1.14.2 labels=workflow/version:canary,app:nginx,workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI selectorLabels=app:nginx,workflow/version:canary
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Deployment name=nginx-deployment-baseline containerName=nginx:latest labels=workflow/version:baseline,app:nginx,workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI selectorLabels=app:nginx,workflow/version:baseline
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Deployment name=nginx-deployment-stable containerName=nginx:latest labels=workflow/version:stable,app:nginx,workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI selectorLabels=app:nginx,workflow/version:stable
|
|
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI selectorLabels=app:nginx
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service-stable labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI,workflow/version:stable selectorLabels=app:nginx,workflow/version:stable
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service-baseline labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI,workflow/version:baseline selectorLabels=app:nginx,workflow/version:baseline
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service-canary labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI,workflow/version:canary selectorLabels=app:nginx,workflow/version:canary
|
|
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=TrafficSplit name=nginx-service-workflow-rollout tsServices=nginx-service-stable:500,nginx-service-canary:250,nginx-service-baseline:250
|
|
|
|
- name: Executing reject action for smi to reject new deployment with 1.14.2 tag
|
|
uses: ./
|
|
with:
|
|
namespace: ${{ env.NAMESPACE }}
|
|
images: nginx:1.14.2
|
|
manifests: |
|
|
test/integration/manifests/test.yml
|
|
strategy: canary
|
|
percentage: 50
|
|
traffic-split-method: smi
|
|
action: reject
|
|
|
|
# MAY BE USEFUL TO ADD AN ANTI-CHECK - CHECK TO MAKE SURE CERTAIN OBJECTS DON'T EXIST
|
|
- name: Checking if deployments and services were created with stable labels and latest tag after reject
|
|
run: |
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Deployment name=nginx-deployment-stable containerName=nginx:latest labels=workflow/version:stable,app:nginx,workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI selectorLabels=app:nginx,workflow/version:stable
|
|
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI selectorLabels=app:nginx
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service-stable labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_canary_SMI,workflow/version:stable selectorLabels=app:nginx,workflow/version:stable
|
|
|
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=TrafficSplit name=nginx-service-workflow-rollout tsServices=nginx-service-stable:1000,nginx-service-canary:0,nginx-service-baseline:0
|
|
|
|
- name: Cleaning up current set up
|
|
run: |
|
|
python test/integration/k8s-deploy-delete.py 'Service' 'all' ${{ env.NAMESPACE }}
|
|
python test/integration/k8s-deploy-delete.py 'Deployment' 'all' ${{ env.NAMESPACE }}
|
|
python test/integration/k8s-deploy-delete.py 'Ingress' 'all' ${{ env.NAMESPACE }}
|
|
python test/integration/k8s-deploy-delete.py 'TrafficSplit' 'all' ${{ env.NAMESPACE }}
|
|
|
|
- if: ${{ always() }}
|
|
name: Delete created namespace
|
|
run: kubectl delete ns ${{ env.NAMESPACE }}
|