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 two caching modes #91

Merged
merged 4 commits into from
Oct 17, 2023
Merged

Add two caching modes #91

merged 4 commits into from
Oct 17, 2023

Conversation

mprahl
Copy link
Contributor

@mprahl mprahl commented Oct 12, 2023

See each commit for changes.

The default caching mode is one that caches objects for the duration of the ResolveTemplate execution. This mode is not completely concurrency safe.

The advanced caching mode is concurrency safe and utilizes watches to update the cache in background goroutines.

Relates:
https://issues.redhat.com/browse/ACM-7398

@mprahl mprahl marked this pull request as draft October 12, 2023 19:39
@openshift-ci openshift-ci bot requested a review from gparvin October 12, 2023 19:39
@mprahl mprahl force-pushed the caching branch 6 times, most recently from 75ab9dc to 40cce6f Compare October 13, 2023 20:04
@mprahl mprahl changed the title WIP: Add two caching modes Add two caching modes Oct 17, 2023
@mprahl mprahl marked this pull request as ready for review October 17, 2023 13:30
@openshift-ci openshift-ci bot requested a review from dhaiducek October 17, 2023 13:30
Copy link
Contributor

@JustinKuli JustinKuli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall to me! There isn't even too much that I need clarification on, although I have the advantage of you walking me through it last week.

pkg/templates/generic_lookup_func.go Outdated Show resolved Hide resolved
pkg/templates/templates.go Outdated Show resolved Hide resolved
The default caching mode is one that caches objects for the duration of
the ResolveTemplate execution. This mode is not completely concurrency
safe.

The advanced caching mode is concurrency safe and utilizes watches to
update the cache in background goroutines.

The resolve options are now passed to the ResolveTemplate method. This
allows a shared resolver to resolve templates for different
propagated policies. This allows the cache to be shared as well.

Relates:
https://issues.redhat.com/browse/ACM-7398

Signed-off-by: mprahl <mprahl@users.noreply.github.com>
Signed-off-by: mprahl <mprahl@users.noreply.github.com>
This is useful in the OCM Policy Propagator, where the
ManagedClusterLabels variable is set from the ManagedCluster object the
replicated policy is being built for.

Signed-off-by: mprahl <mprahl@users.noreply.github.com>
Signed-off-by: mprahl <mprahl@users.noreply.github.com>
@sonarcloud
Copy link

sonarcloud bot commented Oct 17, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

88.0% 88.0% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@JustinKuli JustinKuli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@openshift-ci
Copy link

openshift-ci bot commented Oct 17, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JustinKuli, mprahl

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

@openshift-ci openshift-ci bot merged commit 25010ba into stolostron:main Oct 17, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants