Skip to content

Commit

Permalink
Improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
Tharsanan1 committed Jan 16, 2024
1 parent 677b851 commit 8a07529
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions adapter/internal/operator/controllers/dp/api_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2079,9 +2079,7 @@ func prepareOwnerReference(apiItems []dpv1alpha2.API) []metav1.OwnerReference {
ownerReferences := []metav1.OwnerReference{}
uidMap := make(map[string]bool)
for _, ref := range apiItems {
if _, exists := uidMap[string(ref.UID)]; exists {
continue
} else {
if _, exists := uidMap[string(ref.UID)]; !exists {
ownerReferences = append(ownerReferences, metav1.OwnerReference{
APIVersion: ref.APIVersion,
Kind: ref.Kind,
Expand Down
6 changes: 2 additions & 4 deletions adapter/internal/operator/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,8 @@ func ResolveAndAddBackendToMapping(ctx context.Context, client k8client.Client,
// ResolveRef this function will return k8client object and update owner
func ResolveRef(ctx context.Context, client k8client.Client, api *dpv1alpha2.API,
namespacedName types.NamespacedName, isReplace bool, obj k8client.Object, opts ...k8client.GetOption) error {
if err := client.Get(ctx, namespacedName, obj, opts...); err != nil {
return err
}
return nil
err := client.Get(ctx, namespacedName, obj, opts...);
return err
}

// GetResolvedBackend resolves backend TLS configurations.
Expand Down

0 comments on commit 8a07529

Please sign in to comment.