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

[release-2.9] 🥸 Sync from open-cluster-management-io/governance-policy-propagator: #130 #462

Merged

Conversation

JustinKuli
Copy link
Contributor

This is a manual cherry-pick of #459

This commit only moves some code between files, it does change any
content.

Signed-off-by: Justin Kulikauskas <[email protected]>
(cherry picked from commit 81284e9)
(cherry picked from commit 52484a7)
This adds some documentation, as well as renames the functions to be
a bit more descriptive. Most code changes are only stylistic or to help
them match other similar functions.

Signed-off-by: Justin Kulikauskas <[email protected]>
(cherry picked from commit 594df54)
(cherry picked from commit 4762d9d)
The new Propagator type has (almost) all the methods that were on the
PolicyReconciler - the only exception is `Reconcile`, which is on the
new RootPolicyReconciler type. This should help organize things to make
a new ReplicatedPolicyReconciler type.

Signed-off-by: Justin Kulikauskas <[email protected]>
(cherry picked from commit 6b98674)
(cherry picked from commit fd24168)
This new reconciler currently handles when a replicated policy changes
unexpectedly, and is triggered by events coming from the root policy
reconciler. This removes the custom concurrency for replicated policy
creation and deletion, and the concurrency here will be adjustable via
the more usual `MaxConcurrentReconciles` controller option.

Because the replicated policy reconciler changes the same resources that
trigger its reconciliation, it often reconciles the same resource twice
in a row. That needs to be addressed for this to be more performant than
the previous implementation.

When running the tests, it became apparent that the encryptionkeys
controller triggers reconciliation on the replicated policies by adding
an annotation to the root policy. This is another place for possible
improvements, it can likely also trigger replicated policy reconciles
directly.

Refs:
 - https://issues.redhat.com/browse/ACM-7332

Signed-off-by: Justin Kulikauskas <[email protected]>
(cherry picked from commit 3bd0d29)
(cherry picked from commit 0496315)
Signed-off-by: Justin Kulikauskas <[email protected]>
(cherry picked from commit dfde80f)
(cherry picked from commit c3bfd4c)
This should help answer some performance questions in the propagator.
These metrics are not as good as running a real performance tests, but
they will provide some data, from tests we already run regularly.

Signed-off-by: Justin Kulikauskas <[email protected]>
(cherry picked from commit 35d5aa2)
(cherry picked from commit 225880f)
Based on metrics from the e2e tests, this may reduce the number of
replicated policy reconciles by 35%.

Events from the dependency watcher are artificially delayed on the
replicated policy reconcile queue - the watch there and a watch for the
controller-runtime cache on ManagedCluster labels will race each other,
and if the cache is old during the reconcile, the needed update will
be missed. This is not the best way to resolve the race: it would be
better to ensure that both use the same watch or cache somehow.

Refs:
 - https://issues.redhat.com/browse/ACM-7332

Signed-off-by: Justin Kulikauskas <[email protected]>

update resource version cache

(cherry picked from commit 76f7ff6)
(cherry picked from commit bf1edc0)
This increases the root policy concurrency from 1 to 2, and makes it
configurable. It also adds concurrency to the replicated policy - the
default is 10, up from the concurrency it replaces which defaulted to 5.

Some refactoring was done to have all reconciler concurrencies be
configured uniformly.

Signed-off-by: Justin Kulikauskas <[email protected]>
(cherry picked from commit aa643c0)
(cherry picked from commit 3651c4f)
The bigger change is that the status is now updated before sending the
events to the replicated policy reconciler - this should help prevent
some requeues. Otherwise, these are largely just organizational changes.

Signed-off-by: Justin Kulikauskas <[email protected]>
(cherry picked from commit b2aa21d)
(cherry picked from commit 56b9c23)
It calls them "Implicit memory aliasing in for loop"

Signed-off-by: Justin Kulikauskas <[email protected]>
(cherry picked from commit daa7599)
Signed-off-by: Justin Kulikauskas <[email protected]>
(cherry picked from commit bbe0749)
@sonarqubecloud
Copy link

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 9 Code Smells

87.5% 87.5% Coverage
4.0% 4.0% Duplication

@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 83adc83 into stolostron:release-2.9 Oct 17, 2023
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.

2 participants