Skip to content

Commit

Permalink
Polish comments
Browse files Browse the repository at this point in the history
Signed-off-by: kerthcet <[email protected]>
  • Loading branch information
kerthcet committed Apr 19, 2024
1 parent cf3cf26 commit 83af7f7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions api/leaderworkerset/v1/leaderworkerset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pkg/controllers/leaderworkerset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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++
}
}
}
Expand All @@ -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 {
Expand Down

0 comments on commit 83af7f7

Please sign in to comment.