Skip to content

Commit e66a52c

Browse files
author
Jim Ryan
committed
make changes from code review
1 parent cc4e1fb commit e66a52c

File tree

5 files changed

+14
-19
lines changed

5 files changed

+14
-19
lines changed

examples/custom-resources/transport-server-sni/README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# TransportServer SNI
22

33
In this example we create two different TransportServers that listen on the same interface, which are distinguished by their Host field.
4+
The applications (a TCP echo server, and MongoDB) will be accessed via `ncat` and `mongosh`.
5+
The `ncat` binary is available via `nmap`. On mac/linux this can be installed via homebrew/linuxbrew with `brew install nmap`
6+
`mongosh` installation instructions are [available here](https://www.mongodb.com/docs/mongodb-shell/install/).
47

58
## Create a GlobalConfiguration resource with the following listener
69

710
```yaml
8-
listeners:
9-
- name: tcp-listener
10-
port: 7000
11-
protocol: TCP
11+
listeners:
12+
- name: tcp-listener
13+
port: 7000
14+
protocol: TCP
1215
```
1316
1417
## Add a custom port to the NGINX Ingress Controller pod with the Helm chart
@@ -24,10 +27,10 @@ controller.customPorts:
2427
2528
```yaml
2629
controller.service.customPorts:
27-
- name: tcp-port
28-
port: 7000
29-
protocol: TCP
30-
targetPort: 7000
30+
- name: tcp-port
31+
port: 7000
32+
protocol: TCP
33+
targetPort: 7000
3134
```
3235
3336
## Use `kubectl` to create the cafe-secret, and mongo-secret. These secrets are used for TLS in the TransportServers

examples/custom-resources/transport-server-sni/tcp-echo-server.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818
command: ["/bin/sh"]
1919
args:
2020
- -c
21-
- |
22-
apk add --no-cache socat
23-
echo "TCP Echo Server starting..."
24-
socat -v tcp-listen:7000,fork,reuseaddr,keepalive exec:'/bin/cat'
21+
- nc -lk -p 7000 -e /bin/cat
2522
ports:
2623
- containerPort: 7000
2724
---

internal/configs/version2/__snapshots__/templates_test.snap

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ upstream cafe-upstream {
88
server {
99
listen 1234 ssl;
1010
listen [::]:1234 ssl;
11-
1211
server_name "cafe.example.com";
1312
ssl_certificate cafe-secret.pem;
1413
ssl_certificate_key cafe-secret.pem;
@@ -37,7 +36,6 @@ upstream cafe-upstream {
3736
server {
3837
listen 1234 ssl;
3938
listen [::]:1234 ssl;
40-
4139
server_name "cafe.example.com";
4240
ssl_certificate cafe-secret.pem;
4341
ssl_certificate_key cafe-secret.pem;
@@ -161,7 +159,6 @@ server {
161159
listen 127.0.0.1:1234 ssl udp;
162160
listen [::1]:1234 ssl udp;
163161

164-
165162
ssl_certificate cafe-secret.pem;
166163
ssl_certificate_key cafe-secret.pem;
167164

@@ -207,7 +204,6 @@ server {
207204
listen 127.0.0.1:1234 ssl;
208205
listen [::1]:1234 ssl;
209206

210-
211207
ssl_certificate cafe-secret.pem;
212208
ssl_certificate_key cafe-secret.pem;
213209

@@ -7973,7 +7969,6 @@ server {
79737969
listen 1234 ssl udp;
79747970
listen [::]:1234 ssl udp;
79757971

7976-
79777972
ssl_certificate cafe-secret.pem;
79787973
ssl_certificate_key cafe-secret.pem;
79797974

internal/configs/version2/nginx-plus.transportserver.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ server {
4040
set_real_ip_from unix:;
4141
{{- else }}
4242
{{ makeTransportListener $s | printf }}
43-
{{ makeServerName $s | printf }}
43+
{{- with makeServerName $s }}{{ printf "\t%s" . }}{{- end }}
4444
{{- end }}
4545

4646
{{- if $ssl.Enabled }}

internal/configs/version2/nginx.transportserver.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ server {
2424
set_real_ip_from unix:;
2525
{{- else }}
2626
{{ makeTransportListener $s | printf }}
27-
{{ makeServerName $s | printf }}
27+
{{- with makeServerName $s }}{{ printf "\t%s" . }}{{- end }}
2828
{{- end }}
2929

3030
{{- if $ssl.Enabled }}

0 commit comments

Comments
 (0)