Skip to content

Commit b2865de

Browse files
authored
breaking change: when annotation is empty default managed by addon-manager (#302)
Signed-off-by: Qing Hao <[email protected]>
1 parent aede957 commit b2865de

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

pkg/utils/helpers.go

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -296,39 +296,17 @@ func ManagedByAddonManager(obj interface{}) bool {
296296
accessor, _ := meta.Accessor(obj)
297297
annotations := accessor.GetAnnotations()
298298
if len(annotations) == 0 {
299-
return false
299+
return true
300300
}
301301

302302
value, ok := annotations[addonapiv1alpha1.AddonLifecycleAnnotationKey]
303303
if !ok {
304-
return false
304+
return true
305305
}
306306

307307
return value == addonapiv1alpha1.AddonLifecycleAddonManagerAnnotationValue
308308
}
309309

310-
func ManagedBySelf(agentAddons map[string]agent.AgentAddon) func(obj interface{}) bool {
311-
return func(obj interface{}) bool {
312-
accessor, _ := meta.Accessor(obj)
313-
if _, ok := agentAddons[accessor.GetName()]; !ok {
314-
return false
315-
}
316-
317-
annotations := accessor.GetAnnotations()
318-
319-
if len(annotations) == 0 {
320-
return true
321-
}
322-
323-
value, ok := annotations[addonapiv1alpha1.AddonLifecycleAnnotationKey]
324-
if !ok {
325-
return true
326-
}
327-
328-
return value == addonapiv1alpha1.AddonLifecycleSelfManageAnnotationValue
329-
}
330-
}
331-
332310
func FilterByAddonName(agentAddons map[string]agent.AgentAddon) func(obj interface{}) bool {
333311
return func(obj interface{}) bool {
334312
accessor, _ := meta.Accessor(obj)

0 commit comments

Comments
 (0)