Sort ZWE_DISCOVERY_SERVICES_LIST to prefer local discovery url#4586
Sort ZWE_DISCOVERY_SERVICES_LIST to prefer local discovery url#45861000TurquoisePogs wants to merge 5 commits intov3.x/stagingfrom
Conversation
Signed-off-by: 1000TurquoisePogs <sgrady@rocketsoftware.com>
Fix pr number Signed-off-by: 1000TurquoisePogs <sgrady@rocketsoftware.com>
|
build 9202 SUCCEEDED. |
|
build 9203 SUCCEEDED. |
|
build 9204 SUCCEEDED. |
|
Test workflow 7822 is started. |
|
Test workflow 7823 is started. |
|
Test workflow 7824 is started. |
Signed-off-by: 1000TurquoisePogs <sgrady@rocketsoftware.com>
|
build 9316 SUCCEEDED. |
|
Test workflow 7894 is started. |
Signed-off-by: 1000TurquoisePogs <sgrady@rocketsoftware.com>
|
build 9571 SUCCEEDED. |
|
Test workflow 8077 is started. |
| const definedHaInstanceNames = haInstanceKeys.map(name=>stringlib.sanitizeAlphanum(name.toLowerCase())); | ||
| //TODO check if this exists | ||
| const currentHaInstanceName = std.getenv('ZWE_CLI_PARAMETER_HA_INSTANCE'); | ||
| let currentInstance; | ||
| for (let i = 0; i < haInstanceKeys.length; i++) { | ||
| let mappedName = stringlib.sanitizeAlphanum(haInstanceKeys[i].toLowerCase()); | ||
| if (mappedName == currentHaInstanceName) { | ||
| currentInstance = config.haInstances[haInstanceKeys[i]]; | ||
| } | ||
| } |
There was a problem hiding this comment.
haInstances:
lpar1:
hostname: lpr1.example.com
sysname: lpr1
elpardva:
hostname: lpr2.example.com
sysname: lpr2
LPAR3:
hostname: lpr3.example.com
sysname: lpr3
LPAR-4:
hostname: lpr4.example.com
sysname: lpr4
lpar_4:
hostname: lpr5.example.com
sysname: lpr5
lpar#4:
hostname: lpr6.example.com
sysname: lpr6/S ZWESLSTC,HAINST=ELPARDVA
ZWE_DISCOVERY_SERVICES_LIST=
https://lpr2.example.com:7553/eureka/,
https://lpr1.example.com:7553/eureka/,
https://lpr3.example.com:7553/eureka/,
https://lpr4.example.com:7553/eureka/,
https://lpr5.example.com:7553/eureka/,
https://lpr6.example.com:7553/eureka/
- 2nd LPAR started, 2nd hostname on the first place, which is OK (newlines added for readability)
- IMHO
lpr5andlpr6should not be there,LPAR-4,lpar_4andlpar#4sanitized tolpar_4, but the first HA look up match is forLPAR-4. Solpar_4andlpar#4are "unreachable/dead" instances.
| } | ||
|
|
||
|
|
||
| const currentPort = currentInstance?.components?.discovery?.port ? currentInstance.components.discovery.port : config.components.discovery?.port; |
There was a problem hiding this comment.
Discovery port is now possible to configure also under "apiml" component for modulith setup. Does it make sense to include it here?
property name: components.apiml.internal.discovery.port
ZWE_DISCOVERY_SERVICES_LIST env var is given to each server as a way to tell them which places they can go to do eureka registration. It's expected there's only 1, except when using HA, in which case this is a comma separated list.
Currently, this list is in the same order for every HA instance.
That's not good, because it means every HA instance tries to register to the same destination instead of spreading out the load, but it also leads to higher occurrence of issues overall.
So, this PR changes the list so that the local discovery server, if it exists, is going to be first in the list for each HA instance.
Fixes #4568
How to test: Start up HA instances and check the value of the ZWE_DISCOVERY_SERVICES_LIST environment variable. You can expect it to be in the same order prior, but with this PR the local URL will be first in the list for each HA instance.