You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by gy...@apache.org on 2022/11/10 17:44:17 UTC

[flink-kubernetes-operator] branch main updated: [FLINK-29936] Add option to ignore informer errors on startup

This is an automated email from the ASF dual-hosted git repository.

gyfora pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-kubernetes-operator.git


The following commit(s) were added to refs/heads/main by this push:
     new 03416c34 [FLINK-29936] Add option to ignore informer errors on startup
03416c34 is described below

commit 03416c345408b0facd9637c0f9efb9ff7514194d
Author: Gyula Fora <g_...@apple.com>
AuthorDate: Wed Nov 9 12:40:39 2022 +0100

    [FLINK-29936] Add option to ignore informer errors on startup
---
 .../generated/kubernetes_operator_config_configuration.html       | 6 ++++++
 docs/layouts/shortcodes/generated/system_advanced_section.html    | 6 ++++++
 .../java/org/apache/flink/kubernetes/operator/FlinkOperator.java  | 6 ++++++
 .../operator/config/KubernetesOperatorConfigOptions.java          | 8 ++++++++
 .../org/apache/flink/kubernetes/operator/FlinkOperatorTest.java   | 3 +++
 5 files changed, 29 insertions(+)

diff --git a/docs/layouts/shortcodes/generated/kubernetes_operator_config_configuration.html b/docs/layouts/shortcodes/generated/kubernetes_operator_config_configuration.html
index ffd1768f..48bc0a63 100644
--- a/docs/layouts/shortcodes/generated/kubernetes_operator_config_configuration.html
+++ b/docs/layouts/shortcodes/generated/kubernetes_operator_config_configuration.html
@@ -236,6 +236,12 @@
             <td>Duration</td>
             <td>The interval before a savepoint trigger attempt is marked as unsuccessful.</td>
         </tr>
+        <tr>
+            <td><h5>kubernetes.operator.startup.stop-on-informer-error</h5></td>
+            <td style="word-wrap: break-word;">true</td>
+            <td>Boolean</td>
+            <td>Whether informer errors should stop operator startup. If false, the startup will ignore recoverable errors, caused for example by RBAC issues and will retry periodically.</td>
+        </tr>
         <tr>
             <td><h5>kubernetes.operator.user.artifacts.base.dir</h5></td>
             <td style="word-wrap: break-word;">"/opt/flink/artifacts"</td>
diff --git a/docs/layouts/shortcodes/generated/system_advanced_section.html b/docs/layouts/shortcodes/generated/system_advanced_section.html
index a47d7df2..1a89d3d3 100644
--- a/docs/layouts/shortcodes/generated/system_advanced_section.html
+++ b/docs/layouts/shortcodes/generated/system_advanced_section.html
@@ -74,5 +74,11 @@
             <td>Integer</td>
             <td>Maximum number threshold of savepoint history entries to retain.</td>
         </tr>
+        <tr>
+            <td><h5>kubernetes.operator.startup.stop-on-informer-error</h5></td>
+            <td style="word-wrap: break-word;">true</td>
+            <td>Boolean</td>
+            <td>Whether informer errors should stop operator startup. If false, the startup will ignore recoverable errors, caused for example by RBAC issues and will retry periodically.</td>
+        </tr>
     </tbody>
 </table>
diff --git a/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/FlinkOperator.java b/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/FlinkOperator.java
index 2808fae4..78d106f3 100644
--- a/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/FlinkOperator.java
+++ b/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/FlinkOperator.java
@@ -24,6 +24,7 @@ import org.apache.flink.core.plugin.PluginManager;
 import org.apache.flink.core.plugin.PluginUtils;
 import org.apache.flink.kubernetes.operator.api.listener.FlinkResourceListener;
 import org.apache.flink.kubernetes.operator.config.FlinkConfigManager;
+import org.apache.flink.kubernetes.operator.config.KubernetesOperatorConfigOptions;
 import org.apache.flink.kubernetes.operator.controller.FlinkDeploymentController;
 import org.apache.flink.kubernetes.operator.controller.FlinkSessionJobController;
 import org.apache.flink.kubernetes.operator.health.OperatorHealthService;
@@ -117,6 +118,11 @@ public class FlinkOperator {
         if (configManager.getOperatorConfiguration().isJosdkMetricsEnabled()) {
             overrider.withMetrics(new OperatorJosdkMetrics(metricGroup, configManager));
         }
+
+        overrider.withStopOnInformerErrorDuringStartup(
+                configManager
+                        .getDefaultConfig()
+                        .get(KubernetesOperatorConfigOptions.OPERATOR_STOP_ON_INFORMER_ERROR));
     }
 
     @VisibleForTesting
diff --git a/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/config/KubernetesOperatorConfigOptions.java b/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/config/KubernetesOperatorConfigOptions.java
index 8e229b80..9053531c 100644
--- a/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/config/KubernetesOperatorConfigOptions.java
+++ b/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/config/KubernetesOperatorConfigOptions.java
@@ -346,6 +346,14 @@ public class KubernetesOperatorConfigOptions {
                     .defaultValue(8085)
                     .withDescription("The port the health probe will use to expose the status.");
 
+    @Documentation.Section(SECTION_ADVANCED)
+    public static final ConfigOption<Boolean> OPERATOR_STOP_ON_INFORMER_ERROR =
+            operatorConfig("startup.stop-on-informer-error")
+                    .booleanType()
+                    .defaultValue(true)
+                    .withDescription(
+                            "Whether informer errors should stop operator startup. If false, the startup will ignore recoverable errors, caused for example by RBAC issues and will retry periodically.");
+
     @Documentation.Section(SECTION_DYNAMIC)
     public static final ConfigOption<Boolean> OPERATOR_CLUSTER_HEALTH_CHECK_ENABLED =
             operatorConfig("cluster.health-check.enabled")
diff --git a/flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/FlinkOperatorTest.java b/flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/FlinkOperatorTest.java
index cf5bb68c..5b01c493 100644
--- a/flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/FlinkOperatorTest.java
+++ b/flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/FlinkOperatorTest.java
@@ -45,6 +45,7 @@ public class FlinkOperatorTest {
         operatorConfig.setInteger(
                 KubernetesOperatorConfigOptions.OPERATOR_RECONCILE_PARALLELISM, testParallelism);
         operatorConfig.set(KubernetesOperatorConfigOptions.OPERATOR_LABEL_SELECTOR, testSelector);
+        operatorConfig.set(KubernetesOperatorConfigOptions.OPERATOR_STOP_ON_INFORMER_ERROR, false);
 
         var testOperator = new FlinkOperator(operatorConfig);
         testOperator.registerDeploymentController();
@@ -64,6 +65,8 @@ public class FlinkOperatorTest {
                         .map(ControllerConfiguration::getLabelSelector);
 
         labelSelectors.forEach(selector -> Assertions.assertEquals(testSelector, selector));
+        Assertions.assertFalse(
+                ConfigurationServiceProvider.instance().stopOnInformerErrorDuringStartup());
 
         // TODO: Overriding operator configuration twice in JOSDK v3 yields IllegalStateException
         var secondParallelism = 420;