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

Sync from open-cluster-management-io/governance-policy-propagator: #130 #459

Merged
merged 11 commits into from
Oct 11, 2023

Conversation

JustinKuli
Copy link
Contributor

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)
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)
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)
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)
Signed-off-by: Justin Kulikauskas <[email protected]>
(cherry picked from commit dfde80f)
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)
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)
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)
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)
It calls them "Implicit memory aliasing in for loop"

Signed-off-by: Justin Kulikauskas <[email protected]>
@JustinKuli
Copy link
Contributor Author

It looks like this will need additional fixes which we'll have to push back up to ocm-io somehow.

@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 11, 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 d180162 into stolostron:main Oct 11, 2023
11 checks passed
@JustinKuli JustinKuli deleted the sync-ocm-130 branch October 11, 2023 17:42
@JustinKuli
Copy link
Contributor Author

/cherry-pick release-2.9

@openshift-cherrypick-robot

@JustinKuli: #459 failed to apply on top of branch "release-2.9":

Applying: Refactor propagator reconciler setup to one file
Using index info to reconstruct a base tree...
M	controllers/propagator/placementBindingMapper.go
M	controllers/propagator/placementBindingPredicate.go
M	controllers/propagator/placementDecisionMapper.go
M	controllers/propagator/placementRuleMapper.go
M	controllers/propagator/policy_controller.go
Falling back to patching base and 3-way merge...
Auto-merging controllers/propagator/policy_controller.go
Removing controllers/propagator/policySetPredicate.go
Removing controllers/propagator/policySetMapper.go
Removing controllers/propagator/policyPredicate.go
CONFLICT (modify/delete): controllers/propagator/placementRuleMapper.go deleted in Refactor propagator reconciler setup to one file and modified in HEAD. Version HEAD of controllers/propagator/placementRuleMapper.go left in tree.
CONFLICT (modify/delete): controllers/propagator/placementDecisionMapper.go deleted in Refactor propagator reconciler setup to one file and modified in HEAD. Version HEAD of controllers/propagator/placementDecisionMapper.go left in tree.
CONFLICT (modify/delete): controllers/propagator/placementBindingPredicate.go deleted in Refactor propagator reconciler setup to one file and modified in HEAD. Version HEAD of controllers/propagator/placementBindingPredicate.go left in tree.
CONFLICT (modify/delete): controllers/propagator/placementBindingMapper.go deleted in Refactor propagator reconciler setup to one file and modified in HEAD. Version HEAD of controllers/propagator/placementBindingMapper.go left in tree.
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Refactor propagator reconciler setup to one file
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-2.9

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@JustinKuli
Copy link
Contributor Author

/cherry-pick release-2.9

@openshift-cherrypick-robot

@JustinKuli: #459 failed to apply on top of branch "release-2.9":

Applying: Refactor propagator reconciler setup to one file
Applying: Refactor predicates and mappers: PolicyReconciler
Applying: Rename PolicyReconciler to RootPolicyReconciler
Applying: Add replicated policy reconciler
Applying: Remove old concurrency pieces
Using index info to reconstruct a base tree...
M	README.md
Falling back to patching base and 3-way merge...
Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0005 Remove old concurrency pieces
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-2.9

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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.

😿 Failed to sync the upstream PRs: #130
3 participants