Skip to content

Commit

Permalink
fix(gateway): make MeshHTTPRoute-based routing available to plugins (#…
Browse files Browse the repository at this point in the history
…8916)

Signed-off-by: Mike Beaumont <[email protected]>
  • Loading branch information
michaelbeaumont authored Jan 18, 2024
1 parent dadce73 commit 22951d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/plugins/policies/meshhttproute/plugin/v1alpha1/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ func ApplyToGateway(
return nil
}

for _, info := range plugin_gateway.ExtractGatewayListeners(proxy) {
listeners := plugin_gateway.ExtractGatewayListeners(proxy)
for listenerIndex, info := range listeners {
address := proxy.Dataplane.Spec.GetNetworking().Address
port := info.Listener.Port
inboundListener := rules.InboundListener{
Expand Down Expand Up @@ -187,6 +188,10 @@ func ApplyToGateway(
return hostInfos[i].Host.Hostname > hostInfos[j].Host.Hostname
})

info.HostInfos = hostInfos
listeners[listenerIndex] = info
plugin_gateway.SetGatewayListeners(proxy, listeners)

cdsResources, err := generateGatewayClusters(ctx, xdsCtx, info, hostInfos)
if err != nil {
return err
Expand Down
4 changes: 4 additions & 0 deletions pkg/plugins/runtime/gateway/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func ExtractGatewayListeners(proxy *core_xds.Proxy) []GatewayListenerInfo {
return ext.([]GatewayListenerInfo)
}

func SetGatewayListeners(proxy *core_xds.Proxy, infos []GatewayListenerInfo) {
proxy.RuntimeExtensions[metadata.PluginName] = infos
}

func (p *plugin) AfterBootstrap(context *core_plugins.MutablePluginContext, config core_plugins.PluginConfig) error {
// Insert our resolver before the default so that we can intercept
// builtin gateway dataplanes.
Expand Down

0 comments on commit 22951d2

Please sign in to comment.