-
Notifications
You must be signed in to change notification settings - Fork 39.1k
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
MinReadySeconds / AvailableReplicas for ReplicaSets #32771
MinReadySeconds / AvailableReplicas for ReplicaSets #32771
Conversation
GCE e2e build/test passed for commit 61e1a145cc29eb8664fac913c3804fed3a0658d4. |
Jenkins GCE e2e failed for commit d7dd751. The magic incantation to run this job again is |
API change LGTM |
// 1. minReadySeconds == 0, or | ||
// 2. LastTransitionTime (is set) + minReadySeconds < current time | ||
func IsPodAvailable(pod *Pod, minReadySeconds int32, now unversioned.Time) bool { | ||
if !IsPodReady(pod) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we exclude inactive ones, i.e. the ones that succeeded, failed, or are terminating? If we're changing this, add this test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in this level. I wanted to keep IsPodAvailable merely as an incremental addition on top of IsPodReady. Callers should decide if they want to filter succeeded/failed/terminating pods, similar to how we use IsPodReady in the replica set and rc controllers.
@@ -1739,6 +1744,9 @@ type ReplicationControllerStatus struct { | |||
// The number of ready replicas for this replication controller. | |||
ReadyReplicas int32 `json:"readyReplicas,omitempty"` | |||
|
|||
// The number of available replicas for this replication controller. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explain what "available" means in the comment (how is it different from ready ones, and mention minreadyseconds)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -2050,6 +2055,9 @@ type ReplicationControllerStatus struct { | |||
// The number of ready replicas for this replication controller. | |||
ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,4,opt,name=readyReplicas"` | |||
|
|||
// The number of available replicas for this replication controller. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -632,6 +637,9 @@ type ReplicaSetStatus struct { | |||
// The number of ready replicas for this replica set. | |||
ReadyReplicas int32 `json:"readyReplicas,omitempty"` | |||
|
|||
// The number of available replicas for this replica set. | |||
AvailableReplicas int32 `json:"availableReplicas,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@k8s-ci-robot |
fakePodControl := controller.FakePodControl{} | ||
manager.podControl = &fakePodControl | ||
|
||
// The controller checks for available pods at 00:21 - it shoud see only one available pod. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*should
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
|
||
// The controller checks for available pods at 00:21 - it shoud see only one available pod. | ||
now = func() unversioned.Time { return unversioned.Date(2016, 11, 13, 0, 0, 21, 0, time.UTC) } | ||
manager.syncReplicaSet(getKey(rs, t)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is now
only used here (in the unit test)? Why not just declare it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's used only for unit testing but we need to declare it in replica_set.go since it's part of it.:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, now I see what now
is for. Could you instead create a private function in manager
/ReplicaSetController
(e.g. setNow()
) that does what now did? It'd be more clear IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Fix the typo and the last suggestion then I have no more comments |
// Minimum number of seconds for which a newly created pod should be ready | ||
// without any of its container crashing, for it to be considered available. | ||
// Defaults to 0 (pod will be considered available as soon as it is ready) | ||
MinReadySeconds int32 `json:"minReadySeconds,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put this last in the spec, after Template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
We're going to add minReadySeconds to all controllers. We should consider adding it to PodSpec, but version skew (Kubelets not supporting it) would make it hard to rely on, so I'm ok with this for now. |
Jenkins verification failed for commit af01ebcf917631223d3b9b5d06b7d0ac845acf61. Full PR test history. The magic incantation to run this job again is |
Jenkins GCI GKE smoke e2e failed for commit af01ebcf917631223d3b9b5d06b7d0ac845acf61. Full PR test history. The magic incantation to run this job again is |
rebased, reapplying lgtm |
Jenkins GKE smoke e2e failed for commit d8dc2aa. Full PR test history. The magic incantation to run this job again is |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue |
…ler-ready-available-replicas Automatic merge from submit-queue populate ready replicas and aviable replicas to federated replicaset … populate ready replicas and aviable replicas to federated replicaset status @nikhiljindal #33312 #29481 #32771 @deepak-vij
This PR adds minReadySeconds and availableReplicas for replica sets / replication controllers
Partially addresses #28381
cc: @mfojtik
@bgrant0607 for the api changes, @janetkuo for controller changes
This change is![Reviewable](https://camo.githubusercontent.com/2d899f4291d07d3cd2fa4aaae1e3b243f164c23fce87d30a589ace0d496a444c/68747470733a2f2f72657669657761626c652e6b756265726e657465732e696f2f7265766965775f627574746f6e2e737667)