From 173d663c54bff67c93c693e93096f01d6e0de893 Mon Sep 17 00:00:00 2001 From: Marco Braga Date: Wed, 23 Oct 2024 16:56:12 -0300 Subject: [PATCH] DNM/CAPA#5175 assessment - hotfix go.mod was crashing due new CAPI dependencies. Creating this hotfix to quickly check e2e // mtulio fix-capa-4917 giantswarm:fix-tag-subnets replace sigs.k8s.io/cluster-api-provider-aws/v2 => github.com/giantswarm/cluster-api-provider-aws/v2 v2.6.1-0.20241023072232-c8eb4797b15e --- .../v2/pkg/cloud/services/network/subnets.go | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/cluster-api/providers/aws/vendor/sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/network/subnets.go b/cluster-api/providers/aws/vendor/sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/network/subnets.go index 62277cd9fb2..d87734702d3 100644 --- a/cluster-api/providers/aws/vendor/sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/network/subnets.go +++ b/cluster-api/providers/aws/vendor/sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/network/subnets.go @@ -58,14 +58,6 @@ func (s *Service) reconcileSubnets() error { existing infrav1.Subnets ) - // Describing the VPC Subnets tags the resources. - if s.scope.TagUnmanagedNetworkResources() { - // Describe subnets in the vpc. - if existing, err = s.describeVpcSubnets(); err != nil { - return err - } - } - unmanagedVPC := s.scope.VPC().IsUnmanaged(s.scope.Name()) if len(subnets) == 0 { @@ -93,12 +85,9 @@ func (s *Service) reconcileSubnets() error { } } - // Describing the VPC Subnets tags the resources. - if !s.scope.TagUnmanagedNetworkResources() { - // Describe subnets in the vpc. - if existing, err = s.describeVpcSubnets(); err != nil { - return err - } + // Describe subnets in the vpc. + if existing, err = s.describeVpcSubnets(); err != nil { + return err } if s.scope.SecondaryCidrBlock() != nil { @@ -139,11 +128,13 @@ func (s *Service) reconcileSubnets() error { existingSubnet.ID = sub.ID } + // Make sure tags defined in spec are created. + subnetTags := sub.Tags + // Update subnet spec with the existing subnet details existingSubnet.DeepCopyInto(sub) // Make sure tags are up-to-date. - subnetTags := sub.Tags if err := wait.WaitForWithRetryable(wait.NewBackoff(), func() (bool, error) { buildParams := s.getSubnetTagParams(unmanagedVPC, existingSubnet.GetResourceID(), existingSubnet.IsPublic, existingSubnet.AvailabilityZone, subnetTags, existingSubnet.IsEdge()) tagsBuilder := tags.New(&buildParams, tags.WithEC2(s.EC2Client))