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: #127 #435

Merged
merged 2 commits into from
Sep 13, 2023

Conversation

magic-mirror-bot[bot]
Copy link
Contributor

The new `IsForPolicyOrPolicySet` may be very slightly faster than the
previous implementation.

The `GetPoliciesInPlacementBinding` function is from duplicated code.

The removal of a `DeepCopy()` call may improve performance.

Signed-off-by: Justin Kulikauskas <[email protected]>
(cherry picked from commit fdc3118)
Previously, the `common` package had separate functions to get the
decisions from a PlacementBinding depending on whether it was bound to
a Placement or a PlacementRule. But every caller would need to use both,
so that was unnecessary. Now, there is a unified `GetDecisions` func.

Similarly, the `propagator` had separate functions to find the policy
placements (not to be confused with Placements...), and the de-
duplicated logic was brought to the `getPolicyPlacementDecisions` func
more directly.

Signed-off-by: Justin Kulikauskas <[email protected]>
(cherry picked from commit 4178f22)
@openshift-ci
Copy link

openshift-ci bot commented Sep 13, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: magic-mirror-bot[bot]
Once this PR has been reviewed and has the lgtm label, please assign gparvin for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@magic-mirror-bot magic-mirror-bot bot merged commit 98d2af9 into main Sep 13, 2023
@magic-mirror-bot magic-mirror-bot bot deleted the magic-mirror-main-1694619684154 branch September 13, 2023 16:05
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability C 4 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

91.2% 91.2% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

}
}
}
result = append(result, common.GetPoliciesInPlacementBinding(ctx, c, &pb)...)

Check warning

Code scanning / SonarCloud

<!--SONAR_ISSUE_KEY:AYqPSsPE3PkE-TAvSFWh-->Implicit memory aliasing in for loop. <p>See more on <a href="https://sonarcloud.io/project/issues?id=open-cluster-management_governance-policy-propagator&issues=AYqPSsPE3PkE-TAvSFWh&open=AYqPSsPE3PkE-TAvSFWh&pullRequest=435">SonarCloud</a></p>

<!--SONAR_ISSUE_KEY:AYqPSsPE3PkE-TAvSFWh-->Implicit memory aliasing in for loop. <p>See more on <a href="https://sonarcloud.io/project/issues?id=open-cluster-management_governance-policy-propagator&issues=AYqPSsPE3PkE-TAvSFWh&open=AYqPSsPE3PkE-TAvSFWh&pullRequest=435">SonarCloud</a></p>
foundInDecisions := false

plcDecisions, plcPlacements, err := r.getPolicyPlacementDecisions(instance, pb)
plcDecisions, plcPlacements, err := r.getPolicyPlacementDecisions(instance, &pb)

Check warning

Code scanning / SonarCloud

<!--SONAR_ISSUE_KEY:AYqPSsTw3PkE-TAvSFWi-->Implicit memory aliasing in for loop. <p>See more on <a href="https://sonarcloud.io/project/issues?id=open-cluster-management_governance-policy-propagator&issues=AYqPSsTw3PkE-TAvSFWi&open=AYqPSsTw3PkE-TAvSFWi&pullRequest=435">SonarCloud</a></p>

<!--SONAR_ISSUE_KEY:AYqPSsTw3PkE-TAvSFWi-->Implicit memory aliasing in for loop. <p>See more on <a href="https://sonarcloud.io/project/issues?id=open-cluster-management_governance-policy-propagator&issues=AYqPSsTw3PkE-TAvSFWi&open=AYqPSsTw3PkE-TAvSFWi&pullRequest=435">SonarCloud</a></p>
continue
}

plcDecisions, plcPlacements, err := r.getPolicyPlacementDecisions(instance, pb)
plcDecisions, plcPlacements, err := r.getPolicyPlacementDecisions(instance, &pb)

Check warning

Code scanning / SonarCloud

<!--SONAR_ISSUE_KEY:AYqPSsTw3PkE-TAvSFWj-->Implicit memory aliasing in for loop. <p>See more on <a href="https://sonarcloud.io/project/issues?id=open-cluster-management_governance-policy-propagator&issues=AYqPSsTw3PkE-TAvSFWj&open=AYqPSsTw3PkE-TAvSFWj&pullRequest=435">SonarCloud</a></p>

<!--SONAR_ISSUE_KEY:AYqPSsTw3PkE-TAvSFWj-->Implicit memory aliasing in for loop. <p>See more on <a href="https://sonarcloud.io/project/issues?id=open-cluster-management_governance-policy-propagator&issues=AYqPSsTw3PkE-TAvSFWj&open=AYqPSsTw3PkE-TAvSFWj&pullRequest=435">SonarCloud</a></p>
}

result = append(result, common.GetPoliciesInPlacementBinding(ctx, c, &pb)...)

Check warning

Code scanning / SonarCloud

<!--SONAR_ISSUE_KEY:AYqPSsUU3PkE-TAvSFWk-->Implicit memory aliasing in for loop. <p>See more on <a href="https://sonarcloud.io/project/issues?id=open-cluster-management_governance-policy-propagator&issues=AYqPSsUU3PkE-TAvSFWk&open=AYqPSsUU3PkE-TAvSFWk&pullRequest=435">SonarCloud</a></p>

<!--SONAR_ISSUE_KEY:AYqPSsUU3PkE-TAvSFWk-->Implicit memory aliasing in for loop. <p>See more on <a href="https://sonarcloud.io/project/issues?id=open-cluster-management_governance-policy-propagator&issues=AYqPSsUU3PkE-TAvSFWk&open=AYqPSsUU3PkE-TAvSFWk&pullRequest=435">SonarCloud</a></p>
@JustinKuli
Copy link
Contributor

/cherry-pick release-2.9

@openshift-cherrypick-robot

@JustinKuli: new pull request created: #460

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.

2 participants