gateway icon indicating copy to clipboard operation
gateway copied to clipboard

feat: add file resource provider for EG standalone mode

Open shawnh2 opened this issue 1 year ago • 10 comments

What type of PR is this?

What this PR does / why we need it:

This PR implement two component for file resource provider: Notifier and ResourceStore.

  • Notifier monitors paths(files or dirs) on host via fsnotify, and send Write/Remove event to ResourceStore
  • ResourceStore load and store resources according to the received event

Which issue(s) this PR fixes:

related #1393


There're some TODOs in this PR, tracked by #3213 #3207

shawnh2 avatar Apr 10 '24 04:04 shawnh2

As discussed in today's meeting, I prefer to remove the EnvoyGatewayCustomProvider and add a flat EnvoyGatewayFileProvider(or a better name).

Custom is needed to allow for different resource and infra provider

arkodg avatar Apr 24 '24 00:04 arkodg

As discussed in today's meeting, I prefer to remove the EnvoyGatewayCustomProvider and add a flat EnvoyGatewayFileProvider(or a better name).

Custom is needed to allow for different resource and infra provider

Add it later when a use case comes out? The File/Host Provider is not a custom provider, it's a known one.

zhaohuabing avatar Apr 24 '24 00:04 zhaohuabing

As discussed in today's meeting, I prefer to remove the EnvoyGatewayCustomProvider and add a flat EnvoyGatewayFileProvider(or a better name).

Custom is needed to allow for different resource and infra provider

Add it later when a use case comes out? The File/Host Provider is not a custom provider, it's a known one.

use case exists today - file resource provider and host infra provider to implement standalone case, running EG in a docker container or bare metal directly w/o any API server

arkodg avatar Apr 24 '24 00:04 arkodg

/retest

Xunzhuo avatar May 14 '24 08:05 Xunzhuo

Do we plan on releasing this in v1.1.0 ?

cc @arkodg

yeah I'm a +1 for this, prioritizing other PRs right now, will get to this one soon

arkodg avatar May 15 '24 00:05 arkodg

Some tests will be added after the first round of reviews.

shawnh2 avatar May 16 '24 04:05 shawnh2

will split changes of api/v1alpha1/validation/envoygateway_validate.go into a separate PR, since it's only a refactor and very easily to conflict.

shawnh2 avatar Jun 04 '24 03:06 shawnh2

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. Please feel free to give a status update now, ping for review, when it's ready. Thank you for your contributions!

github-actions[bot] avatar Jul 04 '24 04:07 github-actions[bot]

Hi, does it set -c or --config-path to switch to file-mode? how to implement the config file?

sky92zwq avatar Jul 30 '24 11:07 sky92zwq

Codecov Report

Attention: Patch coverage is 7.87270% with 550 lines in your changes missing coverage. Please review.

Project coverage is 66.54%. Comparing base (c109131) to head (3c5d0f1). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/provider/file/resources.go 0.00% 234 Missing :warning:
internal/provider/file/notifier.go 0.00% 158 Missing :warning:
internal/provider/file/file.go 0.00% 66 Missing :warning:
internal/provider/runner/runner.go 0.00% 32 Missing :warning:
internal/provider/file/store.go 0.00% 26 Missing :warning:
internal/cmd/server.go 0.00% 15 Missing :warning:
internal/infrastructure/manager.go 0.00% 9 Missing :warning:
internal/infrastructure/runner/runner.go 0.00% 6 Missing :warning:
internal/provider/file/path.go 88.88% 1 Missing and 1 partial :warning:
internal/provider/kubernetes/kubernetes.go 0.00% 2 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3159      +/-   ##
==========================================
- Coverage   67.99%   66.54%   -1.45%     
==========================================
  Files         190      195       +5     
  Lines       23130    23699     +569     
==========================================
+ Hits        15727    15771      +44     
- Misses       6284     6809     +525     
  Partials     1119     1119              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 13 '24 14:08 codecov[bot]

hey @shawnh2 this PR looks good, added some minor comments !

arkodg avatar Aug 15 '24 19:08 arkodg

Hi, does it set -c or --config-path to switch to file-mode? how to implement the config file?

You can start file-provider mode like envoy-gateway server -c config.yaml, with config.yaml:

apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyGateway
gateway:
  controllerName: gateway.envoyproxy.io/gatewayclass-controller
provider:
  type: Custom
  custom:
    resource:
      type: File
      file:
        paths: ["test/"]
logging:
  level:
    default: info

shawnh2 avatar Sep 08 '24 09:09 shawnh2

/retest

shawnh2 avatar Sep 08 '24 12:09 shawnh2