Skip to content
This repository was archived by the owner on Feb 5, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions modules/aws/master-asg/master.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ data "ignition_config" "tnc_master" {
}

files = ["${data.ignition_file.kubelet_master_kubeconfig.id}"]

append {
source = "data:text/plain;charset=utf-8;base64,${base64encode(var.user_ign)}"
}
}

data "ignition_file" "kubelet_master_kubeconfig" {
Expand Down
5 changes: 5 additions & 0 deletions modules/aws/master-asg/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,8 @@ variable "kubeconfig_content" {
type = "string"
default = ""
}

variable "user_ign" {
type = "string"
default = ""
}
5 changes: 5 additions & 0 deletions modules/aws/worker-asg/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,8 @@ variable "kubeconfig_content" {
type = "string"
default = ""
}

variable "user_ign" {
type = "string"
default = ""
}
4 changes: 4 additions & 0 deletions modules/aws/worker-asg/worker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ data "ignition_config" "tnc_worker" {
}

files = ["${data.ignition_file.kubelet_worker_kubeconfig.id}"]

append {
source = "data:text/plain;charset=utf-8;base64,${base64encode(var.user_ign)}"
}
}

data "ignition_file" "kubelet_worker_kubeconfig" {
Expand Down
3 changes: 3 additions & 0 deletions steps/assets/resources/ignition-master.ign
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignition": { "version": "2.1.0" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than make this a file that is always in the repo, shouldn't this be a top level input that users can provide optionally? this would allow us to perform validation in the CLI as well rather than just appending whatever is given.

}
3 changes: 3 additions & 0 deletions steps/assets/resources/ignition-worker.ign
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignition": { "version": "2.1.0" }
}
10 changes: 10 additions & 0 deletions steps/bootstrap/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ module "masters" {
subnet_ids = "${module.vpc.master_subnet_ids}"
ec2_ami = "${var.tectonic_aws_ec2_ami_override}"
kubeconfig_content = "${local.kubeconfig_kubelet_content}"
user_ign = "${data.template_file.user_ign_master.rendered}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here we would do something like

"${var.tectonic_user_ignition_master}"

}

module "workers" {
Expand All @@ -146,6 +147,15 @@ module "workers" {
ec2_ami = "${var.tectonic_aws_ec2_ami_override}"
base_domain = "${var.tectonic_base_domain}"
kubeconfig_content = "${local.kubeconfig_kubelet_content}"
user_ign = "${data.template_file.user_ign_worker.rendered}"
}

data "template_file" "user_ign_master" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and we would not need to template anything here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we do not go with the top level config option, this should be

data "local_file" "foo" {
    filename = "${path.module}/foo.bar"
}

rather than template_file
https://www.terraform.io/docs/providers/local/d/file.html

template = "${file("${path.module}/../assets/resources/ignition-master.ign")}"
}

data "template_file" "user_ign_worker" {
template = "${file("${path.module}/../assets/resources/ignition-worker.ign")}"
}

module "dns" {
Expand Down