Skip to content

Commit

Permalink
Merge pull request #1035 from hebelsan/fix/ensure-ip
Browse files Browse the repository at this point in the history
Fix flow reconcile ensure public ip
  • Loading branch information
hebelsan authored Dec 10, 2024
2 parents 3c14bf4 + bdfed14 commit 4a50b69
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 @@ -155,6 +155,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 @@ -414,7 +414,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 @@ -455,8 +456,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 4a50b69

Please sign in to comment.