Dennis-Mircea opened a new pull request, #1124:
URL: https://github.com/apache/flink-kubernetes-operator/pull/1124
## What is the purpose of the change
`FlinkVersion` had carried a contradiction since FLINK-37236 and FLINK-38147
added `@Deprecated` annotations to `v1_15` through `v1_18` without updating the
runtime check. Documentation, javadoc, and the deprecation annotations all
signaled those versions were unsupported, but `isSupported()` kept returning
`true` because the floor was still `v1_15`. Users got no
`UnsupportedFlinkVersion` events, no validation rejection, just a silent
acceptance of versions every other signal in the codebase declared dead.
FLINK-33089 had previously set the correct pattern (deprecate, raise the
runtime floor, update docs in lockstep), but that pattern drifted.
This PR restores that pattern, and goes one step further: instead of bumping
a literal floor in `isSupported()`, the supported set is now derived from the
`@Deprecated` annotations themselves. The annotation becomes the single source
of truth. Future deprecations only need to add `@Deprecated` to the enum
constant. There is no second site (the floor literal) to remember to update,
which was the drift mechanism the previous pattern depended on a human catching.
## Brief change log
- `FlinkVersion.isSupported()` now consults a private static `EnumSet`
populated once at class init by reflecting over each enum constant's
`@Deprecated` annotation. The `v1_15` (and now-unused `v1_19`) floor literal is
gone.
- Javadoc comments added for `v1_17` and `v1_18` ("Deprecated since 1.13
operator release") to match the pattern used for `v1_15` and `v1_16`.
- `FlinkVersionTest` extended with a full behavior table (rejects `null` and
`v1_13..v1_18`, accepts `v1_19..v2_4`) and a new structural-invariant test
`supportedSetMatchesDeprecatedAnnotation` that iterates `values()` and
cross-checks `isSupported(v) == [email protected](v)`. Any future
contributor who marks a version `@Deprecated` without thinking about the floor
will get a failing test, not a silent runtime regression.
- Test fixtures and assertions retargeted off deprecated versions: builder
defaults in `BaseTestUtils` and `TestUtils` moved to `v1_20`, parameterized
version sets shifted to `{v1_19, v1_20}`, `DefaultValidatorTest` now asserts
that `v1_15` and `v1_18` are rejected and `v1_19` is accepted, and the
`UnsupportedFlinkVersion` boundary in `FlinkDeploymentControllerTest` and
`FlinkSessionJobControllerTest` moved from `v1_15` to `v1_19`.
- Docs:
- English `docs/content/docs/custom-resource/overview.md` updated to list
only currently-supported versions (`v1_19`, `v1_20`, `v2_0`, `v2_1`, `v2_2`).
- English `docs/content/docs/custom-resource/reference.md` Notes column
updated for `v1_17` and `v1_18`.
- Chinese `docs/content.zh/docs/custom-resource/overview.md` and
`reference.md` brought to parity with the English versions (the Chinese
reference table was already drifted on `v1_15` and `v1_16`; this PR closes that
drift too).
- Drive-by: `ValidatorUtils.java` logger fix
(`LoggerFactory.getLogger(FlinkUtils.class)` was wrong, should have been
`ValidatorUtils.class`). Unrelated to the main change but trivially in scope of
the same file touched by the test discovery. Happy to split into a separate
`[hotfix]` if reviewers prefer.
## Verifying this change
This change is covered by existing tests plus the new `FlinkVersionTest`
cases.
## 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 changes to the `CustomResourceDescriptors`:
no. The `FlinkVersion` enum constants are unchanged. `@Deprecated` was already
present on `v1_15..v1_18` before this PR. The behavioral change is in
`isSupported()`, which is not part of the CRD surface.
- Core observer or reconciler logic that is regularly executed: yes, with a
user-visible behavior change. Deployments and session jobs with `flinkVersion`
in `v1_15..v1_18` will now produce an `UnsupportedFlinkVersion` warning event
from `ValidatorUtils.validateSupportedVersion()` and be rejected by
`DefaultValidator.validateFlinkVersion()`, where previously they were silently
accepted despite the `@Deprecated` annotation.
## Documentation
- Does this pull request introduce a new feature? No.
- Is documentation updated? Yes. The English and Chinese versions of
`overview.md` and `reference.md` under `docs/content*/docs/custom-resource/`
are updated to match the new runtime behavior. The Chinese reference table is
also brought to parity with the English one on rows it had drifted from earlier
(`v1_15`, `v1_16`).
--
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]