diff --git a/pkg/apis/service/utils.go b/pkg/apis/service/utils.go new file mode 100644 index 00000000..1bde2624 --- /dev/null +++ b/pkg/apis/service/utils.go @@ -0,0 +1,13 @@ +package service + +import "github.com/gardener/gardener-extension-shoot-dns-service/pkg/service" + +// ResolveImageName returns the image name based on the cleanup metadata records flag. +// TODO(marc1404): Remove once metadata records have been cleaned up. +func (dnsconfig *DNSConfig) ResolveImageName() string { + if dnsconfig.CleanupMetadataRecords != nil && *dnsconfig.CleanupMetadataRecords { + return service.ImageName + } + + return service.ImageNameWithMetadataRecords +} diff --git a/pkg/controller/lifecycle/actuator.go b/pkg/controller/lifecycle/actuator.go index 9cdcb1a5..cf828455 100644 --- a/pkg/controller/lifecycle/actuator.go +++ b/pkg/controller/lifecycle/actuator.go @@ -412,9 +412,10 @@ func (a *actuator) createOrUpdateSeedResources(ctx context.Context, dnsconfig *a } chartValues["targetClusterSecret"] = gutil.SecretNamePrefixShootAccess + service.ShootAccessSecretName - chartValues, err = chart.InjectImages(chartValues, imagevector.ImageVector(), []string{service.ImageName}) + imageName := dnsconfig.ResolveImageName() + chartValues, err = chart.InjectImages(chartValues, imagevector.ImageVector(), []string{imageName}) if err != nil { - return fmt.Errorf("failed to find image version for %s: %v", service.ImageName, err) + return fmt.Errorf("failed to find image version for %s: %v", imageName, err) } a.Info("Component is being applied", "component", service.ExtensionServiceName, "namespace", namespace)