Skip to content

Commit

Permalink
[test] e2e tests(konnectivity) for kubeadm-full (#447)
Browse files Browse the repository at this point in the history
* E2E test for Konnectivity and checking provisioned CAPI resources and child cluster resources

* Added additional tests for deleting child cluster

* Updated GHA workflow files to run E2E test on draft PR

* Updating path to e2e kubeadm-full test

* Checking if correct key is passed to the selector

* Checking if correct key is passed to the selector. v2.

* Updated GHA filter and added tests for etcd

* Added Ephemeral key
Added tests for StatefulSets
Split DeamonSets tests and konnectivity tests

* - Konnectivity complete tests
- Etcd tests for volume mount, partial checks

* - reverted build_test_ci.yml to original file available on the main branch

* -  removed files related to ETCD

* - formatted chainsaw-test.yaml for konnectivity server and agent

* - updating workflow files to run e2e tests on GHA

* - combined konnectivity deployments and daemonsets into one file for improved readability

* - updated test identifier name
- fixed the right expected values to assert on in daemonsets
- updated autoscaler version to a hardcoded one

* - hygine changes in files release.yml and build_test_ci.yml

- removed etcd-tests from konnectivity branch

- added tests for cluster and node balancer(LinodeCluster)

* - updated file names to be consistent

* Update e2e/capl-cluster-flavors/kubeadm-full-capl-cluster/check-child-cluster-and-vpc-deleted.yaml

Co-authored-by: Rahul Sharma <[email protected]>

* Update e2e/capl-cluster-flavors/kubeadm-full-capl-cluster/chainsaw-test.yaml

Co-authored-by: Rahul Sharma <[email protected]>

* Update e2e/capl-cluster-flavors/kubeadm-full-capl-cluster/assert-child-cluster-resources.yaml

Co-authored-by: Rahul Sharma <[email protected]>

* - combined all parent resources into one file
- seperated tests for deployment, daemonsets, statefulsets
- added meaningful test names for better understanding while going through logs
- added env variables to set konnectivity agents to 1 during testing

* - added test to get logs from a pod

* - fixed kubeconfig issue for getting pod logs

* - updated environment variable for cluster-autoscaler-version

---------

Co-authored-by: Rahul Sharma <[email protected]>
  • Loading branch information
prajwalvathreya and rahulait authored Aug 14, 2024
1 parent 2a3ff96 commit 323cfaa
Show file tree
Hide file tree
Showing 14 changed files with 632 additions and 101 deletions.
49 changes: 25 additions & 24 deletions .github/filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,60 @@ src:
kubeadm:
- templates/flavors/kubeadm/default/*
- e2e/capl-cluster-flavors/kubeadm-capl-cluster/*
kubeadm_cluster-autoscaler:
kubeadm-cluster-autoscaler:
- templates/flavors/kubeadm/cluster-autoscaler/*
kubeadm_dual-stack:
kubeadm-dual-stack:
- templates/flavors/kubeadm/dual-stack/*
kubeadm_etcd-backup-restore:
kubeadm-etcd-backup-restore:
- templates/flavors/kubeadm/etcd-backup-restore/*
kubeadm_etcd-disk:
kubeadm-etcd-disk:
- templates/flavors/kubeadm/etcd-disk/*
kubeadm_full:
kubeadm-full:
- templates/flavors/kubeadm/full/*
kubeadm_full-vpcless:
- e2e/capl-cluster-flavors/kubeadm-full-capl-cluster/*
kubeadm-full-vpcless:
- templates/flavors/kubeadm/full-vpcless/*
kubeadm_self-healing:
kubeadm-self-healing:
- templates/flavors/kubeadm/self-healing/*
kubeadm_vpcless:
kubeadm-vpcless:
- templates/flavors/kubeadm/vpcless/*
kubeadm_cilium_bgp_lb:
kubeadm-cilium-bgp-lb:
- templates/flavors/kubeadm/cilium-bgp-lb/*
kubeadm_konnectivity:
kubeadm-konnectivity:
- templates/flavors/kubeadm/konnectivity/*

k3s:
- templates/flavors/k3s/default/*
- e2e/capl-cluster-flavors/k3s-capl-cluster/*
k3s_cluster-autoscaler:
k3s-cluster-autoscaler:
- templates/flavors/k3s/cluster-autoscaler/*
k3s_dual-stack:
k3s-dual-stack:
- templates/flavors/k3s/dual-stack/*
k3s_etcd-backup-restore:
k3s-etcd-backup-restore:
- templates/flavors/k3s/etcd-backup-restore/*
k3s_full:
k3s-full:
- templates/flavors/k3s/full/*
k3s_full-vpcless:
k3s-full-vpcless:
- templates/flavors/k3s/full-vpcless/*
k3s_self-healing:
k3s-self-healing:
- templates/flavors/k3s/self-healing/*
k3s_vpcless:
k3s-vpcless:
- templates/flavors/k3s/vpcless/*

rke2:
- templates/flavors/rke2/default/*
- e2e/capl-cluster-flavors/rke2-capl-cluster/*
rke2_cluster-autoscaler:
rke2-cluster-autoscaler:
- templates/flavors/rke2/cluster-autoscaler/*
rke2_etcd-backup-restore:
rke2-etcd-backup-restore:
- templates/flavors/rke2/etcd-backup-restore/*
rke2_etcd-disk:
rke2-etcd-disk:
- templates/flavors/rke2/etcd-disk/*
rke2_full:
rke2-full:
- templates/flavors/rke2/full/*
rke2_full-vpcless:
rke2-full-vpcless:
- templates/flavors/rke2/full-vpcless/*
rke2_self-healing:
rke2-self-healing:
- templates/flavors/rke2/self-healing/*
rke2_vpcless:
rke2-vpcless:
- templates/flavors/rke2/vpcless/*
150 changes: 75 additions & 75 deletions .github/workflows/build_test_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,57 +44,57 @@ jobs:
needs: changes
if: ${{ contains(fromJSON(needs.changes.outputs.paths), 'src') }}
steps:
- uses: actions/checkout@v4
- name: Validate YAML file
run: yamllint templates
- uses: actions/checkout@v4
- name: Validate YAML file
run: yamllint templates

go-build-test:
runs-on: ubuntu-latest
needs: changes
if: ${{ contains(fromJSON(needs.changes.outputs.paths), 'src') }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
golang.org:443
proxy.golang.org:443
sum.golang.org:443
objects.githubusercontent.com:443
storage.googleapis.com:443
cli.codecov.io:443
api.codecov.io:443
raw.githubusercontent.com:443
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
check-latest: true

- name: Build
run: make build

- name: Check for generated diff
run: make check-gen-diff

- name: Test
run: make test

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.out
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
slug: linode/cluster-api-provider-linode
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
golang.org:443
proxy.golang.org:443
sum.golang.org:443
objects.githubusercontent.com:443
storage.googleapis.com:443
cli.codecov.io:443
api.codecov.io:443
raw.githubusercontent.com:443
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
check-latest: true

- name: Build
run: make build

- name: Check for generated diff
run: make check-gen-diff

- name: Test
run: make test

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.out
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
slug: linode/cluster-api-provider-linode

e2e-test:
needs: changes
Expand All @@ -107,7 +107,7 @@ jobs:
include:
- flavor: ${{ github.ref == 'refs/heads/main' && 'all' || 'quick' }}
uses: ./.github/workflows/e2e-test.yaml
if: ${{ github.event.pull_request.draft == false && contains(fromJSON(needs.changes.outputs.paths), 'src') }}
if: ${{contains(fromJSON(needs.changes.outputs.paths), 'src')}}
secrets: inherit
with:
e2e-selector: ${{ matrix.flavor }}
Expand All @@ -119,32 +119,32 @@ jobs:
needs: changes
if: ${{ contains(fromJSON(needs.changes.outputs.paths), 'src') }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
proxy.golang.org:443
sum.golang.org:443
go.dev:443
dl.google.com:443
golang.org:443
objects.githubusercontent.com:443
registry-1.docker.io:443
auth.docker.io:443
production.cloudflare.docker.com:443
gcr.io:443
storage.googleapis.com:443
- uses: actions/checkout@v4

- name: Docker cache
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ hashFiles('go.sum') }}

- name: Build the Docker image
run: make docker-build
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
proxy.golang.org:443
sum.golang.org:443
go.dev:443
dl.google.com:443
golang.org:443
objects.githubusercontent.com:443
registry-1.docker.io:443
auth.docker.io:443
production.cloudflare.docker.com:443
gcr.io:443
storage.googleapis.com:443
- uses: actions/checkout@v4

- name: Docker cache
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ hashFiles('go.sum') }}

- name: Build the Docker image
run: make docker-build
1 change: 1 addition & 0 deletions .github/workflows/e2e-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ on:
- k3s
- rke2
- default-cluster
- kubeadm-full
- linodecluster
- linodemachine
- linodeobj
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ test: generate fmt vet envtest ## Run tests.

.PHONY: e2etest
e2etest: generate local-release local-deploy chainsaw
GIT_REF=$(GIT_REF) $(CHAINSAW) test ./e2e --selector $(E2E_SELECTOR) $(E2E_FLAGS)
GIT_REF=$(GIT_REF) SSE_KEY=$$(openssl rand -base64 32) $(CHAINSAW) test ./e2e --selector $(E2E_SELECTOR) $(E2E_FLAGS)

local-deploy: kind ctlptl tilt kustomize clusterctl
$(CTLPTL) apply -f .tilt/ctlptl-config.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: caaph-controller-manager
namespace: caaph-system
status:
availableReplicas: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: capi-operator-cluster-api-operator
namespace: capi-operator-system
status:
availableReplicas: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: capi-controller-manager
namespace: capi-system
status:
availableReplicas: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: capl-controller-manager
namespace: capl-system
status:
availableReplicas: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cert-manager
namespace: cert-manager
status:
availableReplicas: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cert-manager-cainjector
namespace: cert-manager
status:
availableReplicas: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cert-manager-webhook
namespace: cert-manager
status:
availableReplicas: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: coredns
namespace: kube-system
status:
availableReplicas: 2
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: capi-kubeadm-bootstrap-controller-manager
namespace: kubeadm-bootstrap-system
status:
availableReplicas: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: capi-kubeadm-control-plane-controller-manager
namespace: kubeadm-control-plane-system
status:
availableReplicas: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: ccm-linode
namespace: kube-system
status:
currentNumberScheduled: 1
desiredNumberScheduled: 1
numberAvailable: 1
numberMisscheduled: 0
numberReady: 1
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: cilium
namespace: kube-system
status:
currentNumberScheduled: 2
desiredNumberScheduled: 2
numberAvailable: 2
numberMisscheduled: 0
numberReady: 2
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: csi-linode-node
namespace: kube-system
status:
currentNumberScheduled: 2
desiredNumberScheduled: 2
numberAvailable: 2
numberMisscheduled: 0
numberReady: 2
Loading

0 comments on commit 323cfaa

Please sign in to comment.