@@ -86,6 +86,7 @@ func NewDaemonSetManager(config *ManagerConfig, getComputeDomain GetComputeDomai
8686
8787 informer := factory .Apps ().V1 ().DaemonSets ().Informer ()
8888
89+ klog .Infof ("Creating new DaemonSetManager for driver %s/%s" , config .driverNamespace , config .driverName )
8990 m := & DaemonSetManager {
9091 config : config ,
9192 getComputeDomain : getComputeDomain ,
@@ -162,7 +163,7 @@ func (m *DaemonSetManager) Create(ctx context.Context, namespace string, cd *nva
162163 return nil , fmt .Errorf ("error retrieving DaemonSet: %w" , err )
163164 }
164165 if len (ds ) > 1 {
165- return nil , fmt .Errorf ("more than one DaemonSet found with same ComputeDomain UID" )
166+ return nil , fmt .Errorf ("more than one DaemonSet found with same ComputeDomain UID %s" , cd . UID )
166167 }
167168 if len (ds ) == 1 {
168169 return ds [0 ], nil
@@ -209,6 +210,7 @@ func (m *DaemonSetManager) Create(ctx context.Context, namespace string, cd *nva
209210 return nil , fmt .Errorf ("error creating DaemonSet: %w" , err )
210211 }
211212
213+ klog .V (2 ).Infof ("Successfully created DaemonSet %s/%s for ComputeDomain %s/%s" , d .Namespace , d .Name , cd .Namespace , cd .Name )
212214 return d , nil
213215}
214216
@@ -218,9 +220,10 @@ func (m *DaemonSetManager) Delete(ctx context.Context, cdUID string) error {
218220 return fmt .Errorf ("error retrieving DaemonSet: %w" , err )
219221 }
220222 if len (ds ) > 1 {
221- return fmt .Errorf ("more than one DaemonSet found with same ComputeDomain UID" )
223+ return fmt .Errorf ("more than one DaemonSet found with same ComputeDomain UID %s" , cdUID )
222224 }
223225 if len (ds ) == 0 {
226+ klog .V (2 ).Infof ("No DaemonSet found for ComputeDomain UID %s, nothing to delete" , cdUID )
224227 return nil
225228 }
226229
@@ -231,6 +234,7 @@ func (m *DaemonSetManager) Delete(ctx context.Context, cdUID string) error {
231234 }
232235
233236 if d .GetDeletionTimestamp () != nil {
237+ klog .V (2 ).Infof ("DaemonSet %s/%s is already marked for deletion" , d .Namespace , d .Name )
234238 return nil
235239 }
236240
@@ -239,6 +243,7 @@ func (m *DaemonSetManager) Delete(ctx context.Context, cdUID string) error {
239243 return fmt .Errorf ("erroring deleting DaemonSet: %w" , err )
240244 }
241245
246+ klog .V (2 ).Infof ("Successfully deleted DaemonSet %s/%s for ComputeDomain UID %s" , d .Namespace , d .Name , cdUID )
242247 return nil
243248}
244249
@@ -271,6 +276,7 @@ func (m *DaemonSetManager) removeFinalizer(ctx context.Context, cdUID string) er
271276 return fmt .Errorf ("more than one DaemonSet found with same ComputeDomain UID" )
272277 }
273278 if len (ds ) == 0 {
279+ klog .V (2 ).Infof ("No DaemonSet found for ComputeDomain UID %s, nothing to remove finalizer from" , cdUID )
274280 return nil
275281 }
276282
@@ -288,6 +294,7 @@ func (m *DaemonSetManager) removeFinalizer(ctx context.Context, cdUID string) er
288294 }
289295 }
290296 if len (d .Finalizers ) == len (newD .Finalizers ) {
297+ klog .V (2 ).Infof ("Finalizer %s not found on DaemonSet %s/%s" , computeDomainFinalizer , d .Namespace , d .Name )
291298 return nil
292299 }
293300
@@ -322,10 +329,12 @@ func (m *DaemonSetManager) onAddOrUpdate(ctx context.Context, obj any) error {
322329 return fmt .Errorf ("error getting ComputeDomain: %w" , err )
323330 }
324331 if cd == nil {
332+ klog .V (2 ).Info ("No ComputeDomain found, skipping processing" )
325333 return nil
326334 }
327335
328336 if int (d .Status .NumberReady ) != cd .Spec .NumNodes {
337+ klog .V (2 ).Infof ("DaemonSet %s/%s has %d ready nodes, expecting %d, waiting for all nodes to be ready" , d .Namespace , d .Name , d .Status .NumberReady , cd .Spec .NumNodes )
329338 return nil
330339 }
331340
0 commit comments