[ 
https://issues.apache.org/jira/browse/FLINK-36073?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18147640#comment-18147640
 ] 

Ferenc Csaky commented on FLINK-36073:
--------------------------------------

I got busy and forgot about this, but now I had some time to play with it.

The problem is on the operator side. In standalone mode the operator puts the 
{{jarURI}} into {{{}pipeline.classpaths{}}}, and Flink parses those entries as 
{{{}java.net.URL{}}}, which has no handler for {{{}s3{}}}. In native mode it 
goes to {{pipeline.jars}} instead, which 
{{KubernetesApplicationClusterEntrypoint}} downloads through the filesystem 
plugins. Since Flink 1.19 (FLINK-28915) the standalone entrypoint can do the 
same with its {{--jars}} option, the operator just never passes it.

Until the fix is out, this works as a workaround on Flink 1.19+: leave 
{{jarURI}} unset and pass the jar as the first job argument. The operator 
appends the job args to the {{standalone-job}} command as they are, so Flink 
picks it up as its own option. The plugin setup from the description stays the 
same.
{code:yaml}
spec:   mode: standalone
  job:     args: ["--jars=s3://myDevBucket/myjob.jar", "--my-program-arg", 
"value"]
{code}
Two things to watch out for:
 * It has to be the {{\-\-jars=...}} form. {{\-\-jars}} accepts multiple 
values, so with {{"\-\-jars", "s3://..."}} as two separate args Flink also 
takes every following program argument as a JAR to fetch.
 * It only works in standalone mode. Native mode passes the job args to 
{{{}main(){}}}, so there the program would get {{\-\-jars=...}} as an argument.

I'll open a PR that does the same thing in the operator: for a non-local 
{{jarURI}} in standalone mode it passes {{\-\-jars}} instead of setting 
{{{}pipeline.classpaths{}}}.

> ApplicationMode with the K8s operator does not support downloading jars via 
> filesystem plugins
> ----------------------------------------------------------------------------------------------
>
>                 Key: FLINK-36073
>                 URL: https://issues.apache.org/jira/browse/FLINK-36073
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / Coordination
>    Affects Versions: 2.0.0, 1.20.0, 1.19.2
>            Reporter: Robert Metzger
>            Assignee: Ferenc Csaky
>            Priority: Major
>
> As discussed in this ticket https://issues.apache.org/jira/browse/FLINK-28915 
> we can not define a FlinkDeployment spec with
> {code}
> spec:
>   job:
>     jarURI: s3://myDevBucket/myjob.jar
> {code}
> It fails with:
> {code}
> org.apache.flink.container.entrypoint.StandaloneApplicationClusterEntryPoint.main(StandaloneApplicationClusterEntryPoint.java:89)
>  [flink-dist-1.19-x.jar:1.19-x]
> Caused by: java.net.MalformedURLException: unknown protocol: s3
>       at java.net.URL.<init>(URL.java:652) ~[?:?]
>       at java.net.URL.<init>(URL.java:541) ~[?:?]
>       at java.net.URL.<init>(URL.java:488) ~[?:?]
>       at 
> org.apache.flink.configuration.ConfigUtils.decodeListFromConfig(ConfigUtils.java:133)
>  ~[flink-dist-1.19-x.jar:1.19-x]
>       at 
> org.apache.flink.client.program.DefaultPackagedProgramRetriever.getClasspathsFromConfiguration(DefaultPackagedProgramRetriever.java:273)
>  ~[flink-dist-1.19-x.jar:1.19-x]
>       at 
> org.apache.flink.client.program.DefaultPackagedProgramRetriever.create(DefaultPackagedProgramRetriever.java:121)
>  ~[flink-dist-1.19-x.jar:1.19-x]
>       ... 4 more
> {code}
> even though I have defined:
> {code}
>   podTemplate:
>     spec:
>       containers:
>         - name: flink-main-container
>           env:
>             - name: ENABLE_BUILT_IN_PLUGINS
>               value: "flink-s3-fs-presto-1.19.0.jar"
> {code}



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to