E2E - Upgrade path tests - KinD #16294
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
# ------------------------------------------------------------ | |
# Copyright 2021 The Dapr Authors | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# ------------------------------------------------------------ | |
name: E2E - Upgrade path tests - KinD | |
on: | |
push: | |
branches: | |
- master | |
- release-* | |
paths-ignore: | |
- '**.md' | |
schedule: | |
- cron: '0 */3 * * *' | |
- cron: '0 */6 * * *' | |
pull_request: | |
branches: | |
- master | |
- 'release-*' | |
paths-ignore: | |
- '**.md' | |
defaults: | |
run: | |
shell: bash | |
working-directory: ./src/github.com/dapr/cli | |
jobs: | |
# This workflow runs our e2e tests in a local KinD cluster. Since it | |
# does not required a paid cluster and special credentials, it does | |
# not require /ok-to-test. That allows contributors to run E2E tests | |
# in their Draft PRs without explicit approval from Dapr | |
# maintainers. | |
# | |
# One other benefit of a fully-localized workflow is that tests are | |
# running on a fresh cluster everytime, thus being decoupled from | |
# shared resource issues. | |
# | |
kubernetes-e2e: | |
name: Upgrade path tests (KinD) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false # Keep running if one leg fails. | |
matrix: | |
k8s-version: | |
- v1.23.12 | |
- v1.24.6 | |
- v1.25.2 | |
mode: | |
- ha | |
- non-ha | |
# Map between K8s and KinD versions. | |
# This is attempting to make it a bit clearer what's being tested. | |
# See: https://github.com/kubernetes-sigs/kind/releases/tag/v0.16.0 | |
include: | |
- k8s-version: v1.23.12 | |
kind-version: v0.16.0 | |
kind-image-sha: sha256:9402cf1330bbd3a0d097d2033fa489b2abe40d479cc5ef47d0b6a6960613148a | |
- k8s-version: v1.24.6 | |
kind-version: v0.16.0 | |
kind-image-sha: sha256:97e8d00bc37a7598a0b32d1fabd155a96355c49fa0d4d4790aab0f161bf31be1 | |
- k8s-version: v1.25.2 | |
kind-version: v0.16.0 | |
kind-image-sha: sha256:9be91e9e9cdf116809841fc77ebdb8845443c4c72fe5218f3ae9eb57fdb4bace | |
steps: | |
- name: Check out code onto GOPATH | |
uses: actions/checkout@v3 | |
with: | |
path: ./src/github.com/dapr/cli | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
id: setup-go | |
with: | |
go-version-file: './src/github.com/dapr/cli/go.mod' | |
- name: Cache Go modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ matrix.k8s-version }}-${{ matrix.kind-version }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ matrix.k8s-version }}-${{ matrix.kind-version }}-go-${{ steps.setup-go.outputs.go-version }}- | |
- name: Configure KinD | |
# Generate a KinD configuration file that uses: | |
# (a) a couple of worker nodes: this is needed to run both | |
# ZooKeeper + Kakfa, and | |
# (b) a local registry: Due to `kind load` performance | |
# https://github.com/kubernetes-sigs/kind/issues/1165, using | |
# a local repository speeds up the image pushes into KinD | |
# significantly. | |
working-directory: ./ | |
run: | | |
cat > kind.yaml <<EOF | |
apiVersion: kind.x-k8s.io/v1alpha4 | |
kind: Cluster | |
nodes: | |
- role: control-plane | |
image: kindest/node:${{ matrix.k8s-version }}@${{ matrix.kind-image-sha }} | |
- role: worker | |
image: kindest/node:${{ matrix.k8s-version }}@${{ matrix.kind-image-sha }} | |
- role: worker | |
image: kindest/node:${{ matrix.k8s-version }}@${{ matrix.kind-image-sha }} | |
- role: worker | |
image: kindest/node:${{ matrix.k8s-version }}@${{ matrix.kind-image-sha }} | |
EOF | |
# Log the generated kind.yaml for easy reference. | |
cat kind.yaml | |
- name: Create KinD Cluster | |
uses: helm/[email protected] | |
with: | |
config: kind.yaml | |
cluster_name: kind | |
version: ${{ matrix.kind-version }} | |
- name: Get KinD info | |
run: | | |
kubectl cluster-info --context kind-kind | |
NODE_IP=$(kubectl get nodes \ | |
-lkubernetes.io/hostname!=kind-control-plane \ | |
-ojsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}') | |
echo "MINIKUBE_NODE_IP=$NODE_IP" >> $GITHUB_ENV | |
- name: Free up some diskspace | |
run: | | |
docker image prune -a -f | |
- name: Run tests with GHCR | |
# runs every 6hrs | |
if: github.event.schedule == '0 */6 * * *' | |
env: | |
DAPR_DEFAULT_IMAGE_REGISTRY: ghcr | |
run: | | |
export TEST_OUTPUT_FILE=$GITHUB_WORKSPACE/test-e2e-upgrade-kind.json | |
echo "TEST_OUTPUT_FILE=$TEST_OUTPUT_FILE" >> $GITHUB_ENV | |
make e2e-build-run-upgrade | |
- name: Run tests with Docker hub | |
if: github.event.schedule != '0 */6 * * *' | |
run: | | |
export TEST_OUTPUT_FILE=$GITHUB_WORKSPACE/test-e2e-upgrade-kind.json | |
echo "TEST_OUTPUT_FILE=$TEST_OUTPUT_FILE" >> $GITHUB_ENV | |
make e2e-build-run-upgrade | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.k8s-version }}_${{ matrix.mode }}_e2e_upgrade_k8s.json | |
path: ${{ env.TEST_OUTPUT_FILE }} |