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

Add composite ConfigStore to combine multiple ConfigStore #3027

Conversation

pierDipi
Copy link
Member

In some repositories, we used multiple ConfigStores to store feature flags, for example, in eventing kafka broker, we use the Eventing core feature flags store and the EKB feature flags store

Changes

  • Add composite ConfigStore to combine multiple ConfigStore

In some repositories, we used multiple ConfigStores to store feature
flags, for example, in eventing kafka broker, we use the Eventing
core feature flags store and the EKB feature flags store

Signed-off-by: Pierangelo Di Pilato <[email protected]>
@knative-prow knative-prow bot requested review from dprotaso and skonto April 29, 2024 09:37
@knative-prow knative-prow bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 29, 2024
Copy link

knative-prow bot commented Apr 29, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pierDipi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 29, 2024
Copy link

codecov bot commented Apr 29, 2024

Codecov Report

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

Project coverage is 78.73%. Comparing base (03bf3de) to head (57cad9e).
Report is 29 commits behind head on main.

Files Patch % Lines
reconciler/configstore.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3027      +/-   ##
==========================================
- Coverage   78.75%   78.73%   -0.02%     
==========================================
  Files         188      189       +1     
  Lines       11107     8873    -2234     
==========================================
- Hits         8747     6986    -1761     
+ Misses       2094     1621     -473     
  Partials      266      266              

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

@skonto
Copy link
Contributor

skonto commented Apr 29, 2024

Do you see this being

	for _, s := range stores {
		ctx = s.ToContext(ctx)
	}

being used often in different reconcilers, besides the example in the description? Trying to understand where we can re-use it.

@pierDipi
Copy link
Member Author

pierDipi commented Apr 29, 2024

This can be reused everywhere we have multiple config stores (config stores being mainly configmaps), a serving example could be: config-features and config-network in the case one reconciler depends on both

	impl := <resource>reconciler.NewImpl(ctx, reconciler, func(impl *controller.Impl) controller.Options {
		return controller.Options{
			ConfigStore:       reconciler.ConfigStores{s1, s2},
                        // ...
		}
	})

and then the usage would just pull the config from the context in ReconcileKind

s1 := s1package.FromContext(ctx)
...

@skonto
Copy link
Contributor

skonto commented Apr 29, 2024

in the case one reconciler depends on both

Not sure if we have a scenario in Serving but ok I see how this can be useful.

@skonto
Copy link
Contributor

skonto commented Apr 29, 2024

/lgtm
/hold for @dprotaso if he has any objections

@knative-prow knative-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 29, 2024
@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Apr 29, 2024
@pierDipi
Copy link
Member Author

/unhold

@dprotaso I'm merging this as I don't see objections here

@knative-prow knative-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 14, 2024
@ReToCode
Copy link
Member

/test unit-tests

1 similar comment
@ReToCode
Copy link
Member

/test unit-tests

@knative-prow knative-prow bot merged commit 11a3d46 into knative:main May 15, 2024
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants