Skip to content

Sort ZWE_DISCOVERY_SERVICES_LIST to prefer local discovery url#4586

Open
1000TurquoisePogs wants to merge 5 commits intov3.x/stagingfrom
feature/ha-prefer-own-discovery
Open

Sort ZWE_DISCOVERY_SERVICES_LIST to prefer local discovery url#4586
1000TurquoisePogs wants to merge 5 commits intov3.x/stagingfrom
feature/ha-prefer-own-discovery

Conversation

@1000TurquoisePogs
Copy link
Member

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.

Signed-off-by: 1000TurquoisePogs <sgrady@rocketsoftware.com>
Fix pr number

Signed-off-by: 1000TurquoisePogs <sgrady@rocketsoftware.com>
@github-actions
Copy link

github-actions bot commented Nov 18, 2025

build 9202 SUCCEEDED.
Link to workflow run: https://github.com/zowe/zowe-install-packaging/actions/runs/19465091328

@github-actions
Copy link

github-actions bot commented Nov 18, 2025

build 9203 SUCCEEDED.
Link to workflow run: https://github.com/zowe/zowe-install-packaging/actions/runs/19465096841

@github-actions
Copy link

github-actions bot commented Nov 18, 2025

build 9204 SUCCEEDED.
Link to workflow run: https://github.com/zowe/zowe-install-packaging/actions/runs/19465110755

@github-actions
Copy link

github-actions bot commented Nov 18, 2025

Test workflow 7822 is started.
Running install test: Convenience Pax
The zowe artifact being used by this test workflow: libs-snapshot-local/org/zowe/3.4.0-PR-4586/zowe-3.4.0-pr-4586-9202-20251118115414.pax
Running on machine: zzow11
Result: FAILURE
Link to workflow run: https://github.com/zowe/zowe-install-packaging/actions/runs/19465244641

@github-actions
Copy link

github-actions bot commented Nov 18, 2025

Test workflow 7823 is started.
Running install test: Convenience Pax
The zowe artifact being used by this test workflow: libs-snapshot-local/org/zowe/3.4.0-PR-4586/zowe-3.4.0-pr-4586-9204-20251118115512.pax
Running on machine: zzow09
Result: SUCCESS
Link to workflow run: https://github.com/zowe/zowe-install-packaging/actions/runs/19465269729

@github-actions
Copy link

github-actions bot commented Nov 18, 2025

Test workflow 7824 is started.
Running install test: Convenience Pax
The zowe artifact being used by this test workflow: libs-snapshot-local/org/zowe/3.4.0-PR-4586/zowe-3.4.0-pr-4586-9203-20251118115613.pax
Running on machine: zzow11
Result: FAILURE
Link to workflow run: https://github.com/zowe/zowe-install-packaging/actions/runs/19465294999

Signed-off-by: 1000TurquoisePogs <sgrady@rocketsoftware.com>
@github-actions
Copy link

github-actions bot commented Dec 3, 2025

build 9316 SUCCEEDED.
Link to workflow run: https://github.com/zowe/zowe-install-packaging/actions/runs/19899711065

@github-actions
Copy link

github-actions bot commented Dec 3, 2025

Test workflow 7894 is started.
Running install test: Convenience Pax
The zowe artifact being used by this test workflow: libs-snapshot-local/org/zowe/3.4.0-PR-4586/zowe-3.4.0-pr-4586-9316-20251203154818.pax
Running on machine: zzow10
Result: FAILURE
Link to workflow run: https://github.com/zowe/zowe-install-packaging/actions/runs/19899907675

Signed-off-by: 1000TurquoisePogs <sgrady@rocketsoftware.com>
@github-actions
Copy link

github-actions bot commented Jan 22, 2026

build 9571 SUCCEEDED.
Link to workflow run: https://github.com/zowe/zowe-install-packaging/actions/runs/21263644927

@github-actions
Copy link

github-actions bot commented Jan 22, 2026

Test workflow 8077 is started.
Running install test: Convenience Pax
The zowe artifact being used by this test workflow: libs-snapshot-local/org/zowe/3.5.0-PR-4586/zowe-3.5.0-pr-4586-9571-20260122203154.pax
Running on machine: zzow09
Result: SUCCESS
Link to workflow run: https://github.com/zowe/zowe-install-packaging/actions/runs/21263914472

Comment on lines +163 to +172
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]];
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

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/
  1. 2nd LPAR started, 2nd hostname on the first place, which is OK (newlines added for readability)
  2. IMHO lpr5 and lpr6 should not be there, LPAR-4, lpar_4 and lpar#4 sanitized to lpar_4, but the first HA look up match is for LPAR-4. So lpar_4 and lpar#4 are "unreachable/dead" instances.

}


const currentPort = currentInstance?.components?.discovery?.port ? currentInstance.components.discovery.port : config.components.discovery?.port;
Copy link
Member

Choose a reason for hiding this comment

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Discovery service URLs are not in correct order

4 participants

Comments