Skip to content

feat: Watch IMC Leave hub agent#59

Merged
Arvindthiru merged 1 commit into
Azure:mainfrom
Arvindthiru:WatchIMCLeave
Jun 10, 2022
Merged

feat: Watch IMC Leave hub agent#59
Arvindthiru merged 1 commit into
Azure:mainfrom
Arvindthiru:WatchIMCLeave

Conversation

@Arvindthiru

@Arvindthiru Arvindthiru commented Jun 7, 2022

Copy link
Copy Markdown
Contributor

Description of your changes

Fixes #

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

The code has been tested on a Kind Cluster

Special notes for your reviewer

Unit tests and Integration tests will be added in the following PRs

@Arvindthiru Arvindthiru changed the title Watch IMC Leave hub agent feat: Watch IMC Leave hub agent Jun 7, 2022
@Arvindthiru
Arvindthiru marked this pull request as ready for review June 9, 2022 00:23
Comment thread pkg/controllers/membercluster/membercluster_controller.go
Comment thread pkg/controllers/membercluster/membercluster_controller.go Outdated
return nil
}

// addMemberClusterFinalizers is used to add finalizer strings for all the resources created for a member cluster.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd add SetControllerReference in the reconciler for the memberclutser as an owner.

https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/controller/controllerutil#SetOwnerReference

@Arvindthiru Arvindthiru Jun 10, 2022

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll open an issue to address this in a following PR #78

Comment thread pkg/controllers/membercluster/membercluster_controller.go
Comment thread pkg/controllers/membercluster/membercluster_controller.go Outdated

@ryanzhang-oss ryanzhang-oss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please check this in and I will add an adjustment PR afterwards

Comment thread pkg/controllers/membercluster/membercluster_controller.go Outdated
if (joinCondition != nil && joinCondition.Status == metav1.ConditionTrue) && (heartBeatCondition != nil && heartBeatCondition.Status == metav1.ConditionTrue) {
err := r.updateMemberClusterStatus(ctx, mc, imc.Status)

if (joinedCondition != nil && joinedCondition.Status == metav1.ConditionTrue) && (heartBeatCondition != nil && heartBeatCondition.Status == metav1.ConditionTrue) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the join status should not be mixed with heartbeat status

err := r.updateMemberClusterStatus(ctx, mc, imc.Status)

if (joinedCondition != nil && joinedCondition.Status == metav1.ConditionTrue) && (heartBeatCondition != nil && heartBeatCondition.Status == metav1.ConditionTrue) {
err := r.updateMemberClusterStatusAsJoined(ctx, mc, imc.Status)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe not update the mc status if there is nothing to update (in that function which is not in this PR).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

and with a retry?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added retry

internalMemberClusterLeftCondition := imc.GetCondition(fleetv1alpha1.ConditionTypeInternalMemberClusterJoin)
memberClusterLeftCondition := mc.GetCondition(fleetv1alpha1.ConditionTypeInternalMemberClusterJoin)

if (internalMemberClusterLeftCondition != nil && internalMemberClusterLeftCondition.Status == metav1.ConditionFalse) && memberClusterLeftCondition != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why put this in the loop instead of using the finalizer?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you can put a finalizer in the imc and delete the imc.

Comment thread pkg/controllers/membercluster/membercluster_controller.go Outdated
Comment thread pkg/controllers/membercluster/membercluster_controller.go
@Arvindthiru
Arvindthiru merged commit c9a1670 into Azure:main Jun 10, 2022
britaniar pushed a commit to britaniar/fleet that referenced this pull request May 15, 2025
… (except the first one) to fail due to conflicts (Azure#59)
britaniar pushed a commit to britaniar/fleet that referenced this pull request May 15, 2025
… (except the first one) to fail due to conflicts (Azure#59)
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.

4 participants