3
# Any change in triggers needs to be reflected in the concurrency group.
11
types: [checks_requested]
16
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after || github.event.merge_group && github.run_id }}
17
cancel-in-progress: ${{ !github.event.merge_group }}
20
cilium_cli_ci_version:
22
# renovate: datasource=github-releases depName=kubernetes-sigs/kind
24
KIND_CONFIG: .github/kind-config.yaml
25
CONFORMANCE_TEMPLATE: examples/kubernetes/connectivity-check/connectivity-check.yaml
32
name: Deduce required tests from code changes
35
tested: ${{ steps.tested-tree.outputs.src }}
38
if: ${{ !github.event.pull_request }}
39
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
41
persist-credentials: false
42
- name: Check code changes
43
uses: dorny/paths-filter@ebc4d7e9ebcb0b1eb21480bb8f43113e996ac77a # v3.0.1
46
# For `push` events, compare against the `ref` base branch
47
# For `pull_request` events, this is ignored and will compare against the pull request base branch
48
base: ${{ github.ref }}
51
- '!(test|Documentation)/**'
53
preflight-clusterrole:
54
runs-on: ubuntu-latest
55
name: Preflight Clusterrole Check
58
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
60
persist-credentials: false
62
- name: Check pre-flight clusterrole
63
run: make check-k8s-clusterrole
66
runs-on: ubuntu-latest
67
name: Helm Charts Check
70
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
72
persist-credentials: false
74
- name: Run helm-charts
76
make -C install/kubernetes
77
test -z "$(git status --porcelain)" || (echo "please run 'make -C install/kubernetes' and submit your changes"; exit 1)
81
if: ${{ needs.check_changes.outputs.tested == 'true' && github.event_name != 'merge_group' }}
82
runs-on: ubuntu-latest
83
name: Installation and Conformance Test
85
- name: Checkout main branch to access local actions
86
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
88
ref: ${{ github.event.repository.default_branch }}
89
persist-credentials: false
90
- name: Set Environment Variables
91
uses: ./.github/actions/set-env-variables
94
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
96
persist-credentials: false
98
- name: Get Cilium's default values
100
uses: ./.github/actions/helm-default
102
image-tag: ${{ github.event.pull_request.head.sha }}
104
- name: Set image tag
107
echo sha=${{ steps.default_vars.outputs.sha }} >> $GITHUB_OUTPUT
109
- name: Precheck generated connectivity manifest files
111
make -C examples/kubernetes/connectivity-check fmt
112
make -C examples/kubernetes/connectivity-check all
113
test -z "$(git status --porcelain)" || (echo "please run 'make -C examples/kubernetes/connectivity-check fmt all' and submit your changes"; exit 1)
115
- name: Create kind cluster
116
uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0
118
version: ${{ env.KIND_VERSION }}
119
config: ${{ env.KIND_CONFIG }}
121
- name: Wait for images to be available
125
for image in cilium-ci operator-generic-ci hubble-relay-ci ; do
126
until docker manifest inspect quay.io/${{ env.QUAY_ORGANIZATION_DEV }}/$image:${{ steps.sha.outputs.sha }} &> /dev/null; do sleep 45s; done
129
- name: Set up install variables
132
CILIUM_INSTALL_DEFAULTS="${{ steps.default_vars.outputs.cilium_install_defaults }} \
133
--helm-set nodeinit.enabled=true \
134
--helm-set kubeProxyReplacement=true \
135
--helm-set ipam.mode=kubernetes \
136
--helm-set hubble.relay.enabled=true \
137
--helm-set prometheus.enabled=true \
138
--helm-set operator.prometheus.enabled=true \
139
--helm-set hubble.enabled=true \
140
--helm-set=hubble.metrics.enabled=\"{dns,drop,tcp,flow,port-distribution,icmp,http}\" \
141
--helm-set ingressController.enabled=true"
143
echo cilium_install_defaults=${CILIUM_INSTALL_DEFAULTS} >> $GITHUB_OUTPUT
145
- name: Install Cilium CLI
146
uses: cilium/cilium-cli@7306e3cdc6caee738157f08e3e1ba26179f104e5 # v0.15.23
148
repository: ${{ env.CILIUM_CLI_RELEASE_REPO }}
149
release-version: ${{ env.CILIUM_CLI_VERSION }}
150
ci-version: ${{ env.cilium_cli_ci_version }}
152
- name: Install Cilium
155
cilium install ${{ steps.vars.outputs.cilium_install_defaults }}
157
- name: Wait for Cilium status to be ready
160
kubectl -n kube-system get pods
162
- name: Port forward Relay
164
cilium hubble port-forward&
166
[[ $(pgrep -f "cilium.*hubble.*port-forward|kubectl.*port-forward.*hubble-relay" | wc -l) == 2 ]]
168
- name: Run conformance test (e.g. connectivity check)
170
kubectl apply -f ${{ env.CONFORMANCE_TEMPLATE }}
171
kubectl wait --for=condition=Available --all deployment --timeout=${{ env.TIMEOUT }}
173
- name: Check prometheus metrics
177
cilium_pod=$(kubectl -n kube-system get po -o name --field-selector=status.phase==Running -l 'k8s-app=cilium' -o jsonpath='{.items[0].metadata.name}' )
178
kubectl -n kube-system exec $cilium_pod -- sh -c "apt update && apt install curl -y"
179
kubectl -n kube-system exec $cilium_pod -- curl http://localhost:9962/metrics > metrics.prom
180
# Install promtool binary release. `go install` doesn't work due to
181
# https://github.com/prometheus/prometheus/issues/8852 and related issues.
182
curl -sSL --remote-name-all https://github.com/prometheus/prometheus/releases/download/v${PROM_VERSION}/{prometheus-${PROM_VERSION}.linux-amd64.tar.gz,sha256sums.txt}
183
sha256sum --check --ignore-missing sha256sums.txt
184
tar xzvf prometheus-${PROM_VERSION}.linux-amd64.tar.gz prometheus-${PROM_VERSION}.linux-amd64/promtool
185
rm -f prometheus-${PROM_VERSION}.linux-amd64.tar.gz
186
sudo mv prometheus-${PROM_VERSION}.linux-amd64/promtool /usr/bin
187
cat metrics.prom | promtool check metrics
189
- name: Report cluster failure status and capture cilium-sysdump
190
if: ${{ failure() && steps.install-cilium.outcome != 'skipped' }}
191
# The following is needed to prevent hubble from receiving an empty
192
# file (EOF) on stdin and displaying no flows.
193
shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"'
195
echo "=== Retrieve cluster state ==="
196
kubectl get pods --all-namespaces -o wide
198
cilium sysdump --output-filename cilium-sysdump-out
200
- name: Upload cilium-sysdump
201
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
204
name: cilium-sysdump-out.zip
205
path: cilium-sysdump-out.zip