dalelane opened a new pull request, #1259:
URL: https://github.com/apache/flink-kubernetes-operator/pull/1259

   This PR depends on #1223 
   
   Please only review the last **3 commits**, prefixed with FLINK-40862
   
   If it helps with reading, you can see a draft PR with just those three 
commits in my fork at 
https://github.com/dalelane/flink-kubernetes-operator/pull/1 
   
   ---
   
   Pending pull requests for 
[FLIP-611](https://cwiki.apache.org/confluence/spaces/FLINK/pages/451974246/FLIP-611+Running+Flink+jobs+in+MiniCluster+using+the+Kubernetes+Operator):
   - https://github.com/apache/flink-kubernetes-operator/pull/1223
   
   ---
   
   ## What is the purpose of the change
   
   Adds the Kubernetes object generation for the FlinkMiniCluster kind: a 
single-replica Deployment whose pod runs the Flink distribution's 
`bin/minicluster.sh` launcher, a Service exposing its REST endpoint, and a 
ConfigMap holding the Flink configuration and log configuration the launcher 
reads.
   
   The MiniCluster pod will be built by merging `spec.podTemplate` with the 
operator's own main-container definition, preserving any sidecars the user has 
declared.
   
   The launcher is invoked with `jars`, `job-classname` and `job-id` as named 
flags, with job arguments after `--`.  Other settings are in the mounted 
configuration file.
   
   Also add the FlinkConfigManager deploy and observe configuration methods for 
`FlinkMiniCluster`, mirroring the existing FlinkDeployment equivalents.
   
   Nothing calls this yet, the reconciler that deploys these objects will be 
added in a later sub-task. 
   
   ## Brief change log
   
   This pull request creates MiniClusterPodFactory to build the Kubernetes 
resources for a FlinkMiniCluster:
   
   - a single-replica Deployment that runs the minicluster.sh launcher
   - a Service that exposes the REST endpoint
   - a ConfigMap that holds the flink config and log config
   
   The launcher runs through the image entrypoint, in the same way as 
FlinkDeployment, so it runs as the flink user rather than root in the Flink 
images, and ENABLE_BUILT_IN_PLUGINS and jemalloc are consistent.
   
   Resources are built in the same way as for a standalone FlinkDeployment's 
JobManager: spec.podTemplate is loaded into the Kubernetes model shaded into 
flink-kubernetes, and decorated by Flink's decorators. Flink's 
InitJobManagerDecorator isn't used for FlinkMiniCluster, as it sets the 
container resources from the JobManager memory options (which would override 
spec.resources) and declares RPC and blob server ports that a MiniCluster 
doesn't listen on. InitMiniClusterDecorator applies the same pod options 
without those. A test is included that compares it against 
InitJobManagerDecorator so that changes in a future Flink version are detected.
   
   FlinkDeployment users don't need to specify spec.image, because a default is 
used if unspecified. FlinkMiniCluster inherits the same behaviour (and same 
image resolution precedence) for picking the main container image, but the 
default image is (currently) too old to include the minicluster.sh launcher it 
needs. This means that effectively spec.image becomes a required property until 
the default image is updated.
   
   Rather than add a FlinkMiniCluster-specific selection process or default 
image, I've favoured consistency and will document the effective requirement in 
FLINK-40869.
   
   ## Verifying this change
   
   This change added tests: 
   - InitMiniClusterDecoratorTest
   - MiniClusterPodFactoryTest
   - FlinkConfigManagerMiniClusterTest
   
   ## 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
   - Core observer or reconciler logic that is regularly executed: no
   
   ## Documentation
   
   - Does this pull request introduce a new feature?  yes 
   - If yes, how is the feature documented? Documenting the new feature will be 
done in FLINK-40869
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [x] Yes (please specify the tool below)
   
   Generated-by: Claude Opus 5.5
   (commit efdb931f1a958d8ce94100aaee3c6ef834eb48cb)


-- 
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