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

feat: refactor services to build monolithic service easily #5010

Merged
merged 2 commits into from
Nov 22, 2024

Conversation

judehung
Copy link
Member

@judehung judehung commented Nov 21, 2024

fixes #5009

There is a user requirement that prefers to combine all core services into a single monolithic service. To easily achieve this based on current code structure, refactor following codes:

  1. Change the signature of main function for each core services to allow pass os arguments rather than directly parse os.Args[1:]. With this change, the single monolithic service can alter the behavior of each individual internal services by passing different arguments.
  2. Remove os.Exit(0) by end of a successful run of common_config_bootstrapper. This call is redundant and will force monolithic service to exit directly.

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/edgex-go/blob/main/.github/Contributing.md

PR Checklist

Please check if your PR fulfills the following requirements:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?)
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • I have opened a PR for the related docs change (if not, why?)

Testing Instructions

make build
run core-keeper, core-common-config-boostrapper, core-command, core-data, core-metadata, and ensure all bootstraps as expected.

New Dependency Instructions (If applicable)

fixes edgexfoundry#5009

There is a user requirement that prefers to combine all core services into a single
monolithic service. To easily achieve this based on current code structure, refactor
following codes:

1. Change the signature of main function for each core services to allow pass os
   arguments rather than directly parse `os.Args[1:]`. With this change, the single
   monolithic service can alter the behavior of each individual internal services by
   passing different arguments.

2. Remove `os.Exit(0)` by end of a successful run of common_config_bootstrapper. This
   call is redundant and will force monolithic service to exit directly.

Signed-off-by: Jude Hung <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Nov 21, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 40 lines in your changes missing coverage. Please review.

Project coverage is 28.07%. Comparing base (dcc5cb7) to head (9598f85).

Files with missing lines Patch % Lines
internal/security/secretstore/main.go 0.00% 3 Missing ⚠️
internal/core/command/main.go 0.00% 2 Missing ⚠️
internal/core/common_config/main.go 0.00% 2 Missing ⚠️
internal/core/data/main.go 0.00% 2 Missing ⚠️
internal/core/keeper/main.go 0.00% 2 Missing ⚠️
internal/core/metadata/main.go 0.00% 2 Missing ⚠️
internal/security/bootstrapper/main.go 0.00% 2 Missing ⚠️
internal/security/config/main.go 0.00% 2 Missing ⚠️
internal/security/fileprovider/main.go 0.00% 2 Missing ⚠️
internal/security/proxyauth/main.go 0.00% 2 Missing ⚠️
... and 16 more

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5010   +/-   ##
=======================================
  Coverage   28.07%   28.07%           
=======================================
  Files         243      243           
  Lines       17591    17590    -1     
=======================================
  Hits         4938     4938           
+ Misses      11525    11524    -1     
  Partials     1128     1128           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@judehung judehung marked this pull request as ready for review November 21, 2024 14:44
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

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.

please make the same change to all other services
don't limit to core services
make them consistence

Change the signature of main function for each edgex services to allow pass os arguments
rather than directly parse os.Args[1:]. With this change, the single monolithic service
can alter the behavior of each individual internal services by passing different arguments.

Signed-off-by: Jude Hung <[email protected]>
@judehung judehung changed the title feat: refactor core services to build monolithic service easily feat: refactor services to build monolithic service easily Nov 22, 2024
@judehung
Copy link
Member Author

please make the same change to all other services don't limit to core services make them consistence

applied same changes to all edgex services in 9598f85

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

@cloudxxx8 cloudxxx8 merged commit 98bb6eb into edgexfoundry:main Nov 22, 2024
5 checks passed
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.

Refactor core services to allow to build monolithic service easily
3 participants