Skip to content

Commit ce6784e

Browse files
committed
[FLINK-29851] Correctly depend on flink-kubernetes-standalone shaded classifier
1 parent 81d4342 commit ce6784e

File tree

4 files changed

+33
-13
lines changed

4 files changed

+33
-13
lines changed

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ RUN --mount=type=cache,target=/root/.m2 mvn -ntp clean install -pl !flink-kubern
2828
RUN cd /app/tools/license; mkdir jars; cd jars; \
2929
cp /app/flink-kubernetes-operator/target/flink-kubernetes-operator-*-shaded.jar . && \
3030
cp /app/flink-kubernetes-webhook/target/flink-kubernetes-webhook-*-shaded.jar . && \
31-
cp /app/flink-kubernetes-standalone/target/flink-kubernetes-shaded-*.jar . && \
31+
cp /app/flink-kubernetes-standalone/target/flink-kubernetes-standalone-*-shaded.jar . && \
3232
cp -r /app/flink-kubernetes-operator/target/plugins ./plugins && \
3333
cd ../ && ./collect_license_files.sh ./jars ./licenses-output
3434

@@ -38,7 +38,7 @@ ENV FLINK_HOME=/opt/flink
3838
ENV OPERATOR_VERSION=1.3-SNAPSHOT
3939
ENV OPERATOR_JAR=flink-kubernetes-operator-$OPERATOR_VERSION-shaded.jar
4040
ENV WEBHOOK_JAR=flink-kubernetes-webhook-$OPERATOR_VERSION-shaded.jar
41-
ENV FLINK_KUBERNETES_SHADED_JAR=flink-kubernetes-shaded-$OPERATOR_VERSION.jar
41+
ENV FLINK_KUBERNETES_SHADED_JAR=flink-kubernetes-standalone-$OPERATOR_VERSION-shaded.jar
4242

4343
WORKDIR /flink-kubernetes-operator
4444
RUN groupadd --system --gid=9999 flink && \

docs/content/docs/development/guide.md

+28-3
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,19 @@ docker@minikube:~$ exit
7171
```
7272

7373
### Installing the operator locally
74+
7475
```bash
7576
helm install flink-kubernetes-operator helm/flink-kubernetes-operator --set image.repository=<repo>/flink-kubernetes-operator --set image.tag=latest
7677
```
77-
### Running the operator locally
78+
79+
To uninstall you can simply call:
80+
81+
```bash
82+
helm uninstall flink-kubernetes-operator
83+
```
84+
85+
### Running the operator from the IDE
86+
7887
You can run or debug the `FlinkOperator` from your preferred IDE. The operator itself is accessing the deployed Flink clusters through the REST interface. When running locally the `rest.port`, `rest.address` and `kubernetes.rest-service.exposed.type` Flink configuration parameters must be modified.
7988

8089
When using `minikube tunnel` the rest service is exposed on `localhost:8081`
@@ -94,11 +103,26 @@ rest.address: localhost
94103
kubernetes.rest-service.exposed.type: LoadBalancer
95104
```
96105

97-
### Uninstalling the operator locally
106+
Due to fabric8 conflicts between core Flink and the operator, the `flink-kubernetes-operator` module depends on the shaded `flink-kubernetes-standalone` jar which contains the relocated version of the old fabric8 Kubernetes client. Unfortunately IntelliJ is not great at handling dependencies with classifiers so you might get the following error when trying to run `FlinkOperator#main`:
107+
108+
```
109+
java.lang.NoSuchMethodError: 'java.lang.Object io.fabric8.kubernetes.client.dsl.ServiceResource.fromServer()'
110+
```
111+
112+
There are two solutions to this problem, both requires you to first build the project.
113+
114+
First:
115+
98116
```bash
99-
helm uninstall flink-kubernetes-operator
117+
mvn clean install
100118
```
101119

120+
Then either:
121+
122+
1. Import the `flink-kubernetes-operator` submodule as a separate IntelliJ project. This will resolve the classifier dependency correctly from your local maven cache.
123+
2. If you want to keep a single multi-module project, you need to add the `flink-kubernetes-standalone-XX-shaded.jar` on the classpath manually when running the main method:
124+
`Edit Run Configuration/Modify Options/Modify Classpath`
125+
102126
### Generating and Upgrading the CRD
103127

104128
By default, the CRD is generated by the [Fabric8 CRDGenerator](https://github.com/fabric8io/kubernetes-client/blob/master/doc/CRD-generator.md), when building from source.
@@ -119,6 +143,7 @@ helm install flink-operator helm/flink-operator --set operatorVolumeMounts.creat
119143

120144

121145
## CI/CD
146+
122147
We use [GitHub Actions](https://help.github.com/en/actions/getting-started-with-github-actions/about-github-actions) to help you automate your software development workflows in the same place you store code and collaborate on pull requests and issues.
123148
You can write individual tasks, called actions, and combine them to create a custom workflow.
124149
Workflows are custom automated processes that you can set up in your repository to build, test, package, release, or deploy any code project on GitHub.

flink-kubernetes-operator/pom.xml

+1-7
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,7 @@ under the License.
9494
<groupId>org.apache.flink</groupId>
9595
<artifactId>flink-kubernetes-standalone</artifactId>
9696
<version>${project.version}</version>
97-
<scope>provided</scope>
98-
</dependency>
99-
100-
<dependency>
101-
<groupId>org.apache.flink</groupId>
102-
<artifactId>flink-kubernetes</artifactId>
103-
<version>${flink.version}</version>
97+
<classifier>shaded</classifier>
10498
<scope>provided</scope>
10599
</dependency>
106100

flink-kubernetes-standalone/pom.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ under the License.
9393
<goal>shade</goal>
9494
</goals>
9595
<configuration>
96-
<finalName>flink-kubernetes-shaded-${project.version}</finalName>
96+
<shadedArtifactAttached>true</shadedArtifactAttached>
97+
<shadedClassifierName>shaded</shadedClassifierName>
9798
<artifactSet>
9899
<includes combine.children="append">
99100
<include>org.apache.flink:flink-kubernetes</include>

0 commit comments

Comments
 (0)