-
Notifications
You must be signed in to change notification settings - Fork 22
Policyset dependencies #58
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
Policyset dependencies #58
Conversation
Previously, only the spec and annotations of policies were synchronized between root and replicated policies. Labels were not synchronized, and the root and replicated policies could drift apart. This was an inconsistent behavior because when the replicated policy is first created, any labels on the root policy *are* copied over. Signed-off-by: Justin Kulikauskas <[email protected]>
These functions were not as "common" as them being in the "common" pkg would suggest. Now they're closer to where they are used, and future related changes will be able to stay in one place. Signed-off-by: Justin Kulikauskas <[email protected]>
Since whether dependencies are satisfied will be calculated on the managed cluster, and since PolicySets are not propagated to managed clusters, in order to work "as expected" by a user, any PolicySet dependencies should be replaced with the Policies that are in that set. To keep those lists up to date, the root policies need to reconcile whenever the dependent PolicySets are updated, accomplished here with the new dynamic watch library. So now Policies watch items referenced in their templates, as well as relevant PolicySets. Note: when a PolicySet does not exist, the dependency is not changed - it is expected that the status message from the managed cluster (indicating that the set does not exist) will be sufficient for users to understand the issue. Refs: - stolostron/backlog#26181 Signed-off-by: Justin Kulikauskas <[email protected]>
Fun 😆 |
return replicated, nil | ||
} | ||
|
||
func (r *PolicyReconciler) canonicalizeDependencies( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a comment describing what this function does would be useful, since the formatted dependency array is not really used in this repo so it might be a bit confusing why we are changing it
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: JustinKuli, willkutler 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 |
This looks good to me! Just added a nit about adding some comments to clarify what these dependency formatting functions do. |
Signed-off-by: Chunxi Luo <[email protected]> open-cluster-management-io#58
Signed-off-by: Chunxi Luo <[email protected]> open-cluster-management-io#58
Signed-off-by: Chunxi Luo <[email protected]> open-cluster-management-io#58
Some refactoring to (I think) get things in better shape for the changes, and then this is the main commit message:
Since whether dependencies are satisfied will be calculated on the managed cluster, and since PolicySets are not propagated to managed clusters, in order to work "as expected" by a user, any PolicySet dependencies should be replaced with the Policies that are in that set.
To keep those lists up to date, the root policies need to reconcile whenever the dependent PolicySets are updated, accomplished here with the new dynamic watch library. So now Policies watch items referenced in their templates, as well as relevant PolicySets.
Note: when a PolicySet does not exist, the dependency is not changed - it is expected that the status message from the managed cluster (indicating that the set does not exist) will be sufficient for users to understand the issue.
Refs: