Skip to content

Commit

Permalink
gha: migrate workflows to use the global kind-related variables
Browse files Browse the repository at this point in the history
Let's switch all the workflows over to using the globally defined
kind-related variables, and remove the workflow specific definitions.
This also addresses a few cases which didn't specify any version.

Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
  • Loading branch information
giorio94 authored and michi-covalent committed Feb 28, 2024
1 parent 394b3de commit aabdfa7
Show file tree
Hide file tree
Showing 19 changed files with 50 additions and 73 deletions.
8 changes: 4 additions & 4 deletions .github/actions/lvh-kind/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ inputs:
kind-params:
required: true
type: string
kind-image-vsn:
kind-image:
required: true
type: string
test-name:
required: true
Expand Down Expand Up @@ -36,9 +37,8 @@ runs:
provision: 'false'
cmd: |
cd /host
if [ "${{ inputs.kind-image-vsn }}" != "" ]; then
export IMAGE=kindest/node:${{ inputs.kind-image-vsn }}
fi
export IMAGE=${{ inputs.kind-image }}
./contrib/scripts/kind.sh ${{ inputs.kind-params }} 0.0.0.0 6443
- name: Copy kubeconfig
Expand Down
2 changes: 0 additions & 2 deletions .github/kind-config-ipv6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.29.1@sha256:a0cc28af37cf39b019e2b448c54d1a3f789de32536cb5a5db61a49623e527144
kubeadmConfigPatches:
# To make sure that there is no taint for master node.
# Otherwise additional worker node might be required for conformance testing.
Expand All @@ -12,7 +11,6 @@ nodes:
nodeRegistration:
taints: []
- role: worker
image: kindest/node:v1.29.1@sha256:a0cc28af37cf39b019e2b448c54d1a3f789de32536cb5a5db61a49623e527144
networking:
ipFamily: ipv6
disableDefaultCNI: true
Expand Down
2 changes: 0 additions & 2 deletions .github/kind-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.29.1@sha256:a0cc28af37cf39b019e2b448c54d1a3f789de32536cb5a5db61a49623e527144
kubeadmConfigPatches:
# To make sure that there is no taint for master node.
# Otherwise additional worker node might be required for conformance testing.
Expand All @@ -12,7 +11,6 @@ nodes:
nodeRegistration:
taints: []
- role: worker
image: kindest/node:v1.29.1@sha256:a0cc28af37cf39b019e2b448c54d1a3f789de32536cb5a5db61a49623e527144
networking:
disableDefaultCNI: true
podSubnet: "10.244.0.0/16"
Expand Down
3 changes: 0 additions & 3 deletions .github/kind-config.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:${K8S_VERSION}
kubeadmConfigPatches:
# To make sure that there is no taint for master node.
# Otherwise additional worker node might be required for conformance testing.
Expand All @@ -12,9 +11,7 @@ nodes:
nodeRegistration:
taints: []
- role: worker
image: kindest/node:${K8S_VERSION}
- role: worker
image: kindest/node:${K8S_VERSION}
networking:
disableDefaultCNI: true
ipFamily: ${IPFAMILY}
Expand Down
20 changes: 8 additions & 12 deletions .github/workflows/conformance-clustermesh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ concurrency:
cancel-in-progress: true

env:
# renovate: datasource=github-releases depName=kubernetes-sigs/kind
kind_version: v0.22.0
# renovate: datasource=docker depName=kindest/node
k8s_version: v1.29.2
cilium_cli_ci_version:
CILIUM_CLI_MODE: helm
clusterName1: cluster1-${{ github.run_id }}
Expand Down Expand Up @@ -302,15 +298,13 @@ jobs:

- name: Generate Kind configuration files
run: |
K8S_VERSION=${{ env.k8s_version }} \
PODCIDR=${{ steps.vars.outputs.kind_pod_cidr_1 }} \
PODCIDR=${{ steps.vars.outputs.kind_pod_cidr_1 }} \
SVCCIDR=${{ steps.vars.outputs.kind_svc_cidr_1 }} \
IPFAMILY=${{ matrix.ipFamily }} \
KUBEPROXYMODE=${{ matrix.kube-proxy }} \
envsubst < ./.github/kind-config.yaml.tmpl > ./.github/kind-config-cluster1.yaml
K8S_VERSION=${{ env.k8s_version }} \
PODCIDR=${{ steps.vars.outputs.kind_pod_cidr_2 }} \
PODCIDR=${{ steps.vars.outputs.kind_pod_cidr_2 }} \
SVCCIDR=${{ steps.vars.outputs.kind_svc_cidr_2 }} \
IPFAMILY=${{ matrix.ipFamily }} \
KUBEPROXYMODE=${{ matrix.kube-proxy }} \
Expand All @@ -320,17 +314,19 @@ jobs:
uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0
with:
cluster_name: ${{ env.clusterName1 }}
version: ${{ env.kind_version }}
kubectl_version: ${{ env.k8s_version }}
version: ${{ env.KIND_VERSION }}
node_image: ${{ env.KIND_K8S_IMAGE }}
kubectl_version: ${{ env.KIND_K8S_VERSION }}
config: ./.github/kind-config-cluster1.yaml
wait: 0 # The control-plane never becomes ready, since no CNI is present

- name: Create Kind cluster 2
uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0
with:
cluster_name: ${{ env.clusterName2 }}
version: ${{ env.kind_version }}
kubectl_version: ${{ env.k8s_version }}
version: ${{ env.KIND_VERSION }}
node_image: ${{ env.KIND_K8S_IMAGE }}
kubectl_version: ${{ env.KIND_K8S_VERSION }}
config: ./.github/kind-config-cluster2.yaml
wait: 0 # The control-plane never becomes ready, since no CNI is present

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/conformance-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ jobs:
test-name: e2e-conformance
kernel: ${{ matrix.kernel }}
kind-params: "${{ steps.kind-params.outputs.params }}"
kind-image: ${{ env.KIND_K8S_IMAGE }}

# Warning: since this is a privileged workflow, subsequent workflow job
# steps must take care not to execute untrusted code.
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/conformance-gateway-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ concurrency:
env:
cilium_cli_ci_version:
CILIUM_CLI_MODE: helm
# renovate: datasource=github-releases depName=kubernetes-sigs/kind
kind_version: v0.22.0
kind_config: .github/kind-config.yaml
gateway_api_version: v1.0.0
timeout: 5m
Expand Down Expand Up @@ -149,7 +147,9 @@ jobs:
- name: Create kind cluster
uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0
with:
version: ${{ env.kind_version }}
version: ${{ env.KIND_VERSION }}
node_image: ${{ env.KIND_K8S_IMAGE }}
kubectl_version: ${{ env.KIND_K8S_VERSION }}
config: ${{ env.kind_config }}

- name: Install Go
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/conformance-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ concurrency:
env:
cilium_cli_ci_version:
CILIUM_CLI_MODE: helm
# renovate: datasource=github-releases depName=kubernetes-sigs/kind
kind_version: v0.22.0
kind_config: .github/kind-config.yaml
timeout: 5m

Expand Down Expand Up @@ -169,7 +167,9 @@ jobs:
- name: Create kind cluster
uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0
with:
version: ${{ env.kind_version }}
version: ${{ env.KIND_VERSION }}
node_image: ${{ env.KIND_K8S_IMAGE }}
kubectl_version: ${{ env.KIND_K8S_VERSION }}
config: ${{ env.kind_config }}

- name: Checkout ingress-controller-conformance
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/conformance-ipsec-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ jobs:
test-name: e2e-conformance
kernel: ${{ matrix.kernel }}
kind-params: "${{ steps.kind-params.outputs.params }}"
kind-image: ${{ env.KIND_K8S_IMAGE }}

# Warning: since this is a privileged workflow, subsequent workflow job
# steps must take care not to execute untrusted code.
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/conformance-k8s-kind-network-policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,9 @@ concurrency:
cancel-in-progress: true

env:
# renovate: datasource=github-releases depName=kubernetes-sigs/kind
kind_version: v0.22.0
cluster_name: cilium-testing
cilium_cli_ci_version:
CILIUM_CLI_MODE: helm
# renovate: datasource=docker depName=kindest/node
k8s_version: v1.29.2

jobs:
kubernetes-e2e-net-conformance:
Expand Down Expand Up @@ -60,14 +56,14 @@ jobs:
run: |
TMP_DIR=$(mktemp -d)
# Test binaries
curl -L https://dl.k8s.io/${{ env.k8s_version }}/kubernetes-test-linux-amd64.tar.gz -o ${TMP_DIR}/kubernetes-test-linux-amd64.tar.gz
curl -L https://dl.k8s.io/${{ env.KIND_K8S_VERSION }}/kubernetes-test-linux-amd64.tar.gz -o ${TMP_DIR}/kubernetes-test-linux-amd64.tar.gz
tar xvzf ${TMP_DIR}/kubernetes-test-linux-amd64.tar.gz \
--directory ${TMP_DIR} \
--strip-components=3 kubernetes/test/bin/ginkgo kubernetes/test/bin/e2e.test
# kubectl
curl -L https://dl.k8s.io/${{ env.k8s_version }}/bin/linux/amd64/kubectl -o ${TMP_DIR}/kubectl
curl -L https://dl.k8s.io/${{ env.KIND_K8S_VERSION }}/bin/linux/amd64/kubectl -o ${TMP_DIR}/kubectl
# kind
curl -Lo ${TMP_DIR}/kind https://kind.sigs.k8s.io/dl/${{ env.kind_version }}/kind-linux-amd64
curl -Lo ${TMP_DIR}/kind https://kind.sigs.k8s.io/dl/${{ env.KIND_VERSION }}/kind-linux-amd64
# Install
sudo cp ${TMP_DIR}/ginkgo /usr/local/bin/ginkgo
sudo cp ${TMP_DIR}/e2e.test /usr/local/bin/e2e.test
Expand All @@ -80,7 +76,7 @@ jobs:
run: |
cat <<EOF | /usr/local/bin/kind create cluster \
--name ${{ env.cluster_name}} \
--image kindest/node:${{ env.k8s_version }} \
--image ${{ env.KIND_K8S_IMAGE }} \
-v7 --wait 1m --retain --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/conformance-k8s-kind.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,9 @@ concurrency:
cancel-in-progress: true

env:
# renovate: datasource=github-releases depName=kubernetes-sigs/kind
kind_version: v0.22.0
cluster_name: cilium-testing
cilium_cli_ci_version:
CILIUM_CLI_MODE: helm
# renovate: datasource=docker depName=kindest/node
k8s_version: v1.29.2

jobs:
kubernetes-e2e:
Expand Down Expand Up @@ -60,14 +56,14 @@ jobs:
run: |
TMP_DIR=$(mktemp -d)
# Test binaries
curl -L https://dl.k8s.io/${{ env.k8s_version }}/kubernetes-test-linux-amd64.tar.gz -o ${TMP_DIR}/kubernetes-test-linux-amd64.tar.gz
curl -L https://dl.k8s.io/${{ env.KIND_K8S_VERSION }}/kubernetes-test-linux-amd64.tar.gz -o ${TMP_DIR}/kubernetes-test-linux-amd64.tar.gz
tar xvzf ${TMP_DIR}/kubernetes-test-linux-amd64.tar.gz \
--directory ${TMP_DIR} \
--strip-components=3 kubernetes/test/bin/ginkgo kubernetes/test/bin/e2e.test
# kubectl
curl -L https://dl.k8s.io/${{ env.k8s_version }}/bin/linux/amd64/kubectl -o ${TMP_DIR}/kubectl
curl -L https://dl.k8s.io/${{ env.KIND_K8S_VERSION }}/bin/linux/amd64/kubectl -o ${TMP_DIR}/kubectl
# kind
curl -Lo ${TMP_DIR}/kind https://kind.sigs.k8s.io/dl/${{ env.kind_version }}/kind-linux-amd64
curl -Lo ${TMP_DIR}/kind https://kind.sigs.k8s.io/dl/${{ env.KIND_VERSION }}/kind-linux-amd64
# Install
sudo cp ${TMP_DIR}/ginkgo /usr/local/bin/ginkgo
sudo cp ${TMP_DIR}/e2e.test /usr/local/bin/e2e.test
Expand All @@ -80,7 +76,7 @@ jobs:
run: |
cat <<EOF | /usr/local/bin/kind create cluster \
--name ${{ env.cluster_name}} \
--image kindest/node:${{ env.k8s_version }} \
--image ${{ env.KIND_K8S_IMAGE }} \
-v7 --wait 1m --retain --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
Expand Down Expand Up @@ -242,4 +238,3 @@ jobs:
uses: aanm/junit2md@332ebf0fddd34e91b03a832cfafaa826306558f9 # v0.0.3
with:
junit-directory: "_artifacts"

4 changes: 2 additions & 2 deletions .github/workflows/conformance-k8s-network-policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ permissions: read-all

env:
cilium_cli_ci_version:
# renovate: datasource=github-releases depName=kubernetes-sigs/kind
KIND_VERSION: v0.22.0
KIND_CONFIG: .github/kind-config.yaml
CONFORMANCE_TEMPLATE: examples/kubernetes/connectivity-check/connectivity-check.yaml
TIMEOUT: 2m
Expand Down Expand Up @@ -84,6 +82,8 @@ jobs:
uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0
with:
version: ${{ env.KIND_VERSION }}
node_image: ${{ env.KIND_K8S_IMAGE }}
kubectl_version: ${{ env.KIND_K8S_VERSION }}
config: ${{ env.KIND_CONFIG }}

- name: Install cilium chart
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/conformance-kind-proxy-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ concurrency:
cancel-in-progress: true

env:
# renovate: datasource=github-releases depName=kubernetes-sigs/kind
kind_version: v0.22.0
kind_config: .github/kind-config.yaml
cilium_cli_ci_version:
CILIUM_CLI_MODE: helm
Expand Down Expand Up @@ -83,7 +81,9 @@ jobs:
- name: Create kind cluster
uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0
with:
version: ${{ env.kind_version }}
version: ${{ env.KIND_VERSION }}
node_image: ${{ env.KIND_K8S_IMAGE }}
kubectl_version: ${{ env.KIND_K8S_VERSION }}
config: ${{ env.kind_config }}

- name: Wait for images to be available
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/conformance-multi-pool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ concurrency:

env:
cilium_cli_ci_version:
# renovate: datasource=github-releases depName=kubernetes-sigs/kind
kind_version: v0.22.0
kind_config: .github/kind-config.yaml
timeout: 5m

Expand Down Expand Up @@ -171,7 +169,9 @@ jobs:
- name: Create kind cluster
uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0
with:
version: ${{ env.kind_version }}
version: ${{ env.KIND_VERSION }}
node_image: ${{ env.KIND_K8S_IMAGE }}
kubectl_version: ${{ env.KIND_K8S_VERSION }}
config: ${{ env.kind_config }}

- name: Wait for images to be available
Expand Down
20 changes: 8 additions & 12 deletions .github/workflows/tests-clustermesh-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ concurrency:
cancel-in-progress: true

env:
# renovate: datasource=github-releases depName=kubernetes-sigs/kind
kind_version: v0.22.0
# renovate: datasource=docker depName=kindest/node
k8s_version: v1.29.2
cilium_cli_ci_version:

clusterName1: cluster1
Expand Down Expand Up @@ -201,15 +197,13 @@ jobs:

- name: Generate Kind configuration files
run: |
K8S_VERSION=${{ env.k8s_version }} \
PODCIDR=10.242.0.0/16,fd00:10:242::/48 \
PODCIDR=10.242.0.0/16,fd00:10:242::/48 \
SVCCIDR=10.243.0.0/16,fd00:10:243::/112 \
IPFAMILY=dual \
KUBEPROXYMODE=${{ matrix.kube-proxy }} \
envsubst < ./.github/kind-config.yaml.tmpl > ./.github/kind-config-cluster1.yaml
K8S_VERSION=${{ env.k8s_version }} \
PODCIDR=10.244.0.0/16,fd00:10:244::/48 \
PODCIDR=10.244.0.0/16,fd00:10:244::/48 \
SVCCIDR=10.245.0.0/16,fd00:10:245::/112 \
IPFAMILY=dual \
KUBEPROXYMODE=${{ matrix.kube-proxy }} \
Expand All @@ -219,17 +213,19 @@ jobs:
uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0
with:
cluster_name: ${{ env.clusterName1 }}
version: ${{ env.kind_version }}
kubectl_version: ${{ env.k8s_version }}
version: ${{ env.KIND_VERSION }}
node_image: ${{ env.KIND_K8S_IMAGE }}
kubectl_version: ${{ env.KIND_K8S_VERSION }}
config: ./.github/kind-config-cluster1.yaml
wait: 0 # The control-plane never becomes ready, since no CNI is present

- name: Create Kind cluster 2
uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0
with:
cluster_name: ${{ env.clusterName2 }}
version: ${{ env.kind_version }}
kubectl_version: ${{ env.k8s_version }}
version: ${{ env.KIND_VERSION }}
node_image: ${{ env.KIND_K8S_IMAGE }}
kubectl_version: ${{ env.KIND_K8S_VERSION }}
config: ./.github/kind-config-cluster2.yaml
wait: 0 # The control-plane never becomes ready, since no CNI is present

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/tests-e2e-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ jobs:
cmd: |
cd /host/
export IMAGE=${{ env.KIND_K8S_IMAGE }}
IP_FAM="dual"
if [ "${{ matrix.ipv6 }}" == "false" ]; then
IP_FAM="ipv4"
Expand Down
Loading

0 comments on commit aabdfa7

Please sign in to comment.