Skip to content
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

Mimic LeaderWorkerSet status as StatefulSet or Deployment #96

Closed
liurupeng opened this issue Apr 11, 2024 · 18 comments · Fixed by #111
Closed

Mimic LeaderWorkerSet status as StatefulSet or Deployment #96

liurupeng opened this issue Apr 11, 2024 · 18 comments · Fixed by #111
Assignees
Labels
kind/support Categorizes issue or PR as a support question.

Comments

@liurupeng
Copy link
Collaborator

For rolling update related status' fields, should we mimic Statefulset or Deployment. My prefer using the StatefulSet one, since it could provide more information.

@liurupeng liurupeng added the kind/support Categorizes issue or PR as a support question. label Apr 11, 2024
@liurupeng
Copy link
Collaborator Author

liurupeng commented Apr 11, 2024

@ahg-g @kerthcet any thoughts

@ahg-g
Copy link
Contributor

ahg-g commented Apr 11, 2024

For rolling update related status' fields, should we mimic Statefulset or Deployment

+1, we should have this.

@liurupeng
Copy link
Collaborator Author

but do you think we should have the same one as StatefulSet or Deployment though @ahg-g

@ahg-g
Copy link
Contributor

ahg-g commented Apr 11, 2024

can you describe what each one covers?

@kerthcet
Copy link
Contributor

We're now quite similar to deployment. Glad to have one observedGeneration to reflect the current generation.

@liurupeng
Copy link
Collaborator Author

liurupeng commented Apr 15, 2024

In StatefulSet, Link, there are ObservedGeneration, CurrentReplicas, UpdatedReplicas, CurrentRevision, UpdatedRevision etc.
In Deployment, Link, there are ObservedGeneration, UpdatedReplicas.

Both could be supported which we could change the CurrentRevision to CurrentTemplateHash or remove that. I mainly want to support the CurrentReplicas and UpdatedReplicas, for now, the UpdatedReplicas==Lws.Spec.Replicas when upgrade finished which make it hard to calculate the upgrade latency (the same in deployment). In statefulSet, when upgrade finished, UpdatedReplcias == 0 and currentReplicas==lws.Spec.Replicas. This should give more information as well for many cases

@liurupeng
Copy link
Collaborator Author

@ahg-g and @kerthcet thoughts?

@ahg-g
Copy link
Contributor

ahg-g commented Apr 16, 2024

Adding currentReplicas and changing the semantics of updatedReplicas sounds good to me.

@ahg-g
Copy link
Contributor

ahg-g commented Apr 16, 2024

but we need to do that before the release

@liurupeng
Copy link
Collaborator Author

liurupeng commented Apr 16, 2024

I'll submit a change today @ahg-g

@liurupeng
Copy link
Collaborator Author

/assign

@liurupeng
Copy link
Collaborator Author

actually it's hard to calculate currentReplicas if we don't keep a record of the current template hash somewhere. Does it make sense to only update the semantics of updatedReplicas if we don't add the currentReplicas though

@kerthcet
Copy link
Contributor

kerthcet commented Apr 17, 2024

In statefulSet, when upgrade finished, UpdatedReplcias == 0 and currentReplicas==lws.Spec.Replicas.

I rechecked, but the updatedReplicas == spec.Replicas. But when rolling update starts, the updatedReplicas will change to 0.

@kerthcet
Copy link
Contributor

If we set the updatedReplicas to 0 when rolling update finished, then if we have a sts of replicas-10, when two replicas down, what's the value of updatedReplicas right now? eight? then it seems a little weird .. since we jumped from 0 to 8 then to 0 again.

calculate the upgrade latency

Can we start when updatedReplicas changes to 0? and end when updatedReplicas = spec.Replicas. I didn't think too deep about this, have no idea whether this works or not.

@nayihz
Copy link
Contributor

nayihz commented Apr 17, 2024

If we set the updatedReplicas to 0 when rolling update finished, then if we have a sts of replicas-10, when two replicas down, what's the value of updatedReplicas right now? eight?

Yes. updatedReplicas will change when pod restart.

calculate the upgrade latency

There are currentRevision and updateRevision in statefulSet to record the template hash. Maybe we can use them to calculate the upgrade latency.

@kerthcet
Copy link
Contributor

We decided to add a new condition type or progressing reason for record.

@ahg-g
Copy link
Contributor

ahg-g commented Apr 18, 2024

I just noticed that UpdatedReplicas and Replicas semantics are not consistent with Statefulset.

In LWS, UpdatedReplicas is the number of replicas that are ready and updated, while in StatefulSet it is the number of updated replicas whether they are ready or not (i.e., created, but not necessarily ready).

In LWS, Replicas is the number of replicas we aim to create (because we set it to leaderSts.Spec.Replicas); while in StatefulSet it is the number of Replicas we created so far (ready or not). I think we can fix this by setting it to leaderSts.Status.Replicas instead of leaderSts.Spec.Replicas

@ahg-g ahg-g reopened this Apr 18, 2024
@kerthcet
Copy link
Contributor

Both make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants