Skip to content

Commit 313bb88

Browse files
Merge pull request #6458 from jimmycgz:upstream-pr-nginx-3tier
PiperOrigin-RevId: 904495612
2 parents ee362ba + bbf521e commit 313bb88

5 files changed

Lines changed: 441 additions & 70 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: nginx-proxy-deployment
5+
spec:
6+
replicas: {{ nginx_proxy_replicas }}
7+
selector:
8+
matchLabels:
9+
app: nginx-proxy
10+
template:
11+
metadata:
12+
labels:
13+
app: nginx-proxy
14+
spec:
15+
{% if runtime_class_name %}
16+
runtimeClassName: {{ runtime_class_name }}
17+
{% endif %}
18+
affinity:
19+
nodeAffinity:
20+
requiredDuringSchedulingIgnoredDuringExecution:
21+
nodeSelectorTerms:
22+
- matchExpressions:
23+
- key: pkb_nodepool
24+
operator: In
25+
values:
26+
- nginx
27+
initContainers:
28+
- name: setup-ssl
29+
image: {{ nginx_image }}
30+
command: ['/bin/sh', '-c']
31+
args:
32+
- |
33+
mkdir -p /etc/nginx/ssl
34+
openssl ecparam -name secp384r1 -out /tmp/ecparam.pem
35+
openssl req -x509 -nodes -newkey ec:/tmp/ecparam.pem -keyout /etc/nginx/ssl/ecdsa.key -out /etc/nginx/ssl/ecdsa.crt -days 365 -subj "/CN=$HOSTNAME"
36+
volumeMounts:
37+
- name: ssl-volume
38+
mountPath: /etc/nginx/ssl
39+
containers:
40+
- name: nginx-proxy
41+
image: {{ nginx_image }}
42+
ports:
43+
- containerPort: {{ nginx_port }}
44+
volumeMounts:
45+
- name: config-volume
46+
mountPath: /etc/nginx/nginx.conf
47+
subPath: nginx-proxy.conf
48+
- name: ssl-volume
49+
mountPath: /etc/nginx/ssl
50+
volumes:
51+
- name: ssl-volume
52+
emptyDir: {}
53+
- name: config-volume
54+
configMap:
55+
name: nginx-configs
56+
---
57+
apiVersion: v1
58+
kind: Service
59+
metadata:
60+
name: nginx-cluster
61+
spec:
62+
type: LoadBalancer
63+
ports:
64+
- port: {{ nginx_port }}
65+
targetPort: {{ nginx_port }}
66+
selector:
67+
app: nginx-proxy
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: nginx-upstream-deployment
5+
spec:
6+
replicas: {{ nginx_upstream_replicas }}
7+
selector:
8+
matchLabels:
9+
app: nginx-upstream
10+
template:
11+
metadata:
12+
labels:
13+
app: nginx-upstream
14+
spec:
15+
{% if runtime_class_name %}
16+
runtimeClassName: {{ runtime_class_name }}
17+
{% endif %}
18+
affinity:
19+
nodeAffinity:
20+
requiredDuringSchedulingIgnoredDuringExecution:
21+
nodeSelectorTerms:
22+
- matchExpressions:
23+
- key: pkb_nodepool
24+
operator: In
25+
values:
26+
- upstream
27+
initContainers:
28+
- name: setup-random-content
29+
image: busybox:1.35
30+
command: ['sh', '-c']
31+
args:
32+
- |
33+
dd bs=1 count={{ nginx_content_size }} if=/dev/urandom of=/usr/share/nginx/html/random_content
34+
volumeMounts:
35+
- name: html-volume
36+
mountPath: /usr/share/nginx/html
37+
- name: setup-ssl
38+
image: {{ nginx_image }}
39+
command: ['/bin/sh', '-c']
40+
args:
41+
- |
42+
mkdir -p /etc/nginx/ssl
43+
openssl ecparam -name secp384r1 -out /tmp/ecparam.pem
44+
openssl req -x509 -nodes -newkey ec:/tmp/ecparam.pem -keyout /etc/nginx/ssl/ecdsa.key -out /etc/nginx/ssl/ecdsa.crt -days 365 -subj "/CN=$HOSTNAME"
45+
volumeMounts:
46+
- name: ssl-volume
47+
mountPath: /etc/nginx/ssl
48+
containers:
49+
- name: nginx-upstream
50+
image: {{ nginx_image }}
51+
ports:
52+
- containerPort: {{ nginx_port }}
53+
volumeMounts:
54+
- name: config-volume
55+
mountPath: /etc/nginx/nginx.conf
56+
subPath: nginx-upstream.conf
57+
- name: html-volume
58+
mountPath: /usr/share/nginx/html
59+
- name: ssl-volume
60+
mountPath: /etc/nginx/ssl
61+
volumes:
62+
- name: ssl-volume
63+
emptyDir: {}
64+
- name: config-volume
65+
configMap:
66+
name: nginx-configs
67+
- name: html-volume
68+
emptyDir: {}
69+
---
70+
apiVersion: v1
71+
kind: Service
72+
metadata:
73+
name: nginx-upstream
74+
spec:
75+
type: ClusterIP
76+
ports:
77+
- port: {{ nginx_port }}
78+
targetPort: {{ nginx_port }}
79+
selector:
80+
app: nginx-upstream

perfkitbenchmarker/data/docker/k8s_nginx/Dockerfile

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)