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 2021/09/13 02:33:30 UTC

[GitHub] [flink] KarmaGYZ commented on a change in pull request #17198: [FLINK-24212][kerbernets] fix the problem that kerberos krb5.conf file is mounted as empty directory, not a expected file

KarmaGYZ commented on a change in pull request #17198:
URL: https://github.com/apache/flink/pull/17198#discussion_r706958728



##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/decorators/KerberosMountDecorator.java
##########
@@ -107,7 +107,7 @@ public FlinkPod decorateFlinkPod(FlinkPod flinkPod) {
                             .withItems(
                                     new KeyToPathBuilder()
                                             .withKey(krb5Conf.getName())
-                                            .withPath(krb5Conf.getName())
+                                            .withPath("krb5.conf")

Review comment:
       nit: it would be good to introduce a constant for it in `org.apache.flink.kubernetes.utils.Constants`.

##########
File path: flink-kubernetes/src/test/java/org/apache/flink/kubernetes/kubeclient/decorators/KerberosMountDecoratorTest.java
##########
@@ -108,4 +135,36 @@ public void testDecoratedFlinkContainer() {
                 Constants.KERBEROS_KRB5CONF_MOUNT_DIR + "/krb5.conf",
                 krb5ConfVolumeMount.getMountPath());
     }
+
+    @Test
+    public void testDecoratedFlinkPodVolumes() {
+        final FlinkPod resultFlinkPod = kerberosMountDecorator.decorateFlinkPod(baseFlinkPod);
+        List<Volume> volumes = resultFlinkPod.getPodWithoutMainContainer().getSpec().getVolumes();
+        assertEquals(2, volumes.size());
+
+        final Volume keytabVolume =
+                volumes.stream()
+                        .filter(x -> x.getName().equals(Constants.KERBEROS_KEYTAB_VOLUME))
+                        .collect(Collectors.toList())
+                        .get(0);
+        final Volume krb5ConfVolume =
+                volumes.stream()
+                        .filter(x -> x.getName().equals(Constants.KERBEROS_KRB5CONF_VOLUME))
+                        .collect(Collectors.toList())
+                        .get(0);
+        assertNotNull(keytabVolume.getSecret());
+        assertEquals(
+                kerberosMountDecorator.getKerberosKeytabSecretName(
+                        testingKubernetesParameters.getClusterId()),
+                keytabVolume.getSecret().getSecretName());
+
+        assertNotNull(krb5ConfVolume.getConfigMap());
+        assertEquals(
+                kerberosMountDecorator.getKerberosKrb5confConfigMapName(

Review comment:
       ```suggestion
                   KerberosMountDecorator.getKerberosKrb5confConfigMapName(
   ```

##########
File path: flink-kubernetes/src/test/java/org/apache/flink/kubernetes/kubeclient/decorators/KerberosMountDecoratorTest.java
##########
@@ -108,4 +135,36 @@ public void testDecoratedFlinkContainer() {
                 Constants.KERBEROS_KRB5CONF_MOUNT_DIR + "/krb5.conf",
                 krb5ConfVolumeMount.getMountPath());
     }
+
+    @Test
+    public void testDecoratedFlinkPodVolumes() {
+        final FlinkPod resultFlinkPod = kerberosMountDecorator.decorateFlinkPod(baseFlinkPod);
+        List<Volume> volumes = resultFlinkPod.getPodWithoutMainContainer().getSpec().getVolumes();
+        assertEquals(2, volumes.size());
+
+        final Volume keytabVolume =
+                volumes.stream()
+                        .filter(x -> x.getName().equals(Constants.KERBEROS_KEYTAB_VOLUME))
+                        .collect(Collectors.toList())
+                        .get(0);
+        final Volume krb5ConfVolume =
+                volumes.stream()
+                        .filter(x -> x.getName().equals(Constants.KERBEROS_KRB5CONF_VOLUME))
+                        .collect(Collectors.toList())
+                        .get(0);
+        assertNotNull(keytabVolume.getSecret());
+        assertEquals(
+                kerberosMountDecorator.getKerberosKeytabSecretName(

Review comment:
       ```suggestion
                   KerberosMountDecorator.getKerberosKeytabSecretName(
   ```




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