Skip to content

Bump MetalLB

Bump MetalLB #1018

Workflow file for this run

name: CI
on:
push:
branches: [main]
merge_group:
pull_request:
branches:
- "main"
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Verify
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
args: --timeout=15m0s --verbose
unit:
runs-on: ubuntu-22.04
name: Unit and Integration tests
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/workflows/composite/setup
- name: Verify manifests
run: |
make manifests
git diff --exit-code
- name: Verify bin dir
run: |
make bin
git diff --exit-code bin/
- name: Unit and Integration Tests
run: |
export KUBECONFIG=${HOME}/.kube/config
make test
e2e:
runs-on: ubuntu-22.04
env:
built_image: "metallb-operator:ci" # Arbitrary name
needs:
- lint
- unit
defaults:
run:
shell: bash
working-directory: metallboperator
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/workflows/composite/setup
- name: Deploy Metal LB Operator
run: |
KUSTOMIZE_DEPLOY_DIR="config/default/" make deploy
- name: Ensure MetalLB operator is ready
run: |
sleep 5
while [ "$(kubectl get pods -n metallb-system -l control-plane='controller-manager' -o jsonpath='{.items[*].status.containerStatuses[0].ready}')" != "true" ]; do
sleep 5
echo "Waiting for operator pod to be ready."
done
- name: E2E Tests
run: |
export KUBECONFIG=${HOME}/.kube/config
make test-validation
make test-e2e
- name: Collect Logs
if: ${{ failure() }}
uses: ./.github/workflows/composite/collectlogs
with:
artifact-name: e2e
olm:
runs-on: ubuntu-22.04
needs:
- lint
- unit
defaults:
run:
shell: bash
working-directory: metallboperator
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/workflows/composite/setup
- name: Verify release bundle manifests
run: |
make bundle-release
git diff --exit-code -I'^ createdAt: ' bundle
- name: Deploy Metal LB Operator with OLM
run: |
make deploy-with-olm REPO=localhost:5000
- name: E2E Tests
run: |
export KUBECONFIG=${HOME}/.kube/config
make test-validation
make test-e2e
- name: Collect Logs
if: ${{ failure() }}
uses: ./.github/workflows/composite/collectlogs
with:
artifact-name: olm
upgrade_version:
runs-on: ubuntu-22.04
env:
built_image_prev_release: "metallb-operator-prev-rel:ci" # Arbitrary name
built_image: "metallb-operator:ci" # Arbitrary name
name: Upgrade version
defaults:
run:
working-directory: metallboperator
needs:
- lint
- unit
steps:
- name: Checkout Previous Release Metal LB Operator
uses: actions/checkout@v4
with:
path: metallboperator
ref: v0.13 # previous release version
fetch-depth: 0 # Fetch all history for all tags and branches
- uses: actions/setup-go@v2
with:
go-version-file: "go.mod"
cache: true
- name: Build image
run: |
IMG=${built_image_prev_release} make docker-build
- name: Create K8s Kind Cluster
run: |
./hack/kind-cluster-without-registry.sh
kind load docker-image ${built_image_prev_release}
- name: Deploy Previous Release Metal LB Operator
run: |
IMG=${built_image_prev_release} KUSTOMIZE_DEPLOY_DIR="config/kind-ci/" make deploy
- name: Ensure MetalLB operator is ready
run: |
sleep 5
while [ "$(kubectl get pods -n metallb-system -l control-plane='controller-manager' -o jsonpath='{.items[*].status.containerStatuses[0].ready}')" != "true" ]; do
sleep 5
echo "Waiting for operator pod to be ready."
done
- name: E2E Tests
run: |
export KUBECONFIG=${HOME}/.kube/config
make test-validation
make test-e2e
- name: Collect Logs
if: ${{ failure() }}
uses: ./.github/workflows/composite/collectlogs
with:
artifact-name: upgrade_version
- name: Checkout Latest Metal LB Operator
uses: actions/checkout@v4
with:
path: metallboperator-latest
fetch-depth: 0 # Fetch all history for all tags and branches
- name: Deploy Metal LB Operator
run: |
cd ${GITHUB_WORKSPACE}/metallboperator-latest
KUSTOMIZE_DEPLOY_DIR="config/default/" make deploy
- name: Ensure MetalLB operator is ready
run: |
sleep 5
while [ "$(kubectl get pods -n metallb-system -l control-plane='controller-manager' -o jsonpath='{.items[*].status.containerStatuses[0].ready}')" != "true" ]; do
sleep 5
echo "Waiting for operator pod to be ready."
done
- name: E2E Tests
run: |
cd ${GITHUB_WORKSPACE}/metallboperator-latest
export KUBECONFIG=${HOME}/.kube/config
make test-validation
make test-e2e
- name: Checkout
uses: actions/checkout@v4
- name: Collect Logs
if: ${{ failure() }}
uses: ./.github/workflows/composite/collectlogs
with:
artifact-name: upgrade_version
metallb_e2e:
runs-on: ubuntu-22.04
env:
built_image: "metallb-operator:ci" # Arbitrary name
needs:
- lint
- unit
defaults:
run:
shell: bash
working-directory: metallboperator
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/workflows/composite/setup
- name: Read metallb ref
id: metallb_ref
run: |
echo "content=$(cat ./hack/metallb_ref.txt)" >> $GITHUB_OUTPUT
- name: Checkout MetalLB
uses: actions/checkout@v4
with:
repository: metallb/metallb
path: metallb
ref: "${{ steps.metallb_ref.outputs.content }}"
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install linux-modules-extra-$(uname -r) python3-pip arping ndisc6
sudo pip3 install -r ${GITHUB_WORKSPACE}/metallb/dev-env/requirements.txt
go install github.com/onsi/ginkgo/v2/[email protected]
- name: Deploy Metal LB Operator
run: |
KUSTOMIZE_DEPLOY_DIR="config/frr-webhook-prometheus/" make deploy
- name: Deploy Prometheus
run: |
make deploy-prometheus
- name: Ensure MetalLB operator is ready
run: |
while [ "$(kubectl get pods -n metallb-system -l control-plane='controller-manager' -o jsonpath='{.items[*].status.containerStatuses[0].ready}')" != "true" ]; do
sleep 5
echo "Waiting for operator pod to be ready."
done
- name: Enable MetalLB
run: |
export KUBECONFIG=${HOME}/.kube/config
kubectl apply -f config/samples/metallb.yaml
- name: MetalLB E2E Tests
run: |
cd ${GITHUB_WORKSPACE}/metallb
inv remove-lb-exclusion-from-nodes
sudo -E env "PATH=$PATH" inv e2etest -b frr --skip "IPV6|DUALSTACK|FRRK8S-MODE|L2ServiceStatus" -e /tmp/kind_logs
- name: Collect Logs
if: ${{ failure() }}
uses: ./.github/workflows/composite/collectlogs
with:
artifact-name: metallb_e2e
metallb_e2e_frr-k8s:
runs-on: ubuntu-22.04
env:
built_image: "metallb-operator:ci" # Arbitrary name
needs:
- lint
- unit
defaults:
run:
shell: bash
working-directory: metallboperator
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/workflows/composite/setup
- name: Read metallb ref
id: metallb_ref
run: echo "content=$(cat ./hack/metallb_ref.txt)" >> $GITHUB_OUTPUT
- name: Read frr-k8s version
id: frrk8s_ref
run: |
wget https://raw.githubusercontent.com/metallb/metallb/${{ steps.metallb_ref.outputs.content }}/charts/metallb/Chart.yaml
echo "content=v$(yq e '.dependencies[] | select(.name == "frr-k8s") | .version' Chart.yaml)" >> $GITHUB_OUTPUT
rm -f Chart.yaml
- name: Checkout MetalLB
uses: actions/checkout@v2
with:
repository: metallb/metallb
path: metallb
ref: "${{ steps.metallb_ref.outputs.content }}"
- name: Checkout frr-k8s
uses: actions/checkout@v2
with:
repository: metallb/frr-k8s
path: frr-k8s
ref: "${{ steps.frrk8s_ref.outputs.content }}"
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install linux-modules-extra-$(uname -r) python3-pip arping ndisc6
sudo pip3 install -r ${GITHUB_WORKSPACE}/metallb/dev-env/requirements.txt
go install github.com/onsi/ginkgo/v2/[email protected]
- name: Deploy MetalLB Operator
run: |
IMG=${built_image} KUSTOMIZE_DEPLOY_DIR="config/frr-webhook-prometheus/" make deploy
- name: Deploy Prometheus
run: |
make deploy-prometheus
- name: Ensure MetalLB operator is ready
run: |
while [ "$(kubectl get pods -n metallb-system -l control-plane='controller-manager' -o jsonpath='{.items[*].status.containerStatuses[0].ready}')" != "true" ]; do
sleep 5
echo "Waiting for operator pod to be ready."
done
- name: Operator E2E Tests
run: |
export KUBECONFIG=${HOME}/.kube/config
make test-validation
make test-e2e
kubectl wait -n metallb-system --for=delete pod -l "component in (speaker,controller,frr-k8s,frr-k8s-webhook-server)" --timeout=180s
- name: Deploy MetalLB resource
run: |
export KUBECONFIG=${HOME}/.kube/config
kubectl apply -f config/samples/metallb_frrk8s.yaml
sleep 20
kubectl wait -n metallb-system --for=condition=Ready pod -l "component in (speaker,controller,frr-k8s,frr-k8s-webhook-server)" --timeout=180s
- name: frr-k8s E2E Webhooks tests
run: |
export KUBECONFIG=${HOME}/.kube/config
kubectl create ns frr-k8s-system
cd ${GITHUB_WORKSPACE}/frr-k8s
mkdir -p /tmp/kind_logs
# TODO: fix the e2e test so it checks for the current labels too and the proper namespace.
sed -i '/FRRK8isDaemonSetReady/{N;N;d;}' e2etests/e2etest_suite_test.go
sed -i '/github.com\/metallb\/frrk8stests\/pkg\/k8s\"/d' e2etests/e2etest_suite_test.go
# TODO: remove skipping the conflict test, curerntly broken for multiple namespaces
KUBECONFIG_PATH=${HOME}/.kube/config GINKGO_ARGS="--focus Webhooks --skip conflict" TEST_ARGS="--report-path=/tmp/kind_logs" make e2etests
kubectl delete ns frr-k8s-system
#TODO remove when the webhook tests do not leave resources behind
kubectl delete frrconfiguration --all -n metallb-system
- name: MetalLB E2E Tests
run: |
cd ${GITHUB_WORKSPACE}/metallb
inv remove-lb-exclusion-from-nodes
sudo -E env "PATH=$PATH" inv e2etest -b frr-k8s --skip "IPV6|DUALSTACK|FRR-MODE|L2ServiceStatus" -e /tmp/kind_logs
- name: Collect Logs
if: ${{ failure() }}
uses: ./.github/workflows/composite/collectlogs
with:
artifact-name: metallb_e2e_frr-k8s