-
Notifications
You must be signed in to change notification settings - Fork 2k
Add ip
as an option to listeners for VirtualServer
#6180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 43 commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
18a87fb
add ip listener input to virtual server (not working)
AlexFenlon acb8a3b
Initial tests for validating IP field in listeners
jjngx 386600a
Refactor listener validator for IP
AlexFenlon c20235c
Remove accidental code and update CRDs
AlexFenlon 181f676
Merge remote-tracking branch 'refs/remotes/origin/main' into poc/ip-l…
AlexFenlon d53fdfd
Add tests and fix port conflict
AlexFenlon 9187223
Merge remote-tracking branch 'refs/remotes/origin/main' into poc/ip-l…
AlexFenlon d044ea4
Add back vs support (not passing into template helper)
AlexFenlon 3f458c7
Fix vs implementation - fully working
AlexFenlon 54988c8
Merge remote-tracking branch 'refs/remotes/origin/main' into poc/ip-l…
AlexFenlon e08d957
Fix ipv6 nginx break
AlexFenlon 92c5444
Remove debug and fix crd
AlexFenlon 1bfe8cb
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/ip-…
AlexFenlon 7d2f46c
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/ip-…
AlexFenlon d03fd3e
Update warning message and tests
AlexFenlon a96025b
Change ip to ipv4 and ipv6 -- fully working
AlexFenlon b6098e2
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/ip-…
AlexFenlon 369ad28
Refactor
AlexFenlon 159612b
Update and Add new go and snap tests
AlexFenlon e362c5f
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/ip-…
AlexFenlon 41bc404
Update examples - incomplete
AlexFenlon f0b1b9f
Update examples - incomplete
AlexFenlon e175a6a
Update examples readme
AlexFenlon b0e6c80
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/ip-…
AlexFenlon 1a50ba6
Fix values.yaml globalconfig ipv4ip ipv6ip
AlexFenlon afebad6
pytests - unfinished
AlexFenlon c7e5a4d
Merge branch 'main' into feat/ip-listeners
AlexFenlon 4c2abdc
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/ip-…
AlexFenlon 3edd97d
Merge remote-tracking branch 'origin/feat/ip-listeners' into feat/ip-…
AlexFenlon 429cd0b
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/ip-…
AlexFenlon 7628851
fix crds
AlexFenlon 180a7d6
update pytests - 1 working
AlexFenlon 9d5b8b0
update pytests
AlexFenlon 07735b2
fix crds
AlexFenlon 60ed214
fix crds - last
AlexFenlon ab420ee
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/ip-…
AlexFenlon c8eabfd
update pytests, comment out and remove unused test cases yamls
AlexFenlon 7c8262e
update pytests
AlexFenlon 244ba3b
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/ip-…
AlexFenlon 0b63dce
fix example
AlexFenlon 5b200ab
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/ip-…
AlexFenlon b359f0d
fix example
AlexFenlon d7f03ec
restore old custom listener pytest
AlexFenlon fc5c956
add new ip listener pytest
AlexFenlon 56cc854
Merge branch 'main' into feat/ip-listeners
AlexFenlon 063335d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 037a7e6
remove transportserver and fix merge mistakes
AlexFenlon fc91b51
Update example and add doc
AlexFenlon 7f7416e
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/ip-…
AlexFenlon 4e81c84
Update crds and user facing listener names
AlexFenlon 28e5f89
Update example
AlexFenlon 5b514b6
Merge branch 'main' into feat/ip-listeners
AlexFenlon f7a6372
address comments
AlexFenlon cc471bc
remove unused file
AlexFenlon 49d4dfc
Update pyproject.toml
AlexFenlon c04d236
rerun pipeline
AlexFenlon 3ed7211
Merge remote-tracking branch 'origin/feat/ip-listeners' into feat/ip-…
AlexFenlon b3fec89
rerun pipeline
AlexFenlon a41b39e
rerun pipeline - fix
AlexFenlon d87db54
rerun pipeline
AlexFenlon 9c3c571
rerun pipeline - fix
AlexFenlon ef79024
rerun pipeline
AlexFenlon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
charts/nginx-ingress/templates/controller-globalconfiguration.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
examples/custom-resources/custom-ip-listeners/transportserver/global-configuration.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: k8s.nginx.org/v1 | ||
kind: GlobalConfiguration | ||
metadata: | ||
name: nginx-configuration | ||
namespace: nginx-ingress | ||
spec: | ||
listeners: | ||
- name: dns-udp | ||
port: 5353 | ||
protocol: UDP | ||
- name: dns-tcp | ||
port: 5353 | ||
protocol: TCP | ||
232 changes: 232 additions & 0 deletions
232
examples/custom-resources/custom-ip-listeners/virtualserver/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,232 @@ | ||
# Custom IPv4 and IPv6 IP Listeners | ||
j1m-ryan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
In this example, we will configure a VirtualServer resource with a custom IPv4 or IPv6 IP using HTTP/HTTPS listeners. | ||
This will allow IPv4 and/or IPv6 IPs using HTTP and/or HTTPS based requests to be made on non-default ports using separate IPs. | ||
|
||
## Prerequisites | ||
|
||
1. Follow the [installation](https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-manifests/) | ||
instructions to deploy the Ingress Controller with custom resources enabled. | ||
2. Ensure the Ingress Controller is configured with the `-global-configuration` argument: | ||
|
||
```console | ||
args: | ||
- -global-configuration=$(POD_NAMESPACE)/nginx-configuration | ||
``` | ||
|
||
3. If you have a NodePort or Loadbalancer service deployed, ensure they are updated to include the custom listener ports. | ||
Example YAML for a LoadBalancer: | ||
|
||
```yaml | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: nginx-ingress | ||
namespace: nginx-ingress | ||
spec: | ||
type: LoadBalancer | ||
ports: | ||
- port: 8083 | ||
targetPort: 8083 | ||
protocol: TCP | ||
name: ip-listener-1-http | ||
- port: 8443 | ||
targetPort: 8443 | ||
protocol: TCP | ||
name: ip-listener-2-https | ||
selector: | ||
app: nginx-ingress | ||
``` | ||
|
||
## Step 1 - Deploy the GlobalConfiguration resource | ||
|
||
Similar to how listeners are configured in our [custom-listeners](../../custom-listeners) examples, | ||
here we deploy a GlobalConfiguration resource with the listeners we want to use in our VirtualServer. | ||
|
||
```yaml | ||
apiVersion: k8s.nginx.org/v1 | ||
kind: GlobalConfiguration | ||
metadata: | ||
name: nginx-configuration | ||
namespace: nginx-ingress | ||
spec: | ||
listeners: | ||
- name: ip-listener-1-http | ||
port: 8083 | ||
protocol: HTTP | ||
ipv4ip: 127.0.0.1 | ||
j1m-ryan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
- name: ip-listener-2-https | ||
port: 8443 | ||
protocol: HTTP | ||
ipv4ip: 127.0.0.2 | ||
ipv6ip: ::1 | ||
ssl: true | ||
``` | ||
|
||
```console | ||
kubectl create -f global-configuration.yaml | ||
``` | ||
|
||
## Step 2 - Deploy the Cafe Application | ||
|
||
Create the coffee and the tea deployments and services: | ||
|
||
```console | ||
kubectl create -f cafe.yaml | ||
``` | ||
|
||
## Step 3 - Deploy the VirtualServer with custom listeners | ||
|
||
The VirtualServer in this example is set to use the listeners defined in the GlobalConfiguration resource | ||
that was deployed in Step 1. Below is the yaml of this example VirtualServer: | ||
|
||
```yaml | ||
apiVersion: k8s.nginx.org/v1 | ||
kind: VirtualServer | ||
metadata: | ||
name: cafe | ||
spec: | ||
listener: | ||
http: ip-listener-1-http | ||
https: ip-listener-2-https | ||
host: cafe.example.com | ||
tls: | ||
secret: cafe-secret | ||
upstreams: | ||
- name: tea | ||
service: tea-svc | ||
port: 80 | ||
- name: coffee | ||
service: coffee-svc | ||
port: 80 | ||
routes: | ||
- path: /tea | ||
action: | ||
pass: tea | ||
- path: /coffee | ||
action: | ||
pass: coffee | ||
``` | ||
|
||
1. Create the secret with the TLS certificate and key: | ||
|
||
```console | ||
kubectl create -f cafe-secret.yaml | ||
``` | ||
|
||
2. Create the VirtualServer resource: | ||
|
||
```console | ||
kubectl create -f cafe-virtual-server.yaml | ||
``` | ||
|
||
## Step 4 - Test the Configuration | ||
|
||
1. Check that the configuration has been successfully applied by inspecting the events of the VirtualServer and the GlobalConfiguration: | ||
|
||
```console | ||
kubectl describe virtualserver cafe | ||
``` | ||
|
||
Below you will see the events as well as the new `Listeners` field | ||
|
||
```console | ||
. . . | ||
Spec: | ||
Host: cafe.example.com | ||
Listener: | ||
Http: ip-listener-1-http | ||
Https: ip-listener-2-https | ||
. . . | ||
Routes: | ||
. . . | ||
Events: | ||
Type Reason Age From Message | ||
---- ------ ---- ---- ------- | ||
Normal AddedOrUpdated 2s nginx-ingress-controller Configuration for default/cafe was added or updated | ||
``` | ||
|
||
```console | ||
kubectl describe globalconfiguration nginx-configuration -n nginx-ingress | ||
``` | ||
|
||
```console | ||
. . . | ||
Spec: | ||
Listeners: | ||
ipv4ip: 127.0.0.1 | ||
Name: ip-listener-1-http | ||
Port: 8083 | ||
Protocol: HTTP | ||
ipv4ip: 127.0.0.2 | ||
ipv6ip: ::1 | ||
Name: ip-listener-2-https | ||
Port: 8443 | ||
Protocol: HTTP | ||
Ssl: true | ||
Events: | ||
Type Reason Age From Message | ||
---- ------ ---- ---- ------- | ||
Normal Updated 14s nginx-ingress-controller GlobalConfiguration nginx-ingress/nginx-configuration was added or updated | ||
``` | ||
|
||
2. Since the deployed VirtualServer is using ports `8083` and `8443` in this example. you can see that the specific ips and ports | ||
are set and listening by using the below commands: | ||
|
||
Access the NGINX Pod: | ||
|
||
```console | ||
kubectl get pods -n nginx-ingress | ||
``` | ||
|
||
```text | ||
NAME READY STATUS RESTARTS AGE | ||
nginx-ingress-65cd79bb8f-crst4 1/1 Running 0 97s | ||
``` | ||
|
||
```console | ||
kubectl debug -it nginx-ingress-65cd79bb8f-crst4 --image=busybox:1.28 --target=nginx-ingress | ||
``` | ||
|
||
```console | ||
/ # netstat -tulpn | ||
Active Internet connections (only servers) | ||
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name | ||
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN - | ||
tcp 0 0 127.0.0.1:8083 0.0.0.0:* LISTEN - | ||
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN - | ||
tcp 0 0 127.0.0.2:8443 0.0.0.0:* LISTEN - | ||
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN - | ||
tcp 0 0 :::8081 :::* LISTEN - | ||
tcp 0 0 :::8080 :::* LISTEN - | ||
tcp 0 0 :::8083 :::* LISTEN - | ||
tcp 0 0 ::1:8443 :::* LISTEN - | ||
tcp 0 0 :::443 :::* LISTEN - | ||
tcp 0 0 :::80 :::* LISTEN - | ||
tcp 0 0 :::9113 :::* LISTEN - | ||
``` | ||
|
||
We can see here that the two IPv4s (`127.0.0.1:8083` and `127.0.0.2:8443`) and the one IPv6 (`::1:8443`) that are set and listening. | ||
|
||
3. Examine the NGINX config using the following command: | ||
|
||
```console | ||
kubectl exec -it nginx-ingress-65cd79bb8f-crst4 -n nginx-ingress -- cat /etc/nginx/conf.d/vs_default_cafe.conf | ||
``` | ||
|
||
```console | ||
... | ||
server { | ||
listen 127.0.0.1:8083; | ||
listen [::]:8083; | ||
|
||
|
||
server_name cafe.example.com; | ||
|
||
set $resource_type "virtualserver"; | ||
set $resource_name "cafe"; | ||
set $resource_namespace "default"; | ||
listen 127.0.0.2:8443 ssl; | ||
listen [::1]:8443 ssl; | ||
... | ||
``` |
8 changes: 8 additions & 0 deletions
8
examples/custom-resources/custom-ip-listeners/virtualserver/cafe-secret.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: cafe-secret | ||
type: kubernetes.io/tls | ||
data: | ||
tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURMakNDQWhZQ0NRREFPRjl0THNhWFdqQU5CZ2txaGtpRzl3MEJBUXNGQURCYU1Rc3dDUVlEVlFRR0V3SlYKVXpFTE1Ba0dBMVVFQ0F3Q1EwRXhJVEFmQmdOVkJBb01HRWx1ZEdWeWJtVjBJRmRwWkdkcGRITWdVSFI1SUV4MApaREViTUJrR0ExVUVBd3dTWTJGbVpTNWxlR0Z0Y0d4bExtTnZiU0FnTUI0WERURTRNRGt4TWpFMk1UVXpOVm9YCkRUSXpNRGt4TVRFMk1UVXpOVm93V0RFTE1Ba0dBMVVFQmhNQ1ZWTXhDekFKQmdOVkJBZ01Ba05CTVNFd0h3WUQKVlFRS0RCaEpiblJsY201bGRDQlhhV1JuYVhSeklGQjBlU0JNZEdReEdUQVhCZ05WQkFNTUVHTmhab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Tl6WkxPN2x0QjBLSWtPOVpSY21Vam84UQpjcExsSE1BcWJMSjhXWUdKQ2toaVd4eWFsNmhZVHlXWTRjVmtDMHh0VGwvaFVFOUllTktvCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg== |
25 changes: 25 additions & 0 deletions
25
examples/custom-resources/custom-ip-listeners/virtualserver/cafe-virtual-server.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: k8s.nginx.org/v1 | ||
kind: VirtualServer | ||
metadata: | ||
name: cafe | ||
spec: | ||
listener: | ||
http: ip-listener-1-http | ||
https: ip-listener-2-https | ||
host: cafe.example.com | ||
tls: | ||
secret: cafe-secret | ||
upstreams: | ||
- name: tea | ||
service: tea-svc | ||
port: 80 | ||
- name: coffee | ||
service: coffee-svc | ||
port: 80 | ||
routes: | ||
- path: /tea | ||
action: | ||
pass: tea | ||
- path: /coffee | ||
action: | ||
pass: coffee |
65 changes: 65 additions & 0 deletions
65
examples/custom-resources/custom-ip-listeners/virtualserver/cafe.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: coffee | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: coffee | ||
template: | ||
metadata: | ||
labels: | ||
app: coffee | ||
spec: | ||
containers: | ||
- name: coffee | ||
image: nginxdemos/nginx-hello:plain-text | ||
ports: | ||
- containerPort: 8080 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: coffee-svc | ||
spec: | ||
ports: | ||
- port: 80 | ||
targetPort: 8080 | ||
protocol: TCP | ||
name: ip | ||
selector: | ||
app: coffee | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: tea | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: tea | ||
template: | ||
metadata: | ||
labels: | ||
app: tea | ||
spec: | ||
containers: | ||
- name: tea | ||
image: nginxdemos/nginx-hello:plain-text | ||
ports: | ||
- containerPort: 8080 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: tea-svc | ||
spec: | ||
ports: | ||
- port: 80 | ||
targetPort: 8080 | ||
protocol: TCP | ||
name: http | ||
selector: | ||
app: tea |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.