Skip to content

Commit

Permalink
replace ParseObjectName
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinWeindel committed Jul 26, 2024
1 parent bb9f0b4 commit e8b31da
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/controller/lifecycle/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,17 +713,18 @@ func (a *actuator) collectProviderDetailsOnDeletingDNSEntries(ctx context.Contex
status = append(status, "no suitable provider")
continue
}
namespace, name := kutil.ParseObjectName(k)
if namespace == "" {
parts := strings.Split(k, "/")
if len(parts) != 2 {
status = append(status, fmt.Sprintf("unknown provider name: %s", k))
continue
}
objectKey := client.ObjectKey{Namespace: parts[0], Name: parts[1]}
provider := &dnsv1alpha1.DNSProvider{}
if err := a.Client().Get(ctx, client.ObjectKey{Namespace: namespace, Name: name}, provider); err != nil {
if err := a.Client().Get(ctx, objectKey, provider); err != nil {
status = append(status, fmt.Sprintf("error on retrieving status of provider %s: %s", k, err))
continue
}
status = append(status, fmt.Sprintf("provider %s has status: %s", name, ptr.Deref(provider.Status.Message, "unknwon")))
status = append(status, fmt.Sprintf("provider %s has status: %s", objectKey, ptr.Deref(provider.Status.Message, "unknwon")))
}
return strings.Join(status, ", ")
}
Expand Down

0 comments on commit e8b31da

Please sign in to comment.