[ISSUE #6967] Preserve discovery upstream props as divide upstream metadata. - #6968
[ISSUE #6967] Preserve discovery upstream props as divide upstream metadata.#6968sunnysabor wants to merge 2 commits into
Conversation
Future DiscussionThis PR intentionally keeps the scope small and only preserves the existing There may be a broader question about whether ShenYu should support full Currently, registry implementations such as Eureka and Nacos only extract a It would be helpful to understand the community's view on this design: A full metadata passthrough would likely require a larger design discussion |
Fixes #6967
Problem
Discovery registry implementations such as Eureka and Nacos already read the
propsentry from instance metadata and store it inDiscoveryUpstreamData.props.However, when the divide plugin converts
DiscoveryUpstreamDatato runtimeUpstream, it only reads several built-in properties fromprops, such aswarmup,gray, andhealthCheckEnabled. The remaining custom properties are not preserved in the runtime upstream object.As a result, custom load balancers cannot access discovery upstream extension properties from
Upstream.getMetadata(), even thoughUpstreamalready provides a metadata field.Root Cause
The discovery-to-runtime conversion in the divide plugin parses
DiscoveryUpstreamData.propsonly for built-in upstream options and then builds anUpstreamwithout setting its metadata.This means the existing discovery
propsextension channel works at the registry and admin data model level, but the data is dropped before the load balancer receives the runtime upstream list.Solution
Parse discovery upstream
propsas aMap<String, String>and preserve it asUpstream.metadataduring divide upstream conversion.The same metadata map is also used to keep the existing parsing behavior for built-in properties:
warmupgrayhealthCheckEnabledScope
This change keeps the existing
propsextension channel and does not introduce full registry metadata passthrough.For example, custom metadata should still be placed inside the
propsentry of the discovery instance metadata. This PR only makes those parsedpropsavailable from runtimeUpstream.getMetadata().Changed Behavior
warmup,gray, andhealthCheckEnabledremains unchanged.propsare copied intoUpstream.metadata.az,version, orgrayTagfromUpstream.getMetadata()when these properties are provided inside discovery upstreamprops.Validation
git diff --checkmvn -pl :shenyu-plugin-divide -am -Dtest=DivideUpstreamDataHandlerTest -DfailIfNoTests=false testmvn -pl :shenyu-plugin-divide -am -DfailIfNoTests=false test./mvnw clean install -Dmaven.javadoc.skip=truewas not run locally.Checklist
./mvnw clean install -Dmaven.javadoc.skip=true.