Skip to content

Commit

Permalink
steps/bootstrap: Merge into the infra step
Browse files Browse the repository at this point in the history
Booting clusters is faster and teardown is more robust if we can
perform everything in a single Terraform step.  With this commit, we
are down to that single step.

It would be nice to drop the terraform_remote_state hack for the
bootstrap Ignition.  But we'll be doing that when we switch to
cmd/openshift-install and its all-Go asset generation, so I'm rolling
with the existing approach for now.
  • Loading branch information
wking committed Sep 21, 2018
1 parent 1e37909 commit e4bfe27
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 127 deletions.
5 changes: 0 additions & 5 deletions installer/pkg/workflow/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func DestroyWorkflow(clusterDir string, contOnErr bool) Workflow {
steps: []step{
readClusterConfigStep,
generateTerraformVariablesStep,
destroyBootstrapStep,
destroyWorkersStep,
destroyInfraStep,
destroyAssetsStep,
Expand All @@ -47,10 +46,6 @@ func destroyInfraStep(m *metadata) error {
return runDestroyStep(m, infraStep)
}

func destroyBootstrapStep(m *metadata) error {
return runDestroyStep(m, bootstrapStep)
}

func destroyWorkersStep(m *metadata) error {
kubeconfig := filepath.Join(m.clusterDir, generatedPath, "auth", "kubeconfig")

Expand Down
8 changes: 0 additions & 8 deletions installer/pkg/workflow/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func InstallWorkflow(clusterDir string) Workflow {
generateIgnConfigStep,
installAssetsStep,
installInfraStep,
installBootstrapStep,
},
}
}
Expand All @@ -34,13 +33,6 @@ func installInfraStep(m *metadata) error {
return runInstallStep(m, infraStep)
}

func installBootstrapStep(m *metadata) error {
if !hasStateFile(m.clusterDir, bootstrapStep) {
return runInstallStep(m, bootstrapStep)
}
return nil
}

func runInstallStep(m *metadata, step string, extraArgs ...string) error {
templateDir, err := findStepTemplates(step, m.cluster.Platform)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion steps/bootstrap/aws/config.tf

This file was deleted.

24 changes: 0 additions & 24 deletions steps/bootstrap/aws/inputs.tf

This file was deleted.

29 changes: 0 additions & 29 deletions steps/bootstrap/aws/main.tf

This file was deleted.

1 change: 0 additions & 1 deletion steps/bootstrap/aws/variables-aws.tf

This file was deleted.

1 change: 0 additions & 1 deletion steps/bootstrap/libvirt/config.tf

This file was deleted.

22 changes: 0 additions & 22 deletions steps/bootstrap/libvirt/inputs.tf

This file was deleted.

13 changes: 0 additions & 13 deletions steps/bootstrap/libvirt/main.tf

This file was deleted.

1 change: 0 additions & 1 deletion steps/bootstrap/libvirt/variables-libvirt.tf

This file was deleted.

11 changes: 11 additions & 0 deletions steps/infra/aws/inputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
data "terraform_remote_state" "assets" {
backend = "local"

config {
path = "${path.cwd}/assets.tfstate"
}
}

locals {
ignition_bootstrap = "${data.terraform_remote_state.assets.ignition_bootstrap}"
}
19 changes: 19 additions & 0 deletions steps/infra/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@ provider "aws" {
}
}

module "bootstrap" {
source = "../../../modules/aws/bootstrap"

ami = "${var.tectonic_aws_ec2_ami_override}"
associate_public_ip_address = "${var.tectonic_aws_endpoints != "private"}"
bucket = "${aws_s3_bucket.tectonic.bucket}"
cluster_name = "${var.tectonic_cluster_name}"
elbs = "${module.vpc.aws_lbs}"
iam_role = "${var.tectonic_aws_master_iam_role_name}"
ignition = "${local.ignition_bootstrap}"
subnet_id = "${module.vpc.master_subnet_ids[0]}"
vpc_security_group_ids = ["${concat(var.tectonic_aws_master_extra_sg_ids, list(module.vpc.master_sg_id))}"]

tags = "${merge(map(
"Name", "${var.tectonic_cluster_name}-bootstrap",
"tectonicClusterID", "${var.tectonic_cluster_id}"
), var.tectonic_aws_extra_tags)}"
}

module "masters" {
source = "../../../modules/aws/master"

Expand Down
15 changes: 0 additions & 15 deletions steps/infra/aws/outputs.tf

This file was deleted.

11 changes: 11 additions & 0 deletions steps/infra/libvirt/inputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
data "terraform_remote_state" "assets" {
backend = "local"

config {
path = "${path.cwd}/assets.tfstate"
}
}

locals {
ignition_bootstrap = "${data.terraform_remote_state.assets.ignition_bootstrap}"
}
10 changes: 10 additions & 0 deletions steps/infra/libvirt/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ module "libvirt_base_volume" {
image = "${var.tectonic_os_image}"
}

module "bootstrap" {
source = "../../../modules/libvirt/bootstrap"

addresses = ["${var.tectonic_libvirt_bootstrap_ip}"]
base_volume_id = "${module.libvirt_base_volume.coreos_base_volume_id}"
cluster_name = "${var.tectonic_cluster_name}"
ignition = "${local.ignition_bootstrap}"
network_id = "${libvirt_network.tectonic_net.id}"
}

resource "libvirt_volume" "master" {
count = "${var.tectonic_master_count}"
name = "master${count.index}"
Expand Down
7 changes: 0 additions & 7 deletions steps/infra/libvirt/outputs.tf

This file was deleted.

0 comments on commit e4bfe27

Please sign in to comment.