From ed34f6c93d27fa69253822cf0d66f542d369a1c8 Mon Sep 17 00:00:00 2001 From: counter2015 Date: Tue, 2 Nov 2021 08:12:58 +0800 Subject: [PATCH] fix ingress syntax. (#7867) --- .github/ISSUE_TEMPLATE/bug_report.md | 13 +++--- .../affinity/cookie/ingress-samesite.yaml | 22 ++++++---- docs/examples/affinity/cookie/ingress.yaml | 11 +++-- docs/examples/auth/basic/README.md | 7 +++- docs/examples/auth/client-certs/ingress.yaml | 11 +++-- docs/examples/auth/external-auth/README.md | 11 +++-- docs/examples/auth/external-auth/ingress.yaml | 11 +++-- .../dashboard-ingress.yaml | 23 ++++++---- docs/examples/chashsubset/deployment.yaml | 14 +++++-- .../configuration-snippets/ingress.yaml | 11 +++-- .../deploy/echo-service.yaml | 22 ++++++---- .../docker-registry/ingress-with-tls.yaml | 11 +++-- .../docker-registry/ingress-without-tls.yaml | 11 +++-- docs/examples/multi-tls/multi-tls.yaml | 22 ++++++---- docs/examples/rewrite/README.md | 22 ++++++---- docs/examples/static-ip/nginx-ingress.yaml | 10 +++-- docs/examples/tls-termination/README.md | 7 +++- docs/examples/tls-termination/ingress.yaml | 7 +++- docs/user-guide/fcgi-services.md | 10 +++-- docs/user-guide/ingress-path-matching.md | 42 +++++++++++++------ .../third-party-addons/opentracing.md | 11 +++-- 21 files changed, 204 insertions(+), 105 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index c39d6e2c2..63a7bfbf6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -100,7 +100,7 @@ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main ## Create an ingress (please add any additional annotation required) echo " - apiVersion: networking.k8s.io/v1beta1 + apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: foo-bar @@ -109,10 +109,13 @@ echo " - host: foo.bar http: paths: - - backend: - serviceName: http-svc - servicePort: 80 - path: / + - path: / + pathType: Prefix + backend: + service: + name: http-svc + port: + number: 80 " | kubectl apply -f - ## make a request diff --git a/docs/examples/affinity/cookie/ingress-samesite.yaml b/docs/examples/affinity/cookie/ingress-samesite.yaml index edfa1b653..d03a25e39 100644 --- a/docs/examples/affinity/cookie/ingress-samesite.yaml +++ b/docs/examples/affinity/cookie/ingress-samesite.yaml @@ -15,10 +15,13 @@ spec: - host: stickyingress-samesite-none.example.com http: paths: - - backend: - serviceName: http-svc - servicePort: 80 - path: / + - path: / + pathType: Prefix + backend: + service: + name: http-svc + port: + number: 80 --- apiVersion: networking.k8s.io/v1 kind: Ingress @@ -35,7 +38,10 @@ spec: - host: stickyingress-samesite-strict.example.com http: paths: - - backend: - serviceName: http-svc - servicePort: 80 - path: / + - path: / + pathType: Prefix + backend: + service: + name: http-svc + port: + number: 80 \ No newline at end of file diff --git a/docs/examples/affinity/cookie/ingress.yaml b/docs/examples/affinity/cookie/ingress.yaml index eac973fde..d3053021e 100644 --- a/docs/examples/affinity/cookie/ingress.yaml +++ b/docs/examples/affinity/cookie/ingress.yaml @@ -13,7 +13,10 @@ spec: - host: stickyingress.example.com http: paths: - - backend: - serviceName: http-svc - servicePort: 80 - path: / + - path: / + pathType: Prefix + backend: + service: + name: http-svc + port: + number: 80 diff --git a/docs/examples/auth/basic/README.md b/docs/examples/auth/basic/README.md index a5fa579e0..d3d255afb 100644 --- a/docs/examples/auth/basic/README.md +++ b/docs/examples/auth/basic/README.md @@ -47,9 +47,12 @@ spec: http: paths: - path: / + pathType: Prefix backend: - serviceName: http-svc - servicePort: 80 + service: + name: http-svc + port: + number: 80 " | kubectl create -f - ``` diff --git a/docs/examples/auth/client-certs/ingress.yaml b/docs/examples/auth/client-certs/ingress.yaml index 7172081b4..90ff87514 100644 --- a/docs/examples/auth/client-certs/ingress.yaml +++ b/docs/examples/auth/client-certs/ingress.yaml @@ -19,10 +19,13 @@ spec: - host: mydomain.com http: paths: - - backend: - serviceName: http-svc - servicePort: 80 - path: / + - path: / + pathType: Prefix + backend: + service: + name: http-svc + port: + number: 80 tls: - hosts: - mydomain.com diff --git a/docs/examples/auth/external-auth/README.md b/docs/examples/auth/external-auth/README.md index 235cca9cb..62ae72e2c 100644 --- a/docs/examples/auth/external-auth/README.md +++ b/docs/examples/auth/external-auth/README.md @@ -30,10 +30,13 @@ spec: - host: external-auth-01.sample.com http: paths: - - backend: - serviceName: http-svc - servicePort: 80 - path: / + - path: / + pathType: Prefix + backend: + service: + name: http-svc + port: + number: 80 status: loadBalancer: ingress: diff --git a/docs/examples/auth/external-auth/ingress.yaml b/docs/examples/auth/external-auth/ingress.yaml index 2a58ca2e3..df80cbb25 100644 --- a/docs/examples/auth/external-auth/ingress.yaml +++ b/docs/examples/auth/external-auth/ingress.yaml @@ -9,7 +9,10 @@ spec: - host: external-auth-01.sample.com http: paths: - - backend: - serviceName: http-svc - servicePort: 80 - path: / \ No newline at end of file + - path: / + pathType: Prefix + backend: + service: + name: http-svc + port: + number: 80 \ No newline at end of file diff --git a/docs/examples/auth/oauth-external-auth/dashboard-ingress.yaml b/docs/examples/auth/oauth-external-auth/dashboard-ingress.yaml index 725bf1dc5..4c0a2d373 100644 --- a/docs/examples/auth/oauth-external-auth/dashboard-ingress.yaml +++ b/docs/examples/auth/oauth-external-auth/dashboard-ingress.yaml @@ -11,11 +11,13 @@ spec: - host: __INGRESS_HOST__ http: paths: - - backend: - serviceName: kubernetes-dashboard - servicePort: 80 - path: / - + - path: / + pathType: Prefix + backend: + service: + name: kubernetes-dashboard + port: + number: 80 --- apiVersion: networking.k8s.io/v1 @@ -28,10 +30,13 @@ spec: - host: __INGRESS_HOST__ http: paths: - - backend: - serviceName: oauth2-proxy - servicePort: 4180 - path: /oauth2 + - path: /oauth2 + pathType: Prefix + backend: + service: + name: oauth2-proxy + port: + number: 4180 tls: - hosts: - __INGRESS_HOST__ diff --git a/docs/examples/chashsubset/deployment.yaml b/docs/examples/chashsubset/deployment.yaml index 24a41dcc2..867cd01c0 100644 --- a/docs/examples/chashsubset/deployment.yaml +++ b/docs/examples/chashsubset/deployment.yaml @@ -64,7 +64,15 @@ metadata: name: nginxhello-ingress namespace: default spec: - backend: - serviceName: nginxhello - servicePort: 80 + rules: + - host: foo.bar.com + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: nginxhello + port: + number: 80 diff --git a/docs/examples/customization/configuration-snippets/ingress.yaml b/docs/examples/customization/configuration-snippets/ingress.yaml index 70d9042c7..aaf31f0bb 100644 --- a/docs/examples/customization/configuration-snippets/ingress.yaml +++ b/docs/examples/customization/configuration-snippets/ingress.yaml @@ -10,7 +10,10 @@ spec: - host: custom.configuration.com http: paths: - - backend: - serviceName: http-svc - servicePort: 80 - path: / + - path: / + pathType: Prefix + backend: + service: + name: http-svc + port: + number: 80 diff --git a/docs/examples/customization/external-auth-headers/deploy/echo-service.yaml b/docs/examples/customization/external-auth-headers/deploy/echo-service.yaml index 075421807..3a80ae834 100644 --- a/docs/examples/customization/external-auth-headers/deploy/echo-service.yaml +++ b/docs/examples/customization/external-auth-headers/deploy/echo-service.yaml @@ -56,10 +56,13 @@ spec: - host: public-demo-echo-service.kube.local http: paths: - - backend: - serviceName: demo-echo-service - servicePort: 80 - path: / + - path: / + pathType: Prefix + backend: + service: + name: demo-echo-service + port: + number: 80 --- apiVersion: networking.k8s.io/v1 kind: Ingress @@ -74,7 +77,10 @@ spec: - host: secure-demo-echo-service.kube.local http: paths: - - backend: - serviceName: demo-echo-service - servicePort: 80 - path: / + - path: / + pathType: Prefix + backend: + service: + name: demo-echo-service + port: + number: 80 diff --git a/docs/examples/docker-registry/ingress-with-tls.yaml b/docs/examples/docker-registry/ingress-with-tls.yaml index 11ccf6627..bef35c50b 100644 --- a/docs/examples/docker-registry/ingress-with-tls.yaml +++ b/docs/examples/docker-registry/ingress-with-tls.yaml @@ -17,7 +17,10 @@ spec: - host: registry. http: paths: - - backend: - serviceName: docker-registry - servicePort: 5000 - path: / + - path: / + pathType: Prefix + backend: + service: + name: docker-registry + port: + number: 5000 \ No newline at end of file diff --git a/docs/examples/docker-registry/ingress-without-tls.yaml b/docs/examples/docker-registry/ingress-without-tls.yaml index 2d713cb8c..f64cbb295 100644 --- a/docs/examples/docker-registry/ingress-without-tls.yaml +++ b/docs/examples/docker-registry/ingress-without-tls.yaml @@ -12,7 +12,10 @@ spec: - host: registry. http: paths: - - backend: - serviceName: docker-registry - servicePort: 5000 - path: / + - path: / + pathType: Prefix + backend: + service: + name: docker-registry + port: + number: 5000 diff --git a/docs/examples/multi-tls/multi-tls.yaml b/docs/examples/multi-tls/multi-tls.yaml index b3985439e..aa2cf54d6 100644 --- a/docs/examples/multi-tls/multi-tls.yaml +++ b/docs/examples/multi-tls/multi-tls.yaml @@ -115,14 +115,20 @@ spec: - host: foo.bar.com http: paths: - - backend: - serviceName: http-svc - servicePort: 80 - path: / + - path: / + pathType: Prefix + backend: + service: + name: http-svc + port: + number: 80 - host: bar.baz.com http: paths: - - backend: - serviceName: nginx - servicePort: 80 - path: / + - path: / + pathType: Prefix + backend: + service + name: nginx + port: + number: 80 diff --git a/docs/examples/rewrite/README.md b/docs/examples/rewrite/README.md index 6ae71a5d8..3c48b100f 100644 --- a/docs/examples/rewrite/README.md +++ b/docs/examples/rewrite/README.md @@ -46,10 +46,13 @@ spec: - host: rewrite.bar.com http: paths: - - backend: - serviceName: http-svc - servicePort: 80 - path: /something(/|$)(.*) + - path: /something(/|$)(.*) + pathType: Prefix + backend: + service: + name: http-svc + port: + number: 80 ' | kubectl create -f - ``` @@ -78,10 +81,13 @@ spec: - host: approot.bar.com http: paths: - - backend: - serviceName: http-svc - servicePort: 80 - path: / + - path: / + pathType: Prefix + backend: + service: + name: http-svc + port: + number: 80 " | kubectl create -f - ``` diff --git a/docs/examples/static-ip/nginx-ingress.yaml b/docs/examples/static-ip/nginx-ingress.yaml index 358942f5c..740f46e89 100644 --- a/docs/examples/static-ip/nginx-ingress.yaml +++ b/docs/examples/static-ip/nginx-ingress.yaml @@ -9,7 +9,11 @@ spec: rules: - http: paths: - - backend: + - path: / + pathType: Prefix + backend: # This assumes http-svc exists and routes to healthy endpoints. - serviceName: http-svc - servicePort: 80 + service: + name: http-svc + port: + number: 80 diff --git a/docs/examples/tls-termination/README.md b/docs/examples/tls-termination/README.md index f3096db2e..2df767e26 100644 --- a/docs/examples/tls-termination/README.md +++ b/docs/examples/tls-termination/README.md @@ -27,10 +27,13 @@ spec: http: paths: - path: / + pathType: Prefix backend: # This assumes http-svc exists and routes to healthy endpoints - serviceName: http-svc - servicePort: 80 + service: + name: http-svc + port: + number: 80 ``` The following command instructs the controller to terminate traffic using the provided diff --git a/docs/examples/tls-termination/ingress.yaml b/docs/examples/tls-termination/ingress.yaml index 2e989d1b0..debaa45b2 100644 --- a/docs/examples/tls-termination/ingress.yaml +++ b/docs/examples/tls-termination/ingress.yaml @@ -14,7 +14,10 @@ spec: http: paths: - path: / + pathType: Prefix backend: # This assumes http-svc exists and routes to healthy endpoints - serviceName: http-svc - servicePort: 80 + service: + name: http-svc + port: + number: 80 diff --git a/docs/user-guide/fcgi-services.md b/docs/user-guide/fcgi-services.md index 62271c2ce..03afc89d1 100644 --- a/docs/user-guide/fcgi-services.md +++ b/docs/user-guide/fcgi-services.md @@ -74,9 +74,13 @@ spec: - host: app.example.com http: paths: - - backend: - serviceName: example-service - servicePort: fastcgi + - path: / + pathType: Prefix + backend: + service: + name: example-service + port: + name: fastcgi ``` ## FastCGI Ingress Annotations diff --git a/docs/user-guide/ingress-path-matching.md b/docs/user-guide/ingress-path-matching.md index 6812e2cb5..e5e0d9a50 100644 --- a/docs/user-guide/ingress-path-matching.md +++ b/docs/user-guide/ingress-path-matching.md @@ -27,9 +27,12 @@ spec: http: paths: - path: /foo/.* + pathType: Prefix backend: - serviceName: test - servicePort: 80 + service: + name: test + port: + number: 80 ``` The preceding ingress definition would translate to the following location block within the NGINX configuration for the `test.com` server: @@ -61,13 +64,19 @@ spec: http: paths: - path: /foo/bar + pathType: Prefix backend: - serviceName: service1 - servicePort: 80 + service: + name: service1 + port: + number: 80 - path: /foo/bar/ + pathType: Prefix backend: - serviceName: service2 - servicePort: 80 + service: + name: service2 + port: + number: 80 ``` ```yaml @@ -83,9 +92,12 @@ spec: http: paths: - path: /foo/bar/(.+) + pathType: Prefix backend: - serviceName: service3 - servicePort: 80 + service: + name: service3 + port: + number: 80 ``` The ingress controller would define the following location blocks, in order of descending length, within the NGINX template for the `test.com` server: @@ -137,13 +149,19 @@ spec: http: paths: - path: /foo/bar/bar + pathType: Prefix backend: - serviceName: test - servicePort: 80 + service: + name: test + port: + number: 80 - path: /foo/bar/[A-Z0-9]{3} + pathType: Prefix backend: - serviceName: test - servicePort: 80 + service: + name: test + port: + number: 80 ``` The ingress controller would define the following location blocks (in this order) within the NGINX template for the `test.com` server: diff --git a/docs/user-guide/third-party-addons/opentracing.md b/docs/user-guide/third-party-addons/opentracing.md index 6c2918046..e27f32f6b 100644 --- a/docs/user-guide/third-party-addons/opentracing.md +++ b/docs/user-guide/third-party-addons/opentracing.md @@ -189,10 +189,13 @@ In the Zipkin interface we can see the details: - host: example.com http: paths: - - backend: - serviceName: echoheaders-x - servicePort: 80 - path: /echo + - path: /echo + pathType: Prefix + backend: + service: + name: echoheaders-x + port: + number: 80 ' | kubectl apply -f - ```