Merge pull request #11831 from k8s-infra-cherrypick-robot/cherry-pick-11815-to-release/2.1

[release/2.1] core/runtime/v2: cleanup shim-cleanup logs
This commit is contained in:
Akihiro Suda
2025-05-11 01:35:59 +09:00
committed by GitHub
2 changed files with 12 additions and 6 deletions

View File

@@ -154,7 +154,7 @@ func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_
}
func (b *binary) Delete(ctx context.Context) (*runtime.Exit, error) {
log.G(ctx).Info("cleaning up dead shim")
log.G(ctx).WithField("id", b.bundle.ID).Info("cleaning up dead shim")
// On Windows and FreeBSD, the current working directory of the shim should
// not be the bundle path during the delete operation. Instead, we invoke
@@ -195,12 +195,18 @@ func (b *binary) Delete(ctx context.Context) (*runtime.Exit, error) {
cmd.Stdout = out
cmd.Stderr = errb
if err := cmd.Run(); err != nil {
log.G(ctx).WithField("cmd", cmd.String()).WithError(err).Error("failed to delete")
log.G(ctx).WithFields(log.Fields{
"cmd": cmd.String(),
"error": err,
"id": b.bundle.ID,
}).Error("failed to delete dead shim")
return nil, fmt.Errorf("%s: %w", errb.String(), err)
}
s := errb.String()
if s != "" {
log.G(ctx).Warnf("cleanup warnings %s", s)
if s := errb.String(); s != "" {
log.G(ctx).WithFields(log.Fields{
"id": b.bundle.ID,
"warnings": s,
}).Warn("warnings while cleaning up dead shim")
}
var response task.DeleteResponse
if err := proto.Unmarshal(out.Bytes(), &response); err != nil {

View File

@@ -138,7 +138,7 @@ func cleanupAfterDeadShim(ctx context.Context, id string, rt *runtime.NSMap[Shim
ctx, cancel := timeout.WithContext(ctx, cleanupTimeout)
defer cancel()
log.G(ctx).WithField("id", id).Warn("cleaning up after shim disconnected")
log.G(ctx).WithField("id", id).Info("cleaning up after shim disconnected")
response, err := binaryCall.Delete(ctx)
if err != nil {
log.G(ctx).WithError(err).WithField("id", id).Warn("failed to clean up after shim disconnected")