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

make the agent deploy controller watch the managed cluster #199

Merged

Conversation

zhujian7
Copy link
Member

@zhujian7 zhujian7 commented Jul 28, 2023

Provide an option for developer to make the agent deploy controller watches the managed cluster, so if there are any changes on the managed cluster, the agent deploy controller can reconcile quickly

for example: if a helm addon wants managed cluster annotation changing trigger the agent redeploy:

.WithAgentDeployTriggerClusterFilter(func(old, new *clusterv1.ManagedCluster) bool {
			return !equality.Semantic.DeepEqual(old.Annotations, new.Annotations)
		})

issue reference: #198

Signed-off-by: zhujian <jiazhu@redhat.com>
@zhujian7 zhujian7 force-pushed the watch-cluster branch 3 times, most recently from 10f5803 to 03db4ac Compare August 1, 2023 03:26
@zhujian7 zhujian7 changed the title WIP: make the agent deploy controller watch the managed cluster make the agent deploy controller watch the managed cluster Aug 1, 2023
@zhujian7
Copy link
Member Author

zhujian7 commented Aug 1, 2023

/assign @qiujian16 @zhiweiyin318

// AgentDeployClusterInformerFilter: func(old, new *clusterv1.ManagedCluster) bool {
// return !equality.Semantic.DeepEqual(old.Annotations, new.Annotations)
// }
AgentDeployClusterInformerFilter func(old, new *clusterv1.ManagedCluster) bool
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
AgentDeployClusterInformerFilter func(old, new *clusterv1.ManagedCluster) bool
AgentDeployTriggerClusterFilter func(old, new *clusterv1.ManagedCluster) bool

something like this?

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, fixed

@@ -76,6 +76,19 @@ type AgentAddonOptions struct {
// SupportedConfigGVRs is a list of addon supported configuration GroupVersionResource
// each configuration GroupVersionResource should be unique
SupportedConfigGVRs []schema.GroupVersionResource

// AgentDeployClusterInformerFilter defines the filter function for the cluster informer when deploying the addon
Copy link
Member

Choose a reason for hiding this comment

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

the filter func to trigger the agent deploy/redploy when cluster info is changed.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Signed-off-by: zhujian <jiazhu@redhat.com>
@qiujian16
Copy link
Member

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm label Aug 1, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 1, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiujian16, zhujian7

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

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.

None yet

4 participants