-
Notifications
You must be signed in to change notification settings - Fork 259
Description
Originally posted as a discussion in https://github.com/stackrox/kube-linter/discussions/931but but reopening as an issue as it appears that discussions rarely get answered.
kube-linter/pkg/templates/danglinghpa/template.go
Lines 81 to 84 in 51eb58e
| for _, obj := range lintCtx.Objects() { | |
| _, hasPods := extract.PodTemplateSpec(obj.K8sObject) | |
| if !hasPods { | |
| continue |
I have a HPA targeting a KafkaNodePool resource but because of that condition in the code, it doesn't go further and it flags my HPA as being dangling.
Why is it needed to check if the potential target object has pods? Why is it not sufficient for this check to only make sure that the scaleTargetRef exists (as it's already doing later in the loop as shown below)?
kube-linter/pkg/templates/danglinghpa/template.go
Lines 86 to 91 in 51eb58e
| k8sObj := obj.K8sObject | |
| gvk := k8sObj.GetObjectKind().GroupVersionKind() | |
| if target.Name == obj.GetK8sObjectName().Name && target.Kind == gvk.Kind && target.APIVersion == gvk.Group+"/"+gvk.Version { | |
| // Found! | |
| return nil | |
| } |
Thank you