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

Add remove_default_node_pool #55

Merged
merged 7 commits into from
Jan 5, 2019

Conversation

mkubaczyk
Copy link
Contributor

In the #15 issue there was a request for remove_default_node_pool. I'm interested in introducing this to the module. There's no point in keeping the default node pool the google_container_cluster forces us to have on the beginning. Usually, the one wants to manage the pools explicitly, and so do I, hence this PR.

Adding the remove_default_node_pool was not enough to make it work perfectly. A change in the manner of providing the google_container_cluster with the network and subnetwork parameters had to be changed as well. Without it, terraform produced permadiff with every plan and apply. That's the issue with google provider, more on that is described in this google provider issue.

The approach I propose is a workaround which won't cause any backward incompatibilities. The issue I faced might be the problem described from the #15.

If anyone is having the better solution, feel free to propose it!

Copy link
Contributor

@morgante morgante left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this. I believe there are some complexities with the 0-node default pool we currently create for clusters with node_pools configured - could you take a look at that?

The other thing to test/confirm is compatibility with Shared VPC clusters.

cluster_zonal.tf Outdated
@@ -26,8 +26,8 @@ resource "google_container_cluster" "zonal_primary" {
zone = "${var.zones[0]}"
additional_zones = ["${slice(var.zones,1,length(var.zones))}"]

network = "${data.google_compute_network.gke_network.self_link}"
subnetwork = "${data.google_compute_subnetwork.gke_subnetwork.self_link}"
network = "projects/${var.project_id}/global/networks/${data.google_compute_network.gke_network.name}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't that equivalent to the self_link?

The issue with formatting it like this is if the cluster is being launched on a shared VPC, in which case the network is in a different project.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

self_link adds https://www.googleapis.com/compute/v1 before the projects/[..], hence the permadiff since terraform sees the current path as the one starting from projects/[..] and tries to update it.

I'll take a look at the shared VPC case and will come with a solution/an idea hopefully. :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@morgante I reused the 'data.google_compute_network` to get the project_id, which takes the shared VPC into account right now. Proposed in 8f96807

Copy link
Contributor

Choose a reason for hiding this comment

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

One alternative idea: what if we used the self_link but used replace to strip the URL prefix? https://www.terraform.io/docs/configuration/interpolation.html#replace-string-search-replace-

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good.
As simple as network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in e997e66. :-)

@morgante
Copy link
Contributor

morgante commented Jan 4, 2019 via email

Copy link
Contributor

@morgante morgante left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the contribution.

@Jberlinsky Jberlinsky merged commit e2745df into terraform-google-modules:master Jan 5, 2019
@mkubaczyk mkubaczyk deleted the ops-31505 branch January 5, 2019 17:41
CPL-markus pushed a commit to WALTER-GROUP/terraform-google-kubernetes-engine that referenced this pull request Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants