Skip to content

[Console] Fix YARN RM REST endpoints being routed to web proxy - #4524

Open
songchaolin wants to merge 1 commit into
apache:devfrom
songchaolin:fix/rm-rest-webproxy-address
Open

songchaolin wants to merge 1 commit into
apache:devfrom
songchaolin:fix/rm-rest-webproxy-address

Conversation

@songchaolin

Copy link
Copy Markdown

Problem

When yarn.web-proxy.address is configured (a common setup on managed YARN clusters such as Alibaba EMR), YarnUtils.getRMWebAppURL() always prefers the web proxy address over the ResourceManager's own web app address.

The YARN web proxy only serves /proxy/... paths — it does not expose the ResourceManager-only REST endpoints such as ws/v1/cluster/apps/{id}. As a result, restRequest(ws/v1/cluster/apps/...) returns 404, getFromYarnRestApi throws, and a FAILED application is never detected (it keeps showing as RUNNING and no alert is fired), even though the RM reports finalStatus=FAILED.

Reproduction

On a cluster where yarn.web-proxy.address differs from yarn.resourcemanager.webapp.address:

  1. Run a Flink job on YARN and let it FAILED.
  2. Observed: task stays RUNNING in StreamPark, no alert.
  3. curl http://<RM_HOST>:8088/ws/v1/cluster/apps/ returns the app with finalStatus: FAILED, while http://<PROXY_HOST>:<PORT>/ws/v1/cluster/apps/ returns 404.

Fix

  • Add YarnUtils.getRMWebAppRestURL() that resolves the RM web app address (yarn.resourcemanager.webapp.address / ..._HTTPS_ADDRESS) via getSocketAddr, reusing the default port constants (YarnConfiguration.DEFAULT_RM_WEBAPP_PORT), so no port is hard-coded.
  • In restRequest(), route ws/v1* (RM-only REST) requests to getRMWebAppRestURL() while keeping all other relative paths (e.g. /proxy/...) on the existing web-proxy base URL. UI proxying is unaffected.

Tests

Compiled with JDK 11 (mvn -pl streampark-common compile -> BUILD SUCCESS). Verified in production: the FAILED state is now detected and the alert fires.

The YARN web proxy (yarn.web-proxy.address) only serves /proxy/... paths and
does not expose the ResourceManager-only REST endpoints such as
ws/v1/cluster/apps/.... getRMWebAppURL() always prefers yarn.web-proxy.address,
so those RM-only calls failed with 404 and job states were never detected.

Introduce getRMWebAppRestURL() which resolves the ResourceManager web app
address (yarn.resourcemanager.webapp.address) via getSocketAddr, and route
ws/v1/* requests to it in restRequest() while keeping /proxy/* UI paths on the
web proxy.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant