1fanwang opened a new pull request, #28047:
URL: https://github.com/apache/flink/pull/28047

   ## What is the purpose of the change
   
   The Kubernetes REST service exposed by the JobManager hardcodes its port 
name to `"rest"` (`Constants.REST_PORT_NAME`). Operators in environments that 
enforce port-naming policies — for example, service meshes that route by port 
name, or organizations with strict port-name conventions — cannot align Flink's 
rest service with those policies.
   
   This change adds a new config option `kubernetes.rest-service.port-name` 
(string, default `"rest"`) that controls the port name on the REST Service. The 
default preserves existing behavior, making this a purely additive change.
   
   ## Brief change log
   
   - New config option `kubernetes.rest-service.port-name` in 
`KubernetesConfigOptions` (default `"rest"`)
   - New getter `KubernetesJobManagerParameters#getRestServicePortName()`
   - `ServiceType#buildUpExternalRestService` uses the configured name instead 
of `Constants.REST_PORT_NAME`
   - `ServiceType#getRestPortFromExternalService` no longer filters ports by 
name. Flink always builds the rest Service with a single port, so the lookup 
can simply return that port; this lets the reader work for any configured name 
without plumbing it through the abstract `getRestEndpoint` signature on 
`ServiceType` (which would change a public surface and require updating all 
subclasses).
   - 
`KubernetesResourceManagerDriver#updateKubernetesServiceTargetPortIfNecessary` 
reads the configured port name from `flinkConfig` when updating the rest 
service's target port in host-network mode
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
   - `ExternalServiceDecoratorTest#testDefaultRestServicePortName` — verifies 
the default port name `"rest"` is used when the option is unset
   - `ExternalServiceDecoratorTest#testCustomRestServicePortName` — verifies a 
custom port name (`"flink-rest"`) propagates to the built Service
   - `ServiceTypeTest#testGetRestPortFromExternalServiceWithDefaultName` — 
verifies the reader works for a Service with the default port name (back-compat)
   - `ServiceTypeTest#testGetRestPortFromExternalServiceWithCustomName` — 
verifies the reader works for a Service with a custom port name
   - `ServiceTypeTest#testGetRestPortFromExternalServiceFailsWhenNoPorts` — 
verifies the error path when the Service has no ports
   - All 106 existing tests in the kubeclient/services/decorators packages 
continue to pass (`mvn -pl flink-kubernetes 
-Dtest='*KubeClient*,*ServiceType*,*ServiceDecorator*,*JobManagerDecorator*,KubernetesResourceManagerDriverTest,KubernetesUtilsTest'
 test`)
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: yes — `KubernetesConfigOptions` is `@PublicEvolving`. Adds 
a new option (additive).
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: yes — affects native 
Kubernetes JobManager Service builder and `KubernetesResourceManagerDriver`. No 
behavior change at default.
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? yes
     - If yes, how is the feature documented? config option `withDescription` 
(auto-generated into the Flink config docs)
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (claude-opus-4-7)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to