datavane / tis

Support agile DataOps Based on Flink, DataX and Flink-CDC, Chunjun with Web-UI
https://tis.pub
Apache License 2.0
1.04k stars 221 forks source link

aliyun ACK 测试flink-application模式增量通部署失败,须将TIS的JDK版本升级到JDK11 #365

Closed baisui1981 closed 1 month ago

baisui1981 commented 1 month ago

点击部署按钮之后在wait服务端部署完成节点报以下异常

Caused by: java.lang.IllegalArgumentException: The field `volumeMounts` in the JSON string is not defined in the `V1ContainerStatus` properties. JSON: 

{
    "name": "flink-main-container",
    "state": {
        "waiting": {
            "reason": "ContainerCreating"
        }
    },
    "lastState": {},
    "ready": false,
    "restartCount": 0,
    "image": "registry.cn-hangzhou.aliyuncs.com/tis/flink:4.0.1",
    "imageID": "",
    "started": false,
    "volumeMounts": [{
        "name": "flink-config-volume",
        "mountPath": "/opt/flink/conf"
    }, {
        "name": "kube-api-access-7j942",
        "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount",
        "readOnly": true,
        "recursiveReadOnly": "Disabled"
    }]
}

        at io.kubernetes.client.openapi.models.V1ContainerStatus.validateJsonObject(V1ContainerStatus.java:448)
        at io.kubernetes.client.openapi.models.V1PodStatus.validateJsonObject(V1PodStatus.java:661)
        at io.kubernetes.client.openapi.models.V1Pod.validateJsonObject(V1Pod.java:284)
        at io.kubernetes.client.openapi.models.V1Pod$CustomTypeAdapterFactory$1.read(V1Pod.java:309)
        at io.kubernetes.client.openapi.models.V1Pod$CustomTypeAdapterFactory$1.read(V1Pod.java:299)
        at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:204)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.readIntoField(ReflectiveTypeAdapterFactory.java:212)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:433)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:393)
        at com.google.gson.Gson.fromJson(Gson.java:1227)
        at com.google.gson.Gson.fromJson(Gson.java:1137)
        at com.google.gson.Gson.fromJson(Gson.java:1047)
        at com.google.gson.Gson.fromJson(Gson.java:1014)
        at io.kubernetes.client.openapi.JSON.deserialize(JSON.java:722)
        at io.kubernetes.client.util.Watch.parseLine(Watch.java:172)
        at io.kubernetes.client.util.Watch.next(Watch.java:128)
        at io.kubernetes.client.util.Watch.next(Watch.java:38)
        at com.qlangtech.tis.plugin.k8s.K8SUtils.waitReplicaControllerLaunch(K8SUtils.java:638)
        ... 138 common frames omitted
{
    "name": "flink-main-container",
    "state": {
        "waiting": {
            "reason": "ContainerCreating"
        }
    },
    "lastState": {},
    "ready": false,
    "restartCount": 0,
    "image": "registry.cn-hangzhou.aliyuncs.com/tis/flink:4.0.1",
    "imageID": "",
    "started": false,
    "volumeMounts": [{
        "name": "flink-config-volume",
        "mountPath": "/opt/flink/conf"
    }, {
        "name": "kube-api-access-7j942",
        "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount",
        "readOnly": true,
        "recursiveReadOnly": "Disabled"
    }]
}
baisui1981 commented 1 month ago

查阅了 k8s-java-api 的最新实现,https://github.com/kubernetes-client/java/blob/c6c92b0d54e9bd730e13913517b129d76ff53c92/kubernetes/src/main/java/io/kubernetes/client/openapi/models/V1ContainerStatus.java#L459 已经加上了volumeMounts 子元素

需要将依赖包升级到:

 <dependency>
            <groupId>io.kubernetes</groupId>
            <artifactId>client-java</artifactId>
            <version>21.0.1</version>
            <exclusions>
                <exclusion>
                    <groupId>com.sun</groupId>
                    <artifactId>tools</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

不过这个依赖包使用的是jdk11 构建的,导致TIS在编译项目时 报,如下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project tis-k8s-plugin: Compilation failure
[ERROR] /Users/mozhenghua/j2ee_solution/project/plugins/tis-k8s-plugin/src/main/java/com/qlangtech/tis/config/k8s/impl/DefaultK8SImage.java:[37,36] 无法访问io.kubernetes.client.openapi.ApiClient
[ERROR]   错误的类文件: /Users/mozhenghua/j2ee_solution/mvn_repository/io/kubernetes/client-java-api/21.0.0/client-java-api-21.0.0.jar(io/kubernetes/client/openapi/ApiClient.class)
[ERROR]     类文件具有错误的版本 55.0, 应为 52.0
[ERROR]     请删除该文件或确保该文件位于正确的类路径子目录中。

看了一下解决方案只有整体将TIS的JDK版本升级到JDK11了