-
Notifications
You must be signed in to change notification settings - Fork 82
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
NatGateway integration – step 2 #54
Conversation
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.
Looks good, a few minor suggestions. :)
Converted to a draft PR as its dependencies are not yet resolved. Please mark as 'ready for review' once they are resolved. |
hashicorp/terraform-provider-azurerm#6052 seems now fixed as of hashicorp/terraform-provider-azurerm#6450. |
Nice! Let's wait until there is a new release of the |
Now there is an release which contain the fix https://github.com/terraform-providers/terraform-provider-azurerm/blob/v2.12.0/CHANGELOG.md#2120-may-28-2020 |
So have tried it out. It does not work without introducing a new association resource for the public ip to nat gateway instead of using the internal public ip association of the nat gateway resource. The migration from the internal association to association resource does not work, see here: hashicorp/terraform-provider-azurerm#7167 |
I checked hashicorp/terraform-provider-azurerm#7167 and it is quite unfortunate. resource "azurerm_nat_gateway" "nat" {
name = "{{ required "clusterName is required" .Values.clusterName }}-nat-gateway"
location = "{{ required "azure.region is required" .Values.azure.region }}"
{{ if .Values.create.resourceGroup -}}
resource_group_name = azurerm_resource_group.rg.name
{{- else -}}
resource_group_name = data.azurerm_resource_group.rg.name
{{- end }}
sku_name = "Standard"
{{ if .Values.natGateway.migrateToPublicIPAssociation -}}
public_ip_address_ids = []
{{- end }}
}
resource "azurerm_nat_gateway_public_ip_association" "nat-ip-association" {
nat_gateway_id = "${azurerm_nat_gateway.nat.id}"
public_ip_address_id = "${azurerm_public_ip.natip.id}"
}
I guess we could have in the Infrastructure status field like |
@ialidzhikov I had the same idea and already implemented that almost exactly like you proposed. The issue here is that there will be a time during the first and the second reconciliation where no public ip is assigned to the NatGateway. In this period of time there is no ip assigned to the NatGateway and it can't be used to route egress traffic which require a stable ip. For some workloads this would mean a serious disruption. Can we somehow influence that an infrastructure resource get reconciled multiple times even after the previous reconcile succeed? I didn't find a way to archive that. Therefore I rather thought in the direction of import support. I think having a generic way to support Terraform imports for the Gardener extensions could also help in the future with other migration scenarios. |
Hmm, why there would be 2 reconciliations. Setting
resource "azurerm_public_ip" "natip" {
name = "nat-ip"
location = "westeurope"
resource_group_name = "${azurerm_resource_group.rg.name}"
allocation_method = "Static"
sku = "Standard"
}
resource "azurerm_nat_gateway" "nat" {
name = "nat-gateway"
location = "westeurope"
resource_group_name = "${azurerm_resource_group.rg.name}"
sku_name = "Standard"
public_ip_address_ids = ["${azurerm_public_ip.natip.id}"]
}
resource "azurerm_public_ip" "natip" {
name = "nat-ip"
location = "westeurope"
resource_group_name = "${azurerm_resource_group.rg.name}"
allocation_method = "Static"
sku = "Standard"
}
resource "azurerm_nat_gateway" "nat" {
name = "nat-gateway"
location = "westeurope"
resource_group_name = "${azurerm_resource_group.rg.name}"
sku_name = "Standard"
- public_ip_address_ids = ["${azurerm_public_ip.natip.id}"]
+ public_ip_address_ids = []
}
+resource "azurerm_nat_gateway_public_ip_association" "nat-ip-association" {
+ nat_gateway_id = "${azurerm_nat_gateway.nat.id}"
+ public_ip_address_id = "${azurerm_public_ip.natip.id}"
+}
resource "azurerm_nat_gateway" "nat" {
name = "nat-gateway"
location = "westeurope"
resource_group_name = "${azurerm_resource_group.rg.name}"
sku_name = "Standard"
- public_ip_address_ids = []
}
resource "azurerm_nat_gateway_public_ip_association" "nat-ip-association" {
nat_gateway_id = "${azurerm_nat_gateway.nat.id}"
public_ip_address_id = "${azurerm_public_ip.natip.id}"
}
|
a9b3121
to
012f0da
Compare
012f0da
to
c40ddda
Compare
Thanks @ialidzhikov |
/test |
Testrun: e2e-wsmbr +---------------------+---------------------+-----------+----------+ | NAME | STEP | PHASE | DURATION | +---------------------+---------------------+-----------+----------+ | infrastructure-test | infrastructure-test | Succeeded | 25m19s | +---------------------+---------------------+-----------+----------+ |
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.
/lgtm
/needs second-opinion
c40ddda
to
bb7619b
Compare
@kon-angelo Thanks for the review. I have addressed the requested changes. |
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.
/lgtm
Allow users to attach their own zonal public ip addresses to the NatGateway of a Shoot cluster.
Allow also to decide in which zone the NatGateway should be deployed to. User provided public ips needs to be zonal and in the same zone as the NatGateway.
Attaching Public IP Prefixes to the NatGateway will currently not be supported as there is no association resource to attach IP Prefixes to the NatGateway in the
azurerm
Terraform provider. Attaching IP Prefixes is currently only possible inline on the NatGateway resource, but as we were forced to write complicated migration logic for public ips when we moved toazurerm
v2 Terraform provider, we don't want to repeat that for IP Prefixes.❌ Do not merge until hashicorp/terraform-provider-azurerm#6052 is fixed and a new Terraformer is integrated that contain a version of theazurerm
provider which incorporate the fix for the mentioned issue.What this PR does / why we need it:
Part 2 of #43
Which issue(s) this PR fixes:
Fixes partly #43
Release note: