Skip to content
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

Add support for IPv6 #2576

Merged
merged 2 commits into from
Apr 6, 2022
Merged

Add support for IPv6 #2576

merged 2 commits into from
Apr 6, 2022

Conversation

jjngx
Copy link
Contributor

@jjngx jjngx commented Apr 4, 2022

Proposed changes

Add support for IPv6

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

@jjngx jjngx added the enhancement Pull requests for new features/feature enhancements label Apr 4, 2022
@jjngx jjngx marked this pull request as ready for review April 4, 2022 17:30
Copy link
Contributor

@eufinco eufinco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No unit tests with IPv6 addresses?

Copy link
Contributor

@pleshakov pleshakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jjngx

Please see my comments and suggestions.

Note that the review doesn't cover the changes added to the branch and covered in this PR #2577

Could we also double check that the examples that provision NGINX backends or configure NGINX using snippets (grep -R "listen" examples) also work in IPv6 mode?

build/Dockerfile Outdated
@@ -50,7 +50,7 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
&& apt-get install -y zlib1g \
&& curl -fsSL https://cs.nginx.com/static/keys/nginx_signing.key | gpg --dearmor > /etc/apt/trusted.gpg.d/nginx_signing.gpg \
&& curl -fsSL -o /etc/apt/apt.conf.d/90pkgs-nginx https://cs.nginx.com/static/files/90pkgs-nginx \
&& DEBIAN_VERSION=$(awk -F '=' '/^VERSION_CODENAME=/ {print $2}' /etc/os-release) \
&& DEBIAN_VERSION=bullseye \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we revert this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pleshakov reverted

build/Dockerfile Outdated
@@ -59,7 +59,16 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
&& rm -rf /var/lib/apt/lists/*


############################################# Base image for Debian with NGINX Plus and App Protect WAF/DoS #############################################
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this commented out part?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pleshakov commented out code removed, Dockerfile cleaned

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's still something left in line 62

@@ -197,6 +199,7 @@ http {
# NGINX Plus APIs
server {
listen {{.NginxStatusPort}};
listen [::]:{{.NginxStatusPort}};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to change the default value of https://github.com/nginxinc/kubernetes-ingress/blob/main/cmd/nginx-ingress/main.go#L134 to include the IPV6 localhost. That value is used in this server in the allow directive:

        {{range $value := .NginxStatusAllowCIDRs}}
        allow {{$value}};{{end}}
        deny all;
        location /api {
            api write=off;
        }

currently, the default value is 127.0.0.1.

this endpoint is used to access the dashboard https://docs.nginx.com/nginx-ingress-controller/logging-and-monitoring/status-page/#accessing-live-activity-monitoring-dashboard

same for NGINX OSS.


{{if .TLSPassthrough}}
listen unix:/var/lib/nginx/passthrough-https.sock ssl default_server{{if .HTTP2}} http2{{end}} proxy_protocol;
set_real_ip_from unix:;
real_ip_header proxy_protocol;
{{else}}
listen 443 ssl default_server{{if .HTTP2}} http2{{end}}{{if .ProxyProtocol}} proxy_protocol{{end}};
listen [::]:443 ssl default_server{{if .HTTP2}} http2{{end}}{{if .ProxyProtocol}} proxy_protocol{{end}};
{{end}}

{{if .SSLRejectHandshake}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

listen directive in {{- if .NginxStatus}} needs to be updated similarly to NGINX Plus.

networking:
ipFamily: {{.IPFamily}}
apiServerAddress: {{.APIServerAddress}}
#apiServerPort: 6443
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this parameter commented out? perhaps better to remove all together?

@github-actions github-actions bot added the documentation Pull requests/issues for documentation label Apr 5, 2022
@codecov-commenter
Copy link

codecov-commenter commented Apr 5, 2022

Codecov Report

Merging #2576 (672afc5) into main (143b9b2) will decrease coverage by 0.01%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##             main    #2576      +/-   ##
==========================================
- Coverage   53.50%   53.49%   -0.02%     
==========================================
  Files          49       49              
  Lines       14314    14299      -15     
==========================================
- Hits         7659     7649      -10     
+ Misses       6412     6407       -5     
  Partials      243      243              
Impacted Files Coverage Δ
cmd/nginx-ingress/main.go 6.98% <ø> (ø)
internal/configs/version1/config.go 0.00% <0.00%> (ø)
internal/k8s/controller.go 10.90% <60.00%> (+0.07%) ⬆️
internal/configs/configurator.go 37.45% <100.00%> (-0.07%) ⬇️
internal/configs/ingress.go 76.54% <100.00%> (-0.10%) ⬇️
pkg/apis/configuration/validation/policy.go 96.55% <0.00%> (+0.91%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Copy link
Member

@lucacome lucacome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can revert build/Dockerfile

Copy link
Contributor

@pleshakov pleshakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Pull requests/issues for documentation enhancement Pull requests for new features/feature enhancements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants