From e662ad02e51285e4017237015bba23539f7da4d8 Mon Sep 17 00:00:00 2001 From: ialidzhikov Date: Fri, 9 Feb 2024 16:37:22 +0200 Subject: [PATCH] Address TODO --- pkg/webhook/cache/ensurer.go | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/pkg/webhook/cache/ensurer.go b/pkg/webhook/cache/ensurer.go index bd04e9d6..d5747744 100644 --- a/pkg/webhook/cache/ensurer.go +++ b/pkg/webhook/cache/ensurer.go @@ -135,21 +135,7 @@ Type=simple ExecStart=/opt/bin/configure-containerd-registries.sh ` + strings.Join(scriptArgs, " ")), } - // TODO(ialidzhikov): Use "extensionswebhook.EnsureUnitWithName" when vendoring gardener/gardener that contains https://github.com/gardener/gardener/pull/9121. - appendUniqueUnit(new, unit) + *new = extensionswebhook.EnsureUnitWithName(*new, unit) return nil } - -// appendUniqueUnit appends a unit only if it does not exist, otherwise overwrite content of previous unit -func appendUniqueUnit(units *[]extensionsv1alpha1.Unit, unit extensionsv1alpha1.Unit) { - resFiles := make([]extensionsv1alpha1.Unit, 0, len(*units)) - - for _, f := range *units { - if f.Name != unit.Name { - resFiles = append(resFiles, f) - } - } - - *units = append(resFiles, unit) -}