This repository was archived by the owner on Feb 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 262
Etcd tnc #3079
Merged
Merged
Etcd tnc #3079
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,11 +61,13 @@ func installBootstrapStep(m *metadata) error { | |
| return err | ||
| } | ||
|
|
||
| if err := waitForTNC(m); err != nil { | ||
| destroyCNAME(m.clusterDir) | ||
|
|
||
| if err := runInstallStep(m.clusterDir, etcdStep); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| return destroyCNAME(m.clusterDir) | ||
| return waitForTNC(m) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By having it here we ensure that the step holds until etcd comes up (so the api server actually gives a response and waitForTNC finish when the TNC daemonset gets deployed) |
||
| } | ||
|
|
||
| func installJoinStep(m *metadata) error { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,17 @@ locals { | |
| ignition_etcd_keys = ["ignition_etcd_0.json", "ignition_etcd_1.json", "ignition_etcd_2.json"] | ||
| } | ||
|
|
||
| data "ignition_config" "s3" { | ||
| data "ignition_config" "tnc" { | ||
| count = "${length(var.external_endpoints) == 0 ? var.instance_count : 0}" | ||
|
|
||
| replace { | ||
| append { | ||
| source = "${format("http://${var.cluster_name}-tnc.${var.base_domain}/ignition?role=etcd&etcd_index=%d", count.index)}" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :p it’s a little funny doing both interpolation and formatting but not a blocker |
||
|
|
||
| # TODO: add verification | ||
| } | ||
|
|
||
| # Used for loading certificates | ||
| append { | ||
| source = "${format("s3://%s/%s", var.s3_bucket, local.ignition_etcd_keys[count.index])}" | ||
|
|
||
| # TODO: add verification | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../config.tf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| provider "aws" { | ||
| region = "${var.tectonic_aws_region}" | ||
| profile = "${var.tectonic_aws_profile}" | ||
| version = "1.8.0" | ||
|
|
||
| assume_role { | ||
| role_arn = "${var.tectonic_aws_installer_role == "" ? "" : "${var.tectonic_aws_installer_role}"}" | ||
| session_name = "TECTONIC_INSTALLER_${var.tectonic_cluster_name}" | ||
| } | ||
| } | ||
|
|
||
| resource "aws_s3_bucket_object" "ignition_etcd" { | ||
| count = "${local.instance_count}" | ||
| bucket = "${local.s3_bucket}" | ||
| key = "ignition_etcd_${count.index}.json" | ||
| content = "${local.ignition_etcd[count.index]}" | ||
| acl = "private" | ||
|
|
||
| server_side_encryption = "AES256" | ||
|
|
||
| tags = "${merge(map( | ||
| "Name", "${var.tectonic_cluster_name}-ignition-etcd-${count.index}", | ||
| "KubernetesCluster", "${var.tectonic_cluster_name}", | ||
| "tectonicClusterID", "${var.tectonic_cluster_id}" | ||
| ), var.tectonic_aws_extra_tags)}" | ||
| } | ||
|
|
||
| module "etcd" { | ||
| source = "../../modules/aws/etcd" | ||
|
|
||
| base_domain = "${var.tectonic_base_domain}" | ||
| cluster_id = "${var.tectonic_cluster_id}" | ||
| cluster_name = "${var.tectonic_cluster_name}" | ||
| container_image = "${var.tectonic_container_images["etcd"]}" | ||
| container_linux_channel = "${var.tectonic_container_linux_channel}" | ||
| container_linux_version = "${local.container_linux_version}" | ||
| ec2_type = "${var.tectonic_aws_etcd_ec2_type}" | ||
| external_endpoints = "${compact(var.tectonic_etcd_servers)}" | ||
| extra_tags = "${var.tectonic_aws_extra_tags}" | ||
| instance_count = "${local.instance_count}" | ||
| root_volume_iops = "${var.tectonic_aws_etcd_root_volume_iops}" | ||
| root_volume_size = "${var.tectonic_aws_etcd_root_volume_size}" | ||
| root_volume_type = "${var.tectonic_aws_etcd_root_volume_type}" | ||
| s3_bucket = "${local.s3_bucket}" | ||
| sg_ids = "${concat(var.tectonic_aws_etcd_extra_sg_ids, list(local.sg_id))}" | ||
| ssh_key = "${var.tectonic_aws_ssh_key}" | ||
| subnets = ["${local.subnet_ids_workers}"] | ||
| etcd_iam_role = "${var.tectonic_aws_etcd_iam_role_name}" | ||
| ec2_ami = "${var.tectonic_aws_ec2_ami_override}" | ||
| } | ||
|
|
||
| resource "aws_route53_record" "etcd_a_nodes" { | ||
| count = "${local.instance_count}" | ||
| type = "A" | ||
| ttl = "60" | ||
| zone_id = "${local.private_zone_id}" | ||
| name = "${var.tectonic_cluster_name}-etcd-${count.index}" | ||
| records = ["${module.etcd.ip_addresses[count.index]}"] | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignition does not continuously retry to download forever, so I think this introduces a race. What if one of the etcd machines gets provisioned and tries to load it’s ignition before the TNC is up?
I think this should go after the waitForTNC step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes there's a race which is currently only relying on retries. The problem here is that there's no obvious way for etcd to waitForTNC (when this is running as static pod) as the kubeclient won't be able to get answers until the server gets the state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I second @squat's concern about the race condition. If we know there could be one, we should try to find a solution.
I don't have enough insight into the matter right now to suggest one here, but let me know if you need my help looking into it.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexsomesan @squat this relies on ignition retries https://github.com/coreos/ignition/blob/master/internal/resource/http.go#L200 which will keep retrying until it times out, and if I'm not wrong by the look of
httpTotalhere https://coreos.com/ignition/docs/latest/configuration-v2_1.html it will keep retrying for ever by default https://github.com/coreos/ignition/blob/master/internal/resource/http.go#L69Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexsomesan @squat it's verified that Ignition will never continue if it isn't completely successful.
waitForTNC(m)where it is now, will ensure that the step holds until etcd comes up (so the cluster get state, so the TNC daemonset gets deployed and so the api server actually gives a response, so waitForTNC can finish)This is not strictly necessary as the every node will be able to get its config from the TNC pod, so the question is: do we still want to
waitForTNC(m)? wdyt?