You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by GitBox <gi...@apache.org> on 2022/02/23 12:57:45 UTC

[GitHub] [flink-kubernetes-operator] Aitozi opened a new pull request #18: [FLINK-26332]Move the operator env to common utils

Aitozi opened a new pull request #18:
URL: https://github.com/apache/flink-kubernetes-operator/pull/18


   Move the scattered environments variables to the `EnvUtils` and make it clear whether the variable is required


-- 
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: commits-unsubscribe@flink.apache.org

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



[GitHub] [flink-kubernetes-operator] gyfora commented on a change in pull request #18: [FLINK-26332]Move the operator env to common utils

Posted by GitBox <gi...@apache.org>.
gyfora commented on a change in pull request #18:
URL: https://github.com/apache/flink-kubernetes-operator/pull/18#discussion_r813544933



##########
File path: flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/EnvUtils.java
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.kubernetes.operator.utils;
+
+/** Util to get value from environments. */
+public class EnvUtils {
+
+    public static final String ENV_FLINK_OPERATOR_CONF_DIR = "FLINK_OPERATOR_CONF_DIR";
+    public static final String ENV_FLINK_CONF_DIR = "FLINK_CONF_DIR";
+    public static final String ENV_WEBHOOK_KEYSTORE_FILE = "WEBHOOK_KEYSTORE_FILE";
+    public static final String ENV_WEBHOOK_KEYSTORE_PASSWORD = "WEBHOOK_KEYSTORE_PASSWORD";
+    public static final String ENV_WEBHOOK_KEYSTORE_TYPE = "WEBHOOK_KEYSTORE_TYPE";
+    public static final String ENV_WEBHOOK_SERVER_PORT = "WEBHOOK_SERVER_PORT";
+    public static final String ENV_WATCHED_NAMESPACES = "FLINK_OPERATOR_WATCH_NAMESPACES";
+    public static final String ENV_HOSTNAME = "HOSTNAME";
+    public static final String ENV_OPERATOR_NAME = "OPERATOR_NAME";
+    public static final String ENV_OPERATOR_NAMESPACE = "OPERATOR_NAMESPACE";
+
+    /**
+     * Get the value provided by environments.
+     *
+     * @param key the target key
+     * @return the value value provided by environments.
+     */
+    public static String get(String key) {
+        return getRequired(key, false);
+    }
+
+    /**
+     * Get the value provided by environments.
+     *
+     * @param key the target key
+     * @param required whether to verify the key is exists.
+     * @return the value provided by environments.
+     */
+    public static String getRequired(String key, boolean required) {

Review comment:
       getRequired should not have a boolean parameter, it is always true (its in the method name)




-- 
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: commits-unsubscribe@flink.apache.org

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



[GitHub] [flink-kubernetes-operator] wangyang0918 commented on pull request #18: [FLINK-26332]Move the operator env to common utils

Posted by GitBox <gi...@apache.org>.
wangyang0918 commented on pull request #18:
URL: https://github.com/apache/flink-kubernetes-operator/pull/18#issuecomment-1049526186


   LGTM. +1 for merging.


-- 
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: commits-unsubscribe@flink.apache.org

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



[GitHub] [flink-kubernetes-operator] Aitozi commented on a change in pull request #18: [FLINK-26332]Move the operator env to common utils

Posted by GitBox <gi...@apache.org>.
Aitozi commented on a change in pull request #18:
URL: https://github.com/apache/flink-kubernetes-operator/pull/18#discussion_r813513481



##########
File path: flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/EnvUtils.java
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.kubernetes.operator.utils;
+
+/** Util to get value from environments. */
+public class EnvUtils {
+
+    public static final String ENV_FLINK_OPERATOR_CONF_DIR = "FLINK_OPERATOR_CONF_DIR";
+    public static final String ENV_FLINK_CONF_DIR = "FLINK_CONF_DIR";
+    public static final String ENV_WEBHOOK_KEYSTORE_FILE = "WEBHOOK_KEYSTORE_FILE";
+    public static final String ENV_WEBHOOK_KEYSTORE_PASSWORD = "WEBHOOK_KEYSTORE_PASSWORD";
+    public static final String ENV_WEBHOOK_KEYSTORE_TYPE = "WEBHOOK_KEYSTORE_TYPE";
+    public static final String ENV_WEBHOOK_SERVER_PORT = "WEBHOOK_SERVER_PORT";
+    public static final String ENV_WATCHED_NAMESPACES = "FLINK_OPERATOR_WATCH_NAMESPACES";
+    public static final String ENV_HOSTNAME = "HOSTNAME";
+    public static final String ENV_OPERATOR_NAME = "OPERATOR_NAME";
+    public static final String ENV_OPERATOR_NAMESPACE = "OPERATOR_NAMESPACE";
+
+    /**
+     * Get the value provided by environments.
+     *
+     * @param key the target key
+     * @param required whether to verify the key is exists.
+     * @return the value or default value provided by environments.
+     */
+    public static String get(String key, boolean required) {

Review comment:
       I added separate `get` method without `required` parameter 




-- 
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: commits-unsubscribe@flink.apache.org

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



[GitHub] [flink-kubernetes-operator] wangyang0918 commented on a change in pull request #18: [FLINK-26332]Move the operator env to common utils

Posted by GitBox <gi...@apache.org>.
wangyang0918 commented on a change in pull request #18:
URL: https://github.com/apache/flink-kubernetes-operator/pull/18#discussion_r813544365



##########
File path: flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/EnvUtils.java
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.kubernetes.operator.utils;
+
+/** Util to get value from environments. */
+public class EnvUtils {
+
+    public static final String ENV_FLINK_OPERATOR_CONF_DIR = "FLINK_OPERATOR_CONF_DIR";
+    public static final String ENV_FLINK_CONF_DIR = "FLINK_CONF_DIR";
+    public static final String ENV_WEBHOOK_KEYSTORE_FILE = "WEBHOOK_KEYSTORE_FILE";
+    public static final String ENV_WEBHOOK_KEYSTORE_PASSWORD = "WEBHOOK_KEYSTORE_PASSWORD";
+    public static final String ENV_WEBHOOK_KEYSTORE_TYPE = "WEBHOOK_KEYSTORE_TYPE";
+    public static final String ENV_WEBHOOK_SERVER_PORT = "WEBHOOK_SERVER_PORT";
+    public static final String ENV_WATCHED_NAMESPACES = "FLINK_OPERATOR_WATCH_NAMESPACES";
+    public static final String ENV_HOSTNAME = "HOSTNAME";
+    public static final String ENV_OPERATOR_NAME = "OPERATOR_NAME";
+    public static final String ENV_OPERATOR_NAMESPACE = "OPERATOR_NAMESPACE";
+
+    /**
+     * Get the value provided by environments.
+     *
+     * @param key the target key
+     * @return the value value provided by environments.
+     */
+    public static String get(String key) {
+        return getRequired(key, false);
+    }
+
+    /**
+     * Get the value provided by environments.
+     *
+     * @param key the target key
+     * @param required whether to verify the key is exists.
+     * @return the value provided by environments.
+     */
+    public static String getRequired(String key, boolean required) {
+        String value = System.getenv().get(key);
+        if (value == null && required) {

Review comment:
       Do we also need to check the empty string here?

##########
File path: flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/EnvUtils.java
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.kubernetes.operator.utils;
+
+/** Util to get value from environments. */
+public class EnvUtils {
+
+    public static final String ENV_FLINK_OPERATOR_CONF_DIR = "FLINK_OPERATOR_CONF_DIR";
+    public static final String ENV_FLINK_CONF_DIR = "FLINK_CONF_DIR";
+    public static final String ENV_WEBHOOK_KEYSTORE_FILE = "WEBHOOK_KEYSTORE_FILE";
+    public static final String ENV_WEBHOOK_KEYSTORE_PASSWORD = "WEBHOOK_KEYSTORE_PASSWORD";
+    public static final String ENV_WEBHOOK_KEYSTORE_TYPE = "WEBHOOK_KEYSTORE_TYPE";
+    public static final String ENV_WEBHOOK_SERVER_PORT = "WEBHOOK_SERVER_PORT";
+    public static final String ENV_WATCHED_NAMESPACES = "FLINK_OPERATOR_WATCH_NAMESPACES";
+    public static final String ENV_HOSTNAME = "HOSTNAME";
+    public static final String ENV_OPERATOR_NAME = "OPERATOR_NAME";
+    public static final String ENV_OPERATOR_NAMESPACE = "OPERATOR_NAMESPACE";
+
+    /**
+     * Get the value provided by environments.
+     *
+     * @param key the target key
+     * @return the value value provided by environments.
+     */
+    public static String get(String key) {
+        return getRequired(key, false);
+    }
+
+    /**
+     * Get the value provided by environments.
+     *
+     * @param key the target key
+     * @param required whether to verify the key is exists.
+     * @return the value provided by environments.
+     */
+    public static String getRequired(String key, boolean required) {

Review comment:
       Hmm. We will not need the second argument `required` now. Right?

##########
File path: flink-kubernetes-webhook/src/main/java/org/apache/flink/kubernetes/operator/admission/FlinkOperatorWebhook.java
##########
@@ -117,26 +111,19 @@ protected void initChannel(SocketChannel ch) {
     }
 
     private static SslContext createSslContext() throws Exception {
-        String keystorePath = System.getenv(WEBHOOK_KEYSTORE_FILE);
-        String keystorePassword = System.getenv(WEBHOOK_KEYSTORE_PASSWORD);
-        String keystoreType = System.getenv(WEBHOOK_KEYSTORE_TYPE);
+        String keystorePath = EnvUtils.get(EnvUtils.ENV_WEBHOOK_KEYSTORE_FILE);
 
         if (StringUtils.isEmpty(keystorePath)) {
             LOG.info(
                     "No keystore path is defined in "
-                            + WEBHOOK_KEYSTORE_FILE
+                            + EnvUtils.ENV_WEBHOOK_KEYSTORE_FILE
                             + ", running without ssl");
             return null;
         }
 
-        if (StringUtils.isAnyEmpty(keystorePassword, keystoreType)) {
-            throw new RuntimeException(
-                    WEBHOOK_KEYSTORE_PASSWORD
-                            + " and "
-                            + WEBHOOK_KEYSTORE_TYPE
-                            + " must no be empty");
-        }
-
+        String keystorePassword =
+                EnvUtils.getRequired(EnvUtils.ENV_WEBHOOK_KEYSTORE_PASSWORD, true);

Review comment:
       `getRequired` does not check the empty string.




-- 
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: commits-unsubscribe@flink.apache.org

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



[GitHub] [flink-kubernetes-operator] wangyang0918 merged pull request #18: [FLINK-26332]Move the operator env to common utils

Posted by GitBox <gi...@apache.org>.
wangyang0918 merged pull request #18:
URL: https://github.com/apache/flink-kubernetes-operator/pull/18


   


-- 
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: commits-unsubscribe@flink.apache.org

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



[GitHub] [flink-kubernetes-operator] wangyang0918 commented on a change in pull request #18: [FLINK-26332]Move the operator env to common utils

Posted by GitBox <gi...@apache.org>.
wangyang0918 commented on a change in pull request #18:
URL: https://github.com/apache/flink-kubernetes-operator/pull/18#discussion_r813523930



##########
File path: flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/EnvUtils.java
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.kubernetes.operator.utils;
+
+/** Util to get value from environments. */
+public class EnvUtils {
+
+    public static final String ENV_FLINK_OPERATOR_CONF_DIR = "FLINK_OPERATOR_CONF_DIR";
+    public static final String ENV_FLINK_CONF_DIR = "FLINK_CONF_DIR";
+    public static final String ENV_WEBHOOK_KEYSTORE_FILE = "WEBHOOK_KEYSTORE_FILE";
+    public static final String ENV_WEBHOOK_KEYSTORE_PASSWORD = "WEBHOOK_KEYSTORE_PASSWORD";
+    public static final String ENV_WEBHOOK_KEYSTORE_TYPE = "WEBHOOK_KEYSTORE_TYPE";
+    public static final String ENV_WEBHOOK_SERVER_PORT = "WEBHOOK_SERVER_PORT";
+    public static final String ENV_WATCHED_NAMESPACES = "FLINK_OPERATOR_WATCH_NAMESPACES";
+    public static final String ENV_HOSTNAME = "HOSTNAME";
+    public static final String ENV_OPERATOR_NAME = "OPERATOR_NAME";
+    public static final String ENV_OPERATOR_NAMESPACE = "OPERATOR_NAMESPACE";
+
+    /**
+     * Get the value provided by environments.
+     *
+     * @param key the target key
+     * @param required whether to verify the key is exists.
+     * @return the value or default value provided by environments.
+     */
+    public static String get(String key, boolean required) {

Review comment:
       nit: I also lean to `getRequired()`.




-- 
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: commits-unsubscribe@flink.apache.org

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



[GitHub] [flink-kubernetes-operator] Aitozi commented on a change in pull request #18: [FLINK-26332]Move the operator env to common utils

Posted by GitBox <gi...@apache.org>.
Aitozi commented on a change in pull request #18:
URL: https://github.com/apache/flink-kubernetes-operator/pull/18#discussion_r813526890



##########
File path: flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/EnvUtils.java
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.kubernetes.operator.utils;
+
+/** Util to get value from environments. */
+public class EnvUtils {
+
+    public static final String ENV_FLINK_OPERATOR_CONF_DIR = "FLINK_OPERATOR_CONF_DIR";
+    public static final String ENV_FLINK_CONF_DIR = "FLINK_CONF_DIR";
+    public static final String ENV_WEBHOOK_KEYSTORE_FILE = "WEBHOOK_KEYSTORE_FILE";
+    public static final String ENV_WEBHOOK_KEYSTORE_PASSWORD = "WEBHOOK_KEYSTORE_PASSWORD";
+    public static final String ENV_WEBHOOK_KEYSTORE_TYPE = "WEBHOOK_KEYSTORE_TYPE";
+    public static final String ENV_WEBHOOK_SERVER_PORT = "WEBHOOK_SERVER_PORT";
+    public static final String ENV_WATCHED_NAMESPACES = "FLINK_OPERATOR_WATCH_NAMESPACES";
+    public static final String ENV_HOSTNAME = "HOSTNAME";
+    public static final String ENV_OPERATOR_NAME = "OPERATOR_NAME";
+    public static final String ENV_OPERATOR_NAMESPACE = "OPERATOR_NAMESPACE";
+
+    /**
+     * Get the value provided by environments.
+     *
+     * @param key the target key
+     * @param required whether to verify the key is exists.
+     * @return the value or default value provided by environments.
+     */
+    public static String get(String key, boolean required) {

Review comment:
       updated




-- 
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: commits-unsubscribe@flink.apache.org

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



[GitHub] [flink-kubernetes-operator] gyfora commented on pull request #18: [FLINK-26332]Move the operator env to common utils

Posted by GitBox <gi...@apache.org>.
gyfora commented on pull request #18:
URL: https://github.com/apache/flink-kubernetes-operator/pull/18#issuecomment-1049494900


   I added a minor comment, also please rebase on top of your config changes and then it should be good to go :) 


-- 
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: commits-unsubscribe@flink.apache.org

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



[GitHub] [flink-kubernetes-operator] morhidi commented on a change in pull request #18: [FLINK-26332]Move the operator env to common utils

Posted by GitBox <gi...@apache.org>.
morhidi commented on a change in pull request #18:
URL: https://github.com/apache/flink-kubernetes-operator/pull/18#discussion_r813103579



##########
File path: flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/EnvUtils.java
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.kubernetes.operator.utils;
+
+/** Util to get value from environments. */
+public class EnvUtils {
+
+    public static final String ENV_FLINK_OPERATOR_CONF_DIR = "FLINK_OPERATOR_CONF_DIR";
+    public static final String ENV_FLINK_CONF_DIR = "FLINK_CONF_DIR";
+    public static final String ENV_WEBHOOK_KEYSTORE_FILE = "WEBHOOK_KEYSTORE_FILE";
+    public static final String ENV_WEBHOOK_KEYSTORE_PASSWORD = "WEBHOOK_KEYSTORE_PASSWORD";
+    public static final String ENV_WEBHOOK_KEYSTORE_TYPE = "WEBHOOK_KEYSTORE_TYPE";
+    public static final String ENV_WEBHOOK_SERVER_PORT = "WEBHOOK_SERVER_PORT";
+    public static final String ENV_WATCHED_NAMESPACES = "FLINK_OPERATOR_WATCH_NAMESPACES";
+    public static final String ENV_HOSTNAME = "HOSTNAME";
+    public static final String ENV_OPERATOR_NAME = "OPERATOR_NAME";
+    public static final String ENV_OPERATOR_NAMESPACE = "OPERATOR_NAMESPACE";
+
+    /**
+     * Get the value provided by environments.
+     *
+     * @param key the target key
+     * @param required whether to verify the key is exists.
+     * @return the value or default value provided by environments.
+     */
+    public static String get(String key, boolean required) {

Review comment:
       We could probably use two separate methods get() and getRequired() here.




-- 
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: commits-unsubscribe@flink.apache.org

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



[GitHub] [flink-kubernetes-operator] morhidi commented on a change in pull request #18: [FLINK-26332]Move the operator env to common utils

Posted by GitBox <gi...@apache.org>.
morhidi commented on a change in pull request #18:
URL: https://github.com/apache/flink-kubernetes-operator/pull/18#discussion_r813106573



##########
File path: flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/EnvUtils.java
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.kubernetes.operator.utils;
+
+/** Util to get value from environments. */
+public class EnvUtils {
+
+    public static final String ENV_FLINK_OPERATOR_CONF_DIR = "FLINK_OPERATOR_CONF_DIR";
+    public static final String ENV_FLINK_CONF_DIR = "FLINK_CONF_DIR";
+    public static final String ENV_WEBHOOK_KEYSTORE_FILE = "WEBHOOK_KEYSTORE_FILE";
+    public static final String ENV_WEBHOOK_KEYSTORE_PASSWORD = "WEBHOOK_KEYSTORE_PASSWORD";
+    public static final String ENV_WEBHOOK_KEYSTORE_TYPE = "WEBHOOK_KEYSTORE_TYPE";
+    public static final String ENV_WEBHOOK_SERVER_PORT = "WEBHOOK_SERVER_PORT";
+    public static final String ENV_WATCHED_NAMESPACES = "FLINK_OPERATOR_WATCH_NAMESPACES";
+    public static final String ENV_HOSTNAME = "HOSTNAME";
+    public static final String ENV_OPERATOR_NAME = "OPERATOR_NAME";
+    public static final String ENV_OPERATOR_NAMESPACE = "OPERATOR_NAMESPACE";
+
+    /**
+     * Get the value provided by environments.
+     *
+     * @param key the target key
+     * @param required whether to verify the key is exists.
+     * @return the value or default value provided by environments.
+     */
+    public static String get(String key, boolean required) {

Review comment:
       LGTM otherwise




-- 
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: commits-unsubscribe@flink.apache.org

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



[GitHub] [flink-kubernetes-operator] Aitozi commented on pull request #18: [FLINK-26332]Move the operator env to common utils

Posted by GitBox <gi...@apache.org>.
Aitozi commented on pull request #18:
URL: https://github.com/apache/flink-kubernetes-operator/pull/18#issuecomment-1049500348


   I have rebased the master and addressed the comments, Please take a look again, thanks cc @gyfora @wangyang0918 


-- 
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: commits-unsubscribe@flink.apache.org

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