@@ -204,30 +204,31 @@ func (r *NodeLabelController) Reconcile(ctx context.Context, req ctrl.Request) (
204204
205205 // Create a map for tags to sync with the cloud provider
206206 tagsToSync := make (map [string ]string )
207+ var notFoundLabels , notFoundAnnotations []string
207208
208209 // First collect labels (may be overwritten by annotations with same key)
209- if node .Labels != nil {
210- for _ , k := range r .Labels {
211- if value , exists := node .Labels [k ]; exists {
212- tagsToSync [k ] = value
213- } else {
214- logger .V (1 ).Info ("Monitored label not found on node" , "label" , k )
215- }
210+ for _ , k := range r .Labels {
211+ if value , exists := node .Labels [k ]; exists {
212+ tagsToSync [k ] = value
213+ } else {
214+ notFoundLabels = append (notFoundLabels , k )
216215 }
217216 }
218217
219218 // Then collect annotations (will overwrite labels with same key)
220- if node .Annotations != nil {
221- for _ , k := range r .Annotations {
222- if value , exists := node .Annotations [k ]; exists {
223- tagsToSync [k ] = value
224- } else {
225- logger .V (1 ).Info ("Monitored annotation not found on node" , "annotation" , k )
226- }
219+ for _ , k := range r .Annotations {
220+ if value , exists := node .Annotations [k ]; exists {
221+ tagsToSync [k ] = value
222+ } else {
223+ notFoundAnnotations = append (notFoundAnnotations , k )
227224 }
228225 }
229226
230- logger .V (1 ).Info ("Collected tags to sync" , "tagsToSync" , tagsToSync , "monitoredLabels" , r .Labels , "monitoredAnnotations" , r .Annotations )
227+ logger .V (1 ).Info ("Collected tags to sync" ,
228+ "tagsToSync" , tagsToSync ,
229+ "notFoundLabels" , notFoundLabels ,
230+ "notFoundAnnotations" , notFoundAnnotations ,
231+ )
231232
232233 var err error
233234 switch r .Cloud {
0 commit comments