-
Notifications
You must be signed in to change notification settings - Fork 79
173 lines (173 loc) · 6.36 KB
/
kind_e2e_tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# This workflow is for tests that require a single cluster.
name: Run e2e tests
on:
push:
branches:
- main
- 'release/**'
paths-ignore:
- 'docs/**'
- 'CHANGELOG/**'
pull_request:
branches:
- main
- 'release/**'
paths-ignore:
- 'docs/**'
- 'CHANGELOG/**'
workflow_call:
inputs:
kind_node_version:
required: true
type: string
jobs:
set_kind_node_version:
runs-on: ubuntu-latest
outputs:
kind_node_version: ${{ steps.input_or_default.outputs.kind_node_version }}
steps:
- id: input_or_default
name: Set Kind node version from workflow input or default
env:
DEFAULT_KIND_NODE_VERSION: v1.25.3
run: |
if [[ -z "${{ inputs.kind_node_version }}" ]]; then
echo "kind_node_version=${{ env.DEFAULT_KIND_NODE_VERSION }}" >> $GITHUB_OUTPUT
else
echo "kind_node_version=${{ inputs.kind_node_version }}" >> $GITHUB_OUTPUT
fi
build_image:
name: Build Image
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.parse_image_tag.outputs.image_tag }}
steps:
- uses: actions/checkout@v3
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/checkout@v3
if: github.event_name != 'pull_request'
- name: Parse image version
id: parse_image_tag
run: echo "image_tag=$(yq eval '.images[0].newTag' config/deployments/default/kustomization.yaml)" >> $GITHUB_OUTPUT
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v2
- name: Build image
id: docker_build
uses: docker/build-push-action@v2
with:
file: Dockerfile
context: .
push: false
tags: k8ssandra/k8ssandra-operator:latest,k8ssandra/k8ssandra-operator:${{ steps.parse_image_tag.outputs.image_tag }}
platforms: linux/amd64
outputs: type=docker,dest=/tmp/k8ssandra-operator.tar
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Upload k8ssandra-operator image
uses: actions/upload-artifact@v3
with:
name: k8ssandra-operator
path: /tmp/k8ssandra-operator.tar
kind_e2e_tests:
runs-on: ubuntu-latest
needs: [set_kind_node_version, build_image]
strategy:
matrix:
kind_node_version: ["${{ needs.set_kind_node_version.outputs.kind_node_version }}"]
e2e_test:
- CreateSingleDatacenterCluster
- CreateStargateAndDatacenter
- CreateSingleReaper
- CreateSingleReaperWStargateAndHTTP
- CreateReaperAndDatacenter
- CreateSingleMedusaJob
- CreateSingleDseMedusaJob
- ConfigControllerRestarts
# TODO: these e2e tests started breaking after new client certificates were added. Needs fixing.
#- SingleDcEncryptionWithStargate
- SingleDcEncryptionWithReaper
- GCTests/3.11-jdk8-G1
- GCTests/3.11-jdk8-CMS
- GCTests/4.0-jdk11-G1
- GCTests/4.0-jdk11-CMS
- GCTests/4.0-jdk11-ZGC
- UpgradeOperatorImage
- StargateJwt
- CreateSingleDseDatacenterCluster
- CreateSingleDseSearchDatacenterCluster
- CreateSingleDseGraphDatacenterCluster
- ChangeDseWorkload
- PerNodeConfig/UserDefined
- RemoveLocalDcFromCluster
- AddDcToClusterSameDataplane
fail-fast: false
name: ${{ matrix.e2e_test }}
env:
CGO_ENABLED: 0
KUBECONFIG_FILE: "./build/kind-kubeconfig"
CONTROL_PLANE: kind-k8ssandra-0
DATA_PLANES: kind-k8ssandra-0
steps:
- name: Raise open files limit
run: |
echo fs.file-max=1000000 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
echo fs.inotify.max_user_instances=1280 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
echo fs.inotify.max_user_watches=655360 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
ulimit -a
- name: Free diskspace by removing unused packages
run: |
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
- uses: actions/checkout@v3
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/checkout@v3
if: github.event_name != 'pull_request'
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
cache: true
- name: Install kustomize
uses: imranismail/setup-kustomize@v2
with:
kustomize-version: 4.x
- name: Log kustomize version
run: kustomize version
- name: Install Kind
run: go get sigs.k8s.io/kind
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download k8ssandra-operator image
uses: actions/download-artifact@v3
with:
name: k8ssandra-operator
path: /tmp
- name: Load images
run: |
docker load --input /tmp/k8ssandra-operator.tar
- name: Setup kind cluster ( ${{ matrix.kind_node_version }} )
run: make IMG="k8ssandra/k8ssandra-operator:${{ needs.build_image.outputs.image_tag }}" KIND_NODE_VERSION="${{ matrix.kind_node_version }}" create-kind-cluster kind-load-image cert-manager nginx-kind
- name: Run e2e test ( ${{ matrix.e2e_test }} )
run: |
e2e_test="TestOperator/${{ matrix.e2e_test }}"
args="-kubeconfigFile '${{ env.KUBECONFIG_FILE }}'"
args="$args -controlPlane '${{ env.CONTROL_PLANE }}'"
args="$args -dataPlanes '${{ env.DATA_PLANES }}'"
args="$args -imageTag ${{ needs.build_image.outputs.image_tag }}"
make E2E_TEST="$e2e_test" TEST_ARGS="$args" e2e-test
- name: Get artefact upload directory
if: ${{ failure() }}
run: |
uploaddir_name=$(echo ${{ matrix.e2e_test }}| sed 's/\//__/g')
echo 'setting uploaddir_name to' $uploaddir_name
echo "uploaddir_name=$uploaddir_name" >> $GITHUB_ENV
- name: Archive k8s logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: k8s-logs-${{ env.uploaddir_name }}
path: ./build/test