Skip to content

Commit

Permalink
fix(konnect): don't block deletion when entity has no Konnect ID and …
Browse files Browse the repository at this point in the history
…is not Programmed
  • Loading branch information
pmalek committed Oct 24, 2024
1 parent 737150d commit c6e03c7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions controller/konnect/ops/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,14 @@ func Delete[
](ctx context.Context, sdk sdkops.SDKWrapper, cl client.Client, e *T) error {
ent := TEnt(e)
if ent.GetKonnectStatus().GetKonnectID() == "" {
return fmt.Errorf(
"can't delete %T %s when it does not have the Konnect ID",
ent, client.ObjectKeyFromObject(ent),
)
cond, ok := k8sutils.GetCondition(konnectv1alpha1.KonnectEntityProgrammedConditionType, ent)
if ok && cond.Status == metav1.ConditionTrue {
return fmt.Errorf(
"can't delete %T %s when it does not have the Konnect ID",
ent, client.ObjectKeyFromObject(ent),
)
}
return nil
}

var (
Expand Down

0 comments on commit c6e03c7

Please sign in to comment.