cherry-picks from upstream on v1.14.18 for conformance test fix #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Conformance Multi Pool IPAM | |
# Any change in triggers needs to be reflected in the concurrency group. | |
on: | |
pull_request: | |
paths-ignore: | |
- 'Documentation/**' | |
- 'test/**' | |
push: | |
branches: | |
- v1.14 | |
- ft/v1.14/** | |
- 'renovate/v1.14-**' | |
paths-ignore: | |
- 'Documentation/**' | |
- 'test/**' | |
permissions: read-all | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }} | |
cancel-in-progress: true | |
env: | |
cilium_cli_ci_version: | |
kind_config: .github/kind-config.yaml | |
timeout: 5m | |
jobs: | |
echo-inputs: | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
name: Echo Workflow Dispatch Inputs | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Echo Workflow Dispatch Inputs | |
run: | | |
echo '${{ tojson(inputs) }}' | |
multi-pool-ipam-conformance-test: | |
name: Install and Connectivity Test | |
runs-on: ubuntu-latest | |
timeout-minutes: 120 | |
steps: | |
- name: Checkout target branch to access local actions | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
ref: ${{ github.base_ref || github.ref }} | |
persist-credentials: false | |
- name: Set Environment Variables | |
uses: ./.github/actions/set-env-variables | |
- name: Install Cilium CLI | |
uses: cilium/cilium-cli@c52e8c38e6d6235bd8e6e961199a984275547d6f # v0.16.22 | |
with: | |
release-version: ${{ env.CILIUM_CLI_VERSION }} | |
ci-version: ${{ env.cilium_cli_ci_version }} | |
- name: Set image tag | |
id: vars | |
run: | | |
if [ ${{ github.event.pull_request }} ]; then | |
SHA=${{ github.event.pull_request.head.sha }} | |
else | |
SHA=${{ github.sha }} | |
fi | |
echo sha=${SHA} >> $GITHUB_OUTPUT | |
# Notes: | |
# - Multi-pool IPAM only supports direct routing, thus we disable | |
# tunnel mode and enable auto-direct-routes. | |
# - Multi-pool IPAM only supports endpoint routes, thus we disable | |
# the local-node-route. | |
# - helm/kind-action does not support BPF host routing, so we fall | |
# back on legacy host routing (#23283) | |
# - iptables-based masquerading does not support multiple non-masquerade | |
# CIDRs. Thus, we enable BPF masquerading where we can add multiple | |
# non-masquerade CIDRs. | |
CILIUM_INSTALL_DEFAULTS="--chart-directory=./untrusted/install/kubernetes/cilium \ | |
--helm-set=debug.enabled=true \ | |
--helm-set=image.repository=quay.io/${{ env.QUAY_ORGANIZATION_DEV }}/cilium-ci \ | |
--helm-set=image.useDigest=false \ | |
--helm-set=image.tag=${SHA} \ | |
--helm-set=operator.image.repository=quay.io/${{ env.QUAY_ORGANIZATION_DEV }}/operator \ | |
--helm-set=operator.image.suffix=-ci \ | |
--helm-set=operator.image.tag=${SHA} \ | |
--helm-set=operator.image.useDigest=false \ | |
--helm-set=hubble.relay.enabled=true \ | |
--helm-set=hubble.relay.image.repository=quay.io/${{ env.QUAY_ORGANIZATION_DEV }}/hubble-relay-ci \ | |
--helm-set=hubble.relay.image.tag=${SHA} \ | |
--helm-set=hubble.relay.image.useDigest=false \ | |
--helm-set=tunnel=disabled \ | |
--helm-set=autoDirectNodeRoutes=true \ | |
--helm-set=routingMode=native \ | |
--helm-set=endpointRoutes.enabled=true \ | |
--helm-set-string=extraConfig.enable-local-node-route=false \ | |
--helm-set=kubeProxyReplacement=strict \ | |
--helm-set=bpf.masquerade=true \ | |
--helm-set=bpf.hostLegacyRouting=true\ | |
--helm-set=ipv4NativeRoutingCIDR=10.0.0.0/8 \ | |
--helm-set=ipMasqAgent.enabled=true \ | |
--helm-set=ipMasqAgent.config.nonMasqueradeCIDRs='{192.168.0.0/16}' \ | |
--helm-set=ipam.mode=multi-pool \ | |
--helm-set=ipam.operator.autoCreateCiliumPodIPPools.default.ipv4.cidrs='{10.10.0.0/16}' \ | |
--helm-set=ipam.operator.autoCreateCiliumPodIPPools.default.ipv4.maskSize=24 \ | |
--helm-set=ipam.operator.autoCreateCiliumPodIPPools.cilium-test-pool.ipv4.cidrs='{10.20.0.0/16}' \ | |
--helm-set=ipam.operator.autoCreateCiliumPodIPPools.cilium-test-pool.ipv4.maskSize=24 \ | |
--helm-set=ipam.operator.autoCreateCiliumPodIPPools.client-pool.ipv4.cidrs='{192.168.0.0/20}' \ | |
--helm-set=ipam.operator.autoCreateCiliumPodIPPools.client-pool.ipv4.maskSize=27 \ | |
--helm-set=ipam.operator.autoCreateCiliumPodIPPools.echo-other-node-pool.ipv4.cidrs='{192.168.16.0/20}' \ | |
--helm-set=ipam.operator.autoCreateCiliumPodIPPools.echo-other-node-pool.ipv4.maskSize=27" | |
CONNECTIVITY_TEST_DEFAULTS="--test-concurrency=5 \ | |
--flow-validation=disabled --hubble=false --collect-sysdump-on-failure \ | |
--external-target bing.com. --external-cidr 8.0.0.0/8 --external-ip 8.8.4.4 --external-other-ip 8.8.8.8 \ | |
--namespace-annotations='{\"ipam.cilium.io/ip-pool\":\"cilium-test-pool\"}' \ | |
--deployment-pod-annotations='{ \ | |
\"client\":{\"ipam.cilium.io/ip-pool\":\"client-pool\"}, \ | |
\"echo-other-node\":{\"ipam.cilium.io/ip-pool\":\"echo-other-node-pool\"} \ | |
}'" | |
echo cilium_install_defaults=${CILIUM_INSTALL_DEFAULTS} >> $GITHUB_OUTPUT | |
echo connectivity_test_defaults=${CONNECTIVITY_TEST_DEFAULTS} >> $GITHUB_OUTPUT | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
ref: ${{ steps.vars.outputs.sha }} | |
persist-credentials: false | |
path: untrusted | |
sparse-checkout: | | |
install/kubernetes/cilium | |
- name: Create kind cluster | |
uses: helm/kind-action@9fdad0686e6f19fcd572f62516f5e0436f562ee7 # v1.10.0 | |
with: | |
version: ${{ env.KIND_VERSION }} | |
node_image: ${{ env.KIND_K8S_IMAGE }} | |
kubectl_version: ${{ env.KIND_K8S_VERSION }} | |
config: ${{ env.kind_config }} | |
wait: 0 # The control-plane never becomes ready, since no CNI is present | |
- name: Wait for images to be available | |
timeout-minutes: 30 | |
shell: bash | |
run: | | |
for image in cilium-ci operator-generic-ci hubble-relay-ci; do | |
until docker manifest inspect quay.io/${{ env.QUAY_ORGANIZATION_DEV }}/$image:${{ steps.vars.outputs.sha }} &> /dev/null; do sleep 45s; done | |
done | |
- name: Install Cilium | |
run: | | |
CILIUM_CLI_MODE=helm cilium install ${{ steps.vars.outputs.cilium_install_defaults }} | |
- name: Wait for Cilium status to be ready | |
run: | | |
cilium status --wait | |
kubectl -n kube-system get pods | |
- name: Make JUnit report directory | |
run: | | |
mkdir -p cilium-junits | |
- name: Run connectivity test | |
run: | | |
cilium connectivity test ${{ steps.vars.outputs.connectivity_test_defaults }} \ | |
--junit-file "cilium-junits/${{ env.job_name }} - 1.xml" --junit-property github_job_step="Run connectivity test" | |
- name: Collect Pod and Pool IPs | |
id: ips | |
run: | | |
for pod in client client2 echo-same-node echo-other-node; do | |
kubectl get pod -A -l "name=${pod}" -o jsonpath="${pod}={.items[*].status.podIP}{'\n'}" >> "$GITHUB_OUTPUT" | |
done | |
for pool in cilium-test-pool client-pool echo-other-node-pool; do | |
kubectl get ciliumpodippool "${pool}" -o "jsonpath=${pool}={.spec.ipv4.cidrs[0]}{'\n'}" >> "$GITHUB_OUTPUT" | |
done | |
- name: Validate Pod IPs | |
shell: python | |
run: | | |
from ipaddress import ip_address, ip_network | |
for ip in "${{ steps.ips.outputs.client }}".split(): | |
assert ip_address(ip) in ip_network("${{ steps.ips.outputs.client-pool }}"), "client pool mismatch" | |
for ip in "${{ steps.ips.outputs.client2 }}".split(): | |
assert ip_address(ip) in ip_network("${{ steps.ips.outputs.cilium-test-pool }}"), "client2 pool mismatch" | |
for ip in "${{ steps.ips.outputs.echo-same-node }}".split(): | |
assert ip_address(ip) in ip_network("${{ steps.ips.outputs.cilium-test-pool }}"), "echo-same-node pool mismatch" | |
for ip in "${{ steps.ips.outputs.echo-other-node }}".split(): | |
assert ip_address(ip) in ip_network("${{ steps.ips.outputs.echo-other-node-pool }}"), "echo-other-node pool mismatch" | |
- name: Post-test information gathering | |
if: ${{ !success() }} | |
run: | | |
kubectl get pods --all-namespaces -o wide | |
cilium status | |
cilium sysdump --output-filename cilium-sysdump-out | |
shell: bash {0} # Disable default fail-fast behaviour so that all commands run independently | |
- name: Upload artifacts | |
if: ${{ !success() }} | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: cilium-sysdump-out.zip | |
path: cilium-sysdump-*.zip | |
retention-days: 5 |