mirror of https://github.com/kubernetes/kops.git
Merge pull request #12624 from justinsb/up_show_plan
kubetest2: force printing of the plan on cluster creation
This commit is contained in:
commit
f61fc88ec8
|
|
@ -79,9 +79,19 @@ func (d *deployer) Up() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err := d.createCluster(zones, adminAccess)
|
if d.terraform != nil {
|
||||||
if err != nil {
|
if err := d.createCluster(zones, adminAccess, true); err != nil {
|
||||||
return err
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// For the non-terraform case, we want to see the preview output.
|
||||||
|
// So run a create (which logs the output), then do an update
|
||||||
|
if err := d.createCluster(zones, adminAccess, false); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := d.updateCluster(true); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isUp, err := d.IsUp()
|
isUp, err := d.IsUp()
|
||||||
|
|
@ -95,7 +105,7 @@ func (d *deployer) Up() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *deployer) createCluster(zones []string, adminAccess string) error {
|
func (d *deployer) createCluster(zones []string, adminAccess string, yes bool) error {
|
||||||
|
|
||||||
args := []string{
|
args := []string{
|
||||||
d.KopsBinaryPath, "create", "cluster",
|
d.KopsBinaryPath, "create", "cluster",
|
||||||
|
|
@ -104,7 +114,9 @@ func (d *deployer) createCluster(zones []string, adminAccess string) error {
|
||||||
"--kubernetes-version", d.KubernetesVersion,
|
"--kubernetes-version", d.KubernetesVersion,
|
||||||
"--ssh-public-key", d.SSHPublicKeyPath,
|
"--ssh-public-key", d.SSHPublicKeyPath,
|
||||||
"--override", "cluster.spec.nodePortAccess=0.0.0.0/0",
|
"--override", "cluster.spec.nodePortAccess=0.0.0.0/0",
|
||||||
"--yes",
|
}
|
||||||
|
if yes {
|
||||||
|
args = append(args, "--yes")
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.CreateArgs != "" {
|
if d.CreateArgs != "" {
|
||||||
|
|
@ -160,6 +172,30 @@ func (d *deployer) createCluster(zones []string, adminAccess string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *deployer) updateCluster(yes bool) error {
|
||||||
|
|
||||||
|
args := []string{
|
||||||
|
d.KopsBinaryPath, "update", "cluster",
|
||||||
|
"--name", d.ClusterName,
|
||||||
|
"--admin",
|
||||||
|
}
|
||||||
|
if yes {
|
||||||
|
args = append(args, "--yes")
|
||||||
|
}
|
||||||
|
|
||||||
|
klog.Info(strings.Join(args, " "))
|
||||||
|
cmd := exec.Command(args[0], args[1:]...)
|
||||||
|
cmd.SetEnv(d.env()...)
|
||||||
|
|
||||||
|
exec.InheritOutput(cmd)
|
||||||
|
err := cmd.Run()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (d *deployer) IsUp() (bool, error) {
|
func (d *deployer) IsUp() (bool, error) {
|
||||||
wait := d.ValidationWait
|
wait := d.ValidationWait
|
||||||
if wait == 0 {
|
if wait == 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue