Skip to content

Conformance Ingress (ci-ingress) #161

Conformance Ingress (ci-ingress)

Conformance Ingress (ci-ingress) #161

name: Conformance Ingress (ci-ingress)
# Any change in triggers needs to be reflected in the concurrency group.
on:
workflow_dispatch:
inputs:
PR-number:
description: "Pull request number."
required: true
context-ref:
description: "Context in which the workflow runs. If PR is from a fork, will be the PR target branch (general case). If PR is NOT from a fork, will be the PR branch itself (this allows committers to test changes to workflows directly from PRs)."
required: true
SHA:
description: "SHA under test (head of the PR branch)."
required: true
extra-args:
description: "[JSON object] Arbitrary arguments passed from the trigger comment via regex capture group. Parse with 'fromJson(inputs.extra-args).argName' in workflow."
required: false
default: '{}'
push:
branches:
- v1.12
- ft/v1.12/**
paths-ignore:
- 'Documentation/**'
- 'test/**'
# By specifying the access of one of the scopes, all of those that are not
# specified are set to 'none'.
permissions:
# To be able to access the repository with actions/checkout
contents: read
# To allow retrieving information from the PR API
pull-requests: read
# To be able to set commit status
statuses: write
concurrency:
# Structure:
# - Workflow name
# - Event type
# - A unique identifier depending on event type:
# - schedule: SHA
# - workflow_dispatch: PR number
#
# This structure ensures a unique concurrency group name is generated for each
# type of testing, such that re-runs will cancel the previous run.
group: |
${{ github.workflow }}
${{ github.event_name }}
${{
(github.event_name == 'push' && github.sha) ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.PR-number)
}}
cancel-in-progress: true
env:
minikube_version: 1.25.2
cilium_cli_version: v0.12.12
timeout: 5m
jobs:
commit-status-start:
name: Commit Status Start
runs-on: ubuntu-latest
steps:
- name: Set initial commit status
uses: myrotvorets/set-commit-status-action@38f3f27c7d52fb381273e95542f07f0fba301307 # v2.0.0
with:
sha: ${{ inputs.SHA || github.sha }}
ingress-conformance-test:
name: Ingress Conformance Test
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Checkout context ref (trusted)
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
ref: ${{ inputs.context-ref || github.sha }}
persist-credentials: false
- name: Set Environment Variables
uses: ./.github/actions/set-env-variables
- name: Install Cilium CLI
run: |
curl -sSL --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${{ env.cilium_cli_version }}/cilium-linux-amd64.tar.gz{,.sha256sum}
sha256sum --check cilium-linux-amd64.tar.gz.sha256sum
sudo tar xzvfC cilium-linux-amd64.tar.gz /usr/local/bin
rm cilium-linux-amd64.tar.gz{,.sha256sum}
cilium version
- name: Set image tag
id: vars
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
SHA="${{ inputs.SHA }}"
else
SHA="${{ github.sha }}"
fi
echo sha=${SHA} >> $GITHUB_OUTPUT
# Warning: since this is a privileged workflow, subsequent workflow job
# steps must take care not to execute untrusted code.
- name: Checkout pull request branch (NOT TRUSTED)
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
ref: ${{ steps.vars.outputs.sha }}
persist-credentials: false
- name: Create minikube cluster with multiple nodes
uses: medyagh/setup-minikube@e0505489c98496aff6ed17db0ba68bf7ecadf730 # v0.0.14
with:
minikube-version: ${{ env.minikube_version }}
network-plugin: cni
cni: false
wait: false
start-args: --nodes 3 --docker-opt "default-ulimit=nofile=102400:102400"
# Start minikube tunnel
- name: Setup minikube
run: |
docker pull ${{ env.ECHO_SERVER_IMAGE }}
minikube image load ${{ env.ECHO_SERVER_IMAGE }}
minikube tunnel &
env:
ECHO_SERVER_IMAGE: k8s.gcr.io/ingressconformance/echoserver:v0.0.1@sha256:9b34b17f391f87fb2155f01da2f2f90b7a4a5c1110ed84cb5379faa4f570dc52
- name: Checkout ingress-controller-conformance
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
repository: kubernetes-sigs/ingress-controller-conformance
path: ingress-controller-conformance
ref: cec7cf25b0291933426e256065ef4afc981ea1fa
persist-credentials: false
- name: Install Ingress conformance test tool
timeout-minutes: 10
run: |
cd ingress-controller-conformance
make build
- name: Wait for images to be available
timeout-minutes: 30
shell: bash
run: |
for image in cilium-ci operator-generic-ci ; do
until docker manifest inspect quay.io/${{ github.repository_owner }}/$image:${{ steps.vars.outputs.sha }} &> /dev/null; do sleep 45s; done
done
- name: Install Cilium
run: |
helm upgrade -i cilium ./install/kubernetes/cilium \
--wait \
--namespace kube-system \
--set kubeProxyReplacement=strict \
--set nodeinit.enabled=true \
--set ipam.mode=kubernetes \
--set image.repository=quay.io/${{ github.repository_owner }}/cilium-ci \
--set image.tag=${{ steps.vars.outputs.sha }} \
--set image.pullPolicy=IfNotPresent \
--set image.useDigest=false \
--set operator.image.repository=quay.io/${{ github.repository_owner }}/operator \
--set operator.image.suffix=-ci \
--set operator.image.tag=${{ steps.vars.outputs.sha }} \
--set operator.image.pullPolicy=IfNotPresent \
--set operator.image.useDigest=false \
--set debug.enabled=true \
--set debug.verbose=flow \
--set securityContext.privileged=true \
--set ingressController.enabled=true
kubectl wait -n kube-system --for=condition=Ready --all pod --timeout=${{ env.timeout }}
# To make sure that cilium envoy CRs are available
kubectl wait --for condition=Established crd/ciliumenvoyconfigs.cilium.io --timeout=${{ env.timeout }}
kubectl wait --for condition=Established crd/ciliumclusterwideenvoyconfigs.cilium.io --timeout=${{ env.timeout }}
# Run the quick sanity check
- name: Run Sanity check
timeout-minutes: 5
run: |
kubectl apply -n default -f https://raw.githubusercontent.com/istio/istio/release-1.11/samples/bookinfo/platform/kube/bookinfo.yaml
kubectl apply -n default -f examples/kubernetes/servicemesh/basic-ingress.yaml
kubectl wait -n default --for=condition=Ready --all pod --timeout=${{ env.timeout }}
lb=$(kubectl get ingress basic-ingress -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
curl -s -v --connect-timeout 5 --max-time 20 --retry 3 --fail -- http://"$lb"
curl -s -v --connect-timeout 5 --max-time 20 --retry 3 --fail -- http://"$lb"/details/1
- name: Run Ingress conformance test
timeout-minutes: 30
run: |
cd ingress-controller-conformance
./ingress-controller-conformance -ingress-class cilium -wait-time-for-ingress-status 10s -wait-time-for-ready 30s
- 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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: cilium-sysdump-out.zip
path: cilium-sysdump-out.zip
retention-days: 5
commit-status-final:
if: ${{ always() }}
name: Commit Status Final
needs: ingress-conformance-test
runs-on: ubuntu-latest
steps:
- name: Set final commit status
uses: myrotvorets/set-commit-status-action@38f3f27c7d52fb381273e95542f07f0fba301307 # v2.0.0
with:
sha: ${{ inputs.SHA || github.sha }}
status: ${{ needs.ingress-conformance-test.result }}