gyfora commented on code in PR #712:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/712#discussion_r1415689682


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/service/AbstractFlinkService.java:
##########
@@ -1075,4 +1106,59 @@ protected void 
updateStatusAfterClusterDeletion(FlinkDeploymentStatus status) {
             status.getJobStatus().setState(JobStatus.FINISHED.name());
         }
     }
+
+    private Configuration getOperatorRestConfig(Configuration origConfig) 
throws IOException {
+        Configuration conf = new Configuration(origConfig);
+        EnvUtils.get(EnvUtils.ENV_OPERATOR_TRUSTSTORE_PATH)
+                .ifPresent(
+                        path -> {
+                            if (Files.notExists(Paths.get(path))) {
+                                return;
+                            }
+                            conf.set(
+                                    SecurityOptions.SSL_REST_TRUSTSTORE,
+                                    
EnvUtils.getRequired(EnvUtils.ENV_OPERATOR_TRUSTSTORE_PATH));
+                            conf.set(
+                                    
SecurityOptions.SSL_REST_TRUSTSTORE_PASSWORD,
+                                    
EnvUtils.getRequired(EnvUtils.ENV_OPERATOR_KEYSTORE_PASSWORD));
+                            if 
(SecurityOptions.isRestSSLAuthenticationEnabled(conf)
+                                    && 
EnvUtils.get(EnvUtils.ENV_OPERATOR_KEYSTORE_PATH)
+                                            .isPresent()) {
+                                conf.set(
+                                        SecurityOptions.SSL_REST_KEYSTORE,
+                                        
EnvUtils.getRequired(EnvUtils.ENV_OPERATOR_KEYSTORE_PATH));
+                                conf.set(
+                                        
SecurityOptions.SSL_REST_KEYSTORE_PASSWORD,
+                                        EnvUtils.getRequired(
+                                                
EnvUtils.ENV_OPERATOR_KEYSTORE_PASSWORD));
+                                conf.set(
+                                        SecurityOptions.SSL_REST_KEY_PASSWORD,
+                                        EnvUtils.getRequired(
+                                                
EnvUtils.ENV_OPERATOR_KEYSTORE_PASSWORD));
+                            } else {
+                                
conf.removeConfig(SecurityOptions.SSL_REST_KEYSTORE);
+                                
conf.removeConfig(SecurityOptions.SSL_REST_KEYSTORE_PASSWORD);
+                            }
+                            conf.removeConfig(SecurityOptions.SSL_TRUSTSTORE);
+                            
conf.removeConfig(SecurityOptions.SSL_TRUSTSTORE_PASSWORD);
+                            conf.removeConfig(SecurityOptions.SSL_KEYSTORE);
+                            
conf.removeConfig(SecurityOptions.SSL_KEYSTORE_PASSWORD);
+                        });
+        return conf;
+    }
+
+    private boolean isValidRuntimeException(Configuration conf, 
RuntimeException e) {

Review Comment:
   Please see my previous comment, I think we should get rid of this logic 
completely.



##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/service/AbstractFlinkService.java:
##########
@@ -195,8 +199,25 @@ public void submitApplicationCluster(
         if (requireHaMetadata) {
             validateHaMetadataExists(conf);
         }
+        try {
+            deployApplicationCluster(jobSpec, removeOperatorConfigs(conf));
+        } catch (RuntimeException e) {
+            LOG.warn("Caught Exception " + e.getMessage());
+            if (!isValidRuntimeException(conf, e)) {
+                throw e;
+            }
+        }

Review Comment:
   I am very confused by this logic, can we keep the previous logic and just 
let the exceptions fall through? What's the point of logging them? Deploy 
errors should result in errors



##########
helm/flink-kubernetes-operator/templates/flink-operator.yaml:
##########
@@ -229,6 +244,12 @@ spec:
             - key: keystore.p12
               path: keystore.p12
         {{- end }}
+        {{- if .Values.tls.create }}
+        - name: flink-operator-cert-secret
+          secret:
+            secretName: {{ .Values.tls.certSecret }}

Review Comment:
   this property could be called `.Values.tls.secretName` to be consistent



##########
helm/flink-kubernetes-operator/templates/flink-operator.yaml:
##########
@@ -110,6 +110,17 @@ spec:
               value: 
-Dlog4j.configurationFile=/opt/flink/conf/log4j-operator.properties
             - name: JVM_ARGS
               value: {{ .Values.jvmArgs.operator }}
+            {{- if .Values.tls.create }}
+            - name: OPERATOR_KEYSTORE_PATH
+              value: /opt/flink/artifacts/operator-cert/keystore.jks
+            - name: OPERATOR_TRUSTSTORE_PATH
+              value: /opt/flink/artifacts/operator-cert/truststore.jks
+            - name: OPERATOR_KEYSTORE_PASSWORD
+              valueFrom:
+                secretKeyRef:
+                  {{- toYaml .Values.tls.certPasswordSecretRef | nindent 18 }}

Review Comment:
   can we call this property `.Values.tls.secretKeyRef` ? that way it's obvious 
what is expected to go there



##########
helm/flink-kubernetes-operator/templates/flink-operator.yaml:
##########
@@ -130,6 +141,10 @@ spec:
             - name: flink-artifacts-volume
               mountPath: /opt/flink/artifacts
             {{- end }}
+          {{- if .Values.tls.create }}
+            - name: flink-operator-cert-secret
+              mountPath: /opt/flink/artifacts/operator-cert

Review Comment:
   I don't think we can mount under `/opt/flink/artifacts` , this should not 
overlap and be something like `/opt/flink/certs` instead



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