mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-11 20:21:02 +00:00
Fix patch MergeFrom target
This commit is contained in:
@@ -434,12 +434,12 @@ func syncRunnerPodsOwners(ctx context.Context, c client.Client, log logr.Logger,
|
|||||||
if _, ok := getAnnotation(ss.owner, AnnotationKeyUnregistrationRequestTimestamp); !ok {
|
if _, ok := getAnnotation(ss.owner, AnnotationKeyUnregistrationRequestTimestamp); !ok {
|
||||||
updated := ss.owner.withAnnotation(AnnotationKeyUnregistrationRequestTimestamp, time.Now().Format(time.RFC3339))
|
updated := ss.owner.withAnnotation(AnnotationKeyUnregistrationRequestTimestamp, time.Now().Format(time.RFC3339))
|
||||||
|
|
||||||
if err := c.Patch(ctx, updated, client.MergeFrom(ss.object)); err != nil {
|
if err := c.Patch(ctx, updated, client.MergeFrom(ss.owner)); err != nil {
|
||||||
log.Error(err, fmt.Sprintf("Failed to patch object to have %s annotation", AnnotationKeyUnregistrationRequestTimestamp))
|
log.Error(err, fmt.Sprintf("Failed to patch owner to have %s annotation", AnnotationKeyUnregistrationRequestTimestamp))
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
log.V(2).Info("Redundant object has been annotated to start the unregistration before deletion")
|
log.V(2).Info("Redundant owner has been annotated to start the unregistration before deletion")
|
||||||
} else {
|
} else {
|
||||||
log.V(2).Info("BUG: Redundant object was already annotated")
|
log.V(2).Info("BUG: Redundant object was already annotated")
|
||||||
}
|
}
|
||||||
@@ -539,7 +539,7 @@ func collectPodsForOwners(ctx context.Context, c client.Client, log logr.Logger,
|
|||||||
if _, ok := getAnnotation(res.owner, AnnotationKeyUnregistrationCompleteTimestamp); !ok {
|
if _, ok := getAnnotation(res.owner, AnnotationKeyUnregistrationCompleteTimestamp); !ok {
|
||||||
updated := res.owner.withAnnotation(AnnotationKeyUnregistrationCompleteTimestamp, time.Now().Format(time.RFC3339))
|
updated := res.owner.withAnnotation(AnnotationKeyUnregistrationCompleteTimestamp, time.Now().Format(time.RFC3339))
|
||||||
|
|
||||||
if err := c.Patch(ctx, updated, client.MergeFrom(res.object)); err != nil {
|
if err := c.Patch(ctx, updated, client.MergeFrom(res.owner)); err != nil {
|
||||||
log.Error(err, fmt.Sprintf("Failed to patch owner to have %s annotation", AnnotationKeyUnregistrationCompleteTimestamp))
|
log.Error(err, fmt.Sprintf("Failed to patch owner to have %s annotation", AnnotationKeyUnregistrationCompleteTimestamp))
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user