-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdc.yaml.j2
123 lines (123 loc) · 4.1 KB
/
dc.yaml.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
apiVersion: v1
kind: List
items:
{% for index in range(1, (num_dc | int) + 1) %}
{% if index % 5 == 1 %}
{% set app_variant = "canary" %}
{% else %}
{% set app_variant = "stable" %}
{% endif %}
- apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
labels:
app: scale-test
version: "1.0"
name: app-{{ index }}
namespace: {{ namespace }}
spec:
replicas: {{ pods_per_dc }}
strategy:
type: Recreate
template:
metadata:
# Automatic injection will be disabled by default, we selectively enable that for app pods.
# Otherwise, in Openshift even the builder and deployer pods would get the sidecar injected.
# Alternative solution: https://bani.com.br/2018/09/istio-sidecar-injection-enabling-automatic-injection-adding-exceptions-and-debugging/
annotations:
sidecar.istio.io/inject: "true"
sidecar.istio.io/statsInclusionPrefixes: listener,cluster.outbound
sidecar.istio.io/proxyCPU: {{ proxy_cpu | default("100m",true) }}
sidecar.istio.io/proxyCPULimit: "1000m"
sidecar.istio.io/concurrency: "1"
labels:
app: scale-test
deploymentconfig: app-{{ index }}
app.index: application-{{ (index + 4) // 5 }}
app.variant: {{ app_variant }}
# Kiali would complain if there were no version label
version: "1.0"
spec:
nodeSelector:
{% if backend_node is defined %}
kubernetes.io/hostname: {{ backend_node }}
{% elif single_node is not defined %}
test.role: workload
{% endif %}
{% if single_node is not defined %}
topologySpreadConstraints:
- maxSkew: 1
topologyKey: workload
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: scale-test
{% endif %}
tolerations:
- key: workload
operator: Exists
effect: NoExecute
containers:
- imagePullPolicy: Always
name: mannequin
{% if backend_type is not defined or backend_type == "java" %}
image: quay.io/rvansa/mannequin:jvm-latest
command:
- java
- -Dquarkus.vertx.event-loops-pool-size=1
- -Dquarkus.vertx.internal-blocking-pool-size=1
- -Dquarkus.vertx.worker-pool-size=1
- -Dquarkus.http.io-threads=1
- -Dquarkus.thread-pool.core-threads=1
- -Dquarkus.http.ssl.certificate.file=/var/certs/tls.crt
- -Dquarkus.http.ssl.certificate.key-file=/var/certs/tls.key
- -jar
- /deployments/app.jar
{% elif backend_type == "native" %}
image: quay.io/rvansa/mannequin:native
args:
- -Dquarkus.vertx.event-loops-pool-size=1
- -Dquarkus.vertx.internal-blocking-pool-size=1
- -Dquarkus.vertx.worker-pool-size=1
- -Dquarkus.http.io-threads=1
- -Dquarkus.thread-pool.core-threads=1
- -Dquarkus.http.ssl.certificate.file=/var/certs/tls.crt
- -Dquarkus.http.ssl.certificate.key-file=/var/certs/tls.key
{% endif %}
env:
- name: NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: VARIANT
value: {{ app_variant }}
- name: JAVA_OPTIONS
value: >
-Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.Log4j2LogDelegateFactory
ports:
- containerPort: 8080
protocol: TCP
readinessProbe:
exec:
command:
- curl
- localhost:8080/
initialDelaySeconds: 5
resources:
{% if backend_cpu is defined %}
requests:
cpu: "{{ backend_cpu }}"
{% endif %}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- name: certs
mountPath: /var/certs
volumes:
- name: certs
secret:
secretName: app-{{ (index + 4) // 5 }}
triggers:
- type: ConfigChange
{% endfor %}