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

chore: refactoring component structure #1044

Merged
merged 11 commits into from
Dec 7, 2023

Conversation

bacherfl
Copy link
Contributor

@bacherfl bacherfl commented Dec 1, 2023

This PR refactors the core package by restructuring the components responsible for managing the subscriptions, as well as the creation of sync sources. The following changes have been made:

  • Renamed sync-store package to subscriptions. This has been done to avoid confusion because we already have a sync, and a store. package. Within the package, the SyncStore. has been renamed to subscriptions.Manager, which should reflect its responsibility in a better way. Also, the syncHandler has been renamed to multiplexer, as this one is responsible for sending updates of a certain target to all subscribers - syncHandler was a bit too generic in my opinion.
  • Moved the GetSyncSourceFromURI method to a new package, sync/builder, to remove the responsibility of building concrete sync sources from the subscription manager
  • Moved the logic of retrieving the K8s client config to the sync builder. Previously, this was done in the runtime package by calling the respective methods for the config retrieval provided by the sync/kubernetes package and then handing that config back to the initialization of the K8sSync. Note: This step can potentially be done in a separate PR, if so desired.

Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Copy link

netlify bot commented Dec 1, 2023

Deploy Preview for polite-licorice-3db33c canceled.

Name Link
🔨 Latest commit bfa6daa
🔍 Latest deploy log https://app.netlify.com/sites/polite-licorice-3db33c/deploys/65715d02b38e810008d7f475

Copy link

codecov bot commented Dec 1, 2023

Codecov Report

Attention: 40 lines in your changes are missing coverage. Please review.

Comparison is base (ec5f778) 71.87% compared to head (bfa6daa) 72.91%.

Files Patch % Lines
core/pkg/sync/builder/syncbuilder.go 85.27% 18 Missing and 1 partial ⚠️
core/pkg/sync/builder/utils.go 87.75% 4 Missing and 2 partials ⚠️
core/pkg/sync/file/filepath_sync.go 0.00% 6 Missing ⚠️
core/pkg/runtime/from_config.go 0.00% 5 Missing ⚠️
core/pkg/subscriptions/multiplexer.go 77.77% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1044      +/-   ##
==========================================
+ Coverage   71.87%   72.91%   +1.03%     
==========================================
  Files          28       31       +3     
  Lines        2866     2865       -1     
==========================================
+ Hits         2060     2089      +29     
+ Misses        701      672      -29     
+ Partials      105      104       -1     

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

Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Makefile Outdated Show resolved Hide resolved
core/pkg/service/sync/handler.go Outdated Show resolved Hide resolved
core/pkg/subscriptions/interface.go Outdated Show resolved Hide resolved
core/pkg/subscriptions/manager.go Outdated Show resolved Hide resolved
core/pkg/service/sync/handler.go Outdated Show resolved Hide resolved
core/pkg/subscriptions/multiplexer.go Outdated Show resolved Hide resolved
core/pkg/subscriptions/multiplexer.go Show resolved Hide resolved
core/pkg/subscriptions/multiplexer.go Show resolved Hide resolved
core/pkg/runtime/from_config.go Outdated Show resolved Hide resolved
core/pkg/sync/builder/syncbuilder.go Outdated Show resolved Hide resolved
bacherfl and others added 6 commits December 4, 2023 08:01
Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
@bacherfl bacherfl marked this pull request as ready for review December 5, 2023 15:13
@bacherfl bacherfl requested a review from a team as a code owner December 5, 2023 15:13
core/pkg/service/sync/server.go Outdated Show resolved Hide resolved
flagd-proxy/cmd/start.go Outdated Show resolved Hide resolved
@bacherfl bacherfl merged commit 0c7f78a into open-feature:main Dec 7, 2023
14 checks passed
@bacherfl bacherfl deleted the chore/refactoring branch December 7, 2023 05:59
@github-actions github-actions bot mentioned this pull request Dec 7, 2023
toddbaert pushed a commit that referenced this pull request Dec 12, 2023
#1076)

This is a follow up to the latest refactoring PR #1044 to avoid a nil
pointer access when attempting to read from a kubernetes sync source

Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
toddbaert pushed a commit that referenced this pull request Dec 22, 2023