Aitozi commented on a change in pull request #38:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/38#discussion_r821280505
##########
File path:
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/config/FlinkOperatorConfiguration.java
##########
@@ -20,25 +20,17 @@
import org.apache.flink.configuration.Configuration;
+import lombok.Value;
+
/** Configuration class for operator. */
+@Value
public class FlinkOperatorConfiguration {
private final int reconcileIntervalInSec;
private final int portCheckIntervalInSec;
- public FlinkOperatorConfiguration(int reconcileIntervalInSec, int
portCheckIntervalInSec) {
- this.reconcileIntervalInSec = reconcileIntervalInSec;
- this.portCheckIntervalInSec = portCheckIntervalInSec;
- }
-
- public int getReconcileIntervalInSec() {
- return reconcileIntervalInSec;
- }
-
- public int getPortCheckIntervalInSec() {
- return portCheckIntervalInSec;
- }
+ private final int savepointTriggerGracePeriodInSec;
Review comment:
nit: It seems we can remove the `private final` when use `@Value`.
##########
File path:
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/ReconciliationUtils.java
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.reconciler;
+
+import org.apache.flink.kubernetes.operator.crd.FlinkDeployment;
+import org.apache.flink.kubernetes.operator.crd.spec.FlinkDeploymentSpec;
+import org.apache.flink.kubernetes.operator.crd.status.ReconciliationStatus;
+import org.apache.flink.kubernetes.operator.utils.CloneUtils;
+
+/** Reconsiliation utilities. */
Review comment:
typo
##########
File path:
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/CloneUtils.java
##########
@@ -0,0 +1,41 @@
+/*
+ * 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.utils;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/** Utility class for cloning objects. */
+public class CloneUtils {
Review comment:
this is duplicate with
`org.apache.flink.kubernetes.operator.admission.admissioncontroller.clone.ObjectMapperCloner`
Can extract and use the common one
##########
File path:
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/ReconciliationUtils.java
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.reconciler;
+
+import org.apache.flink.kubernetes.operator.crd.FlinkDeployment;
+import org.apache.flink.kubernetes.operator.crd.spec.FlinkDeploymentSpec;
+import org.apache.flink.kubernetes.operator.crd.status.ReconciliationStatus;
+import org.apache.flink.kubernetes.operator.utils.CloneUtils;
+
+/** Reconsiliation utilities. */
+public class ReconciliationUtils {
+
+ public static void updateForSpecReconciliationSuccess(FlinkDeployment
flinkApp) {
+ ReconciliationStatus reconciliationStatus =
flinkApp.getStatus().getReconciliationStatus();
+ reconciliationStatus.setSuccess(true);
+ reconciliationStatus.setError(null);
+ FlinkDeploymentSpec clonedSpec = CloneUtils.clone(flinkApp.getSpec());
+ if (reconciliationStatus.getLastReconciledSpec() != null) {
+ int oldSavepointGeneration =
+
reconciliationStatus.getLastReconciledSpec().getJob().getSavepointGeneration();
+ clonedSpec.getJob().setSavepointGeneration(oldSavepointGeneration);
+ reconciliationStatus.setLastReconciledSpec(clonedSpec);
Review comment:
This can be out of the `if-else` block
##########
File path:
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/crd/status/SavepointInfo.java
##########
@@ -0,0 +1,34 @@
+/*
+ * 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.crd.status;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/** Stores savepoint related information. */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class SavepointInfo {
+ private Savepoint lastSavepoint;
+ private String triggerId;
+ private long triggerTimestamp;
Review comment:
Why not the `savepointGeneration` be part of the `Savepoint` when sync
this to the status
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]