-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: additional_ip_ranges_config - again #2458
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
Open
DrFaust92
wants to merge
21
commits into
terraform-google-modules:main
Choose a base branch
from
DrFaust92:fix-pods-ip-again
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
4ce2204
fix ranges variable
DrFaust92 2d2a9b2
CR comments
DrFaust92 e815791
add tests
DrFaust92 81ceac0
add tests
DrFaust92 a439249
add tests
DrFaust92 0517305
align tests
DrFaust92 ff26e63
add tests
DrFaust92 de81273
add tests
DrFaust92 bb41b94
change test
DrFaust92 26e4b05
change test
DrFaust92 564e104
change test
DrFaust92 6903e63
change test
DrFaust92 bcce1c5
Update test/fixtures/node_pool/network.tf
apeabody 8c5ec00
Update test/fixtures/node_pool/network.tf
apeabody 18f30a9
Update examples/simple_regional_additional_ip_ranges/variables.tf
apeabody e0bb9fe
Update test/fixtures/simple_regional_additional_ip_ranges/outputs.tf
apeabody 97347e3
Update test/fixtures/simple_regional_additional_ip_ranges/network.tf
apeabody 65e3ea9
change test
DrFaust92 d159cb5
Merge branch 'main' into fix-pods-ip-again
apeabody 1d45563
Update test/integration/simple_regional_additional_ip_ranges/simple_r…
apeabody f203178
Update build/int.cloudbuild.yaml
apeabody 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 |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # Simple Regional Cluster | ||
|
|
||
| This example illustrates how to create a simple cluster. | ||
|
|
||
| <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
| ## Inputs | ||
|
|
||
| | Name | Description | Type | Default | Required | | ||
| |------|-------------|------|---------|:--------:| | ||
| | additional\_ip\_pod\_range | The secondary ip range to use for pods in the additional range | `any` | n/a | yes | | ||
| | additional\_ip\_pod\_range\_subnetwork | The subnetwork to host the additional pod range in | `any` | n/a | yes | | ||
| | cluster\_name\_suffix | A suffix to append to the default cluster name | `string` | `""` | no | | ||
| | compute\_engine\_service\_account | Service account to associate to the nodes in the cluster | `any` | n/a | yes | | ||
| | ip\_range\_pods | The secondary ip range to use for pods | `any` | n/a | yes | | ||
| | ip\_range\_services | The secondary ip range to use for services | `any` | n/a | yes | | ||
| | network | The VPC network to host the cluster in | `any` | n/a | yes | | ||
| | project\_id | The project ID to host the cluster in | `any` | n/a | yes | | ||
| | region | The region to host the cluster in | `any` | n/a | yes | | ||
| | subnetwork | The subnetwork to host the cluster in | `any` | n/a | yes | | ||
|
|
||
| ## Outputs | ||
|
|
||
| | Name | Description | | ||
| |------|-------------| | ||
| | ca\_certificate | n/a | | ||
| | client\_token | n/a | | ||
| | cluster\_name | Cluster name | | ||
| | ip\_range\_pods | The secondary IP range used for pods | | ||
| | ip\_range\_services | The secondary IP range used for services | | ||
| | kubernetes\_endpoint | n/a | | ||
| | location | n/a | | ||
| | master\_kubernetes\_version | The master Kubernetes version | | ||
| | network | n/a | | ||
| | project\_id | n/a | | ||
| | region | n/a | | ||
| | service\_account | The default service account used for running nodes. | | ||
| | subnetwork | n/a | | ||
| | zones | List of zones in which the cluster resides | | ||
|
|
||
| <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
|
|
||
| To provision this example, run the following from within this directory: | ||
| - `terraform init` to get the plugins | ||
| - `terraform plan` to see the infrastructure plan | ||
| - `terraform apply` to apply the infrastructure build | ||
| - `terraform destroy` to destroy the built infrastructure |
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,52 @@ | ||
| /** | ||
| * Copyright 2018 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| locals { | ||
| cluster_type = "simple-regional-add-ip" | ||
| } | ||
|
|
||
| data "google_client_config" "default" {} | ||
|
|
||
| provider "kubernetes" { | ||
| host = "https://${module.gke.endpoint}" | ||
| token = data.google_client_config.default.access_token | ||
| cluster_ca_certificate = base64decode(module.gke.ca_certificate) | ||
| } | ||
|
|
||
| module "gke" { | ||
| source = "terraform-google-modules/kubernetes-engine/google" | ||
| version = "~> 41.0" | ||
|
|
||
| project_id = var.project_id | ||
| name = "${local.cluster_type}-cluster${var.cluster_name_suffix}" | ||
| regional = true | ||
| region = var.region | ||
| network = var.network | ||
| subnetwork = var.subnetwork | ||
| ip_range_pods = var.ip_range_pods | ||
| ip_range_services = var.ip_range_services | ||
| create_service_account = false | ||
| service_account = var.compute_engine_service_account | ||
| enable_cost_allocation = true | ||
| deletion_protection = false | ||
|
|
||
| additional_ip_ranges_config = [ | ||
| { | ||
| subnetwork = "projects/${var.project_id}/regions/${var.region}/subnetworks/${var.additional_ip_pod_range_subnetwork}" | ||
| pod_ipv4_range_names = [var.additional_ip_pod_range] | ||
| } | ||
| ] | ||
| } |
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,35 @@ | ||
| /** | ||
| * Copyright 2018 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| output "kubernetes_endpoint" { | ||
| sensitive = true | ||
| value = module.gke.endpoint | ||
| } | ||
|
|
||
| output "client_token" { | ||
| sensitive = true | ||
| value = base64encode(data.google_client_config.default.access_token) | ||
| } | ||
|
|
||
| output "ca_certificate" { | ||
| value = module.gke.ca_certificate | ||
| } | ||
|
|
||
| output "service_account" { | ||
| description = "The default service account used for running nodes." | ||
| value = module.gke.service_account | ||
| } | ||
|
|
63 changes: 63 additions & 0 deletions
63
examples/simple_regional_additional_ip_ranges/test_outputs.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,63 @@ | ||
| /** | ||
| * Copyright 2018 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| // These outputs are used to test the module with kitchen-terraform | ||
| // They do not need to be included in real-world uses of this module | ||
|
|
||
| output "project_id" { | ||
| value = var.project_id | ||
| } | ||
|
|
||
| output "region" { | ||
| value = module.gke.region | ||
| } | ||
|
|
||
| output "cluster_name" { | ||
| description = "Cluster name" | ||
| value = module.gke.name | ||
| } | ||
|
|
||
| output "network" { | ||
| value = var.network | ||
| } | ||
|
|
||
| output "subnetwork" { | ||
| value = var.subnetwork | ||
| } | ||
|
|
||
| output "location" { | ||
| value = module.gke.location | ||
| } | ||
|
|
||
| output "ip_range_pods" { | ||
| description = "The secondary IP range used for pods" | ||
| value = var.ip_range_pods | ||
| } | ||
|
|
||
| output "ip_range_services" { | ||
| description = "The secondary IP range used for services" | ||
| value = var.ip_range_services | ||
| } | ||
|
|
||
| output "zones" { | ||
| description = "List of zones in which the cluster resides" | ||
| value = module.gke.zones | ||
| } | ||
|
|
||
| output "master_kubernetes_version" { | ||
| description = "The master Kubernetes version" | ||
| value = module.gke.master_version | ||
| } |
56 changes: 56 additions & 0 deletions
56
examples/simple_regional_additional_ip_ranges/variables.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,56 @@ | ||
| /** | ||
| * Copyright 2018 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| variable "project_id" { | ||
| description = "The project ID to host the cluster in" | ||
| } | ||
|
|
||
| variable "cluster_name_suffix" { | ||
| description = "A suffix to append to the default cluster name" | ||
| default = "" | ||
| } | ||
|
|
||
| variable "region" { | ||
| description = "The region to host the cluster in" | ||
| } | ||
|
|
||
| variable "network" { | ||
| description = "The VPC network to host the cluster in" | ||
| } | ||
|
|
||
| variable "subnetwork" { | ||
| description = "The subnetwork to host the cluster in" | ||
| } | ||
|
|
||
| variable "ip_range_pods" { | ||
| description = "The secondary ip range to use for pods" | ||
| } | ||
|
|
||
| variable "ip_range_services" { | ||
| description = "The secondary ip range to use for services" | ||
| } | ||
|
|
||
| variable "compute_engine_service_account" { | ||
| description = "Service account to associate to the nodes in the cluster" | ||
| } | ||
|
|
||
| variable "additional_ip_pod_range_subnetwork" { | ||
| description = "The subnetwork to host the additional pod range in" | ||
| } | ||
|
|
||
| variable "additional_ip_pod_range" { | ||
| description = "The secondary ip range to use for pods in the additional range" | ||
| } | ||
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,27 @@ | ||
| /** | ||
| * Copyright 2021 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| terraform { | ||
| required_providers { | ||
| google = { | ||
| source = "hashicorp/google" | ||
| } | ||
| kubernetes = { | ||
| source = "hashicorp/kubernetes" | ||
| } | ||
| } | ||
| required_version = ">= 0.13" | ||
| } |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.