@@ -22,7 +22,7 @@ import (
2222
2323 remediationv1alpha1 "github.com/medik8s/node-healthcheck-operator/api/v1alpha1"
2424 "github.com/medik8s/node-healthcheck-operator/controllers/utils"
25- "github.com/medik8s/node-healthcheck-operator/controllers/utils/annotationutils "
25+ "github.com/medik8s/node-healthcheck-operator/controllers/utils/annotations "
2626)
2727
2828type Manager interface {
@@ -125,9 +125,9 @@ func (m *manager) generateRemediationCR(name string, healthCheckOwnerRef *metav1
125125 templateSpec , _ , _ := unstructured .NestedMap (template .Object , "spec" , "template" , "spec" )
126126 unstructured .SetNestedField (remediationCR .Object , templateSpec , "spec" )
127127
128- if annotationutils .HasMultipleTemplatesAnnotation (template ) {
128+ if annotations .HasMultipleTemplatesAnnotation (template ) {
129129 remediationCR .SetGenerateName (name )
130- remediationCR .SetAnnotations (map [string ]string {annotationutils .NodeNameAnnotation : name , annotationutils .TemplateNameAnnotation : template .GetName ()})
130+ remediationCR .SetAnnotations (map [string ]string {annotations .NodeNameAnnotation : name , annotations .TemplateNameAnnotation : template .GetName ()})
131131 } else {
132132 remediationCR .SetName (name )
133133 }
@@ -177,7 +177,7 @@ func (m *manager) GenerateRemediationCRBase(gvk schema.GroupVersionKind) *unstru
177177// CreateRemediationCR creates the given remediation CR from remediationCR it'll return: a bool indicator of success, a *time.Duration an indicator on when requeue is needed in order to extend the lease, a *unstructured.Unstructured of the created/existing CR and an error
178178func (m * manager ) CreateRemediationCR (remediationCR * unstructured.Unstructured , owner client.Object , nodeName * string , currentRemediationDuration , previousRemediationsDuration time.Duration ) (bool , * time.Duration , * unstructured.Unstructured , error ) {
179179 var err error
180- if remediationCR .GetAnnotations () == nil || len (remediationCR .GetAnnotations ()[annotationutils .NodeNameAnnotation ]) == 0 {
180+ if remediationCR .GetAnnotations () == nil || len (remediationCR .GetAnnotations ()[annotations .NodeNameAnnotation ]) == 0 {
181181 err = m .Get (m .ctx , client .ObjectKeyFromObject (remediationCR ), remediationCR )
182182 } else {
183183 remediationCR , err = m .getCRWithNodeNameAnnotation (remediationCR )
@@ -358,8 +358,8 @@ func (m *manager) getOwningMachineWithNamespace(node *corev1.Node) (*metav1.Owne
358358}
359359
360360func (m * manager ) getCRWithNodeNameAnnotation (remediationCR * unstructured.Unstructured ) (* unstructured.Unstructured , error ) {
361- nodeName := remediationCR .GetAnnotations ()[annotationutils .NodeNameAnnotation ]
362- templateName := remediationCR .GetAnnotations ()[annotationutils .TemplateNameAnnotation ]
361+ nodeName := remediationCR .GetAnnotations ()[annotations .NodeNameAnnotation ]
362+ templateName := remediationCR .GetAnnotations ()[annotations .TemplateNameAnnotation ]
363363
364364 resourceList := & unstructured.UnstructuredList {Object : m .GenerateRemediationCRBase (remediationCR .GroupVersionKind ()).Object }
365365 if err := m .List (m .ctx , resourceList ); err == nil {
@@ -382,22 +382,22 @@ func (m *manager) isMatchNodeTemplate(cr unstructured.Unstructured, nodeName str
382382 if cr .GetAnnotations () == nil {
383383 return cr .GetName () == nodeName
384384 }
385- annotations := cr .GetAnnotations ()
386- if _ , isMultiSupported := annotations [ annotationutils .TemplateNameAnnotation ]; ! isMultiSupported {
385+ ann := cr .GetAnnotations ()
386+ if _ , isMultiSupported := ann [ annotations .TemplateNameAnnotation ]; ! isMultiSupported {
387387 return cr .GetName () == nodeName
388388 }
389- return annotations [ annotationutils .TemplateNameAnnotation ] == templateName && annotations [ annotationutils .NodeNameAnnotation ] == nodeName
389+ return ann [ annotations .TemplateNameAnnotation ] == templateName && ann [ annotations .NodeNameAnnotation ] == nodeName
390390}
391391
392392func (m * manager ) extractNodeName (cr unstructured.Unstructured ) string {
393393 if cr .GetAnnotations () == nil {
394394 return cr .GetName ()
395395 }
396- annotations := cr .GetAnnotations ()
397- if _ , isMultiSupported := annotations [ annotationutils .TemplateNameAnnotation ]; ! isMultiSupported {
396+ ann := cr .GetAnnotations ()
397+ if _ , isMultiSupported := ann [ annotations .TemplateNameAnnotation ]; ! isMultiSupported {
398398 return cr .GetName ()
399399 }
400- return annotations [ annotationutils .NodeNameAnnotation ]
400+ return ann [ annotations .NodeNameAnnotation ]
401401}
402402
403403func createOwnerRef (obj client.Object ) * metav1.OwnerReference {
0 commit comments