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

design(Refactor Registry): Create a design for refactoring the Registry component #2133

Closed

Conversation

lenny-goodell
Copy link
Member

@lenny-goodell lenny-goodell commented Nov 13, 2019

Design for refactoring the Registry component to separate out the Service Configuration and Service Registration.

Also create initial adr folder and README for location to hold Architecture Decision Records.

Note that this design doesn't address the configuration hierarchy that @jpwhitemn brought up in the PHX F2F. I feel that is out of scope for this effort and should be addressed separately.

If **no value** is provided to the `-cp/-configProvider` option, i.e. just `-cp`, and no environment variable override is specified, the default value of `consul.http://localhost:8500` will be used.

if `-cp/-configProvider` **not used** and no environment variable override is specified the local configuration file is used, as is it now.

Copy link
Contributor

Choose a reason for hiding this comment

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

what happens if the local configuration file has no cp entry? use the consul.http://localhost:8500?

A little concerned if services start-up out of sync, that is one referring to a registry foo and another to bar.
Guess an error message may work that attempts a connection check to registry and if it fails, emit an misconfiguration error message and promptly exit.

A la dependency injection, would it make sense to

Copy link
Member Author

Choose a reason for hiding this comment

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

Plan is to not put config Provider in the local config (chicken before the egg...) If no -cp then config is simply from local file.

Copy link
Contributor

@mkbhanda mkbhanda left a comment

Choose a reason for hiding this comment

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

Minor comments added

GetConfiguration(configStruct interface{}) (interface{}, error)
WatchForChanges(updateChannel chan<- interface{}, errorChannel chan<- error,
configuration interface{}, waitKey string)
IsAlive() bool
Copy link
Contributor

Choose a reason for hiding this comment

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

IsAlive feels more like registry related?

Copy link
Member Author

Choose a reason for hiding this comment

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

IsAlive() just determines if the Provider is alive, i.e. available. Applicable to Config and Registry

```go
type Client interface {
HasConfiguration() (bool, error)
PutConfigurationToml(configuration *toml.Tree, overwrite bool) error
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this? If we have a toml-backed implementation of the Configuration Client, the configuration in toml.Tree form won't need to be seen outside of that

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it is used by Config Seed since it only deals with the TOML

Copy link
Member

Choose a reason for hiding this comment

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

Does this mean update the configurations from TOML file? If it does, we had better rename it to:
PutConfigurationByToml or PutConfigurationFromToml

Also, if it is only for Config Seed, it might not be put in this interface. Config Seed can convert to configStruct on its own and call PutConfiguration.

if `-cp/-configProvider` **not used** and no environment variable override is specified the local configuration file is used, as is it now.

The existing `-r/-registry` command line option will be removed from all services.

Copy link
Member

Choose a reason for hiding this comment

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

Is the -p/-profile option being removed also?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope. Still need it.

@lenny-goodell lenny-goodell force-pushed the RefactorRegistry branch 2 times, most recently from 274249a to d4fe39b Compare November 15, 2019 18:32
@codecov-io
Copy link

codecov-io commented Nov 15, 2019

Codecov Report

Merging #2133 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2133   +/-   ##
=======================================
  Coverage   39.39%   39.39%           
=======================================
  Files         174      174           
  Lines       12812    12812           
=======================================
  Hits         5047     5047           
  Misses       7498     7498           
  Partials      267      267

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 bf52b33...d9a53a5. Read the comment docs.

lenny added 2 commits December 6, 2019 14:55
…ry component

Design for refactoring the Registry component to separate out the Service Configuration and Service Registration.

Also create initial `adr` folder and README for location to hold Architecture Decision Records.

Signed-off-by: lenny <leonard.goodell@intel.com>
- Added that config provider information will be logged
- Changed Stem to Basepath in the New Configuration Client Config
- Added section for Config endpoint chnages to include the config provider information

Signed-off-by: lenny <leonard.goodell@intel.com>
@lenny-goodell lenny-goodell marked this pull request as ready for review December 6, 2019 21:56
cloudxxx8
cloudxxx8 previously approved these changes Dec 8, 2019
Copy link
Member

@cloudxxx8 cloudxxx8 left a comment

Choose a reason for hiding this comment

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

LGTM, it's a nice work.

Only a minor suggestion in the comment, and we had better write down the GODOC to prevent any function name confusion.

```go
type Client interface {
HasConfiguration() (bool, error)
PutConfigurationToml(configuration *toml.Tree, overwrite bool) error
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean update the configurations from TOML file? If it does, we had better rename it to:
PutConfigurationByToml or PutConfigurationFromToml

Also, if it is only for Config Seed, it might not be put in this interface. Config Seed can convert to configStruct on its own and call PutConfiguration.

@lenny-goodell
Copy link
Member Author

@cloudxxx8 , PutConfigurationToml is currently only used by Config-seed, but from a module perspective it should stay in the interface. I do like the name change for clarity. Thx!

lenny added 5 commits December 10, 2019 09:10
…ry component

Design for refactoring the Registry component to separate out the Service Configuration and Service Registration.

Also create initial `adr` folder and README for location to hold Architecture Decision Records.

Signed-off-by: lenny <leonard.goodell@intel.com>
- Added that config provider information will be logged
- Changed Stem to Basepath in the New Configuration Client Config
- Added section for Config endpoint chnages to include the config provider information

Signed-off-by: lenny <leonard.goodell@intel.com>
…uration Client interface

Signed-off-by: lenny <leonard.goodell@intel.com>
…ex-go into RefactorRegistry

# Conflicts:
#	adr/Registry Refactoring Design.md
…uration Client interface

Signed-off-by: lenny <leonard.goodell@intel.com>
@lenny-goodell lenny-goodell deleted the RefactorRegistry branch January 22, 2020 00:42
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.

None yet

6 participants