diff --git a/api/leaderworkerset/v1/leaderworkerset_types.go b/api/leaderworkerset/v1/leaderworkerset_types.go index dd581beb..3e259929 100644 --- a/api/leaderworkerset/v1/leaderworkerset_types.go +++ b/api/leaderworkerset/v1/leaderworkerset_types.go @@ -175,13 +175,13 @@ type LeaderWorkerSetStatus struct { // Conditions track the condition of the leaderworkerset. Conditions []metav1.Condition `json:"conditions,omitempty"` - // ReadyReplicas track the number of groups that are in ready state. + // ReadyReplicas track the number of groups that are in ready state (updated or not). ReadyReplicas int32 `json:"readyReplicas,omitempty"` - // UpdatedReplicas track the number of groups that have been updated. + // UpdatedReplicas track the number of groups that have been updated (ready or not). UpdatedReplicas int32 `json:"updatedReplicas,omitempty"` - // Replicas track the active total number of groups. + // Replicas track the total number of groups that have been created (updated or not, ready or not) Replicas int32 `json:"replicas,omitempty"` // HPAPodSelector for pods that belong to the LeaderWorkerSet object, this is diff --git a/config/crd/bases/leaderworkerset.x-k8s.io_leaderworkersets.yaml b/config/crd/bases/leaderworkerset.x-k8s.io_leaderworkersets.yaml index 75d44d07..6965ceb5 100644 --- a/config/crd/bases/leaderworkerset.x-k8s.io_leaderworkersets.yaml +++ b/config/crd/bases/leaderworkerset.x-k8s.io_leaderworkersets.yaml @@ -15392,16 +15392,17 @@ spec: type: string readyReplicas: description: ReadyReplicas track the number of groups that are in - ready state. + ready state (updated or not). format: int32 type: integer replicas: - description: Replicas track the active total number of groups. + description: Replicas track the total number of groups that have been + created (updated or not, ready or not) format: int32 type: integer updatedReplicas: description: UpdatedReplicas track the number of groups that have - been updated. + been updated (ready or not). format: int32 type: integer type: object diff --git a/pkg/controllers/leaderworkerset_controller.go b/pkg/controllers/leaderworkerset_controller.go index 2bc2ef3c..03a6eaa1 100644 --- a/pkg/controllers/leaderworkerset_controller.go +++ b/pkg/controllers/leaderworkerset_controller.go @@ -354,7 +354,7 @@ func (r *LeaderWorkerSetReconciler) updateConditions(ctx context.Context, lws *l } updateStatus := false - readyCount, updatedCount, availableCount := 0, 0, 0 + readyCount, updatedCount, updatedAndReadyCount := 0, 0, 0 templateHash := utils.LeaderWorkerTemplateHash(lws) // Iterate through all statefulsets. @@ -377,7 +377,7 @@ func (r *LeaderWorkerSetReconciler) updateConditions(ctx context.Context, lws *l if sts.Labels[leaderworkerset.TemplateRevisionHashKey] == templateHash && leaderPod.Labels[leaderworkerset.TemplateRevisionHashKey] == templateHash { updatedCount++ if ready { - availableCount++ + updatedAndReadyCount++ } } } @@ -392,7 +392,7 @@ func (r *LeaderWorkerSetReconciler) updateConditions(ctx context.Context, lws *l updateStatus = true } - condition := makeCondition(availableCount == int(*lws.Spec.Replicas)) + condition := makeCondition(updatedAndReadyCount == int(*lws.Spec.Replicas)) updateCondition := setCondition(lws, condition) // if condition changed, record events if updateCondition {