Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -628,12 +628,29 @@ func (r *ReconcileYurtAppSet) conciliateYurtAppSetStatus(
// calculate yas current status
readyWorkloads, updatedWorkloads := 0, 0
for _, workload := range curWorkloads {
workloadObj := workload.(*appsv1.Deployment)
if workloadObj.Status.ReadyReplicas == workloadObj.Status.Replicas {
var readyReplicas, replicas, updatedReplicas int32
var hash string

switch w := workload.(type) {
case *appsv1.Deployment:
readyReplicas = w.Status.ReadyReplicas
replicas = w.Status.Replicas
updatedReplicas = w.Status.UpdatedReplicas
hash = workloadmanager.GetWorkloadHash(w)
case *appsv1.StatefulSet:
readyReplicas = w.Status.ReadyReplicas
replicas = w.Status.Replicas
updatedReplicas = w.Status.UpdatedReplicas
hash = workloadmanager.GetWorkloadHash(w)
default:
klog.Warningf("YurtAppSet[%s/%s] unknown workload type: %T", yas.GetNamespace(), yas.GetName(), workload)
Copy link
Member

Choose a reason for hiding this comment

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

Would it be better to include the workload's name and namespace in the logs?

Copy link
Author

Choose a reason for hiding this comment

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

Would it be better to include the workload's name and namespace in the logs?

That makes sense, including the workload name and namespace would improve debugging and log clarity. I’ll update the warning log to include those fields.
Thanks for the suggestion!

continue
}

if readyReplicas == replicas {
readyWorkloads++
}
if workloadmanager.GetWorkloadHash(workloadObj) == expectedRevision.GetName() &&
workloadObj.Status.UpdatedReplicas == workloadObj.Status.Replicas {
if hash == expectedRevision.GetName() && updatedReplicas == replicas {
updatedWorkloads++
}
}
Expand Down
Loading