-
Notifications
You must be signed in to change notification settings - Fork 909
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
Add FullyApplied to binding #825
Add FullyApplied to binding #825
Conversation
5d88838
to
7dced83
Compare
ResourceBinding status is shown below.
|
return controllerruntime.Result{Requeue: true}, err | ||
} | ||
} else { | ||
err := c.updateFullyAppliedCondition(binding, metav1.ConditionFalse, "FullyAppliedFalse", "Failed to apply all works.") |
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.
It's not a Failed
state, it just means hasn't FullyApplied
.
Failed to apply all works.
will imply something bad happens, but it doesn't.
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 suppose to not setting the condition when FullyApplied==false
.
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.
Thanks for your reviews. @RainbowMango
Failed to apply all works.
Whether it can be changed to
Not all works have been deployed
If necessary, could count the successful applied works:
("Not all works(%v/%v) have been deployed", acutalAppliedWorksNum, total)
I suppose to not setting the condition when FullyApplied==false.
Ok, that is a good idea, reducing unnecessary update
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 suppose to not setting the condition when
FullyApplied==false
.
I have a question, whether or not this is the case that the status is changed from FullyApplied==true
to FullyApplied==false
?
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.
Good question. This would probably happen when there are new clusters
added.
No idea about this yet.
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.
Good question. This would probably happen when there are new
clusters
added. No idea about this yet.
Thanks for your reply! I just changed the code, that didnt set condition when
FullyApplied==false. And if there have been added
FullyApllied` condition, it need not to inspect works status, reducing the inspect times.
Status: status, | ||
Reason: reason, | ||
Message: message, | ||
LastTransitionTime: metav1.Now(), |
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.
We should trigger the update only when the status changed (not FullyApplied --> FullyApplied).
Here will trigger the update operation every time since we have updated the LastTransitionTime
here.
ae4d59f
to
2f445e2
Compare
Hi, @RainbowMango |
Signed-off-by: lonelyCZ <[email protected]>
2f445e2
to
f3eae22
Compare
Type: workv1alpha2.FullyApplied, | ||
Status: metav1.ConditionTrue, | ||
Reason: FullyAppliedSuccessReason, | ||
Message: FullyAppliedSuccessMessage, |
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 wonder who set lastTransitionTime
for us?
- lastTransitionTime: "2021-10-21T02:16:18Z"
message: All works have been successfully applied
reason: FullyAppliedSuccess
status: "True"
type: FullyApplied
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.
It seem automatically set lastTransitionTime
.
Now the new status is shown below:
...
conditions:
- lastTransitionTime: "2021-10-21T03:58:22Z"
message: the binding has been scheduled
reason: BindingScheduled
status: "True"
type: Scheduled
- lastTransitionTime: "2021-10-21T03:58:23Z"
message: All works have been successfully applied
reason: FullyAppliedSuccess
status: "True"
type: FullyApplied
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.
karmada/vendor/k8s.io/apimachinery/pkg/api/meta/conditions.go
Lines 36 to 38 in 9c891f5
if newCondition.LastTransitionTime.IsZero() { | |
newCondition.LastTransitionTime = metav1.NewTime(time.Now()) | |
} |
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.
Thank you for pointing that out!
/lgtm Thanks. |
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: RainbowMango 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 |
What type of PR is this?
/kind feature
What this PR does / why we need it:
FullyApplied represents if the resource is applied to all of the scheduled clusters.
Which issue(s) this PR fixes:
Fixes #820
Special notes for your reviewer:
The process also can be moved to
workstatus.go
, but that is not a accurate place for resourcebinding. so I put them to ResourceBindingController.Does this PR introduce a user-facing change?: