Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve config center #1030

Merged
merged 1 commit into from
Mar 15, 2021

Conversation

luckyxiaoqiang
Copy link
Contributor

What this PR does:

  • Fix update of external config map
  • AppExternalConfiguration orders before ExternalConfiguration
  • Add config cache file
  • Fix some typos

Which issue(s) this PR fixes:

Fixes #729

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


@luckyxiaoqiang luckyxiaoqiang force-pushed the feature/improve_config_center branch 2 times, most recently from e7e1006 to f4be162 Compare January 31, 2021 11:17
@AlexStocks AlexStocks requested review from zouyx, hxmhlt and flycash and removed request for zouyx and hxmhlt January 31, 2021 14:10
@AlexStocks
Copy link
Contributor

pls change the target branch to 1.5

@luckyxiaoqiang luckyxiaoqiang changed the base branch from master to 1.5 February 1, 2021 09:43
@codecov-io
Copy link

Codecov Report

Merging #1030 (2eaecfd) into 1.5 (968650f) will increase coverage by 0.11%.
The diff coverage is 54.10%.

Impacted file tree graph

@@            Coverage Diff             @@
##              1.5    #1030      +/-   ##
==========================================
+ Coverage   59.53%   59.65%   +0.11%     
==========================================
  Files         259      261       +2     
  Lines       12737    12943     +206     
==========================================
+ Hits         7583     7721     +138     
- Misses       4199     4248      +49     
- Partials      955      974      +19     
Impacted Files Coverage Δ
cluster/cluster_impl/available_cluster.go 100.00% <ø> (ø)
cluster/cluster_impl/base_cluster_invoker.go 61.11% <0.00%> (-5.56%) ⬇️
cluster/router/condition/listenable_router.go 54.71% <0.00%> (ø)
cluster/router/healthcheck/health_check_route.go 70.37% <0.00%> (ø)
cluster/router/tag/router_rule.go 89.47% <ø> (+12.20%) ⬆️
cluster/router/tag/tag_router.go 72.59% <0.00%> (ø)
common/extension/config_post_processor.go 0.00% <0.00%> (ø)
common/proxy/proxy.go 90.19% <0.00%> (+0.87%) ⬆️
common/proxy/proxy_factory/default.go 13.55% <0.00%> (+0.22%) ⬆️
config/base_config.go 64.02% <ø> (ø)
... and 150 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 96a2c92...e703ce9. Read the comment docs.

@luckyxiaoqiang
Copy link
Contributor Author

pls change the target branch to 1.5

Updated.

common/config/environment.go Show resolved Hide resolved
common/config/environment.go Show resolved Hide resolved
Comment on lines +144 to +152
if consumerConfig.CacheFile != "" {
if data, err := yaml.MarshalYML(consumerConfig); err != nil {
logger.Errorf("Marshal consumer config err: %s", err.Error())
} else {
if err := ioutil.WriteFile(consumerConfig.CacheFile, data, 0666); err != nil {
logger.Errorf("Write consumer config cache file err: %s", err.Error())
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure whether we should do this like:

(c *consumerConfig) SaveToCacheFile() {
    // ...
}

// in this funtion

consumerConfig.SaveToFile()

Comment on lines +210 to +219
// Write the current configuration to cache file.
if providerConfig.CacheFile != "" {
if data, err := yaml.MarshalYML(providerConfig); err != nil {
logger.Errorf("Marshal provider config err: %s", err.Error())
} else {
if err := ioutil.WriteFile(providerConfig.CacheFile, data, 0666); err != nil {
logger.Errorf("Write provider config cache file err: %s", err.Error())
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my above comment

if data, err := yaml.MarshalYML(consumerConfig); err != nil {
logger.Errorf("Marshal consumer config err: %s", err.Error())
} else {
if err := ioutil.WriteFile(consumerConfig.CacheFile, data, 0666); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can not get this point. why will you copy this config to a new file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see the issue comment: #729 (comment).

@cityiron cityiron added this to the v1.5.7 milestone Feb 25, 2021
@LaurenceLiZhixin LaurenceLiZhixin self-requested a review March 7, 2021 13:04
@@ -50,6 +50,9 @@ type BaseConfig struct {
EventDispatcherType string `default:"direct" yaml:"event_dispatcher_type" json:"event_dispatcher_type,omitempty"`
MetricConfig *MetricConfig `yaml:"metrics" json:"metrics,omitempty"`
fileStream *bytes.Buffer

// cache file used to store the current used configurations.
CacheFile string `yaml:"cache_file" json:"cache_file,omitempty" property:"cache_file"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find where to use this field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see config_loader.go file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you write provider config to CacheFile, but I want to know where to use it.

Copy link
Contributor Author

@luckyxiaoqiang luckyxiaoqiang Mar 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see the issue comment: #729 (comment).

@AlexStocks AlexStocks merged commit 4f60f69 into apache:1.5 Mar 15, 2021
AlexStocks added a commit that referenced this pull request Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

配置中心功能完善
7 participants