Skip to content

Commit 7e8e1be

Browse files
Copilotrakechill
andcommitted
Add TODO and enhanced comment about risk if vm.Properties.TimeCreated is never populated
Co-authored-by: rakechill <30397998+rakechill@users.noreply.github.com>
1 parent 196b2bf commit 7e8e1be

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/cloudprovider/cloudprovider.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,10 @@ func (c *CloudProvider) vmInstanceToNodeClaim(ctx context.Context, vm *armcomput
538538
// Fallback to current time to ensure garbage collection grace period is enforced
539539
// when TimeCreated is unavailable. Without this, CreationTimestamp would be epoch (zero value)
540540
// and the instance could be immediately garbage collected, bypassing the 5-minute grace period.
541+
// TODO: Investigate a more fail-safe approach. If vm.Properties.TimeCreated is NEVER populated,
542+
// this fallback means the VM will never be garbage collected since we call this helper every time
543+
// we create an in-memory NodeClaim. We currently assume this shouldn't happen because VMs that fail
544+
// to come up should eventually stop appearing in Azure API responses.
541545
nodeClaim.CreationTimestamp = metav1.Time{Time: time.Now()}
542546
}
543547
// Set the deletionTimestamp to be the current time if the instance is currently terminating

0 commit comments

Comments
 (0)