Skip to content

Commit

Permalink
Removing all e2e github workflows but the in-cluster-build one. (#224)
Browse files Browse the repository at this point in the history
This detach the running cluster from its backend, for example running
any other cluster than a cluster using the host kernel (such as
`minikube` with the `docker` driver or `kind`) and allow us to re-use
those tests in other cluster envs.

The following jobs are removed:

* `e2e-two-nodes`
* `e2e-crd-variable`
* `e2e-pre-built-kernel-module`

Those jobs are not testing anything special, one is just testing the
selector of the `ds`, the second is just using a regex in the `kernelMapping`
flow which IMO should be both tested in UT rather than having their own e2e
workflows and the last one is just replicating the second part of the
`in-cluster-build`.

Signed-off-by: Yoni Bettan <[email protected]>

Signed-off-by: Yoni Bettan <[email protected]>
  • Loading branch information
ybettan authored Jan 5, 2023
1 parent 546c833 commit 4eb0736
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 390 deletions.
25 changes: 0 additions & 25 deletions .github/actions/build-drivercontainer-image/action.yml

This file was deleted.

176 changes: 4 additions & 172 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ env:
GO_VERSION: 1.18

jobs:

build-operator-image:
runs-on: ubuntu-latest

Expand All @@ -29,124 +30,11 @@ jobs:
path: kmm_local.tar
retention-days: 1

e2e:
runs-on: ubuntu-latest

name: Prebuilt kernel module

needs: [build-operator-image]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Create the minikube cluster
uses: ./.github/actions/create-minikube-cluster

- name: Label the node so that it gets the module
run: kubectl label node minikube wants-module=kmm_ci_a

- name: Download container images
uses: actions/download-artifact@v3
with:
name: ci-images

- name: Save the kernel version
run: echo "KERNEL_VERSION=$(uname -r)" >> $GITHUB_ENV

- name: Build the DriverContainer image
uses: ./.github/actions/build-drivercontainer-image
with:
kernel-version: ${{ env.KERNEL_VERSION }}

- name: Import images into minikube
run: |
minikube image load kmm_local.tar
minikube image load kmm-kmod_local.tar
- name: Cache binaries needed by Makefile
id: cache-bin
uses: actions/cache@v3
with:
path: ./bin
key: ${{ runner.os }}-bin-${{ env.GO_VERSION }}-${{ hashFiles('Makefile') }}

- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
if: steps.cache-bin.outputs.cache-hit != 'true'

- name: Run e2e-prebuilt-kernel-module tests
run: ./ci/prow/e2e-prebuilt-kernel-module
env:
KUSTOMIZE_CONFIG_DEFAULT: ci/install-ci

- name: Collect troubleshooting data
uses: ./.github/actions/collect-troubleshooting
if: ${{ always() }}

e2e-two-nodes:
name: Prebuilt kernel module - two nodes

runs-on: ubuntu-latest

needs: [build-operator-image]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Create the minikube cluster
uses: ./.github/actions/create-minikube-cluster
with:
start-args: --nodes 2

- name: Download container images
uses: actions/download-artifact@v3
with:
name: ci-images

- name: Save the kernel version
run: echo "KERNEL_VERSION=$(uname -r)" >> $GITHUB_ENV

- name: Build the DriverContainer image
uses: ./.github/actions/build-drivercontainer-image
with:
kernel-version: ${{ env.KERNEL_VERSION }}

- name: Import images into minikube
run: |
minikube image load kmm_local.tar
minikube image load kmm-kmod_local.tar
- name: Cache binaries needed by Makefile
id: cache-bin
uses: actions/cache@v3
with:
path: ./bin
key: ${{ runner.os }}-bin-${{ env.GO_VERSION }}-${{ hashFiles('Makefile') }}

- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
if: steps.cache-bin.outputs.cache-hit != 'true'

- name: Run e2e-prebuilt-kernel-module-two-nodes tests
run: ./ci/prow/e2e-prebuilt-kernel-module-two-nodes
env:
KUSTOMIZE_CONFIG_DEFAULT: ci/install-ci

- name: Collect troubleshooting data
uses: ./.github/actions/collect-troubleshooting
if: ${{ always() }}

in-cluster-build:
runs-on: ubuntu-latest

name: In-cluster build

runs-on: ubuntu-latest
name: in-cluster-build
needs: [build-operator-image]

steps:

- name: Checkout
Expand Down Expand Up @@ -189,67 +77,11 @@ jobs:
kubectl wait --for=condition=Complete --timeout -1s job/wait-minikube-registry-alias
timeout-minutes: 6

- name: Run e2e-incluster-build tests
- name: Run test
run: ./ci/prow/e2e-incluster-build
env:
KUSTOMIZE_CONFIG_DEFAULT: ci/install-ci

- name: Collect troubleshooting data
uses: ./.github/actions/collect-troubleshooting
if: ${{ always() }}

e2e-crd-variable:
runs-on: ubuntu-latest

name: Container image CRD variable

needs: [build-operator-image]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Create the minikube cluster
uses: ./.github/actions/create-minikube-cluster

- name: Download container images
uses: actions/download-artifact@v3
with:
name: ci-images

- name: Save the kernel version
run: echo "KERNEL_VERSION=$(uname -r)" >> $GITHUB_ENV

- name: Build the DriverContainer image
uses: ./.github/actions/build-drivercontainer-image
with:
kernel-version: ${{ env.KERNEL_VERSION }}

- name: Import images into minikube
run: |
minikube image load kmm_local.tar
minikube image load kmm-kmod_local.tar
- name: Tag the DriverContainer image with the kernel version
run: minikube image tag kmm-kmod:local kmm-kmod:${{ env.KERNEL_VERSION }}

- name: Cache binaries needed by Makefile
id: cache-bin
uses: actions/cache@v3
with:
path: ./bin
key: ${{ runner.os }}-bin-${{ env.GO_VERSION }}-${{ hashFiles('Makefile') }}

- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
if: steps.cache-bin.outputs.cache-hit != 'true'

- name: Run e2e-crd-variable tests
run: ./ci/prow/e2e-crd-variable
env:
KUSTOMIZE_CONFIG_DEFAULT: ci/install-ci

- name: Collect troubleshooting data
uses: ./.github/actions/collect-troubleshooting
if: ${{ always() }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,15 @@ spec:
modprobe:
moduleName: kmm_ci_a
kernelMappings:
- literal: KVER_CHANGEME
containerImage: registry.minikube/kmm-kmod:local
- regexp: '^.+$'
containerImage: registry.minikube/kmm-kmod:$KERNEL_FULL_VERSION
registryTLS:
insecure: true
build:
buildArgs:
- name: CI_BUILD_ARG
value: some-build-arg
baseImageRegistryTLS:
insecure: true
secrets:
- name: build-secret
dockerfileConfigMap:
name: kmm-kmod-dockerfile

# Optional. If kanikoParams.tag is empty, the default value will be: 'latest'
kanikoParams:
tag: "debug"
Expand Down
16 changes: 0 additions & 16 deletions ci/module-kmm-ci-variable.yaml

This file was deleted.

29 changes: 0 additions & 29 deletions ci/module-kmm-ci.template.yaml

This file was deleted.

27 changes: 0 additions & 27 deletions ci/prow/e2e-crd-variable

This file was deleted.

13 changes: 7 additions & 6 deletions ci/prow/e2e-incluster-build
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ set -euxo pipefail
echo "Deploy KMMO..."
make deploy

echo "Create a build secret..."
kubectl create secret generic build-secret --from-literal=ci-build-secret=super-secret-value
echo "Check that the kmm_ci_a module is not loaded on the node..."
if minikube ssh -- lsmod | grep kmm_ci_a; then
echo "Unexpected lsmod output - the module is present on the node before the module was applied to the cluster"
exit 1
fi

echo "Add a configmap that contain the kernel module build dockerfile..."
kubectl apply -f ci/kmm-kmod-dockerfile.yaml

echo "Add an kmm-ci Module that contains a valid mapping..."
sed -e "s/KVER_CHANGEME/$(minikube ssh -- uname -r)/g" ci/module-kmm-ci-build.template.yaml | tee module-kmm-ci.yaml
kubectl apply -f module-kmm-ci.yaml
kubectl apply -f ci/module-kmm-ci-build.yaml

# Wait for the build pod to be created. `kubectl wait` doesn't support such option,
# see https://github.com/kubernetes/kubernetes/issues/83242.
Expand All @@ -30,9 +32,8 @@ kubectl logs pod/${POD_NAME} -f
echo "Check that the module gets loaded on the node..."
timeout 10m bash -c 'until minikube ssh -- lsmod | grep kmm_ci_a; do sleep 3; done'


echo "Remove the Module..."
kubectl delete -f module-kmm-ci.yaml
kubectl delete -f ci/module-kmm-ci-build.yaml

echo "Check that the module gets unloaded from the node..."
timeout 1m bash -c 'until ! minikube ssh -- lsmod | grep kmm_ci_a; do sleep 3; done'
Expand Down
Loading

0 comments on commit 4eb0736

Please sign in to comment.