vahmed-hamdy opened a new pull request, #30270:
URL: https://github.com/apache/flink/pull/30270
## What is the purpose of the change
Add the option `high-availability.kubernetes.config-map.owner-reference`. If
set, the owner references are added to the cluster HA ConfigMap, so that
Kubernetes garbage-collects it once all owners are deleted. This is needed when
the JobManager runs as a Deployment or StatefulSet, where a cluster shutdown
only restarts the container and the HA ConfigMap is recreated. If not set, no
owner references are added.
The cluster ConfigMap is created and patched by the fabric8 `ConfigMapLock`,
so the configured owner references are also applied to an existing cluster
ConfigMap on the next leadership acquisition or renewal.
## Brief change log
- Added `KubernetesHighAvailabilityOptions#HA_CONFIG_MAP_OWNER_REFERENCE`,
a list of maps with no default, in the expert Kubernetes HA documentation
section.
- Added `KubernetesUtils#getHighAvailabilityConfigMapOwnerReferences` to
turn the option into fabric8 `OwnerReference`s, reusing
`KubernetesOwnerReference`.
- `KubernetesLeaderElectionConfiguration` resolves the owner references
once and exposes them through `getOwnerReferences()`.
- `KubernetesLeaderElector` builds the lock's ConfigMap metadata through
`createConfigMapMetadata` and only sets owner references when configured, so
the owner references of an existing ConfigMap are left alone otherwise.
- Regenerated the configuration documentation.
## Verifying this change
This change added tests and can be verified as follows:
- Added `KubernetesLeaderElectorTest` cases that verify the created
ConfigMap has the configured owner references, or none if not configured.
- Added `KubernetesLeaderElectorTest` cases that verify configured owner
references are applied to an existing ConfigMap, and that existing owner
references are kept if the option is not set.
- Added `KubernetesUtilsTest` cases that verify the option is parsed into
owner references and yields an empty list if not configured.
## 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, a new option in `KubernetesHighAvailabilityOptions`
(`@PublicEvolving`)
- 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, the Kubernetes HA
ConfigMap metadata
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? yes
- If yes, how is the feature documented? docs (generated configuration
reference) and the option description
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code (Claude Sonnet 5.5)
--
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]