Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/crossplane/render/op/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ func (c *Cmd) Run(k *kong.Context, log logging.Logger, sp terminal.SpinnerPrinte
defer func() {
if err := render.StopFunctionRuntimes(ctx, fnAddrs); err != nil {
log.Info("Error stopping function runtimes", "error", err)
render.WarnCleanupFailure(k.Stderr, err)
}
}()

Expand Down
12 changes: 12 additions & 0 deletions cmd/crossplane/render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ package render

import (
"context"
"fmt"
"io"
"strings"

fnv1 "github.com/crossplane/function-sdk-go/proto/v1"
Expand Down Expand Up @@ -196,3 +198,13 @@ func OverrideFunctionAnnotations(fns []pkgv1.Function, annotations []string) err
}
return nil
}

// WarnCleanupFailure writes a short warning about err to w. It does nothing if
// err is nil. Callers use it to surface function runtime cleanup failures that
// would otherwise only be visible with --verbose.
func WarnCleanupFailure(w io.Writer, err error) {
if err == nil {
return
}
_, _ = fmt.Fprintf(w, "warning: failed to clean up function runtimes; some resources (e.g. containers) may need to be removed manually: %v\n", err)
}
1 change: 1 addition & 0 deletions cmd/crossplane/render/xr/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ func (c *Cmd) Run(k *kong.Context, log logging.Logger, sp terminal.SpinnerPrinte
defer func() {
if err := render.StopFunctionRuntimes(ctx, fnAddrs); err != nil {
log.Info("Error stopping function runtimes", "error", err)
render.WarnCleanupFailure(k.Stderr, err)
}
}()

Expand Down
Loading