kubernetes / ingress-nginx

Ingress-NGINX Controller for Kubernetes
https://kubernetes.github.io/ingress-nginx/
Apache License 2.0
17.26k stars 8.2k forks source link

Unmentioned breaking change in 1.11 for GRPC #11866

Open flphvlck opened 2 weeks ago

flphvlck commented 2 weeks ago

There is unmentioned breaking change in 1.11 related to GRPC in combination with nginx.ingress.kubernetes.io/configuration-snippet annotation.

This feature came from issue #11250 and pull request #11258.

It would be nice to mention it in release notes.

What happened: Nginx exits with error:

Error: exit status 1
2024/08/19 12:10:49 [emerg] 60#60: "grpc_read_timeout" directive is duplicate in /tmp/nginx/nginx-cfg658058193:2367
nginx: [emerg] "grpc_read_timeout" directive is duplicate in /tmp/nginx/nginx-cfg658058193:2367
nginx: configuration file /tmp/nginx/nginx-cfg658058193 test failed

This happens because we are using

      nginx.ingress.kubernetes.io/configuration-snippet: |
        grpc_next_upstream_tries X;
        grpc_read_timeout Xs;
        grpc_send_timeout Xs;

In the /tmp/nginx/nginx-cfg658058193 there really are duplicated directives for grpc (default values from annotations and our custom values from configuration-snippet

            # Grpc settings
            grpc_connect_timeout                    5s;
            grpc_send_timeout                       60s;
            grpc_read_timeout                       60s;

            grpc_next_upstream error timeout http_502 http_503 http_504 non_idempotent;
            grpc_next_upstream_tries X;
            grpc_read_timeout Xs;
            grpc_send_timeout Xs;
flphvlck commented 2 weeks ago

If it's just about editing files in https://github.com/kubernetes/ingress-nginx/tree/main/changelog and the rest is magic behind, I can do it. something like:

Breaking change Stop using grpc_connect_timeout, grpc_send_timeout, grpc_read_timeout in nginx.ingress.kubernetes.io/configuration-snippet annotation (otherwise controller crash). These GRPC options (and eventually their default values) are inherited from respective proxy timeouts. Find out more in docs: https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#custom-timeouts

longwuyuan commented 2 weeks ago

/assign @Gacko /triage accepted