Skip to content

Conversation

@ryanrolds
Copy link

@ryanrolds ryanrolds commented Apr 4, 2025

Description

The addition of supporting multiple target refs for VHO exposed a gap with how status are reported for resources that reference multiple Gateways.

This PR resolves that gap by introducing a way for plugins to merge their status caches, allowing the syncer to merge the caches of all status plugins in the snapshots, producing a complete status report for the resource. Only VHO and RO are status plugins, also the RO lacks warnings - all of the key information comes from the proxy reports, so the marge is mostly a no-op.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

@solo-changelog-bot
Copy link

Issues linked to changelog:
https://github.com/solo-io/solo-projects/issues/7980

@ryanrolds ryanrolds changed the title [WIP] PoC to not drop statuses across gateways [WIP] Merge VHO/RO statuses from snapshots Apr 8, 2025
Comment on lines +46 to +85
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: example-route
spec:
parentRefs:
- name: gw-1
hostnames:
- "example.com"
rules:
- filters:
- type: ExtensionRef
extensionRef:
group: gateway.solo.io
kind: RouteOption
name: header-manipulation
backendRefs:
- name: example-svc
port: 8080
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: example-route-2
spec:
parentRefs:
- name: gw-2
hostnames:
- "example.com"
rules:
- filters:
- type: ExtensionRef
extensionRef:
group: gateway.solo.io
kind: RouteOption
name: header-manipulation-2
backendRefs:
- name: example-svc
port: 8080
---
Copy link
Author

Choose a reason for hiding this comment

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

I moved these up so it was easier to skim.

@ryanrolds ryanrolds marked this pull request as ready for review April 8, 2025 21:21
@github-actions
Copy link

github-actions bot commented Apr 8, 2025

Visit the preview URL for this PR (updated for commit b65109b):

https://gloo-edge--pr10745-rolds-vho-statuses-g39aryiz.web.app

(expires Wed, 16 Apr 2025 17:44:39 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 77c2b86e287749579b7ff9cadb81e099042ef677

@ryanrolds ryanrolds changed the title [WIP] Merge VHO/RO statuses from snapshots Merge VHO/RO statuses from snapshots Apr 8, 2025
@ryanrolds ryanrolds changed the title Merge VHO/RO statuses from snapshots Merge VHO/RO statuses from snapshots when updating resource status Apr 8, 2025
Copy link
Collaborator

@sheidkamp sheidkamp left a comment

Choose a reason for hiding this comment

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

Would approve, but don't want it to merge before Sam/Steven have a chance to look.

If we were planning on keeping this code around, I'd advocate for some consolidation (reconcile the "classicStatus" and "legacyStatus" objects used by RO and VHO, move the merge functionality into a library for reuse by (Http)ListenerOptions), but we aren't so the effort isn't worth it at the moment.

@ryanrolds
Copy link
Author

ryanrolds commented Apr 9, 2025

If we were planning on keeping this code around, I'd advocate for some consolidation (reconcile the "classicStatus" and "legacyStatus" objects used by RO and VHO, move the merge functionality into a library for reuse by (Http)ListenerOptions), but we aren't so the effort isn't worth it at the moment.

This is a good callout and I wish we had more clarity on what the plan for the current Gloo's GW API is and if it will eventually be updated with the newer patterns in kgateway. I have no objection to DRYing this out and making a common status struct.

@sheidkamp
Copy link
Collaborator

This is a good callout and I wish we had more clarity on what the plan for the current Gloo's GW API is and if it will eventually be updated with the newer patterns in kgateway. I have no objection to DRYing this out and making a common status struct.

For the moment, I'm fine keeping it how it is and if we do end up coming back to the code, fixing it up then

) error
MergeStatusPlugin(
ctx context.Context,
sources any,

Choose a reason for hiding this comment

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

super nit: can we have this be some interface that has the XYZStatusPlugin methods?

Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure I understand the ask. It's on the StatusPlugin interface.

Choose a reason for hiding this comment

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

just to avoid any, only allow passing in things that implement status methods

nbd, just stylistic

// MergeStatusPlugin merges the status of the source plugin in to the current plugin.
// This is used late in the proxy sync process to report the status of the VHO when
// it references multiple proxies/snapshots.
func (p *plugin) MergeStatusPlugin(ctx context.Context, source any) error {

Choose a reason for hiding this comment

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

would it be possible to avoid this method altogether by merging the StatusContext?

Copy link
Author

Choose a reason for hiding this comment

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

Each plugin may have it's own internal state/struct that need plugin-specific logic. I wanted to make sure to support that that case, just like we do when applying the statuses.

@soloio-bulldozer soloio-bulldozer bot merged commit 2dc15b2 into main Apr 9, 2025
20 checks passed
@soloio-bulldozer soloio-bulldozer bot deleted the rolds/vho_statuses branch April 9, 2025 21:12
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.

5 participants