Skip to content

Commit

Permalink
chore: New client returns different error when API is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
dmage authored and openshift-merge-robot committed Aug 21, 2023
1 parent 327bb5f commit 8b97643
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions controllers/quay/quayregistry_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package controllers

import (
"context"
goerrors "errors"
"fmt"
"os"
"strings"
Expand All @@ -34,13 +35,13 @@ import (
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
meta "k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/discovery"
"k8s.io/client-go/tools/record"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -952,7 +953,8 @@ func (r *QuayRegistryReconciler) createOrUpdateObject(
client.FieldOwner("quay-operator"),
}
err := r.Client.Patch(ctx, obj, client.Apply, opts...)
if meta.IsNoMatchError(err) && gvk == hpaGVK {
gdferr := &discovery.ErrGroupDiscoveryFailed{}
if goerrors.As(err, &gdferr) && gvk == hpaGVK {
var hpa *autoscalingv2beta2.HorizontalPodAutoscaler
hpa, err = convertHpaToV2beta2(obj.(*autoscalingv2.HorizontalPodAutoscaler))
if err != nil {
Expand Down

0 comments on commit 8b97643

Please sign in to comment.