Skip to content

Conversation

@daum3ns
Copy link

@daum3ns daum3ns commented Oct 24, 2025

This change enables the file-based (standalone) provider to understand and load custom resources that are defined by an extension server.

  • the LoadResourcesFromYAMLBytes now accepts a server config pointer. When a resource kind is unknown, the loader checks the configured ExtensionManager and, if the GVK matches a declared policy resource, stores the object as an ExtensionServerPolicy
    • Updated callers to pass the new parameter
  • the newOfflineGatewayAPIClient function now accepts extensionServerPoliciesGVKs, which are then registered in the scheme. this allows the offline reconciler to manipulate custom resources
  • added testcases for decoder, offline_controller and config_loader,
    • the config reload test starts Envoy Gateway in standalone mode, hot-reloads a configuration that adds an ExtensionManager with policy resources, and verifies the new GVKs are recognized

Fixes #7141

Release Notes: Yes/No

Notes:
I found out that we most probably have the same problem with ExtensionManagers backendResources and resources field (at least the config_loader test can easily be extended to show that the registration in the scheme is missing).

I think it could be fixed in a similar way (although not sure whether the translator needs to be adapted as well). See the commented code snippets...

However, I'm very new to envoy-gateway so I'm still raising this PR to get a first, much appreciated feedback whether it makes sense to continue in this direction..

@daum3ns daum3ns requested a review from a team as a code owner October 24, 2025 14:23
@arkodg arkodg requested a review from shawnh2 October 24, 2025 14:25
@arkodg arkodg added this to the v1.6.0 Milestone milestone Oct 24, 2025
…nt scheme

Teach the offline controller to recognise custom extension-server
policy GVKs supplied by an extension so they can be decoded and later
processed by the translator.

- newOfflineGatewayAPIClient now accepts extServerPoliciesGVKs
- each GVK is registered as Unstructured/UnstructuredList in the
  fake client's scheme
- call-site updated to pass the collected policy GVKs

Signed-off-by: daum3ns <[email protected]>
Add policy resources from ExtensionManager to extGKs so custom
extension policies are recognised during translation.

Signed-off-by: daum3ns <[email protected]>
…f an EnvoyGateway configuration containing a standalone extension server.

Signed-off-by: daum3ns <[email protected]>
yaml and it gets the default namespace

Signed-off-by: daum3ns <[email protected]>
can check custom resource definitions

Signed-off-by: daum3ns <[email protected]>
@daum3ns daum3ns force-pushed the support-custom-CRDs-for-ExtensionServer-in-Standalone-Mode branch from 1f7a84b to d66478e Compare October 24, 2025 14:29
@codecov
Copy link

codecov bot commented Oct 28, 2025

Codecov Report

❌ Patch coverage is 87.14286% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.40%. Comparing base (fa9f9c3) to head (0ef8f43).
⚠️ Report is 85 commits behind head on main.

Files with missing lines Patch % Lines
internal/provider/file/store.go 25.00% 4 Missing and 2 partials ⚠️
internal/gatewayapi/runner/runner.go 0.00% 2 Missing ⚠️
internal/provider/file/file.go 90.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7331      +/-   ##
==========================================
+ Coverage   70.92%   72.40%   +1.48%     
==========================================
  Files         229      231       +2     
  Lines       41071    34084    -6987     
==========================================
- Hits        29131    24680    -4451     
+ Misses      10221     7629    -2592     
- Partials     1719     1775      +56     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: daum3ns <[email protected]>
ExtensionManager.resources and ExtensionManager.backendResources, use
assertions

Signed-off-by: daum3ns <[email protected]>
@daum3ns
Copy link
Author

daum3ns commented Oct 30, 2025

@shawnh2 i have added a test scenario which shows we have the same problem for the other 2 resources fields in the extension manager in standalone mode....
f996f5a

i think i will address this in this PR as well.. (or would you prefer a separate Issue/PR ?)
Can you answer this question here?
https://github.com/daum3ns/envoy-gateway/blob/support-custom-CRDs-for-ExtensionServer-in-Standalone-Mode/internal/gatewayapi/resource/load.go#L454
Im not sure whether all extensions should go in the same field or wether there are dedicated fields for the different types...

@daum3ns
Copy link
Author

daum3ns commented Nov 4, 2025

I figured it out, extensionRefFilter is the correct place to put it, also had to persist it ..
see ed62242 and 63e49df

for _, policy := range srv.EnvoyGateway.ExtensionManager.PolicyResources {
if policy.Kind == un.GetKind() && policy.Version == un.GroupVersionKind().Version && policy.Group == un.GroupVersionKind().Group {
un.SetNamespace(namespace)
resources.ExtensionServerPolicies = append(resources.ExtensionServerPolicies, *un)
Copy link
Contributor

Choose a reason for hiding this comment

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

why items of PolicyResources will be appended into ExtensionServerPolicies? instead of ExtensionRefFilters?

Copy link
Author

Choose a reason for hiding this comment

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

I looked up how the kubernetes controller does it:
it puts PolicyResources in ExtensionServerPolicies
https://github.com/envoyproxy/gateway/blob/main/internal/provider/kubernetes/controller.go#L2685
and backendResources to ExtensionRefFilters:
https://github.com/envoyproxy/gateway/blob/main/internal/provider/kubernetes/controller.go#L793


// loadKubernetesYAMLToResources converts a Kubernetes YAML string into GatewayAPI Resources.
func loadKubernetesYAMLToResources(input []byte, addMissingResources bool) (*Resources, error) {
func loadKubernetesYAMLToResources(srv *config.Server, input []byte, addMissingResources bool) (*Resources, error) {
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 only pass srv.EnvoyGateway.ExtensionManager here? since it's the only field in srv we need.

And also can we make it the last parameter of this function?

assert.True(t, reconciler.client.Scheme().Recognizes(schema.GroupVersionKind{Group: extBackendGVK.Group, Version: extBackendGVK.Version, Kind: extBackendGVK.Kind}))

// Verify the custom resource can be loaded from YAML
inFile := "./testdata/custom-resource.yaml"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
inFile := "./testdata/custom-resource.yaml"
inFile := "testdata/custom-resource.yaml"

instead of srv.EnvoyGateway (replace function parameter, adapt callers
and tests)

Signed-off-by: daum3ns <[email protected]>
Signed-off-by: daum3ns <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support custom CRDs for ExtensionServer in Standalone Mode

3 participants