You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "huyuanfeng2018 (via GitHub)" <gi...@apache.org> on 2024/07/17 11:50:06 UTC

[PR] [FLINK-35815][autoscaler] Introduce GlobalConfiguration.loadConfiguration load config [flink-kubernetes-operator]

huyuanfeng2018 opened a new pull request, #853:
URL: https://github.com/apache/flink-kubernetes-operator/pull/853

   
   
   <!--
   *Thank you very much for contributing to the Apache Flink Kubernetes Operator - we are happy that you want to help us improve the project. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [JIRA issue](https://issues.apache.org/jira/projects/FLINK/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no JIRA issue.
     
     - Name the pull request in the form "[FLINK-XXXX] [component] Title of the pull request", where *FLINK-XXXX* should be replaced by the actual issue number. Skip *component* if you are unsure about which is the best component.
     Typo fixes that have no associated JIRA issue should be named following this pattern: `[hotfix][docs] Fix typo in event time introduction` or `[hotfix][javadocs] Expand JavaDoc for PuncuatedWatermarkGenerator`.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes. You can read more on how we use GitHub Actions for CI [here](https://nightlies.apache.org/flink/flink-kubernetes-operator-docs-main/docs/development/guide/#cicd).
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message (including the JIRA id)
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   
   
   **(The sections below can be removed for hotfixes of typos)**
   -->
   
   ## What is the purpose of the change
   
    Introduce GlobalConfiguration.loadConfiguration load config
   
   ## Brief change log
    - Introduce GlobalConfiguration.loadConfiguration load config
   
   ## Verifying this change
   <!--
   Please make sure both new and modified tests in this PR follows the conventions defined in our code quality guide: https://flink.apache.org/contributing/code-style-and-quality-common.html#testing
   -->
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API, i.e., is any changes to the `CustomResourceDescriptors`: (no)
     - Core observer or reconciler logic that is regularly executed: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (no)
     - If yes, how is the feature documented? (not applicable)
   


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


Re: [PR] [FLINK-35815][autoscaler] Introduce GlobalConfiguration.loadConfiguration load config [flink-kubernetes-operator]

Posted by "huyuanfeng2018 (via GitHub)" <gi...@apache.org>.
huyuanfeng2018 commented on PR #853:
URL: https://github.com/apache/flink-kubernetes-operator/pull/853#issuecomment-2233132411

   @1996fanrui 
   Can you review it for me? Thank you very much.
   
   


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


Re: [PR] [FLINK-35815][autoscaler] Introduce GlobalConfiguration.loadConfiguration load config [flink-kubernetes-operator]

Posted by "huyuanfeng2018 (via GitHub)" <gi...@apache.org>.
huyuanfeng2018 commented on code in PR #853:
URL: https://github.com/apache/flink-kubernetes-operator/pull/853#discussion_r1683743489


##########
flink-autoscaler-standalone/src/main/java/org/apache/flink/autoscaler/standalone/StandaloneAutoscalerEntrypoint.java:
##########
@@ -94,4 +100,15 @@ JobAutoScaler<KEY, Context> createJobAutoscaler(
                 new RescaleApiScalingRealizer<>(eventHandler),
                 stateStore);
     }
+
+    @VisibleForTesting
+    static Configuration loadConfiguration(Optional<String> confOverrideDir, String[] args) {
+        if (confOverrideDir.isPresent()) {
+            return GlobalConfiguration.loadConfiguration(
+                    confOverrideDir.get(), ParameterTool.fromArgs(args).getConfiguration());
+        } else {
+            return GlobalConfiguration.loadConfiguration(
+                    ParameterTool.fromArgs(args).getConfiguration());
+        }

Review Comment:
   > > Why do we need `CONF_OVERRIDE_DIR`? As I understand, `FLINK_CONF_DIR` is enough.
   > 
   > https://github.com/apache/flink-kubernetes-operator/blob/cb90b10c93241f9994acdd11d59ce1ec25ccbc47/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/EnvUtils.java#L54C32-L54C53
   > 
   > I referred here
   
   I thought carefully that adding an environment variable is indeed a bit redundant, because FLINK_CONF_DIR itself does not have a default configuration. for the opinion that FLINK_CONF_DIR is enough.
   
   



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


Re: [PR] [FLINK-35815][autoscaler] Introduce GlobalConfiguration.loadConfiguration load config [flink-kubernetes-operator]

Posted by "1996fanrui (via GitHub)" <gi...@apache.org>.
1996fanrui commented on code in PR #853:
URL: https://github.com/apache/flink-kubernetes-operator/pull/853#discussion_r1682109072


##########
flink-autoscaler-standalone/src/main/java/org/apache/flink/autoscaler/standalone/StandaloneAutoscalerEntrypoint.java:
##########
@@ -48,7 +49,9 @@ public class StandaloneAutoscalerEntrypoint {
 
     public static <KEY, Context extends JobAutoScalerContext<KEY>> void main(String[] args)
             throws Exception {
-        var conf = ParameterTool.fromArgs(args).getConfiguration();
+        var conf =
+                GlobalConfiguration.loadConfiguration(
+                        ParameterTool.fromArgs(args).getConfiguration());

Review Comment:
   Would you mind extracting this part as a separate method and adding a unit test? 
   
   Separate method is helpful for adding a unit test to check whether overwrite logic is fine.



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


Re: [PR] [FLINK-35815][autoscaler] Introduce GlobalConfiguration.loadConfiguration load config [flink-kubernetes-operator]

Posted by "nuno-c-afonso (via GitHub)" <gi...@apache.org>.
nuno-c-afonso commented on PR #853:
URL: https://github.com/apache/flink-kubernetes-operator/pull/853#issuecomment-2239030064

   Hi,
   
   The title of the PR references a Jira that is for a KDS connector bug:
   - https://issues.apache.org/jira/browse/FLINK-35815
   
   Would it be possible to change it to `FLINK-35851` to point to the right Jira?
   
   Thank you.


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


Re: [PR] [FLINK-35815][autoscaler] Introduce GlobalConfiguration.loadConfiguration load config [flink-kubernetes-operator]

Posted by "huyuanfeng2018 (via GitHub)" <gi...@apache.org>.
huyuanfeng2018 commented on PR #853:
URL: https://github.com/apache/flink-kubernetes-operator/pull/853#issuecomment-2237980572

   > Thanks @huyuanfeng2018 for the contribution!
   > 
   > It's better to add doc to explain how to use this feature.
   
   > Thanks @huyuanfeng2018 for the contribution!
   > 
   > It's better to add doc to explain how to use this feature.
   
   
   Thank you for your review,
   
   I added a new commit including
   
   * Added documentation
   
   * Added test cases
   
   * Supports changing the config file directory through environment variables, and introduces a new class Envs to manage program environment variables, but currently there is only `ENV_CONF_OVERRIDE_DIR`, which seems a bit thin in the long run, But under this PR, I think it is enough
   
   


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


Re: [PR] [FLINK-35815][autoscaler] Introduce GlobalConfiguration.loadConfiguration load config [flink-kubernetes-operator]

Posted by "1996fanrui (via GitHub)" <gi...@apache.org>.
1996fanrui commented on code in PR #853:
URL: https://github.com/apache/flink-kubernetes-operator/pull/853#discussion_r1683727611


##########
docs/content/docs/custom-resource/autoscaler.md:
##########
@@ -308,6 +308,13 @@ org.apache.flink.autoscaler.standalone.StandaloneAutoscalerEntrypoint \
 --autoscaler.standalone.jdbc.username root
 ```
 
+### Load StandaloneAutoscaler configuration through configuration file
+
+Can specify the running configuration of StandaloneAutoscaler in the configuration file. The config.yaml and
+flink-conf.yaml files in the environment variable `FLINK_CONF_DIR` directory will be loaded by default. You can also pass
+`export CONF_OVERRIDE_DIR=xxx` to specify the loaded configuration file directory.
+NOTE: main configuration will overwrite the configuration in the configuration file

Review Comment:
   How about update the `main configuration` to `main parameters`? 
   
   I saw most of doc saw the Java Main parameters. WDYT?



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


Re: [PR] [FLINK-35815][autoscaler] Introduce GlobalConfiguration.loadConfiguration load config [flink-kubernetes-operator]

Posted by "1996fanrui (via GitHub)" <gi...@apache.org>.
1996fanrui commented on code in PR #853:
URL: https://github.com/apache/flink-kubernetes-operator/pull/853#discussion_r1683719440


##########
flink-autoscaler-standalone/src/main/java/org/apache/flink/autoscaler/standalone/StandaloneAutoscalerEntrypoint.java:
##########
@@ -94,4 +100,15 @@ JobAutoScaler<KEY, Context> createJobAutoscaler(
                 new RescaleApiScalingRealizer<>(eventHandler),
                 stateStore);
     }
+
+    @VisibleForTesting
+    static Configuration loadConfiguration(Optional<String> confOverrideDir, String[] args) {
+        if (confOverrideDir.isPresent()) {
+            return GlobalConfiguration.loadConfiguration(
+                    confOverrideDir.get(), ParameterTool.fromArgs(args).getConfiguration());
+        } else {
+            return GlobalConfiguration.loadConfiguration(
+                    ParameterTool.fromArgs(args).getConfiguration());
+        }

Review Comment:
   Why do we need `CONF_OVERRIDE_DIR`?  As I understand, `FLINK_CONF_DIR` is enough.



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


Re: [PR] [FLINK-35815][autoscaler] Introduce GlobalConfiguration.loadConfiguration load config [flink-kubernetes-operator]

Posted by "1996fanrui (via GitHub)" <gi...@apache.org>.
1996fanrui merged PR #853:
URL: https://github.com/apache/flink-kubernetes-operator/pull/853


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


Re: [PR] [FLINK-35815][autoscaler] Introduce GlobalConfiguration.loadConfiguration load config [flink-kubernetes-operator]

Posted by "huyuanfeng2018 (via GitHub)" <gi...@apache.org>.
huyuanfeng2018 commented on code in PR #853:
URL: https://github.com/apache/flink-kubernetes-operator/pull/853#discussion_r1683734732


##########
flink-autoscaler-standalone/src/main/java/org/apache/flink/autoscaler/standalone/StandaloneAutoscalerEntrypoint.java:
##########
@@ -94,4 +100,15 @@ JobAutoScaler<KEY, Context> createJobAutoscaler(
                 new RescaleApiScalingRealizer<>(eventHandler),
                 stateStore);
     }
+
+    @VisibleForTesting
+    static Configuration loadConfiguration(Optional<String> confOverrideDir, String[] args) {
+        if (confOverrideDir.isPresent()) {
+            return GlobalConfiguration.loadConfiguration(
+                    confOverrideDir.get(), ParameterTool.fromArgs(args).getConfiguration());
+        } else {
+            return GlobalConfiguration.loadConfiguration(
+                    ParameterTool.fromArgs(args).getConfiguration());
+        }

Review Comment:
   > Why do we need `CONF_OVERRIDE_DIR`? As I understand, `FLINK_CONF_DIR` is enough.
   
   https://github.com/apache/flink-kubernetes-operator/blob/cb90b10c93241f9994acdd11d59ce1ec25ccbc47/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/EnvUtils.java#L54C32-L54C53
   
   I referred 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: issues-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35815][autoscaler] Introduce GlobalConfiguration.loadConfiguration load config [flink-kubernetes-operator]

Posted by "huyuanfeng2018 (via GitHub)" <gi...@apache.org>.
huyuanfeng2018 commented on code in PR #853:
URL: https://github.com/apache/flink-kubernetes-operator/pull/853#discussion_r1683728619


##########
docs/content/docs/custom-resource/autoscaler.md:
##########
@@ -308,6 +308,13 @@ org.apache.flink.autoscaler.standalone.StandaloneAutoscalerEntrypoint \
 --autoscaler.standalone.jdbc.username root
 ```
 
+### Load StandaloneAutoscaler configuration through configuration file
+
+Can specify the running configuration of StandaloneAutoscaler in the configuration file. The config.yaml and
+flink-conf.yaml files in the environment variable `FLINK_CONF_DIR` directory will be loaded by default. You can also pass
+`export CONF_OVERRIDE_DIR=xxx` to specify the loaded configuration file directory.
+NOTE: main configuration will overwrite the configuration in the configuration file

Review Comment:
   > How about update the `main configuration` to `main parameters`?
   > 
   > I saw most of doc saw the Java Main parameters. WDYT?
   
   +1.



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


Re: [PR] [FLINK-35851][autoscaler] Introduce GlobalConfiguration.loadConfiguration load config [flink-kubernetes-operator]

Posted by "huyuanfeng2018 (via GitHub)" <gi...@apache.org>.
huyuanfeng2018 commented on PR #853:
URL: https://github.com/apache/flink-kubernetes-operator/pull/853#issuecomment-2239462207

   > Hi,
   > 
   > The title of the PR references a Jira that is for a KDS connector bug:
   > 
   > * https://issues.apache.org/jira/browse/FLINK-35815
   > 
   > Would it be possible to change it to `FLINK-35851` to point to the right Jira?
   > 
   > Thank you.
   
   ok


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