Skip to content

K8S E2E Suite

K8S E2E Suite #53856

Workflow file for this run

# K8s E2E Suite
#
# This workflow runs under any of the following conditions:
# - manual dispatch in GH UI
# - on a PR commit if the kubernetes_logs source was changed
# - in the merge queue
# - on a schedule at midnight UTC Tue-Sat
# - on demand by either of the following comments in a PR:
# - '/ci-run-k8s'
# - '/ci-run-all'
#
# If the workflow trigger is the nightly schedule, all the k8s versions
# are run in the matrix, otherwise, only the latest is run.
name: K8S E2E Suite
permissions:
contents: read
on:
workflow_dispatch:
inputs:
ref:
description: 'Git ref to checkout'
required: false
type: string
workflow_call:
inputs:
ref:
description: 'Git ref to checkout'
required: false
type: string
pull_request:
merge_group:
types: [checks_requested]
schedule:
- cron: '0 1 * * 2-6' # 01:00 UTC Tue-Sat
concurrency:
# In flight runs will be canceled through re-trigger in the merge queue, scheduled run, or if
# additional PR commits are pushed. The comment.html_url should always be unique.
#
# Note that technically this workflow can run on PRs which have code changes that affect K8s. Choosing not to add the PR commit to
# the concurrency group settings- since that would result in new PR commits canceling out manual runs on any PR that doesn't flag
# change detection. This is a "conservative" approach that means we may have some runs that could be canceled, but it's safer than
# having user's runs canceled when they shouldn't be. In practice this shouldn't happen very often given this component does not change
# often so any increased cost from the conservative approach should be negligible.
group: ${{ github.workflow }}-${{ github.event.comment.html_url || github.ref || github.event.schedule }}
cancel-in-progress: true
env:
CONTAINER_TOOL: "docker"
RUST_BACKTRACE: full
VECTOR_LOG: vector=debug
VERBOSE: true
CI: true
PROFILE: debug
jobs:
changes:
# Only evaluate files changed on pull request trigger
if: ${{ github.event_name == 'merge_group' }}
uses: ./.github/workflows/changes.yml
secrets: inherit
build-x86_64-unknown-linux-gnu:
name: Build - x86_64-unknown-linux-gnu
runs-on: ubuntu-24.04
timeout-minutes: 45
needs: changes
# Run this job even if `changes` job is skipped
if: ${{ !failure() && !cancelled() && github.event_name != 'pull_request' && needs.changes.outputs.website_only != 'true' && needs.changes.outputs.k8s != 'false' }}
# cargo-deb requires a release build, but we don't need optimizations for tests
env:
CARGO_PROFILE_RELEASE_OPT_LEVEL: 0
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 256
CARGO_INCREMENTAL: 0
DISABLE_MOLD: true
steps:
- name: Checkout branch
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ inputs.ref }}
- run: sudo -E bash scripts/ci-free-disk-space.sh
- uses: ./.github/actions/setup
with:
rust: true
cross: true
mold: false
- run: VECTOR_VERSION="$(vdev version)" make package-deb-x86_64-unknown-linux-gnu
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: e2e-test-deb-package
path: target/artifacts/*
# GitHub Actions don't support `matrix` at the job-level `if:` condition.
# We apply this workaround - compute `matrix` in a preceding job, and assign
# it's value dynamically at the actual test job.
# This approach can be advanced further by, for instance, dynamically
# detecting versions of various components, or reading them from `.meta`.
# See https://github.community/t/feature-request-and-use-case-example-to-allow-matrix-in-if-s/126067
compute-k8s-test-plan:
name: Compute K8s test plan
runs-on: ubuntu-24.04
timeout-minutes: 5
needs: changes
# Run this job even if `changes` job is skipped
if: ${{ !failure() && !cancelled() && github.event_name != 'pull_request' && needs.changes.outputs.website_only != 'true' && needs.changes.outputs.k8s != 'false' }}
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
id: set-matrix
with:
script: |
// Parameters.
const minikube_version = [
"v1.33.1",
]
// Aim to test against oldest supported k8s cloud-provider versions
// https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html
// https://cloud.google.com/kubernetes-engine/docs/release-notes
// https://docs.microsoft.com/en-us/azure/aks/supported-kubernetes-versions?tabs=azure-cli#aks-kubernetes-release-calendar
const kubernetes_version = [
{ version: "v1.23.3", is_essential: true },
{ version: "v1.22.5", is_essential: false },
{ version: "v1.21.8", is_essential: false },
{ version: "v1.20.14", is_essential: false },
{ version: "v1.19.8", is_essential: false },
]
const container_runtime = [
"docker",
"containerd",
// https://github.com/kubernetes/minikube/issues/12928
// "crio",
]
// Run all versions if triggered by nightly schedule. Otherwise only run latest.
const run_all = context.eventName == "schedule";
const filter_targets = array => array.filter(val => run_all || val.is_essential)
const matrix = {
minikube_version,
kubernetes_version: filter_targets(kubernetes_version).map(e => ({
version: e.version,
role: e.is_essential ? "essential" : "extra",
})),
container_runtime,
}
core.setOutput('matrix', matrix)
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(steps.set-matrix.outputs.matrix) }}
run: echo "$MATRIX_CONTEXT"
test-e2e-kubernetes:
name: K8s ${{ matrix.kubernetes_version.version }} / ${{ matrix.container_runtime }} (${{ matrix.kubernetes_version.role }})
runs-on: ubuntu-24.04
timeout-minutes: 45
needs:
- build-x86_64-unknown-linux-gnu
- compute-k8s-test-plan
# because `changes` job might be skipped
if: always() && needs.build-x86_64-unknown-linux-gnu.result == 'success' && needs.compute-k8s-test-plan.result == 'success'
strategy:
matrix: ${{ fromJson(needs.compute-k8s-test-plan.outputs.matrix) }}
fail-fast: false
steps:
- name: Checkout branch
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ inputs.ref }}
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: e2e-test-deb-package
path: target/artifacts
- name: Setup Minikube
run: scripts/ci-setup-minikube.sh
env:
KUBERNETES_VERSION: ${{ matrix.kubernetes_version.version }}
MINIKUBE_VERSION: ${{ matrix.minikube_version }}
CONTAINER_RUNTIME: ${{ matrix.container_runtime }}
# TODO: This job has been quite flakey. Need to investigate further and then remove the retries.
- name: Run tests
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
env:
USE_MINIKUBE_CACHE: "true"
SKIP_PACKAGE_DEB: "true"
CARGO_INCREMENTAL: 0
with:
timeout_minutes: 45
max_attempts: 3
command: make test-e2e-kubernetes
final-result:
name: K8s E2E Suite
runs-on: ubuntu-24.04
timeout-minutes: 5
needs:
- changes
- build-x86_64-unknown-linux-gnu
- compute-k8s-test-plan
- test-e2e-kubernetes
if: always()
env:
FAILED: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
steps:
- name: Check all jobs status
run: |
if [[ "${{ env.FAILED }}" == "true" ]]; then
echo "One or more jobs failed or were cancelled"
exit 1
else
echo "All jobs completed successfully"
fi