@@ -230,6 +230,23 @@ func initFederation(cmdOut io.Writer, config util.AdminConfig, cmd *cobra.Comman
230
230
}
231
231
232
232
if ! dryRun {
233
+ fmt .Fprintf (cmdOut , "Waiting for control plane to come up" )
234
+ for ! podRunning (hostClientset , serverName , initFlags .FederationSystemNamespace ) {
235
+ _ , err := fmt .Fprintf (cmdOut , "." )
236
+ if err != nil {
237
+ return err
238
+ }
239
+ //wait indefinite if the pod doesn't show up with correct status
240
+ time .Sleep (2 * time .Second )
241
+ }
242
+ for ! podRunning (hostClientset , cmName , initFlags .FederationSystemNamespace ) {
243
+ _ , err := fmt .Fprintf (cmdOut , "." )
244
+ if err != nil {
245
+ return err
246
+ }
247
+ //wait indefinite if the pod doesn't show up with correct status
248
+ time .Sleep (2 * time .Second )
249
+ }
233
250
return printSuccess (cmdOut , ips , hostnames )
234
251
}
235
252
_ , err = fmt .Fprintf (cmdOut , "Federation control plane runs (dry run)\n " )
@@ -576,6 +593,21 @@ func createControllerManager(clientset *client.Clientset, namespace, name, svcNa
576
593
return clientset .Extensions ().Deployments (namespace ).Create (dep )
577
594
}
578
595
596
+ func podRunning (clientset * client.Clientset , name , nameSpace string ) bool {
597
+ podList , err := clientset .Core ().Pods (nameSpace ).List (api.ListOptions {})
598
+ if err != nil {
599
+ //Problem in getting pods at this time
600
+ return false
601
+ }
602
+
603
+ for _ , pod := range podList .Items {
604
+ if strings .Contains (pod .Name , name ) && pod .Status .Phase == "Running" {
605
+ return true
606
+ }
607
+ }
608
+ return false
609
+ }
610
+
579
611
func printSuccess (cmdOut io.Writer , ips , hostnames []string ) error {
580
612
svcEndpoints := append (ips , hostnames ... )
581
613
_ , err := fmt .Fprintf (cmdOut , "Federation API server is running at: %s\n " , strings .Join (svcEndpoints , ", " ))
0 commit comments