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

After scale down, the pod may be created again because the pod still terminating. #42

Open
GoneLikeAir opened this issue Mar 12, 2021 · 3 comments

Comments

@GoneLikeAir
Copy link
Contributor

I found that after scale down, the pod may be created again because the pod still terminating.
Here is the code:
func (s *shardManager) Shards() ([]*shard.Shard, error) { pods, err := s.getPods(s.sts.Spec.Selector.MatchLabels) // **Here will also get the pods that is terminating** if err != nil { return nil, errors.Wrap(err, "list pod") } ... return ret, nil }

@RayHuangCN
Copy link
Member

RayHuangCN commented Mar 19, 2021

This is not a problem since NotReady Pods will never participate Target assignment.

@GoneLikeAir
Copy link
Contributor Author

This is not a problem since NotReady Pods will never participate Target assignment.

Yes, NoReady pod will no participate target assignment. However, if it takes longer to terminate the Pod than the coordinator loop interval, it will be created again.

Let's look at the logic that calculate the 'scale' in coordinator.go:

shards := getPod(owner by prometheus statefulset)  // include the pod status is terminating
scale := len(shards) // Because the 'shards' contains the terminating pod, scale >= sts.replicas

Here only focus on tryScaleUp(shardInfo), because the 'changeAble' flag of the pod in terminating state is false, so it will not run into 'scale--'.

Finally, ChangeScale will create the pods that in terminating state again.

@RayHuangCN
Copy link
Member

🤔 That seems to be a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants