Skip to content

Commit

Permalink
pkg,test: Remove duplicate package imports (#2501)
Browse files Browse the repository at this point in the history
Update various pkg,test packages are removed any obvious duplicate
package imports that violate local static linters.

Signed-off-by: timflannagan <timflannagan@gmail.com>
  • Loading branch information
timflannagan committed Dec 2, 2021
1 parent d92ef2c commit 40b8b71
Show file tree
Hide file tree
Showing 7 changed files with 570 additions and 578 deletions.
5 changes: 2 additions & 3 deletions pkg/controller/operators/catalog/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
utilclock "k8s.io/apimachinery/pkg/util/clock"
k8syaml "k8s.io/apimachinery/pkg/util/yaml"
utilyaml "k8s.io/apimachinery/pkg/util/yaml"
"k8s.io/apiserver/pkg/storage/names"
fakedynamic "k8s.io/client-go/dynamic/fake"
Expand Down Expand Up @@ -1302,7 +1301,7 @@ func TestValidateExistingCRs(t *testing.T) {
unstructuredForFile := func(file string) *unstructured.Unstructured {
data, err := ioutil.ReadFile(file)
require.NoError(t, err)
dec := k8syaml.NewYAMLOrJSONDecoder(strings.NewReader(string(data)), 30)
dec := utilyaml.NewYAMLOrJSONDecoder(strings.NewReader(string(data)), 30)
k8sFile := &unstructured.Unstructured{}
require.NoError(t, dec.Decode(k8sFile))
return k8sFile
Expand All @@ -1311,7 +1310,7 @@ func TestValidateExistingCRs(t *testing.T) {
unversionedCRDForV1beta1File := func(file string) *apiextensions.CustomResourceDefinition {
data, err := ioutil.ReadFile(file)
require.NoError(t, err)
dec := k8syaml.NewYAMLOrJSONDecoder(strings.NewReader(string(data)), 30)
dec := utilyaml.NewYAMLOrJSONDecoder(strings.NewReader(string(data)), 30)
k8sFile := &apiextensionsv1beta1.CustomResourceDefinition{}
require.NoError(t, dec.Decode(k8sFile))
convertedCRD := &apiextensions.CustomResourceDefinition{}
Expand Down
5 changes: 2 additions & 3 deletions pkg/controller/operators/olm/labeler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"github.com/operator-framework/api/pkg/operators/v1alpha1"
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver/cache"
"github.com/operator-framework/operator-registry/pkg/registry"
opregistry "github.com/operator-framework/operator-registry/pkg/registry"
extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
extv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
Expand Down Expand Up @@ -98,7 +97,7 @@ func labelSetsForCRDv1beta1(crd *extv1beta1.CustomResourceDefinition) ([]labels.

// Add label sets for each version
for _, version := range crd.Spec.Versions {
hash, err := cache.APIKeyToGVKHash(registry.APIKey{
hash, err := cache.APIKeyToGVKHash(opregistry.APIKey{
Group: crd.Spec.Group,
Version: version.Name,
Kind: crd.Spec.Names.Kind,
Expand Down Expand Up @@ -129,7 +128,7 @@ func labelSetsForCRDv1(crd *extv1.CustomResourceDefinition) ([]labels.Set, error

// Add label sets for each version
for _, version := range crd.Spec.Versions {
hash, err := cache.APIKeyToGVKHash(registry.APIKey{
hash, err := cache.APIKeyToGVKHash(opregistry.APIKey{
Group: crd.Spec.Group,
Version: version.Name,
Kind: crd.Spec.Names.Kind,
Expand Down
3 changes: 1 addition & 2 deletions pkg/controller/operators/olm/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

v1 "github.com/operator-framework/api/pkg/operators/v1"
"github.com/sirupsen/logrus"
log "github.com/sirupsen/logrus"
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
Expand Down Expand Up @@ -2050,7 +2049,7 @@ func (a *Operator) apiServiceOwnerConflicts(csv *v1alpha1.ClusterServiceVersion)

adoptable, err := install.IsAPIServiceAdoptable(a.lister, csv, apiService)
if err != nil {
a.logger.WithFields(log.Fields{"obj": "apiService", "labels": apiService.GetLabels()}).Errorf("adoption check failed - %v", err)
a.logger.WithFields(logrus.Fields{"obj": "apiService", "labels": apiService.GetLabels()}).Errorf("adoption check failed - %v", err)
}

if !adoptable {
Expand Down
3 changes: 1 addition & 2 deletions pkg/controller/registry/reconciler/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
k8serror "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
Expand Down Expand Up @@ -326,7 +325,7 @@ func (c *GrpcRegistryReconciler) ensureService(source grpcCatalogSourceDecorator
return err
}

func (c *GrpcRegistryReconciler) ensureSA(source grpcCatalogSourceDecorator) (*v1.ServiceAccount, error) {
func (c *GrpcRegistryReconciler) ensureSA(source grpcCatalogSourceDecorator) (*corev1.ServiceAccount, error) {
sa := source.ServiceAccount()
if _, err := c.OpClient.CreateServiceAccount(sa); err != nil {
return sa, err
Expand Down
7 changes: 3 additions & 4 deletions pkg/controller/registry/resolver/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"

"github.com/operator-framework/api/pkg/lib/version"
opver "github.com/operator-framework/api/pkg/lib/version"
"github.com/operator-framework/api/pkg/operators/v1alpha1"
listersv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1"
Expand Down Expand Up @@ -1515,7 +1514,7 @@ func TestInferProperties(t *testing.T) {
Name: "a",
},
Spec: v1alpha1.ClusterServiceVersionSpec{
Version: version.OperatorVersion{Version: semver.MustParse("1.2.3")},
Version: opver.OperatorVersion{Version: semver.MustParse("1.2.3")},
},
},
Subscriptions: []*v1alpha1.Subscription{
Expand Down Expand Up @@ -1556,7 +1555,7 @@ func TestInferProperties(t *testing.T) {
Name: "a",
},
Spec: v1alpha1.ClusterServiceVersionSpec{
Version: version.OperatorVersion{Version: semver.MustParse("1.2.3")},
Version: opver.OperatorVersion{Version: semver.MustParse("1.2.3")},
},
},
Subscriptions: []*v1alpha1.Subscription{
Expand Down Expand Up @@ -1585,7 +1584,7 @@ func TestInferProperties(t *testing.T) {
Name: "a",
},
Spec: v1alpha1.ClusterServiceVersionSpec{
Version: version.OperatorVersion{Version: semver.MustParse("1.2.3")},
Version: opver.OperatorVersion{Version: semver.MustParse("1.2.3")},
},
},
Subscriptions: []*v1alpha1.Subscription{
Expand Down
Loading

0 comments on commit 40b8b71

Please sign in to comment.