[ https://issues.apache.org/jira/browse/FLINK-21128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17272058#comment-17272058 ]
Yang Wang commented on FLINK-21128: ----------------------------------- [~chesnay] Thanks for creating this issue. I think your suggestion makes a lot of sense to me. Currently, the native K8s integration implementation is in a hybrid state, which uses both the JAVA codes and scripts to launch the JobManager and TaskManager pods. It is not very easy to maintain. I think we could introduce some dedicated scripts(e.g. {{kubernetes-application.sh}}, {{kubernetes-jobmanager.sh}}, {{kubernetes-taskmanager.sh}}) for native Kubernetes. Theses scripts will help with constructing the classpath, setting the logging and etc. Of cause, the duplicated logics implemented by java in {{flink-kubernetes}} module will be removed. Apart from these scripts, Flink java codes will generate some dynamic config options(e.g. {{-D jobmanager.memory.off-heap.size=134217728b -D jobmanager.memory.jvm-overhead.min=858993472b}}) and easily pass them to the script. > Rethink how Kubernetes interfaces with our docker image > ------------------------------------------------------- > > Key: FLINK-21128 > URL: https://issues.apache.org/jira/browse/FLINK-21128 > Project: Flink > Issue Type: Improvement > Components: Deployment / Kubernetes, Deployment / Scripts > Reporter: Chesnay Schepler > Priority: Major > Fix For: 1.13.0 > > > Our native Kubernetes integration assembles a {{java}} command that is passed > to the docker-script, which first does some magical stuff to create the > classpath > {code} > # Set the Flink related environments > export _FLINK_HOME_DETERMINED=true > . $FLINK_HOME/bin/config.sh > export FLINK_CLASSPATH="`constructFlinkClassPath`:$INTERNAL_HADOOP_CLASSPATHS" > {code} > and then evaluates the given java command. > This magical stuff is a bit problematic for a few reasons: > 1) it is _only_ required for Kubernetes to work; it should not be executed in > any other case > 2) it appears to be required for running anything in Flink that is not part > of the docker-entrypoint API (e.g., jobmanager) when it isn't. > 3) it unnecessarily spreads kubernetes-specific logic across the flink and > flink-docker repositories. > A simple change would be to introduce dedicated Kubernetes scripts into the > distribution, which for starters will just import {{config.sh}}, export > FLINK_CLASSPATH and evaluate the given command. > In the long-run it would be good if we would not create a java command but > instead relied on the existing scripts which do exactly that already. > As is stands we're duplicating code across the distribution and the > Kubernetes module, which already caused troubles when we did the log4j2 > migration. > Ideally we find a way to reuse the existing code in the Kubernetes module for > generating these commands in the existing scripts, e.g., by moving them to > the BashJavaUtils. -- This message was sent by Atlassian Jira (v8.3.4#803005)