forked from Azure/osm-azure
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-distro.yml
More file actions
62 lines (62 loc) · 2 KB
/
check-distro.yml
File metadata and controls
62 lines (62 loc) · 2 KB
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
#
# The job in this YAML file verifies if the current k8s distribution has been tested for osm-arc.
# The job is executed in helm pre-install phase of OSM release lifecycle.
#
apiVersion: v1
kind: ServiceAccount
metadata:
name: check-distro-account
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook-weight": "10"
"helm.sh/hook": pre-install
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
---
apiVersion: batch/v1
kind: Job
metadata:
name: check-distro
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook-weight": "15"
"helm.sh/hook": pre-install
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeededd
spec:
template:
metadata:
labels:
app: check-distro
spec:
serviceAccountName: check-distro-account
automountServiceAccountToken: true
restartPolicy: Never
terminationGracePeriodSeconds: 0
containers:
- name: check-distro
image: {{ .Values.alpine.image.name }}:{{ .Values.alpine.image.tag }}
imagePullPolicy: IfNotPresent
env:
- name: testedDistros
value: {{ .Values.OpenServiceMesh.testedDistros }}
- name: currentDistro
value: {{ .Values.Azure.Cluster.Distribution }}
command:
- "/bin/sh"
- "-ec"
- |
set -o pipefail
token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
testedDistrosList=${testedDistros}
current=${currentDistro}
tested=false
for distro in ${testedDistrosList}
do
if [[ "${distro}" == "${current}" ]]; then
echo "${current} is a tested distribution for osm-arc"
tested=true
fi
done
if [[ "$tested" = "false" ]]; then
echo "Warning: ${current} is not a tested distribution for osm-arc"
exit 0
fi