diff --git a/registry/kubernetes/registry.go b/registry/kubernetes/registry.go index aad79a9dd17e09ce2fc4ff5baafd17b732eb630e..69a3fca18816054738024fb5e1ab7541734444f7 100644 --- a/registry/kubernetes/registry.go +++ b/registry/kubernetes/registry.go @@ -19,7 +19,6 @@ package kubernetes import ( "fmt" - v1 "k8s.io/api/core/v1" "os" "path" "sync" @@ -30,6 +29,7 @@ import ( "github.com/dubbogo/getty" "github.com/dubbogo/gost/net" perrors "github.com/pkg/errors" + v1 "k8s.io/api/core/v1" ) import ( diff --git a/remoting/kubernetes/client.go b/remoting/kubernetes/client.go index b980501490f14762c3175ecd45bba7d540a1933c..430667fec7bfc749baaf93a1974b53a8e85db11f 100644 --- a/remoting/kubernetes/client.go +++ b/remoting/kubernetes/client.go @@ -19,20 +19,20 @@ package kubernetes import ( "context" - "github.com/apache/dubbo-go/common" - "github.com/apache/dubbo-go/common/constant" - v1 "k8s.io/api/core/v1" - "k8s.io/client-go/kubernetes" - "k8s.io/client-go/kubernetes/fake" "strconv" "sync" ) import ( perrors "github.com/pkg/errors" + v1 "k8s.io/api/core/v1" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/kubernetes/fake" ) import ( + "github.com/apache/dubbo-go/common" + "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/logger" ) diff --git a/remoting/kubernetes/facade_test.go b/remoting/kubernetes/facade_test.go index ce303d534aa7c6d772e1250894fbe4696e890a53..4323c0ec565d64f445f15c3e5c265451b2b87ce7 100644 --- a/remoting/kubernetes/facade_test.go +++ b/remoting/kubernetes/facade_test.go @@ -18,13 +18,16 @@ package kubernetes import ( - "github.com/apache/dubbo-go/common" - "github.com/apache/dubbo-go/common/constant" "strconv" "sync" "testing" ) +import ( + "github.com/apache/dubbo-go/common" + "github.com/apache/dubbo-go/common/constant" +) + type mockFacade struct { *common.URL client *Client diff --git a/remoting/kubernetes/registry_controller.go b/remoting/kubernetes/registry_controller.go index aa44202954f7ec0d783671536fb60b7f90aee222..75799b3100ab3ea6a8a5d2a9aacb62014c734238 100644 --- a/remoting/kubernetes/registry_controller.go +++ b/remoting/kubernetes/registry_controller.go @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package kubernetes import ( @@ -5,31 +22,35 @@ import ( "encoding/base64" "encoding/json" "fmt" - "github.com/apache/dubbo-go/common" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/strategicpatch" "os" "strconv" "strings" "sync" "time" +) - "github.com/apache/dubbo-go/common/logger" +import ( + perrors "github.com/pkg/errors" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/strategicpatch" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/informers" - "k8s.io/client-go/tools/cache" - - perrors "github.com/pkg/errors" - v1 "k8s.io/api/core/v1" informerscorev1 "k8s.io/client-go/informers/core/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" + "k8s.io/client-go/tools/cache" "k8s.io/client-go/util/workqueue" ) +import ( + "github.com/apache/dubbo-go/common" + "github.com/apache/dubbo-go/common/logger" +) + const ( // kubernetes suggest resync defaultResync = 5 * time.Minute