Skip to content

Commit

Permalink
Address TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
ialidzhikov committed Feb 9, 2024
1 parent 03c7ab5 commit e662ad0
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions pkg/webhook/cache/ensurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit e662ad0

Please sign in to comment.