Skip to content

Commit f0d4e6c

Browse files
authored
Merge branch 'main' into deps/use-nginx-ubi
2 parents 3094d5d + 30df2ca commit f0d4e6c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1240
-269
lines changed

deployments/helm-chart/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ Parameter | Description | Default
165165
`controller.config.annotations` | The annotations of the Ingress Controller configmap. | {}
166166
`controller.config.entries` | The entries of the ConfigMap for customizing NGINX configuration. See [ConfigMap resource docs](https://docs.nginx.com/nginx-ingress-controller/configuration/global-configuration/configmap-resource/) for the list of supported ConfigMap keys. | {}
167167
`controller.customPorts` | A list of custom ports to expose on the NGINX ingress controller pod. Follows the conventional Kubernetes yaml syntax for container ports. | []
168-
`controller.defaultTLS.cert` | The base64-encoded TLS certificate for the default HTTPS server. If not specified, a pre-generated self-signed certificate is used. **Note:** It is recommended that you specify your own certificate. | A pre-generated self-signed certificate.
169-
`controller.defaultTLS.key` | The base64-encoded TLS key for the default HTTPS server. **Note:** If not specified, a pre-generated key is used. It is recommended that you specify your own key. | A pre-generated key.
170-
`controller.defaultTLS.secret` | The secret with a TLS certificate and key for the default HTTPS server. The value must follow the following format: `<namespace>/<name>`. Used as an alternative to specifying a certificate and key using `controller.defaultTLS.cert` and `controller.defaultTLS.key` parameters. | None
168+
`controller.defaultTLS.cert` | The base64-encoded TLS certificate for the default HTTPS server. **Note:** By default, a pre-generated self-signed certificate is used. It is recommended that you specify your own certificate. Alternatively, omitting the default server secret completely will configure NGINX to reject TLS connections to the default server. | A pre-generated self-signed certificate.
169+
`controller.defaultTLS.key` | The base64-encoded TLS key for the default HTTPS server. **Note:** By default, a pre-generated key is used. It is recommended that you specify your own key. Alternatively, omitting the default server secret completely will configure NGINX to reject TLS connections to the default server. | A pre-generated key.
170+
`controller.defaultTLS.secret` | The secret with a TLS certificate and key for the default HTTPS server. The value must follow the following format: `<namespace>/<name>`. Used as an alternative to specifying a certificate and key using `controller.defaultTLS.cert` and `controller.defaultTLS.key` parameters. **Note:** Alternatively, omitting the default server secret completely will configure NGINX to reject TLS connections to the default server. | None
171171
`controller.wildcardTLS.cert` | The base64-encoded TLS certificate for every Ingress/VirtualServer host that has TLS enabled but no secret specified. If the parameter is not set, for such Ingress/VirtualServer hosts NGINX will break any attempt to establish a TLS connection. | None
172172
`controller.wildcardTLS.key` | The base64-encoded TLS key for every Ingress/VirtualServer host that has TLS enabled but no secret specified. If the parameter is not set, for such Ingress/VirtualServer hosts NGINX will break any attempt to establish a TLS connection. | None
173173
`controller.wildcardTLS.secret` | The secret with a TLS certificate and key for every Ingress/VirtualServer host that has TLS enabled but no secret specified. The value must follow the following format: `<namespace>/<name>`. Used as an alternative to specifying a certificate and key using `controller.wildcardTLS.cert` and `controller.wildcardTLS.key` parameters. | None

deployments/helm-chart/templates/controller-configmap.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if not .Values.controller.customConfigMap -}}
12
apiVersion: v1
23
kind: ConfigMap
34
metadata:
@@ -13,3 +14,4 @@ data:
1314
{{- if .Values.controller.config.entries }}
1415
{{ toYaml .Values.controller.config.entries | indent 2 }}
1516
{{- end }}
17+
{{- end }}

deployments/helm-chart/templates/controller-daemonset.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ spec:
153153
- -nginx-configmaps=$(POD_NAMESPACE)/{{ include "nginx-ingress.configName" . }}
154154
{{- if .Values.controller.defaultTLS.secret }}
155155
- -default-server-tls-secret={{ .Values.controller.defaultTLS.secret }}
156-
{{ else }}
156+
{{ else if and (.Values.controller.defaultTLS.cert) (.Values.controller.defaultTLS.key) }}
157157
- -default-server-tls-secret=$(POD_NAMESPACE)/{{ include "nginx-ingress.defaultTLSName" . }}
158158
{{- end }}
159159
- -ingress-class={{ .Values.controller.ingressClass }}

deployments/helm-chart/templates/controller-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ spec:
156156
- -nginx-configmaps=$(POD_NAMESPACE)/{{ include "nginx-ingress.configName" . }}
157157
{{- if .Values.controller.defaultTLS.secret }}
158158
- -default-server-tls-secret={{ .Values.controller.defaultTLS.secret }}
159-
{{ else }}
159+
{{ else if and (.Values.controller.defaultTLS.cert) (.Values.controller.defaultTLS.key) }}
160160
- -default-server-tls-secret=$(POD_NAMESPACE)/{{ include "nginx-ingress.defaultTLSName" . }}
161161
{{- end }}
162162
- -ingress-class={{ .Values.controller.ingressClass }}

deployments/helm-chart/templates/controller-secret.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{ if not .Values.controller.defaultTLS.secret }}
1+
{{ if and (not .Values.controller.defaultTLS.secret) (.Values.controller.defaultTLS.cert) (.Values.controller.defaultTLS.key) }}
22
apiVersion: v1
33
kind: Secret
44
metadata:

deployments/helm-chart/templates/rbac.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ rules:
7474
- create
7575
- patch
7676
- list
77+
- apiGroups:
78+
- coordination.k8s.io
79+
resources:
80+
- leases
81+
verbs:
82+
- get
83+
- list
84+
- watch
85+
- update
86+
- create
7787
- apiGroups:
7888
- networking.k8s.io
7989
resources:

deployments/helm-chart/values.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,18 @@ controller:
7777

7878
## It is recommended to use your own TLS certificates and keys
7979
defaultTLS:
80-
## The base64-encoded TLS certificate for the default HTTPS server. If not specified, a pre-generated self-signed certificate is used.
81-
## Note: It is recommended that you specify your own certificate.
80+
## The base64-encoded TLS certificate for the default HTTPS server. By default, a pre-generated self-signed certificate is used.
81+
## Note: It is recommended that you specify your own certificate. Alternatively, omitting the default server secret completely will configure NGINX to reject TLS connections to the default server.
8282
cert: LS0tLS1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0ZYQU80YTY3Cklnc1hzYktNbTQwV1U3cG9mcGltU1ZmaXFSdkV5YmN3N0NYODF6cFErUyt1eHRYK2VBZ3V0NHh3VlI5d2IyVXYKelhuZk9HbWhWNThDd1dIQnNKa0kxNXhaa2VUWXdSN0diaEFMSkZUUkk3dkhvQXprTWIzbjAxQjQyWjNrN3RXNQpJUDFmTlpIOFUvOWxiUHNoT21FRFZkdjF5ZytVRVJxbStGSis2R0oxeFJGcGZnPT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
8383

84-
## The base64-encoded TLS key for the default HTTPS server. Note: If not specified, a pre-generated key is used.
85-
## Note: It is recommended that you specify your own key.
84+
## The base64-encoded TLS key for the default HTTPS server. By default, a pre-generated key is used.
85+
## Note: It is recommended that you specify your own key. Alternatively, omitting the default server secret completely will configure NGINX to reject TLS connections to the default server.
8686
key: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBdi91RWM4b1JkMHUvZXVJTHNFK1RYZUprckxMMnNJNGFWaEMvYjVyYy9XMlRiNHEvClJOcktGMEdYaVN1eE9ycXgrajlnamx4NXFjdnhkenRKbXNFUkJ1Z1B0ME9hVGtIekhvb3FVWmcwZGxmZ1dkT0EKUTZMNTdlT1l0Q29VOUZ4amRXdzZUVVRJVUQ4R0JsRlNjSVo0b1hFTkhzbysyR3VTTWk2Zk1wTVM3YUhudzFtMApxWkdvRWEzWFNyZEJ6eGc2clhkcUNlUDlCMXl3VmRyYURiUzc1aGQzdUdETDU4cGszOVFqVUFQaHpxdmRoK1JWClZGNGJCaW9CbTVpeTlZTW1hWVhsMm0wTGZzeTZuUTRRdFFzdEdNVWozcGJtdlFmazJBNnljeGRFeFpkZFZsdmwKMm82MjBsMllxcHFDZEtCRThCay90elFIVTlKcU56cHpoOUJUTXdJREFRQUJBb0lCQVFDZklHbXowOHhRVmorNwpLZnZJUXQwQ0YzR2MxNld6eDhVNml4MHg4Mm15d1kx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sU3FkbXgySkJhZUFVWUNXCndNdlQ4NmNLclNyNkQrZG8wS05FZzFsL0FvR0FlMkFVdHVFbFNqLzBmRzgrV3hHc1RFV1JqclRNUzRSUjhRWXQKeXdjdFA4aDZxTGxKUTRCWGxQU05rMXZLTmtOUkxIb2pZT2pCQTViYjhibXNVU1BlV09NNENoaFJ4QnlHbmR2eAphYkJDRkFwY0IvbEg4d1R0alVZYlN5T294ZGt5OEp0ek90ajJhS0FiZHd6NlArWDZDODhjZmxYVFo5MWpYL3RMCjF3TmRKS2tDZ1lCbyt0UzB5TzJ2SWFmK2UwSkN5TGhzVDQ5cTN3Zis2QWVqWGx2WDJ1VnRYejN5QTZnbXo5aCsKcDNlK2JMRUxwb3B0WFhNdUFRR0xhUkcrYlNNcjR5dERYbE5ZSndUeThXczNKY3dlSTdqZVp2b0ZpbmNvVlVIMwphdmxoTUVCRGYxSjltSDB5cDBwWUNaS2ROdHNvZEZtQktzVEtQMjJhTmtsVVhCS3gyZzR6cFE9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=
8787

8888
## The secret with a TLS certificate and key for the default HTTPS server.
8989
## The value must follow the following format: `<namespace>/<name>`.
9090
## Used as an alternative to specifying a certificate and key using `controller.defaultTLS.cert` and `controller.defaultTLS.key` parameters.
91+
## Note: Alternatively, omitting the default server secret completely will configure NGINX to reject TLS connections to the default server.
9192
## Format: <namespace>/<secret_name>
9293
secret:
9394

docs/content/configuration/transportserver-resource.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,4 +372,4 @@ Note how the events section includes a Warning event with the Rejected reason.
372372
373373
## Customization via ConfigMap
374374
375-
The [ConfigMap](/nginx-ingress-controller/configuration/global-configuration/configmap-resource) keys (except for `stream-snippets` and `stream-log-format`) do not affect TransportServer resources.
375+
The [ConfigMap](/nginx-ingress-controller/configuration/global-configuration/configmap-resource) keys (except for `stream-snippets`, `stream-log-format`, `resolver-addresses`, `resolver-ipv6`, `resolver-valid` and `resolver-timeout`) do not affect TransportServer resources.

docs/content/installation/installation-with-helm.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ The following tables lists the configurable parameters of the NGINX Ingress Cont
168168
|``controller.config.name`` | The name of the ConfigMap used by the Ingress Controller. | Autogenerated |
169169
|``controller.config.entries`` | The entries of the ConfigMap for customizing NGINX configuration. See [ConfigMap resource docs](/nginx-ingress-controller/configuration/global-configuration/configmap-resource/) for the list of supported ConfigMap keys. | {} |
170170
|``controller.customPorts`` | A list of custom ports to expose on the NGINX ingress controller pod. Follows the conventional Kubernetes yaml syntax for container ports. | [] |
171-
|``controller.defaultTLS.cert`` | The base64-encoded TLS certificate for the default HTTPS server. If not specified, a pre-generated self-signed certificate is used. **Note:** It is recommended that you specify your own certificate. | A pre-generated self-signed certificate. |
172-
|``controller.defaultTLS.key`` | The base64-encoded TLS key for the default HTTPS server. **Note:** If not specified, a pre-generated key is used. It is recommended that you specify your own key. | A pre-generated key. |
173-
|``controller.defaultTLS.secret`` | The secret with a TLS certificate and key for the default HTTPS server. The value must follow the following format: ``<namespace>/<name>``. Used as an alternative to specifying a certificate and key using ``controller.defaultTLS.cert`` and ``controller.defaultTLS.key`` parameters. | None |
171+
|``controller.defaultTLS.cert`` | The base64-encoded TLS certificate for the default HTTPS server. **Note:** By default, a pre-generated self-signed certificate is used. It is recommended that you specify your own certificate. Alternatively, omitting the default server secret completely will configure NGINX to reject TLS connections to the default server. See the [default-server-tls-secret command-line argument](/nginx-ingress-controller/configuration/global-configuration/command-line-#cmdoption-default-server-tls-secret) for more details. | A pre-generated self-signed certificate. |
172+
|``controller.defaultTLS.key`` | The base64-encoded TLS key for the default HTTPS server. **Note:** By default, a pre-generated key is used. It is recommended that you specify your own key. Alternatively, omitting the default server secret completely will configure NGINX to reject TLS connections to the default server. See the [default-server-tls-secret command-line argument](/nginx-ingress-controller/configuration/global-configuration/command-line-#cmdoption-default-server-tls-secret) for more details. | A pre-generated key. |
173+
|``controller.defaultTLS.secret`` | The secret with a TLS certificate and key for the default HTTPS server. The value must follow the following format: ``<namespace>/<name>``. Used as an alternative to specifying a certificate and key using ``controller.defaultTLS.cert`` and ``controller.defaultTLS.key`` parameters. **Note:** Alternatively, omitting the default server secret completely will configure NGINX to reject TLS connections to the default server. See the [default-server-tls-secret command-line argument](/nginx-ingress-controller/configuration/global-configuration/command-line-#cmdoption-default-server-tls-secret) for more details. | None |
174174
|``controller.wildcardTLS.cert`` | The base64-encoded TLS certificate for every Ingress/VirtualServer host that has TLS enabled but no secret specified. If the parameter is not set, for such Ingress/VirtualServer hosts NGINX will break any attempt to establish a TLS connection. | None |
175175
|``controller.wildcardTLS.key`` | The base64-encoded TLS key for every Ingress/VirtualServer host that has TLS enabled but no secret specified. If the parameter is not set, for such Ingress/VirtualServer hosts NGINX will break any attempt to establish a TLS connection. | None |
176176
|``controller.wildcardTLS.secret`` | The secret with a TLS certificate and key for every Ingress/VirtualServer host that has TLS enabled but no secret specified. The value must follow the following format: ``<namespace>/<name>``. Used as an alternative to specifying a certificate and key using ``controller.wildcardTLS.cert`` and ``controller.wildcardTLS.key`` parameters. | None |
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Support for Type ExternalName Services in Transport Server
2+
3+
The Ingress Controller supports routing requests to services of the type [ExternalName](https://kubernetes.io/docs/concepts/services-networking/service/#externalname).
4+
5+
An ExternalName service is defined by an external DNS name that is resolved into the IP addresses, typically external to the cluster. This enables to use the Ingress Controller to route requests to the destinations outside of the cluster.
6+
7+
**Note:** This feature is only available in NGINX Plus.
8+
9+
# Prerequisites
10+
11+
For the illustration purpose we will run NGINX Ingress Controller (refered as NIC in the examples) with the ```-watch-namespace=nginx-ingress,default``` option. The option enables NIC to watch selected namespaces.
12+
13+
Any application deployed in other namespaces will be treated as an external service.
14+
15+
We will use the ```examples/custom-resources/tls-passthrough``` application example as our backend app that will be responding to requests.
16+
17+
# Example
18+
19+
## 1. Deploy the tls-passthrough application
20+
21+
1. Deploy the backend application as described in the ```examples/custom-resources/tls-passthrough``` example, and make sure it is working as described.
22+
23+
## 2. Deploy external service to external namespace
24+
25+
1. Deploy backend application to external namespace (```external-ns```). Note that the namespace is not being watched by ```NIC```.
26+
```bash
27+
$ kubectl apply -f secure-app-external.yaml
28+
```
29+
30+
## 3. Setup ExternalName service
31+
32+
1. Create the service of type ```ExternalName```
33+
```
34+
$ kubectl apply -f externalname-svc.yaml
35+
```
36+
37+
2. Apply the config map
38+
```bash
39+
$ kubectl apply -f nginx-config.yaml
40+
```
41+
42+
## 4. Change the Transport Server to point to the ExternalName and verify if it is working correctly
43+
44+
1. Navigate to the tls-passthrough example ```examples/custom-resources/tls-passthrough``` and open the ```transport-server-passthrough.yaml``` file.
45+
46+
2. Replace the service name ```secure-app``` with ```externalname-service``` and apply the change.
47+
```yaml
48+
apiVersion: k8s.nginx.org/v1alpha1
49+
kind: TransportServer
50+
metadata:
51+
name: secure-app
52+
spec:
53+
listener:
54+
name: tls-passthrough
55+
protocol: TLS_PASSTHROUGH
56+
host: app.example.com
57+
upstreams:
58+
- name: secure-app
59+
service: externalname-service
60+
port: 8443
61+
action:
62+
pass: secure-app
63+
```
64+
65+
```
66+
$ kubectl apply -f transport-server-passthrough.yaml
67+
```
68+
69+
3. Verify if the application is working by sending a request and check if the response is coming from the "external backend pod" (refer to to the tls-passthrough example)
70+
```bash
71+
$ curl --resolve app.example.com:$IC_HTTPS_PORT:$IC_IP https://app.example.com:$IC_HTTPS_PORT --insecure
72+
```
73+
Response
74+
```
75+
hello from pod secure-app-external-backend-5fbf4fb494-x7bkl
76+
```

0 commit comments

Comments
 (0)