Skip to content

fix: do not create infra resources when missing translated listeners#3043

Merged
zirain merged 6 commits intoenvoyproxy:mainfrom
cnvergence:fix-missing-listeners
Apr 1, 2024
Merged

fix: do not create infra resources when missing translated listeners#3043
zirain merged 6 commits intoenvoyproxy:mainfrom
cnvergence:fix-missing-listeners

Conversation

@cnvergence
Copy link
Copy Markdown
Member

@cnvergence cnvergence commented Mar 27, 2024

What type of PR is this?

What this PR does / why we need it:
Validate Infra listeners before running createOrUpdate func

Which issue(s) this PR fixes:

Fixes #3044

@cnvergence cnvergence force-pushed the fix-missing-listeners branch from bc7bde4 to 4f01c5e Compare March 27, 2024 16:36
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.90%. Comparing base (519eb70) to head (1b4b9f2).

Additional details and impacted files
@@            Coverage Diff            @@
##           main    #3043       +/-   ##
=========================================
+ Coverage      0   64.90%   +64.90%     
=========================================
  Files         0      121      +121     
  Lines         0    21393    +21393     
=========================================
+ Hits          0    13886    +13886     
- Misses        0     6639     +6639     
- Partials      0      868      +868     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cnvergence cnvergence marked this pull request as ready for review March 27, 2024 17:04
@cnvergence cnvergence requested a review from a team as a code owner March 27, 2024 17:04
@cnvergence
Copy link
Copy Markdown
Member Author

/retest

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what is the impact of this ? do we see an error in the runner for this publish, but for the next iteration once the listeners spec is fixed, the next publish works fine, and the infra is created ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

exactly, so when we will process the gateway with 1 listener that fails validation, we would see

2024-03-27T17:49:41.202+0100    INFO    gateway-api     runner/runner.go:56     received an update      {"runner": "gateway-api"}
2024-03-27T17:49:41.204+0100    INFO    gateway-api     runner/runner.go:104    proxy:
  metadata:
    labels:
      gateway.envoyproxy.io/owning-gateway-name: example
      gateway.envoyproxy.io/owning-gateway-namespace: envoy-gateway-system
  name: envoy-gateway-system/example
        {"runner": "gateway-api", "infra-ir": "envoy-gateway-system/example"}
2024-03-27T17:49:41.204+0100    INFO    infrastructure  runner/runner.go:59     received an update      {"runner": "infrastructure"}
2024-03-27T17:49:41.204+0100    ERROR   infrastructure  runner/runner.go:70     failed to create new infra      {"runner": "infrastructure", "error": "infra proxy listeners ir is nil"}
2024-03-27T17:49:41.204+0100    ERROR   watchable       message/watchutil.go:56 observed an error       {"runner": "infrastructure", "error": "infra proxy listeners ir is nil"}
2024-03-27T17:49:41.205+0100    INFO    gateway-api     runner/runner.go:115    accessLog:
  text:
  - path: /dev/stdout
        {"runner": "gateway-api", "xds-ir": "envoy-gateway-system/example"}

In case of example mentioned in the issue, creating valid secret, reconciles it and infra is created

2024-03-28T13:42:09.579+0100    INFO    infrastructure  runner/runner.go:59     received an update      {"runner": "infrastructure"}
2024-03-28T13:42:09.579+0100    INFO    gateway-api     runner/runner.go:104    proxy:
  listeners:
  - address: null
    name: envoy-gateway-system/example/https-example
    ports:
    - containerPort: 10443
      name: https-example
      protocol: HTTPS
      servicePort: 443
  metadata:
    labels:
      gateway.envoyproxy.io/owning-gateway-name: example
      gateway.envoyproxy.io/owning-gateway-namespace: envoy-gateway-system
  name: envoy-gateway-system/example
        {"runner": "gateway-api", "infra-ir": "envoy-gateway-system/example"}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I have tested it with multiple gateways with multiple listeners and also on merged gateways

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

cool thanks, rethinking, this is not really a infra layer error but a user enforced error, any way we can quietly skip this in infra layer or gateway api layer, an info log helps

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

not ideal, I agree, let's try to state the error more user-friendly :)

Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
@cnvergence cnvergence force-pushed the fix-missing-listeners branch from 4f01c5e to bcdff5a Compare March 28, 2024 12:43
@cnvergence cnvergence requested review from arkodg and zirain March 29, 2024 11:32
@cnvergence
Copy link
Copy Markdown
Member Author

/retest

Copy link
Copy Markdown
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

LGTM thanks !
hope we find a way to move this logic out of the runner in the future

@arkodg arkodg requested review from a team April 1, 2024 19:21
@zirain zirain merged commit 36d7141 into envoyproxy:main Apr 1, 2024
@cnvergence cnvergence deleted the fix-missing-listeners branch April 2, 2024 08:01
arkodg pushed a commit to arkodg/gateway that referenced this pull request Apr 8, 2024
…nvoyproxy#3043)

* fix: do not create infra resources when missing translated listeners

Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>

* remove empty line

Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>

* skip infra creation on empty listeners and log it

Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>

---------

Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
(cherry picked from commit 36d7141)
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
Xunzhuo added a commit that referenced this pull request Apr 8, 2024
* Run certgen when upgrading (#2934)

run certgen when upgrading

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
(cherry picked from commit 62ecf15)
Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* Fix: nil secret in resourceversiontable (#2982)

* fix nil secret in resourceversiontable

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* check secrets in the xds result

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

---------

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
(cherry picked from commit e880439)
Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix: add missing http filters to the http filter chain (#2970)

* fix: add missing http filters to the http filter chain

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* refactor

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* fix lint

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* add comments

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* remove refactor

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* remove refactor

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* fix gen

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* fix lint

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

---------

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
(cherry picked from commit f699edf)
Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix: allow websockets in url rewrite (#3022)

allow websockets in url rewrite

Signed-off-by: Jesse Haka <haka.jesse@gmail.com>
Co-authored-by: zirain <zirain2009@gmail.com>
(cherry picked from commit 3d51933)
Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* Set host for http health checker explicitly to avoid using the cluster name as host header for http health checking request. (#3057)

* Set host for http health checker explictly to avoid using the cluster name as host header for http health checking request

Signed-off-by: lemonlinger <lemonlinger@gmail.com>

* fix broken tests

Signed-off-by: lemonlinger <lemonlinger@gmail.com>

* fix health-check test case in xds translation

Signed-off-by: lemonlinger <lemonlinger@gmail.com>

* Simplify code and concise comments

Signed-off-by: lemonlinger <lemonlinger@gmail.com>

---------

Signed-off-by: lemonlinger <lemonlinger@gmail.com>
(cherry picked from commit 8f450a9)
Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix: do not create infra resources when missing translated listeners (#3043)

* fix: do not create infra resources when missing translated listeners

Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>

* remove empty line

Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>

* skip infra creation on empty listeners and log it

Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>

---------

Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
(cherry picked from commit 36d7141)
Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* Fix: double slashes in redirect URL (#2998)

* fix: double trailing splashs in redirect URL

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* add e2e tests

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* fix lint

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* fix test

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* fix test

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* fix test

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* fix test

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* add e2e tests

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* fix test

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* revert

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* use regex rewrite to generate the redirect url

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* use regex rewrite to generate the redirect url

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* use regex rewrite to generate the redirect url

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* remove comments

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* extract method

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* address comments

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

---------

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
(cherry picked from commit ceb697f)
Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix: Allow Policy to attach to multiple http listeners  (#2967)

* Fixing the clienttrafficpolicy validation.

Signed-off-by: Lior Okman <lior.okman@sap.com>

* Make SecurityPolicy validate correctly.

Signed-off-by: Lior Okman <lior.okman@sap.com>

* Reverted the SecurityPolicy validation - handled differently via
another feature.

Signed-off-by: Lior Okman <lior.okman@sap.com>

* Updated the tests to reflect that this validation isn't required for SecurityPolicy

Signed-off-by: Lior Okman <lior.okman@sap.com>

* Added some comments to explain the validation being performed.

Signed-off-by: Lior Okman <lior.okman@sap.com>

* Updated the error message as requested in the review.

Signed-off-by: Lior Okman <lior.okman@sap.com>

---------

Signed-off-by: Lior Okman <lior.okman@sap.com>
(cherry picked from commit f9409e4)
Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix: set path prefix for http ext auth service (#3018)

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
(cherry picked from commit 2882b7c)
Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* Change route sorting order to Exact > RegularExpression > PathPrefix (#2579)

* Change route sorting order to Exact > RegularExpression > PathPrefix

kubernetes-sigs/gateway-api#1770
kubernetes-sigs/gateway-api#1855

Signed-off-by: Stéphane Cottin <stephane.cottin@vixns.com>
(cherry picked from commit 11f56fd)
Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix: infraIR duplicate port translation for merged gateways (#3061)

* fix: duplicate port translation for merged gateways

Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>

* refactor to map

Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>

* rename map

Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>

* add seperate testcase

Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>

---------

Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
(cherry picked from commit 29946b0)
Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* translator: set SpawnUpstreamSpan to true (#3102)

* translator: set SpawnUpstreamSpan to true

Signed-off-by: zirain <zirain2009@gmail.com>

* update

Signed-off-by: zirain <zirain2009@gmail.com>

---------

Signed-off-by: zirain <zirain2009@gmail.com>
(cherry picked from commit 635ebfc)
Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix: rate limit doesn't work with two(and more) listeners (#3085)

* fix: rate limit doesn't work with two listeners

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* add e2e test for rate limit on multiple listeners

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* address comments

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

---------

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
Co-authored-by: Xunzhuo <bitliu@tencent.com>
(cherry picked from commit a5bedbc)
Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* rerun make testdata

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

---------

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Jesse Haka <haka.jesse@gmail.com>
Signed-off-by: lemonlinger <lemonlinger@gmail.com>
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
Signed-off-by: Lior Okman <lior.okman@sap.com>
Signed-off-by: Stéphane Cottin <stephane.cottin@vixns.com>
Signed-off-by: zirain <zirain2009@gmail.com>
Co-authored-by: Huabing Zhao <zhaohuabing@gmail.com>
Co-authored-by: Jesse Haka <haka.jesse@gmail.com>
Co-authored-by: zirain <zirain2009@gmail.com>
Co-authored-by: Meng <lemonlinger@gmail.com>
Co-authored-by: Karol Szwaj <karol.szwaj@gmail.com>
Co-authored-by: Lior Okman <lior.okman@sap.com>
Co-authored-by: vixns <stephane.cottin@vixns.com>
Co-authored-by: Xunzhuo <bitliu@tencent.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Infrastructure runner trying to create/update proxy despite empty listeners

3 participants