Skip to content
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

Fix flow reconcile ensure public ip #1035

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading