feat: Core Keeper implementation#10
feat: Core Keeper implementation#10jackchenjc wants to merge 1 commit intoedgexfoundry-holding:edgex-go-v3.2.0-dev.10from
Conversation
closes: edgexfoundry-holding#9 Signed-off-by: Jack Chen <jack@iotechsys.com>
|
Hi @lenny-intel, This PR contains the initial implementation of Core Keeper, which has not been tested in secure mode yet. Would you please help reviewing it when you have time? Thanks. |
|
@cloudxxx8 , @jackchenjc , the TSC approved adding this service to EdgeX in Odessa. I don't see the need to do the review in holding and again when it is moved to main org. We never did this with any of the new security services and common config service. That said I'll do a high level review here and more detailed when moved to main org. |
| type ConfigurationStruct struct { | ||
| Writable WritableInfo | ||
| MessageBus bootstrapConfig.MessageBusInfo | ||
| Clients bootstrapConfig.ClientsCollection | ||
| Database bootstrapConfig.Database | ||
| Service bootstrapConfig.ServiceInfo | ||
| } | ||
|
|
||
| type WritableInfo struct { | ||
| LogLevel string | ||
| InsecureSecrets bootstrapConfig.InsecureSecrets | ||
| Telemetry bootstrapConfig.TelemetryInfo | ||
| } |
There was a problem hiding this comment.
This service is NOT a standard EdgeX service when it comes to configuration since it manages the configuration. IMO, this needs to be re-thought. How would it handle Writable? i.e. how would you change this services configuration?? Security service don't have the Writable section. Example:
https://github.com/edgexfoundry/edgex-go/blob/main/cmd/security-bootstrapper/res/configuration.yaml
https://github.com/edgexfoundry/edgex-go/blob/main/internal/security/bootstrapper/config/config.go#L24
There was a problem hiding this comment.
IMO, Telemetry is not needed now and isn't in your configuration.yaml. Remove until this service has some metrics that it is collecting. Or add it to your configuration with the coomm security metrics listed.
https://docs.edgexfoundry.org/3.1/microservices/general/#common-service-metrics
| "github.com/edgexfoundry/edgex-go/internal/core/keeper/infrastructure/interfaces" | ||
| ) | ||
|
|
||
| // RegistryInterfaceName contains the name of the interfaces.Registry implementation in the DIC. |
There was a problem hiding this comment.
Why is the registry implementation needed in the DIC and the kv isn't? i.e. this service implements the Registry rather than dependent on it.
| COPY --from=builder /edgex-go/cmd/core-keeper/res/configuration.toml /res/configuration.toml | ||
|
|
||
| ENTRYPOINT ["/core-keeper"] | ||
| CMD ["--confdir=/res"] |
There was a problem hiding this comment.
Remove --confdir=/res since it is the default. This has been done removed for for all the other services
| RUN apk add --update --no-cache dumb-init | ||
| COPY --from=builder /edgex-go/Attribution.txt / | ||
| COPY --from=builder /edgex-go/cmd/core-keeper/core-keeper / | ||
| COPY --from=builder /edgex-go/cmd/core-keeper/res/configuration.toml /res/configuration.toml |
| replace github.com/edgexfoundry/go-mod-core-contracts/v3 => github.com/jackchenjc/go-mod-core-contracts/v3 v3.2.0-dev.4.0.20240130071054-92a2e48bc6ca | ||
|
|
||
| replace github.com/edgexfoundry/go-mod-registry/v3 => github.com/jackchenjc/go-mod-registry/v3 v3.2.0-dev.1.0.20240130024331-d0f728a41496 | ||
|
|
||
| replace github.com/edgexfoundry/go-mod-configuration/v3 => github.com/jackchenjc/go-mod-configuration/v3 v3.2.0-dev.1.0.20240130054648-e25c4056b9df | ||
|
|
||
| replace github.com/edgexfoundry/go-mod-bootstrap/v3 => github.com/jackchenjc/go-mod-bootstrap/v3 v3.2.0-dev.10.0.20240125072932-e0925013f378 |
There was a problem hiding this comment.
Why does this Keeper Service need modified versions of the go-mods?
I expect the go-mods to be modified for the new Client, not the Service.
| registry := container.RegistryFrom(dic.Get) | ||
| registry.Register(r) |
| ) | ||
|
|
||
| // Registry is an autogenerated mock type for the Registry type | ||
| type Registry struct { |
There was a problem hiding this comment.
Mocks are do dependencies. This service implements the Registry so it isn't a dependency.
| // .... | ||
| // flags.Parse(os.Args[1:]) | ||
| // | ||
| f := flags.New() |
There was a problem hiding this comment.
This adds many command line flags that are meaningless to this service, like -cp/--configProvider.
closes: #9
PR Checklist
Please check if your PR fulfills the following requirements:
If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/edgex-examples/blob/master/.github/CONTRIBUTING.md.
What is the current behavior?
Issue Number:
#9
What is the new behavior?
Core Keeper is a lightweight configuration and registry service that is aimed to replace Consul in the EdgeX architecture
Does this PR introduce a breaking change?
New Imports
github.com/spf13/cast to safely and easily casting from one type to another in Go
Specific Instructions
Common configuration pushing
docker run -d --rm --name redis -p 6379:6379 redismake keeper common-configto ensure the binary buildsexport EDGEX_SECURITY_SECRET_STORE=false; ./core-keeperexport EDGEX_SECURITY_SECRET_STORE=false; ./core-common-config-bootstrapper -cp=keeper.http://localhost:59890which specifies using core keeper as configuration providerService configuration consuming, pushing and watching for change
make metadatato ensure the binary buildsexport EDGEX_SECURITY_SECRET_STORE=false; ./core-metadata -cp=keeper.http://localhost:59890which specifies using core keeper as configuration providerRegistration
cmd/core-common-config-bootstrapper/resand modify the Registry section inconfiguration.yamlasCommon configuration pushingagain to start a new redis container and get the new binary buildsmake metadatato ensure the binary buildsexport EDGEX_SECURITY_SECRET_STORE=false; ./core-metadata -cp=keeper.http://localhost:59890/ -rwhich specifies using core keeper as configuration provider and using registryOther information
Related go modules issues and new branches:
go-mod-core-contracts
issue: edgexfoundry/go-mod-core-contracts#873
branch: https://github.com/jackchenjc/go-mod-core-contracts/tree/issue-873
go-mod-configuration
issue: edgexfoundry/go-mod-configuration#109
branch: https://github.com/jackchenjc/go-mod-configuration/tree/issue-109
go-mod-bootstrap
issue: edgexfoundry/go-mod-bootstrap#649
branch: https://github.com/jackchenjc/go-mod-bootstrap/tree/issue-649
go-mod-registry
issue: edgexfoundry/go-mod-registry#134
branch: https://github.com/jackchenjc/go-mod-registry/tree/issue-134