-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: Core Keeper implementation #10
base: edgex-go-v3.2.0-dev.10
Are you sure you want to change the base?
feat: Core Keeper implementation #10
Conversation
closes: edgexfoundry-holding#9 Signed-off-by: Jack Chen <[email protected]>
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yaml file now.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
) | ||
|
||
// Registry is an autogenerated mock type for the Registry type | ||
type Registry struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 redis
make keeper common-config
to ensure the binary buildsexport EDGEX_SECURITY_SECRET_STORE=false; ./core-keeper
export EDGEX_SECURITY_SECRET_STORE=false; ./core-common-config-bootstrapper -cp=keeper.http://localhost:59890
which specifies using core keeper as configuration providerService configuration consuming, pushing and watching for change
make metadata
to ensure the binary buildsexport EDGEX_SECURITY_SECRET_STORE=false; ./core-metadata -cp=keeper.http://localhost:59890
which specifies using core keeper as configuration providerRegistration
cmd/core-common-config-bootstrapper/res
and modify the Registry section inconfiguration.yaml
asCommon configuration pushing
again to start a new redis container and get the new binary buildsmake metadata
to ensure the binary buildsexport EDGEX_SECURITY_SECRET_STORE=false; ./core-metadata -cp=keeper.http://localhost:59890/ -r
which 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