You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/06/03 12:00:13 UTC

[GitHub] [flink-kubernetes-operator] Miuler commented on a diff in pull request #252: [FLINK-27889] fix: Catch the error when last reconciled spec is null

Miuler commented on code in PR #252:
URL: https://github.com/apache/flink-kubernetes-operator/pull/252#discussion_r888877851


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/service/FlinkService.java:
##########
@@ -354,8 +355,54 @@ protected ClusterClient<String> getClusterClient(Configuration config) throws Ex
     }
 
     public void cancelJob(FlinkDeployment deployment, UpgradeMode upgradeMode) throws Exception {
-        var conf = configManager.getObserveConfig(deployment);
-        var deploymentStatus = deployment.getStatus();
+        Optional<String> savepointOpt = Optional.empty();
+
+        Configuration conf = null;
+        FlinkDeploymentStatus deploymentStatus = deployment.getStatus();
+        try {
+            conf = configManager.getObserveConfig(deployment);
+            savepointOpt = cancelJob(deployment, upgradeMode, conf, deploymentStatus);
+        } catch (LastReconciledSpecException e) {
+            LOG.warn("Last reconciled spec is null", e);

Review Comment:
   For some reason the deployment was corrupted, and could never finish starting, and it is impossible to delete it, impossible.
   
   This happened to me several times, in different namespaces.



##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/exception/LastReconciledSpecException.java:
##########
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+package org.apache.flink.kubernetes.operator.exception;
+
+/** Exception when last status is null. */
+public class LastReconciledSpecException extends RuntimeException {

Review Comment:
   For some reason the deployment was corrupted, and could never finish starting, and it is impossible to delete it, impossible.
   
   This happened to me several times, in different namespaces.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org