wangyang0918 commented on a change in pull request #13644:
URL: https://github.com/apache/flink/pull/13644#discussion_r508988440



##########
File path: 
flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/FlinkKubeClient.java
##########
@@ -104,6 +106,67 @@ KubernetesWatch watchPodsAndDoCallback(
                Map<String, String> labels,
                WatchCallbackHandler<KubernetesPod> podCallbackHandler);
 
+       /**
+        * Create the ConfigMap with specified content. If the ConfigMap 
already exists, a FlinkRuntimeException will be
+        * thrown.
+        *
+        * @param configMap ConfigMap.
+        *
+        * @return Return the ConfigMap create future.
+        */
+       CompletableFuture<Void> createConfigMap(KubernetesConfigMap configMap);
+
+       /**
+        * Get the ConfigMap with specified name.
+        *
+        * @param name ConfigMap name.
+        *
+        * @return Return the ConfigMap, or empty if the ConfigMap does not 
exist.
+        */
+       Optional<KubernetesConfigMap> getConfigMap(String name);
+
+       /**
+        * Update an existing ConfigMap with the data. Benefit from <a 
href=https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions>
+        * resource version</a> and combined with {@link 
#getConfigMap(String)}, we could perform a get-check-and-update
+        * transactional operation. Since concurrent modification could happen 
on a same ConfigMap,
+        * the update operation may fail. We need to retry internally. The max 
retry attempts could be
+        * configured via {@link 
org.apache.flink.kubernetes.configuration.KubernetesConfigOptions#KUBERNETES_TRANSACTIONAL_OPERATION_MAX_RETRIES}.
+        *
+        * @param configMapName ConfigMap to be replaced with.
+        * @param function      Function to be applied to the obtained 
ConfigMap and get a new updated one. If the returned

Review comment:
       If we have an exception in the `updateFunction`, we convert it to the 
unchecked exception and retry again. Since a new retry attempt will get the 
latest ConfigMap, the `updateFunction` could then execute successfully.




----------------------------------------------------------------
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.

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


Reply via email to