-
Notifications
You must be signed in to change notification settings - Fork 12
/
test_pods.yml.j2
160 lines (160 loc) · 4.75 KB
/
test_pods.yml.j2
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
apiVersion: apps/v1
{% if app_ns == 'test-cnf' %}
kind: Deployment
{% elif app_ns == 'production-cnf' %}
kind: StatefulSet
{% endif %}
metadata:
name: test
namespace: {{ app_ns }}
{% if app_ns == 'production-cnf' %}
labels:
AffinityRequired: "true"
{% endif %}
spec:
replicas: 2
selector:
matchLabels:
app: test
template:
metadata:
labels:
app: test
{% if app_ns == 'production-cnf' %}
AffinityRequired: "true"
{% endif %}
{% if targetpodlabels|length %}
{% for label in targetpodlabels %}
{{ label|regex_replace('=', ': ') }}
{% endfor %}
{% if exclude_connectivity_regexp|length and ( "test" | regex_search(exclude_connectivity_regexp) ) %}
redhat-best-practices-for-k8s.com/skip_connectivity_tests: 'true'
redhat-best-practices-for-k8s.com/skip_multus_connectivity_tests: 'true'
{% endif %}
{% endif %}
annotations:
redhat-best-practices-for-k8s.com/container_tests: '["PRIVILEGED_POD","PRIVILEGED_ROLE"]' # optional
redhat-best-practices-for-k8s.com/defaultnetworkinterface: '"eth0"' # optional
{% if app_ns == 'production-cnf' %}
cpu-load-balancing.crio.io: disable
irq-load-balancing.crio.io: disable
{% endif %}
name: test
spec:
serviceAccountName: test
terminationGracePeriodSeconds: 30
automountServiceAccountToken: false
{% if app_ns == 'production-cnf' %}
runtimeClassName: production-runtime-class
{% endif %}
{% if tnf_enable_service_mesh|default(false)|bool and am_installed|default(false)| bool %}
imagePullSecrets:
- name: aspen-mesh-pull-secret
{% endif %}
containers:
- image: {{ tnf_app_image | default('quay.io/redhat-best-practices-for-k8s/certsuite-sample-workload:latest') }}
imagePullPolicy: IfNotPresent
name: test
ports:
- name: "http-probe"
containerPort: 8080
resources:
{% if app_ns == 'production-cnf' %}
requests:
memory: 512Mi
cpu: 2000m
limits:
{% if tnf_enable_hugepages | default(false) | bool %}
hugepages-2Mi: 100Mi
{% endif %}
memory: 512Mi
cpu: 2000m
{% else %}
requests:
memory: 256Mi
cpu: 0.10
limits:
{% if tnf_enable_hugepages | default(false) | bool %}
hugepages-2Mi: 100Mi
{% endif %}
memory: 512Mi
cpu: 0.25
{% endif %}
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "echo Hello from the postStart handler"]
preStop:
exec:
command: ["/bin/sh", "-c", "killall -0 tail"]
livenessProbe:
httpGet:
path: /health
port: 8080
httpHeaders:
- name: health-check
value: liveness
initialDelaySeconds: 10
periodSeconds: 5
readinessProbe:
httpGet:
path: /ready
port: 8080
httpHeaders:
- name: health-check
value: readiness
initialDelaySeconds: 10
periodSeconds: 5
startupProbe:
httpGet:
path: /health
port: 8080
httpHeaders:
- name: health-check
value: startup
failureThreshold: 10
periodSeconds: 5
command: ["./bin/app"]
terminationMessagePolicy: FallbackToLogsOnError
{% if app_ns == 'production-cnf' or tnf_enable_hugepages | default(false) | bool %}
volumeMounts:
{% endif %}
{% if app_ns == 'production-cnf' %}
- mountPath: /data
name: volume-claim-{{ app_ns }}
{% endif %}
{% if tnf_enable_hugepages | default(false) | bool %}
- mountPath: /hugepages-2Mi
name: hugepage-2mi
volumes:
- name: hugepage-2mi
emptyDir:
medium: HugePages-2Mi
{% endif %}
affinity:
{% if app_ns == 'production-cnf' %}
podAffinity:
{% else %}
podAntiAffinity:
{% endif %}
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- test
topologyKey: "kubernetes.io/hostname"
{% if app_ns == 'production-cnf' %}
volumeClaimTemplates:
- metadata:
name: volume-claim-{{ app_ns }}
namespace: {{ app_ns }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
storageClassName: {{ storage_class is defined | ternary(storage_class, 'local-storage') }}
{% endif %}