-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathh2spec.sh
executable file
·149 lines (147 loc) · 3.23 KB
/
h2spec.sh
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
#!/usr/bin/env bash
go_mod="$(sed -e 's/^/ /' go.mod | sed '/^[[:space:]]*$/d')"
go_sum="$(sed -e 's/^/ /' go.sum | sed '/^[[:space:]]*$/d')"
go_src="$(sed -e 's/^/ /' server.go | sed '/^[[:space:]]*$/d')"
cat <<EOF
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: Service
metadata:
name: h2spec-goserver
annotations:
service.beta.openshift.io/serving-cert-secret-name: service-certs
spec:
selector:
app: h2spec-goserver
ports:
- port: 443
name: https
targetPort: 8443
protocol: TCP
- port: 80
name: http
targetPort: 8080
protocol: TCP
- apiVersion: v1
kind: ConfigMap
metadata:
name: src-config
data:
go.mod: |
$go_mod
go.sum: |
$go_sum
server.go: |
$go_src
- apiVersion: v1
kind: Pod
metadata:
name: h2spec-goserver
labels:
app: h2spec-goserver
spec:
containers:
- image: golang:1.14
name: serve
command: ["/bin/bash"]
args: ["-c", "cd /go/src && GODEBUG=http2debug=0 go build -x -mod=readonly -o /tmp/server server.go && /tmp/server"]
env:
- name: GO111MODULE
value: "auto"
- name: GODEBUG
value: "http2debug=1"
ports:
- containerPort: 8443
protocol: TCP
- containerPort: 8080
protocol: TCP
volumeMounts:
- name: src-volume
mountPath: /go/src
- name: service-certs
mountPath: /etc/service-certs
- name: tmp
mountPath: /var/run
volumes:
- name: src-volume
configMap:
name: src-config
- name: conf
configMap:
name: h2spec-goserver
- name: service-certs
secret:
secretName: service-certs
- name: tmp
emptyDir: {}
- name: tmp2
emptyDir: {}
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
annotations:
haproxy.router.openshift.io/enable-h2c: "true"
labels:
app: h2spec-goserver
name: h2spec-goserver-edge
spec:
port:
targetPort: 8080
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect
to:
kind: Service
name: h2spec-goserver
weight: 100
wildcardPolicy: None
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
labels:
app: h2spec-goserver
name: h2spec-goserver-reencrypt
spec:
port:
targetPort: 8443
tls:
termination: reencrypt
insecureEdgeTerminationPolicy: Redirect
to:
kind: Service
name: h2spec-goserver
weight: 100
wildcardPolicy: None
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
labels:
app: h2spec-goserver
name: h2spec-goserver-passthrough
spec:
port:
targetPort: 8443
tls:
termination: passthrough
insecureEdgeTerminationPolicy: Redirect
to:
kind: Service
name: h2spec-goserver
weight: 100
wildcardPolicy: None
- apiVersion: v1
kind: Pod
metadata:
name: h2spec
labels:
app: h2spec
spec:
containers:
- name: h2spec
image: docker.io/summerwind/h2spec:2.4.0
command: ["/bin/bash"]
args: ["-c", "while true; do echo -n 'heartbeat: '; date; sleep 60; done"]
terminationGracePeriodSeconds: 1
EOF