-
Notifications
You must be signed in to change notification settings - Fork 569
/
Copy pathdeployment.yaml
114 lines (111 loc) · 3.83 KB
/
deployment.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
{{$HostNetworkMode := DefaultParam .CL2_USE_HOST_NETWORK_PODS false}}
# Keep the CpuRequest/MemoryRequest request equal percentage of 1-core, 4GB node.
# For now we're setting it to 0.5%.
{{$CpuRequest := DefaultParam .CpuRequest "5m"}}
{{$MemoryRequest := DefaultParam .MemoryRequest "20M"}}
{{$dnsQPSPerClient := DefaultParam .CL2_DNS_QPS_PER_CLIENT 1}}
# Guard the new DNS tests. Remove it once it's confirmed that it works on a subset of tests.
{{$USE_ADVANCED_DNSTEST := DefaultParam .CL2_USE_ADVANCED_DNSTEST false}}
{{$RUN_ON_ARM_NODES := DefaultParam .CL2_RUN_ON_ARM_NODES false}}
{{$EnableNetworkPolicyEnforcementLatencyTest := DefaultParam .EnableNetworkPolicyEnforcementLatencyTest false}}
{{$TargetLabelValue := DefaultParam .TargetLabelValue "enforcement-latency"}}
# Run a server pod for network policy enforcement latency test only on every Nth pod.
# Default every third pod.
{{$NetPolServerOnEveryNthPod := DefaultParam .NetPolServerOnEveryNthPod 3}}
{{$RunNetPolicyTest := and $EnableNetworkPolicyEnforcementLatencyTest (eq (Mod .Index $NetPolServerOnEveryNthPod) 0)}}
{{$Image := DefaultParam .Image "registry.k8s.io/pause:3.9"}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{.Name}}
labels:
group: load
svc: {{.SvcName}}-{{.Index}}
spec:
replicas: {{RandIntRange .ReplicasMin .ReplicasMax}}
selector:
matchLabels:
name: {{.Name}}
template:
metadata:
labels:
group: load
name: {{.Name}}
svc: {{.SvcName}}-{{.Index}}
{{if and .EnableDNSTests $USE_ADVANCED_DNSTEST}}
dns-test: dnsperfgo
{{else}}
{{if $RunNetPolicyTest}}
net-pol-test: {{$TargetLabelValue}}
{{end}}
{{end}}
spec:
hostNetwork: {{$HostNetworkMode}}
containers:
{{if .EnableDNSTests}}
{{if $USE_ADVANCED_DNSTEST}}
- image: gcr.io/k8s-staging-perf-tests/dnsperfgo:v1.4.0
ports:
- containerPort: 9153
name: dnsperfmetrics
protocol: TCP
{{else}}
- image: gcr.io/k8s-staging-perf-tests/dnsperfgo:v1.2.0
{{end}}
# Fetches the dns server from /etc/resolv.conf and
# sends 1 query per second.
# With searchpath expansion, this is upto 12 queries per second.
# dnsperfgo has a default client timeout of 5s. It sends queries for 60s,
# then sleeps for 10s, to mimic bursts of DNS queries.
command:
- sh
- -c
- server=$(cat /etc/resolv.conf | grep nameserver | cut -d ' ' -f 2); echo
"Using nameserver ${server}";
./dnsperfgo -duration 60s -idle-duration 10s -inputfile /var/configmap/all-queries -qps {{$dnsQPSPerClient}};
name: {{.Name}}-dnsperf
{{else}}
{{if $RunNetPolicyTest}}
- image: nginx
name: nginx-server
ports:
- containerPort: 80
{{else}}
- image: {{$Image}}
name: {{.Name}}
{{end}}
{{end}}
resources:
requests:
cpu: {{$CpuRequest}}
memory: {{$MemoryRequest}}
volumeMounts:
- name: configmap
mountPath: /var/configmap
- name: secret
mountPath: /var/secret
terminationGracePeriodSeconds: 1
# Add not-ready/unreachable tolerations for 15 minutes so that node
# failure doesn't trigger pod deletion.
tolerations:
- key: "node.kubernetes.io/not-ready"
operator: "Exists"
effect: "NoExecute"
tolerationSeconds: 900
- key: "node.kubernetes.io/unreachable"
operator: "Exists"
effect: "NoExecute"
tolerationSeconds: 900
{{if $RUN_ON_ARM_NODES}}
- key: "kubernetes.io/arch"
operator: Equal
value: arm64
effect: NoSchedule
{{end}}
volumes:
- name: configmap
configMap:
name: {{.BaseName}}-{{.Index}}
- name: secret
secret:
secretName: {{.BaseName}}-{{.Index}}