Myracle commented on code in PR #27523:
URL: https://github.com/apache/flink/pull/27523#discussion_r2944251805


##########
flink-kubernetes/src/main/java/org/apache/flink/kubernetes/configuration/KubernetesConfigOptions.java:
##########
@@ -586,6 +586,85 @@ public class KubernetesConfigOptions {
                             "The node label whose value is the same as the 
node name. "
                                     + "Currently, this will only be used to 
set the node affinity of TM pods to avoid being scheduled on blocked nodes.");
 
+    /**
+     * The user-specified PersistentVolumeClaims (PVCs) that will be mounted 
into Flink containers.
+     *
+     * <p>The value should be in the form of {@code pvc-name:/mount/path} 
separated by commas.
+     * Multiple PVCs can be specified by separating them with commas.
+     *
+     * <p>Example: {@code 
checkpoint-pvc:/opt/flink/checkpoints,data-pvc:/opt/flink/data}
+     *
+     * <p>Prerequisites:
+     *
+     * <ul>
+     *   <li>The PVCs must exist in the same namespace as the Flink cluster 
before deployment
+     *   <li>The PVCs must have appropriate access modes:
+     *       <ul>
+     *         <li>ReadWriteOnce (RWO): For single pod access
+     *         <li>ReadWriteMany (RWX): For multiple pods (recommended for HA 
setups)
+     *         <li>ReadOnlyMany (ROX): For read-only access from multiple pods
+     *       </ul>
+     * </ul>
+     *
+     * <p>Common use cases:
+     *
+     * <ul>
+     *   <li>Checkpoint storage: Mount a shared PVC for storing checkpoints
+     *   <li>Savepoint storage: Mount a PVC for savepoint data
+     *   <li>Shared data: Mount read-only PVCs containing reference data
+     *   <li>Job artifacts: Mount PVCs containing job JARs or dependencies
+     * </ul>
+     */
+    public static final ConfigOption<Map<String, String>> 
KUBERNETES_PERSISTENT_VOLUME_CLAIMS =
+            key("kubernetes.persistent-volume-claims")
+                    .mapType()
+                    .noDefaultValue()
+                    .withDescription(
+                            Description.builder()
+                                    .text(
+                                            "The user-specified %s that will 
be mounted into Flink containers. "
+                                                    + "The value should be in 
the form of %s. "
+                                                    + "Multiple PVCs can be 
specified, for example: %s. "
+                                                    + "The PVCs must exist in 
the same namespace as the Flink cluster before deployment. "
+                                                    + "For HA setups with 
multiple JobManagers or TaskManagers accessing the same storage, "
+                                                    + "use PVCs with 
ReadWriteMany (RWX) or ReadOnlyMany (ROX) access modes.",
+                                            link(
+                                                    
"https://kubernetes.io/docs/concepts/storage/persistent-volumes/";,
+                                                    "PersistentVolumeClaims 
(PVCs)"),
+                                            code("pvc-name:/mount/path"),
+                                            code(
+                                                    
"checkpoint-pvc:/opt/flink/checkpoints,data-pvc:/opt/flink/data"))
+                                    .build());
+
+    /**
+     * Whether to mount PersistentVolumeClaims (PVCs) as read-only.
+     *
+     * <p>When set to true, all PVCs configured via {@link 
#KUBERNETES_PERSISTENT_VOLUME_CLAIMS}
+     * will be mounted as read-only. This is useful when the PVC contains 
shared data that should
+     * not be modified by Flink, such as reference datasets or pre-trained 
models.
+     *
+     * <p>Note: This setting applies globally to all PVCs configured via {@link
+     * #KUBERNETES_PERSISTENT_VOLUME_CLAIMS}. If you need different access 
modes for different PVCs,
+     * consider using pod templates instead.
+     *
+     * <p>Default: false (read-write mode)
+     */
+    public static final ConfigOption<Boolean> 
KUBERNETES_PERSISTENT_VOLUME_CLAIM_READ_ONLY =
+            key("kubernetes.persistent-volume-claim-read-only")
+                    .booleanType()
+                    .defaultValue(false)
+                    
.withDeprecatedKeys("kubernetes.persistent-volume-claims.read-only")

Review Comment:
   Good catch on both points. Removed the withDeprecatedKeys — this is a new 
option so there's nothing to deprecate, and as you noted 
kubernetes.persistent-volume-claims.read-only would clash with the map-type 
parent key. The current key kubernetes.persistent-volume-claim-read-only avoids 
the prefix conflict.



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

Reply via email to