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

Clients must wait for completion of actions #943

Merged

Conversation

smarterclayton
Copy link
Contributor

Makes the server return for pods and replication controllers when the object is accepted by the apiserver and persisted, rather than when all the consequences of its creation are relevant as per #353. This adds a very simple core "condition / wait" logic to the client that can be used to wait for things to happen. It does not change kubecfg to wait (and so the README was altered to communicate that waits might be necessary), and the replication controller now returns much more quickly in its loop (since it's not waiting for pods to go to running status).

@smarterclayton smarterclayton changed the title WIP - Clients must wait for completion of actions [WIP] Clients must wait for completion of actions Aug 18, 2014
@@ -152,13 +152,11 @@ func runReplicationControllerTest(kubeClient *client.Client) {
glog.Infof("Done creating replication controllers")

// Give the controllers some time to actually create the pods
time.Sleep(time.Second * 10)
if err := client.NewPoller(time.Second, 10).Until(kubeClient.ReplicationControllerAtDesiredState(controllerRequest)); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: a bit much for a single line...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - debating how complex this should be. Initial thought was to define the minimal likely methods that clients use, but it's still a bit verbose. Will iterate more

@smarterclayton
Copy link
Contributor Author

Integration test now waits for conditions, servers return immediately and clients return as well.

@smarterclayton smarterclayton changed the title [WIP] Clients must wait for completion of actions Clients must wait for completion of actions Aug 19, 2014
@smarterclayton
Copy link
Contributor Author

@brendandburns as per the comments in the other issue - I believe this is consistent with the discussion in #353 but now's the time to disagree

@@ -135,7 +136,28 @@ func startComponents(manifestURL string) (apiServerURL string) {
return apiServer.URL
}

func runReplicationControllerTest(kubeClient *client.Client) {
// podsOnMinions returns true when all of the selected pods exist on a minion.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this may not be useful without an expected number of minions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question - if the query changes to return zero it would exit. Could just pass the list of expected pods.

@smarterclayton smarterclayton force-pushed the only_wait_for_acceptance branch from cc3da9b to fe7ef0c Compare August 20, 2014 01:36
@smarterclayton
Copy link
Contributor Author

comments addressed, PTAL (left WaitFor for testability and added Poll for brevity)

@@ -128,6 +129,9 @@ func responseToPods(response *etcd.Response) ([]kubelet.Pod, error) {
// stopChannel creates a channel that is closed after a duration for use with etcd client API
func stopChannel(until time.Duration) chan bool {
stop := make(chan bool)
if until == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

document this behavior in the comment?

@brendandburns
Copy link
Contributor

LGTM, one small comment.

Listen to etcd longer, and wait a shorter time before reconnecting.
No longer an argument to the source.
@smarterclayton smarterclayton force-pushed the only_wait_for_acceptance branch from 681cbef to baaabca Compare August 20, 2014 22:46
@smarterclayton
Copy link
Contributor Author

addressed

@lavalamp
Copy link
Member

LGTM

brendandburns added a commit that referenced this pull request Aug 21, 2014
Clients must wait for completion of actions
@brendandburns brendandburns merged commit 1bd4ae0 into kubernetes:master Aug 21, 2014
@smarterclayton smarterclayton deleted the only_wait_for_acceptance branch February 11, 2015 02:21
seans3 pushed a commit to seans3/kubernetes that referenced this pull request Apr 10, 2019
Create some structure on sig cluster lifecycle KEPs
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

Successfully merging this pull request may close these issues.

3 participants