[FLINK-29851] Optimize poms and drop flink-kubernetes-shaded module
diff --git a/Dockerfile b/Dockerfile
index 64380f0..e1e90c4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -28,7 +28,7 @@
RUN cd /app/tools/license; mkdir jars; cd jars; \
cp /app/flink-kubernetes-operator/target/flink-kubernetes-operator-*-shaded.jar . && \
cp /app/flink-kubernetes-webhook/target/flink-kubernetes-webhook-*-shaded.jar . && \
- cp /app/flink-kubernetes-shaded/target/flink-kubernetes-shaded-*.jar . && \
+ cp /app/flink-kubernetes-standalone/target/flink-kubernetes-shaded-*.jar . && \
cp -r /app/flink-kubernetes-operator/target/plugins ./plugins && \
cd ../ && ./collect_license_files.sh ./jars ./licenses-output
@@ -46,7 +46,7 @@
COPY --from=build /app/flink-kubernetes-operator/target/$OPERATOR_JAR .
COPY --from=build /app/flink-kubernetes-webhook/target/$WEBHOOK_JAR .
-COPY --from=build /app/flink-kubernetes-shaded/target/$FLINK_KUBERNETES_SHADED_JAR .
+COPY --from=build /app/flink-kubernetes-standalone/target/$FLINK_KUBERNETES_SHADED_JAR .
COPY --from=build /app/flink-kubernetes-operator/target/plugins $FLINK_HOME/plugins
COPY --from=build /app/tools/license/licenses-output/NOTICE .
COPY --from=build /app/tools/license/licenses-output/licenses ./licenses
diff --git a/flink-kubernetes-operator-api/pom.xml b/flink-kubernetes-operator-api/pom.xml
index c6c2848..f0b5bbd 100644
--- a/flink-kubernetes-operator-api/pom.xml
+++ b/flink-kubernetes-operator-api/pom.xml
@@ -73,7 +73,7 @@
<groupId>com.squareup.okhttp3</groupId>
<artifactId>*</artifactId>
</exclusion>
- </exclusions>
+ </exclusions>
</dependency>
<!-- Utils -->
diff --git a/flink-kubernetes-operator/pom.xml b/flink-kubernetes-operator/pom.xml
index 763d46e..d7a3f41 100644
--- a/flink-kubernetes-operator/pom.xml
+++ b/flink-kubernetes-operator/pom.xml
@@ -92,15 +92,16 @@
<dependency>
<groupId>org.apache.flink</groupId>
- <artifactId>flink-kubernetes-shaded</artifactId>
+ <artifactId>flink-kubernetes-standalone</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>io.fabric8</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-kubernetes</artifactId>
+ <version>${flink.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
diff --git a/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/service/StandaloneFlinkService.java b/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/service/StandaloneFlinkService.java
index c79536a..41378a1 100644
--- a/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/service/StandaloneFlinkService.java
+++ b/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/service/StandaloneFlinkService.java
@@ -99,8 +99,7 @@
}
@VisibleForTesting
- protected FlinkStandaloneKubeClient createNamespacedKubeClient(
- Configuration configuration, String namespace) {
+ protected FlinkStandaloneKubeClient createNamespacedKubeClient(Configuration configuration) {
final int poolSize =
configuration.get(KubernetesConfigOptions.KUBERNETES_CLIENT_IO_EXECUTOR_POOL_SIZE);
@@ -109,17 +108,12 @@
poolSize,
new ExecutorThreadFactory("flink-kubeclient-io-for-standalone-service"));
- return new Fabric8FlinkStandaloneKubeClient(
- configuration,
- Fabric8FlinkStandaloneKubeClient.createNamespacedKubeClient(namespace),
- executorService);
+ return Fabric8FlinkStandaloneKubeClient.create(configuration, executorService);
}
protected void submitClusterInternal(Configuration conf, Mode mode)
throws ClusterDeploymentException {
- final String namespace = conf.get(KubernetesConfigOptions.NAMESPACE);
-
- FlinkStandaloneKubeClient client = createNamespacedKubeClient(conf, namespace);
+ FlinkStandaloneKubeClient client = createNamespacedKubeClient(conf);
try (final KubernetesStandaloneClusterDescriptor kubernetesClusterDescriptor =
new KubernetesStandaloneClusterDescriptor(conf, client)) {
switch (mode) {
diff --git a/flink-kubernetes-shaded/pom.xml b/flink-kubernetes-shaded/pom.xml
deleted file mode 100644
index 588feaa..0000000
--- a/flink-kubernetes-shaded/pom.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-kubernetes-operator-parent</artifactId>
- <version>1.3-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
-
- <artifactId>flink-kubernetes-shaded</artifactId>
- <name>Flink Kubernetes Shaded</name>
- <packaging>jar</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-kubernetes</artifactId>
- <version>${flink.version}</version>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-kubernetes-standalone</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- FLINK-29384, Since the transitive snakeyaml that we are filtering out from
- flink-kubernetes was relocated we have to bundle a relocated new version -->
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>${snakeyaml.version}</version>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>3.3.0</version>
- <executions>
- <execution>
- <id>shade-flink-operator</id>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <artifactSet>
- <includes combine.children="append">
- <include>*:*</include>
- </includes>
- </artifactSet>
- <relocations>
- <relocation>
- <pattern>io.fabric8</pattern>
- <shadedPattern>org.apache.flink.kubernetes.shaded.io.fabric8</shadedPattern>
- </relocation>
- <!-- FLINK-29384, Since the transitive snakeyaml that we are filtering out from
- flink-kubernetes was relocated we have to bundle a relocated new version -->
- <relocation>
- <pattern>org.yaml.snakeyaml</pattern>
- <shadedPattern>org.apache.flink.kubernetes.shaded.org.yaml.snakeyaml</shadedPattern>
- </relocation>
- </relocations>
- <filters>
- <filter>
- <artifact>*:*</artifact>
- <excludes>
- <exclude>META-INF/DEPENDENCIES</exclude>
- <exclude>META-INF/LICENSE</exclude>
- <exclude>META-INF/MANIFEST.MF</exclude>
- <exclude>org/apache/flink/kubernetes/shaded/org/yaml/snakeyaml/**</exclude>
- </excludes>
- </filter>
- </filters>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/flink-kubernetes-standalone/pom.xml b/flink-kubernetes-standalone/pom.xml
index 462a661..57916fb 100644
--- a/flink-kubernetes-standalone/pom.xml
+++ b/flink-kubernetes-standalone/pom.xml
@@ -34,19 +34,15 @@
<packaging>jar</packaging>
<dependencies>
+
<dependency>
- <groupId>io.fabric8</groupId>
- <artifactId>kubernetes-client</artifactId>
- <version>5.12.3</version>
- <!-- FLINK-29384, can be removed when fabric8 pulls snakeyaml 1.32+ -->
- <exclusions>
- <exclusion>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- </exclusion>
- </exclusions>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-kubernetes</artifactId>
+ <version>${flink.version}</version>
</dependency>
+ <!-- FLINK-29384, Since the transitive snakeyaml that we are filtering out from
+ flink-kubernetes was relocated we have to bundle a relocated new version -->
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
@@ -55,20 +51,9 @@
<dependency>
<groupId>org.apache.flink</groupId>
- <artifactId>flink-kubernetes</artifactId>
- <version>${flink.version}</version>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
<artifactId>flink-clients</artifactId>
<version>${flink.version}</version>
+ <scope>provided</scope>
</dependency>
<!-- Test -->
@@ -92,28 +77,56 @@
<version>${fabric8.version}</version>
<scope>test</scope>
</dependency>
-
- <!-- okhttp -->
- <!--
- Regarding the okhttp explicit version
- see https://github.com/fabric8io/kubernetes-client/issues/4290
- and https://issues.apache.org/jira/browse/FLINK-28637
- -->
- <dependency>
- <groupId>com.squareup.okhttp3</groupId>
- <artifactId>okhttp</artifactId>
- <version>${okhttp.version}</version>
- </dependency>
- <dependency>
- <groupId>com.squareup.okhttp3</groupId>
- <artifactId>logging-interceptor</artifactId>
- <version>${okhttp.version}</version>
- </dependency>
- <dependency>
- <groupId>com.squareup.okhttp3</groupId>
- <artifactId>mockwebserver</artifactId>
- <version>${okhttp.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>3.3.0</version>
+ <executions>
+ <execution>
+ <id>shade-flink-operator</id>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <finalName>flink-kubernetes-shaded-${project.version}</finalName>
+ <artifactSet>
+ <includes combine.children="append">
+ <include>org.apache.flink:flink-kubernetes</include>
+ <include>org.yaml:snakeyaml</include>
+ </includes>
+ </artifactSet>
+ <relocations>
+ <relocation>
+ <pattern>io.fabric8</pattern>
+ <shadedPattern>org.apache.flink.kubernetes.shaded.io.fabric8</shadedPattern>
+ </relocation>
+ <!-- FLINK-29384, Since the transitive snakeyaml that we are filtering out from
+ flink-kubernetes was relocated we have to bundle a relocated new version -->
+ <relocation>
+ <pattern>org.yaml.snakeyaml</pattern>
+ <shadedPattern>org.apache.flink.kubernetes.shaded.org.yaml.snakeyaml</shadedPattern>
+ </relocation>
+ </relocations>
+ <filters>
+ <filter>
+ <artifact>*:*</artifact>
+ <excludes>
+ <exclude>META-INF/DEPENDENCIES</exclude>
+ <exclude>META-INF/LICENSE</exclude>
+ <exclude>META-INF/MANIFEST.MF</exclude>
+ <exclude>org/apache/flink/kubernetes/shaded/org/yaml/snakeyaml/**</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/flink-kubernetes-standalone/src/main/java/org/apache/flink/kubernetes/operator/kubeclient/Fabric8FlinkStandaloneKubeClient.java b/flink-kubernetes-standalone/src/main/java/org/apache/flink/kubernetes/operator/kubeclient/Fabric8FlinkStandaloneKubeClient.java
index 45454dd..b09b667 100644
--- a/flink-kubernetes-standalone/src/main/java/org/apache/flink/kubernetes/operator/kubeclient/Fabric8FlinkStandaloneKubeClient.java
+++ b/flink-kubernetes-standalone/src/main/java/org/apache/flink/kubernetes/operator/kubeclient/Fabric8FlinkStandaloneKubeClient.java
@@ -17,7 +17,9 @@
package org.apache.flink.kubernetes.operator.kubeclient;
+import org.apache.flink.annotation.VisibleForTesting;
import org.apache.flink.configuration.Configuration;
+import org.apache.flink.kubernetes.configuration.KubernetesConfigOptions;
import org.apache.flink.kubernetes.kubeclient.Fabric8FlinkKubeClient;
import org.apache.flink.kubernetes.operator.utils.StandaloneKubernetesUtils;
@@ -35,6 +37,7 @@
private final NamespacedKubernetesClient internalClient;
+ @VisibleForTesting
public Fabric8FlinkStandaloneKubeClient(
Configuration flinkConfig,
NamespacedKubernetesClient client,
@@ -65,7 +68,11 @@
.delete();
}
- public static NamespacedKubernetesClient createNamespacedKubeClient(String namespace) {
- return new DefaultKubernetesClient().inNamespace(namespace);
+ public static Fabric8FlinkStandaloneKubeClient create(
+ Configuration conf, ExecutorService executorService) {
+ var client =
+ new DefaultKubernetesClient()
+ .inNamespace(conf.get(KubernetesConfigOptions.NAMESPACE));
+ return new Fabric8FlinkStandaloneKubeClient(conf, client, executorService);
}
}
diff --git a/pom.xml b/pom.xml
index 7456a6e..3f804d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,7 +52,6 @@
<modules>
<module>flink-kubernetes-standalone</module>
- <module>flink-kubernetes-shaded</module>
<module>flink-kubernetes-operator</module>
<module>flink-kubernetes-operator-api</module>
<module>flink-kubernetes-webhook</module>
@@ -64,7 +63,6 @@
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
- <maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
<maven-surefire-plugin.version>3.0.0-M4</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>3.0.0-M5</maven-failsafe-plugin.version>
@@ -84,7 +82,6 @@
<slf4j.version>1.7.36</slf4j.version>
<log4j.version>2.17.1</log4j.version>
<junit.jupiter.version>5.8.2</junit.jupiter.version>
- <jetbrains.version>13.0</jetbrains.version>
<spotless.version>2.4.2</spotless.version>
<it.skip>true</it.skip>
@@ -92,7 +89,6 @@
<hamcrest.version>1.3</hamcrest.version>
<okhttp.version>4.10.0</okhttp.version>
-
<snakeyaml.version>1.33</snakeyaml.version>
</properties>