forked from newrelic/nri-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (113 loc) · 4.96 KB
/
e2e.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
name: E2E over minikube
on:
pull_request:
branches-ignore:
- v2
push:
branches:
- main
jobs:
e2eTests:
# Do not run e2e tests if commit message or PR has skip-e2e.
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'ci/skip-e2e') }}
runs-on: ubuntu-20.04
strategy:
max-parallel: 3 # len(k8sVersion)/2 is a good number to have here
matrix:
# Latest patch version can be found in https://github.com/kubernetes/website/blob/main/content/en/releases/patch-releases.md
# Some versions might not be available yet in https://storage.googleapis.com/kubernetes-release/release/v1.X.Y/bin/linux/amd64/kubelet
k8sVersion: [ "v1.26.0","v1.25.3", "v1.24.1", "v1.23.8", "v1.22.11", "v1.21.14", "v1.16.15" ]
cri: [ docker ]
exclude:
- k8sVersion: v1.24.1
cri: docker
- k8sVersion: v1.25.3
cri: docker
- k8sVersion: v1.26.0
cri: docker
include:
- k8sVersion: v1.24.1
cri: containerd
- k8sVersion: v1.23.8
cri: containerd
- k8sVersion: v1.25.3
cri: containerd
- k8sVersion: v1.26.0
cri: containerd
env:
DOCKER_BUILDKIT: '1' # Setting DOCKER_BUILDKIT=1 ensures TARGETOS and TARGETARCH are populated
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Setup Minikube
uses: manusa/[email protected]
with:
minikube version: v1.28.0
kubernetes version: ${{ matrix.k8sVersion }}
driver: docker
start args: "--nodes=2 --container-runtime=${{ matrix.cri }}"
- name: Enable addons minikube needed for HPA
run: |
minikube addons enable metrics-server
- name: Compile, Build and load Images
run: |
GOOS=linux GOARCH=amd64 make compile # Set GOOS and GOARCH explicitly since Dockerfile expects them in the binary name
docker build -t e2e/nri-kubernetes:e2e .
minikube image load e2e/nri-kubernetes:e2e
- name: Setup Helm
run: |
chmod go-r /home/runner/.kube/config
helm repo add newrelic https://helm-charts.newrelic.com
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
- name: Install kube-state-metrics service onto test the Minikube cluster
# Starting from k8s v1.26, @autoscaling/v2beta2 API is no longer available as @autoscaling/v2 replaced it. It is important that
# kube-state-metrics v2.7.0 is installed on the k8s v1.26.0+ test cluster because only kube-state-metrics v2.7.0 or higher can
# supports the @autoscaling/v2 API. The following scripts make sure the correct version of kube-state-metrics is installed in respect
# to the k8s version. Incorrect setup will result in missing metrics, for examples: HorizontalPodAutoscaler related metrics .etc .
# Notes:
# - The kube-state-metrics chart v4.25.0 directly maps to kube-state-metrics application v2.7.0.
# - The kube-state-metrics chart v4.23.0 directly maps to kube-state-metrics application v2.6.0.
run: |
MINOR=$(echo "${{ matrix.k8sVersion }}"|sed -e 's_v\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)_\2_')
if [ "$MINOR" -le 25 ]; then
KSM_CHART_VERSION="--version v4.23.0"
fi
helm install prometheus-community/kube-state-metrics $KSM_CHART_VERSION --generate-name
- name: Select metrics exception file
id: exceptions-version
run: |
MINOR=$(echo "${{ matrix.k8sVersion }}"|sed -e 's_v\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)_\2_')
if [ "$MINOR" -le 22 ]; then
echo "::set-output name=exceptions::1_22"
elif [ "$MINOR" -eq 23 ]; then
echo "::set-output name=exceptions::1_23"
elif [ "$MINOR" -eq 24 ]; then
echo "::set-output name=exceptions::1_24"
elif [ "$MINOR" -eq 25 ]; then
echo "::set-output name=exceptions::1_25"
elif [ "$MINOR" -ge 26 ]; then
echo "::set-output name=exceptions::1_26"
fi
- name: Run e2e-test
uses: newrelic/newrelic-integration-e2e-action@v1
env:
EXCEPTIONS_SOURCE_FILE: ${{ steps.exceptions-version.outputs.exceptions }}-exceptions.yml
with:
retry_seconds: 60
retry_attempts: 5
agent_enabled: false
spec_path: e2e/test-specs.yml
account_id: ${{ secrets.COREINT_E2E_ACCOUNT_ID }}
api_key: ${{ secrets.COREINT_E2E_API_KEY }}
license_key: ${{ secrets.COREINT_E2E_LICENSE_KEY }}