Skip to content

Commit

Permalink
Fix #952: fix findings
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed Oct 1, 2019
1 parent 0917c9a commit 6928b9c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 16 deletions.
2 changes: 0 additions & 2 deletions pkg/apis/knative08compat/knative08compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func (in *Subscription) DeepCopyInto(out *Subscription) {
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subscription.
Expand Down Expand Up @@ -82,7 +81,6 @@ func (in *SubscriptionList) DeepCopyInto(out *SubscriptionList) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionList.
Expand Down
4 changes: 2 additions & 2 deletions pkg/trait/knative_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ package trait

import (
"context"
"k8s.io/apimachinery/pkg/runtime/schema"
"knative.dev/pkg/apis"
"testing"

"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
Expand All @@ -36,7 +34,9 @@ import (
k8sutils "github.com/apache/camel-k/pkg/util/kubernetes"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
messaging "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
"knative.dev/pkg/apis"
duckv1 "knative.dev/pkg/apis/duck/v1"
duckv1alpha1 "knative.dev/pkg/apis/duck/v1alpha1"
servingv1 "knative.dev/serving/pkg/apis/serving/v1"
Expand Down
8 changes: 2 additions & 6 deletions pkg/util/knative/knative.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ func GetAnySinkURL(ctx context.Context, c client.Client, types []schema.GroupVer
}

res, err := GetSinkURI(ctx, c, &sink, namespace)
if err != nil && k8serrors.IsNotFound(err) {
continue
} else if err != nil && kubernetesutils.IsUnknownAPIError(err) {
if err != nil && (k8serrors.IsNotFound(err) || kubernetesutils.IsUnknownAPIError(err)) {
continue
} else if err != nil {
return nil, err
Expand All @@ -137,9 +135,7 @@ func GetAddressableReference(ctx context.Context, c client.Client, types []schem
}

_, err := GetSinkURI(ctx, c, &sink, namespace)
if err != nil && k8serrors.IsNotFound(err) {
continue
} else if err != nil && kubernetesutils.IsUnknownAPIError(err) {
if err != nil && (k8serrors.IsNotFound(err) || kubernetesutils.IsUnknownAPIError(err)) {
continue
} else if err != nil {
return nil, err
Expand Down
5 changes: 2 additions & 3 deletions pkg/util/kubernetes/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ package kubernetes

import (
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
serving "knative.dev/serving/pkg/apis/serving/v1beta1"
servingv1 "knative.dev/serving/pkg/apis/serving/v1"
routev1 "github.com/openshift/api/route/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"k8s.io/apimachinery/pkg/runtime"
servingv1 "knative.dev/serving/pkg/apis/serving/v1"
serving "knative.dev/serving/pkg/apis/serving/v1beta1"
)

// A Collection is a container of Kubernetes resources
Expand Down
6 changes: 3 additions & 3 deletions pkg/util/kubernetes/replace.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ import (
"context"

"github.com/apache/camel-k/pkg/client"
messaging "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
routev1 "github.com/openshift/api/route/v1"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
serving "knative.dev/serving/pkg/apis/serving/v1beta1"
messaging "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
servingv1 "knative.dev/serving/pkg/apis/serving/v1"
serving "knative.dev/serving/pkg/apis/serving/v1beta1"
k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
)

// ReplaceResources allows to completely replace a list of resources on Kubernetes, taking care of immutable fields and resource versions
Expand Down

0 comments on commit 6928b9c

Please sign in to comment.