// Create a kubernetes client and wait for the API server to be healthy (if not dryrunning)
client,err:=createClient(i.cfg,i.dryRun)
iferr!=nil{
iferr!=nil{
returnerr
returnerr
}
}
// waiter holds the apiclient.Waiter implementation of choice, responsible for querying the API server in various ways and waiting for conditions to be fulfilled
waiter:=getWaiter(i.dryRun,client)
fmt.Printf("[init] Waiting for the kubelet to boot up the control plane as Static Pods from directory %q\n",kubeadmconstants.GetStaticPodDirectory())
fmt.Println("[init] This process often takes about a minute to perform or longer if the control plane images have to be pulled...")
// TODO: Adjust this timeout or start polling the kubelet API
// TODO: Make this timeout more realistic when we do create some more complex logic about the interaction with the kubelet
iferr:=waiter.WaitForAPI();err!=nil{
returnerr
}
// PHASE 4: Mark the master with the right label/taint
// PHASE 4: Mark the master with the right label/taint
// If we're dry-running; we should create a faked client that answers some GETs in order to be able to do the full init flow and just logs the rest of requests
// If we're dry-running; we should create a faked client that answers some GETs in order to be able to do the full init flow and just logs the rest of requests
// Just as an extra safety check; make sure the API server is returning ok at the /healthz endpoint (although we know it could return a GET answer for a Pod above)
// Just as an extra safety check; make sure the API server is returning ok at the /healthz endpoint (although we know it could return a GET answer for a Pod above)
// Make it possible to fake the path of the file; i.e. you may want to tell the user
// "Here is what would be written to /etc/kubernetes/admin.conf", although you wrote it to /tmp/kubeadm-dryrun/admin.conf and are loading it from there
// Fall back to the "real" path if PrintPath is not set
outputFilePath:=file.PrintPath
iflen(outputFilePath)==0{
outputFilePath=file.RealPath
}
fmt.Fprintf(w,"[dryrun] Would write file %q with content:\n",outputFilePath)