Skip to content

Commit

Permalink
Fix flow reconcile ensure public ip
Browse files Browse the repository at this point in the history
  • Loading branch information
hebelsan committed Dec 10, 2024
1 parent fbfae00 commit 0ace5c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions pkg/azure/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ const (
SeedAnnotationUseFlowValueNew = "new"
// AnnotationEnableVolumeAttributesClass is the annotation to use on shoots to enable VolumeAttributesClasses
AnnotationEnableVolumeAttributesClass = "azure.provider.extensions.gardener.cloud/enable-volume-attributes-class"

// CCMServiceTagKey is the service key applied for public IP tags.
CCMServiceTagKey = "k8s-azure-service"
// CCMLegacyServiceTagKey is the legacy service key applied for public IP tags.
CCMLegacyServiceTagKey = "service"
)

// UsernamePrefix is a constant for the username prefix of components deployed by Azure.
Expand Down
6 changes: 4 additions & 2 deletions pkg/controller/infrastructure/infraflow/ensurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ func (fctx *FlowContext) ensurePublicIps(ctx context.Context) error {
}
currentIPs = Filter(currentIPs, func(address *armnetwork.PublicIPAddress) bool {
// filter only these IpConfigs prefixed by the cluster name and that do not contain the CCM tags.
return fctx.adapter.HasShootPrefix(address.Name) && address.Tags["k8s-azure-service"] == nil
return fctx.adapter.HasShootPrefix(address.Name) &&
(address.Tags[azure.CCMServiceTagKey] == nil && address.Tags[azure.CCMLegacyServiceTagKey] == nil)
})
// obtain an indexed list of current IPs
nameToCurrentIps := ToMap(currentIPs, func(t *armnetwork.PublicIPAddress) string {
Expand Down Expand Up @@ -412,8 +413,9 @@ func (fctx *FlowContext) ensurePublicIps(ctx context.Context) error {
err := fctx.providerAccess.DeletePublicIP(ctx, fctx.adapter.ResourceGroupName(), ipName)
if err != nil {
joinError = errors.Join(joinError, err)
} else {
fctx.inventory.Delete(ip)
}
fctx.inventory.Delete(ip)
}

if joinError != nil {
Expand Down

0 comments on commit 0ace5c0

Please sign in to comment.