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

libvirt: simplify how bootstrap_dns is passed to terraform #1995

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 3 additions & 14 deletions pkg/destroy/bootstrap/bootstrap.go
Expand Up @@ -28,18 +28,6 @@ func Destroy(dir string) (err error) {
}

tfPlatformVarsFileName := fmt.Sprintf(cluster.TfPlatformVarsFileName, platform)
copyNames := []string{terraform.StateFileName, cluster.TfVarsFileName, tfPlatformVarsFileName}

if platform == libvirt.Name {
err = ioutil.WriteFile(filepath.Join(dir, "disable-bootstrap.tfvars.json"), []byte(`{
"bootstrap_dns": false
}
`), 0666)
if err != nil {
return err
}
copyNames = append(copyNames, "disable-bootstrap.tfvars.json")
}

tempDir, err := ioutil.TempDir("", "openshift-install-")
if err != nil {
Expand All @@ -48,7 +36,7 @@ func Destroy(dir string) (err error) {
defer os.RemoveAll(tempDir)

extraArgs := []string{}
for _, filename := range copyNames {
for _, filename := range []string{terraform.StateFileName, cluster.TfVarsFileName, tfPlatformVarsFileName} {
sourcePath := filepath.Join(dir, filename)
targetPath := filepath.Join(tempDir, filename)
err = copy(sourcePath, targetPath)
Expand Down Expand Up @@ -77,7 +65,8 @@ func Destroy(dir string) (err error) {
return errors.Wrap(err, "Terraform apply")
}
case libvirt.Name:
_, err = terraform.Apply(tempDir, platform, extraArgs...)
// First remove the bootstrap node from DNS
_, err = terraform.Apply(tempDir, platform, append(extraArgs, "-var=bootstrap_dns=false")...)
jstuever marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return errors.Wrap(err, "Terraform apply")
}
Expand Down