feat: Watch IMC Leave hub agent#59
Conversation
b94ef78 to
567f898
Compare
| return nil | ||
| } | ||
|
|
||
| // addMemberClusterFinalizers is used to add finalizer strings for all the resources created for a member cluster. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
I'll open an issue to address this in a following PR #78
ryanzhang-oss
left a comment
There was a problem hiding this comment.
Please check this in and I will add an adjustment PR afterwards
| 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) { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
maybe not update the mc status if there is nothing to update (in that function which is not in this PR).
| internalMemberClusterLeftCondition := imc.GetCondition(fleetv1alpha1.ConditionTypeInternalMemberClusterJoin) | ||
| memberClusterLeftCondition := mc.GetCondition(fleetv1alpha1.ConditionTypeInternalMemberClusterJoin) | ||
|
|
||
| if (internalMemberClusterLeftCondition != nil && internalMemberClusterLeftCondition.Status == metav1.ConditionFalse) && memberClusterLeftCondition != nil { |
There was a problem hiding this comment.
why put this in the loop instead of using the finalizer?
There was a problem hiding this comment.
you can put a finalizer in the imc and delete the imc.
567f898 to
5c732ad
Compare
db269c4 to
1e7da3f
Compare
… (except the first one) to fail due to conflicts (Azure#59)
… (except the first one) to fail due to conflicts (Azure#59)
Description of your changes
Fixes #
I have:
make reviewableto 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