Skip to content

feat: enqueue instances on rgd update #474

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

Merged
merged 10 commits into from
Apr 7, 2025

Conversation

fabianburth
Copy link
Contributor

Enhancement
Currently, when applying a modified ResourceGraphDefinition, the corresponding instance objects will not be enqueued for reconciliation. This means, the changes in the RGD do not take effect until the next reconciliation of the instance. If the instances are not modified, the next scheduled reconciliation occurs after the resync period of the dynamic controller.
This PR proposes a change to allow for a rather immediate reconciliation of corresponding instance objects.

This is also mentioned in this issue and work on that has already been started in PR.

TODO: @a-hilaly I'd like to revisit the idea of the update annotation.

@fabianburth
Copy link
Contributor Author

With regards to the update annotation - currently, I feel like the update probably should not be conditional at all. Primarily because even if an instance is annotated with ignore-rgd-update, the rgd update would still be part of the next reconciliation of that instance.
I think with an actual ignore-rgd-update kind of annotation, the expectation would rather be that the instance handler would not be updated based on that annotation. But I guess, then we'd have to track the handlers on a per instance basis. What do you think?

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

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

Awesome, thank you @fabianburth !! left a few thoughts/questions below

dc.handlers.Store(gvr, handler)
// trigger reconciliation of the corresponding gvr's
objs, err := dc.kubeClient.Resource(gvr).Namespace("").List(ctx, metav1.ListOptions{})
Copy link
Member

Choose a reason for hiding this comment

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

Does this list objects in all namespaces or just in the default namespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apparently, it does list objects in all namespaces. But since I actually had to go check after you asked, I included an object with a non-default namespace in the test.

@@ -62,8 +62,10 @@ import (
"time"

"github.com/go-logr/logr"
"github.com/kro-run/kro/api/v1alpha1"
Copy link
Member

Choose a reason for hiding this comment

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

can you please move this import to the L80 import group, checkout this commit message golang/tools@ed69e84

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved itself (due to the removal of the annotation constants)

Comment on lines 109 to 119

// InstanceUpdatePolicy is the annotation key for the instance update policy
InstanceUpdatePolicy = "kro.run/instance-update-policy"

// InstanceUpdatePolicyOnRGDUpdate represents the update policy that leads to
// a reconciliation of the instance after the corresponding resource graph is updated
InstanceUpdatePolicyOnRGDUpdate = "on-rgd-update"

// InstanceUpdatePolicyIgnoreRGDUpdate represents the update policy that explicitly
// avoids reconciliation of the instance after the corresponding resource graph is updated
InstanceUpdatePolicyIgnoreRGDUpdate = "ignore-rgd-update"
Copy link
Member

Choose a reason for hiding this comment

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

I'm thinking that we should first implement the core functionality of updating instances on RGD updates as the default behavior. I'm concerned about introducing annotations at this stage since they represent a potential breaking change and we probablyy should discuss the naming conventions and semantics carefully. maybe we could address the annotation mechanism/names in a separate PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure!
As mentioned in my comment, I feel very unsure about the annotations and their expected / intended behaviour anyway.

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

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

LGTM, danke schoen!

@a-hilaly a-hilaly merged commit 7c7672f into kro-run:main Apr 7, 2025
4 checks passed
@fabianburth fabianburth deleted the feat/enqueue-instances branch April 8, 2025 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants