Skip to content

Commit

Permalink
add log output if deletion of Analysis was unsuccessful
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Bacher <[email protected]>
  • Loading branch information
bacherfl committed Apr 30, 2024
1 parent 187d52b commit 8b93127
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/metrics/providers/keptn.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"k8s.io/klog/v2"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -153,14 +154,17 @@ func (k *KeptnProvider) queryKeptnAnalysis(obj *queryObject) (float64, error) {

// delete the created analysis at the end of the function
defer func() {
_ = k.client.
err := k.client.
Resource(obj.GroupVersionResource).
Namespace(obj.Namespace).
Delete(
context.TODO(),
createdAnalysis.GetName(),
v1.DeleteOptions{},
)
if err != nil {
klog.Error("Could not delete Keptn Analysis '%s': %v", createdAnalysis.GetName(), err)
}
}()

for {
Expand Down

0 comments on commit 8b93127

Please sign in to comment.