diff --git a/pkg/agent/agent.go b/pkg/agent/agent.go index f5c8adafe..31c1a396c 100644 --- a/pkg/agent/agent.go +++ b/pkg/agent/agent.go @@ -211,6 +211,16 @@ func (a *Agent) Start(notifyFn NotifyFn) error { } if e.Type == watch.Added || e.Type == watch.Modified { group, _ := e.Object.(*corev1.Node).Labels[a.groupLabel] + if group == "" { + for _, l := range deprecatedGroupLabels { + group, _ = e.Object.(*corev1.Node).Labels[l] + if group != "" { + log.Warnf("Using DEPRECATED config group label %q", l) + log.Warnf("Please switch to using label %q instead", a.groupLabel) + break + } + } + } if err = a.setupGroupConfigWatch(group); err != nil { log.Errorf("%v", err) } @@ -607,6 +617,11 @@ var ( defaultGroupLabel string defaultKubeConfig string defaultConfigFile string + + deprecatedGroupLabels = []string{ + "group.config.nri", + "resource-policy.nri.io/group", + } ) func init() {