diff --git a/cmd/aeraki/main.go b/cmd/aeraki/main.go index 5e49d5a8f..ee872ed67 100644 --- a/cmd/aeraki/main.go +++ b/cmd/aeraki/main.go @@ -22,6 +22,7 @@ import ( "syscall" "github.com/google/uuid" + "istio.io/pkg/log" "github.com/aeraki-mesh/aeraki/internal/bootstrap" "github.com/aeraki-mesh/aeraki/internal/config/constants" @@ -31,8 +32,6 @@ import ( "github.com/aeraki-mesh/aeraki/internal/plugin/metaprotocol" "github.com/aeraki-mesh/aeraki/internal/plugin/thrift" "github.com/aeraki-mesh/aeraki/internal/plugin/zookeeper" - - "istio.io/pkg/log" ) const ( diff --git a/internal/bootstrap/server.go b/internal/bootstrap/server.go index f363073c9..c8f6af34e 100644 --- a/internal/bootstrap/server.go +++ b/internal/bootstrap/server.go @@ -25,16 +25,14 @@ import ( "sync" "sync/atomic" "time" - //nolint: gosec _ "net/http/pprof" // pprof - "istio.io/istio/pkg/config/mesh" - istioscheme "istio.io/client-go/pkg/apis/networking/v1alpha3" "istio.io/client-go/pkg/clientset/versioned" "istio.io/istio/pilot/pkg/model" istioconfig "istio.io/istio/pkg/config" + "istio.io/istio/pkg/config/mesh" kubelib "istio.io/istio/pkg/kube" "istio.io/pkg/log" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -44,8 +42,6 @@ import ( kubeconfig "sigs.k8s.io/controller-runtime/pkg/client/config" "sigs.k8s.io/controller-runtime/pkg/manager" - aerakischeme "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/scheme" - "github.com/aeraki-mesh/aeraki/internal/controller/istio" "github.com/aeraki-mesh/aeraki/internal/controller/kube" "github.com/aeraki-mesh/aeraki/internal/envoyfilter" @@ -55,6 +51,7 @@ import ( "github.com/aeraki-mesh/aeraki/internal/plugin/redis" "github.com/aeraki-mesh/aeraki/internal/util" "github.com/aeraki-mesh/aeraki/internal/xds" + aerakischeme "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/scheme" ) var ( diff --git a/internal/ca/istio_ca.go b/internal/ca/istio_ca.go index c68243705..e2e3daae4 100644 --- a/internal/ca/istio_ca.go +++ b/internal/ca/istio_ca.go @@ -21,15 +21,13 @@ import ( "path" "time" - "istio.io/istio/security/pkg/pki/util" - "istio.io/istio/pilot/pkg/bootstrap" - "istio.io/istio/security/pkg/cmd" - "istio.io/pkg/env" - "istio.io/istio/pkg/security" + "istio.io/istio/security/pkg/cmd" "istio.io/istio/security/pkg/pki/ca" "istio.io/istio/security/pkg/pki/ra" + "istio.io/istio/security/pkg/pki/util" + "istio.io/pkg/env" "istio.io/pkg/log" corev1 "k8s.io/client-go/kubernetes/typed/core/v1" ) diff --git a/internal/controller/istio/controller.go b/internal/controller/istio/controller.go index 49c6f6d2e..a6d9fc333 100644 --- a/internal/controller/istio/controller.go +++ b/internal/controller/istio/controller.go @@ -19,12 +19,6 @@ import ( "strings" "time" - "github.com/aeraki-mesh/aeraki/internal/model" - - "istio.io/istio/pkg/security" - - "istio.io/istio/security/pkg/nodeagent/cache" - discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" networking "istio.io/api/networking/v1alpha3" "istio.io/istio/pilot/pkg/config/memory" @@ -33,9 +27,12 @@ import ( istioconfig "istio.io/istio/pkg/config" "istio.io/istio/pkg/config/schema/collection" "istio.io/istio/pkg/config/schema/collections" + "istio.io/istio/pkg/security" + "istio.io/istio/security/pkg/nodeagent/cache" citadel "istio.io/istio/security/pkg/nodeagent/caclient/providers/citadel" "istio.io/pkg/log" + "github.com/aeraki-mesh/aeraki/internal/model" "github.com/aeraki-mesh/aeraki/internal/model/protocol" ) @@ -51,10 +48,10 @@ var ( controllerLog = log.RegisterScope("config-controller", "config-controller debugging", 0) // We need serviceentry and virtualservice to generate the envoyfiters configCollection = collection.NewSchemasBuilder().MustAdd(collections.IstioNetworkingV1Alpha3Serviceentries). - MustAdd(collections.IstioNetworkingV1Alpha3Virtualservices). - MustAdd(collections.IstioNetworkingV1Alpha3Destinationrules). - MustAdd(collections.IstioNetworkingV1Alpha3Envoyfilters). - MustAdd(collections.IstioNetworkingV1Alpha3Gateways).Build() + MustAdd(collections.IstioNetworkingV1Alpha3Virtualservices). + MustAdd(collections.IstioNetworkingV1Alpha3Destinationrules). + MustAdd(collections.IstioNetworkingV1Alpha3Envoyfilters). + MustAdd(collections.IstioNetworkingV1Alpha3Gateways).Build() ) // Options for config controller diff --git a/internal/controller/kube/metaprotocol.go b/internal/controller/kube/metaprotocol.go index c25c1925e..67558c3de 100644 --- a/internal/controller/kube/metaprotocol.go +++ b/internal/controller/kube/metaprotocol.go @@ -17,11 +17,8 @@ package kube import ( "context" - "sigs.k8s.io/controller-runtime/pkg/client" - - metaprotocolmodel "github.com/aeraki-mesh/aeraki/internal/model/metaprotocol" - "istio.io/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/handler" @@ -30,6 +27,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" "sigs.k8s.io/controller-runtime/pkg/source" + metaprotocolmodel "github.com/aeraki-mesh/aeraki/internal/model/metaprotocol" "github.com/aeraki-mesh/client-go/pkg/apis/metaprotocol/v1alpha1" ) diff --git a/internal/controller/kube/metarouter.go b/internal/controller/kube/metarouter.go index 80bab5593..73e7eeef1 100644 --- a/internal/controller/kube/metarouter.go +++ b/internal/controller/kube/metarouter.go @@ -17,9 +17,8 @@ package kube import ( "context" - "sigs.k8s.io/controller-runtime/pkg/client" - "istio.io/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/handler" diff --git a/internal/controller/kube/namesapce.go b/internal/controller/kube/namesapce.go index 0cca0d4ca..269ba7084 100644 --- a/internal/controller/kube/namesapce.go +++ b/internal/controller/kube/namesapce.go @@ -18,12 +18,9 @@ import ( "context" "fmt" - "k8s.io/apimachinery/pkg/api/errors" - - "github.com/aeraki-mesh/aeraki/internal/config/constants" - "istio.io/pkg/log" v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" controllerclient "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/event" @@ -32,6 +29,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/reconcile" "sigs.k8s.io/controller-runtime/pkg/source" + + "github.com/aeraki-mesh/aeraki/internal/config/constants" ) var namespaceLog = log.RegisterScope("namespace-controller", "namespace-controller debugging", 0) diff --git a/internal/controller/kube/serviceentry.go b/internal/controller/kube/serviceentry.go index b9b9440b2..7c11bdc0a 100644 --- a/internal/controller/kube/serviceentry.go +++ b/internal/controller/kube/serviceentry.go @@ -20,14 +20,10 @@ import ( "reflect" "strings" - "k8s.io/apimachinery/pkg/api/errors" - - "github.com/aeraki-mesh/aeraki/internal/config/constants" - "github.com/aeraki-mesh/aeraki/internal/model" - istionapi "istio.io/api/networking/v1alpha3" networking "istio.io/client-go/pkg/apis/networking/v1alpha3" "istio.io/pkg/log" + "k8s.io/apimachinery/pkg/api/errors" controllerclient "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/event" @@ -36,6 +32,9 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/reconcile" "sigs.k8s.io/controller-runtime/pkg/source" + + "github.com/aeraki-mesh/aeraki/internal/config/constants" + "github.com/aeraki-mesh/aeraki/internal/model" ) var serviceEntryLog = log.RegisterScope("service-entry-controller", "service-entry-controller debugging", 0) diff --git a/internal/envoyfilter/controller.go b/internal/envoyfilter/controller.go index 6d25210ec..24581004b 100644 --- a/internal/envoyfilter/controller.go +++ b/internal/envoyfilter/controller.go @@ -20,26 +20,24 @@ import ( "strings" "time" - istioclient "istio.io/client-go/pkg/clientset/versioned" - "istio.io/istio/pkg/config" - "github.com/zhaohuabing/debounce" "google.golang.org/protobuf/proto" networking "istio.io/api/networking/v1alpha3" "istio.io/client-go/pkg/apis/networking/v1alpha3" + istioclient "istio.io/client-go/pkg/clientset/versioned" istiomodel "istio.io/istio/pilot/pkg/model" + "istio.io/istio/pkg/config" "istio.io/istio/pkg/config/mesh" "istio.io/istio/pkg/config/schema/collections" "istio.io/pkg/log" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/aeraki-mesh/api/metaprotocol/v1alpha1" - metaprotocol "github.com/aeraki-mesh/client-go/pkg/apis/metaprotocol/v1alpha1" - "github.com/aeraki-mesh/aeraki/internal/config/constants" "github.com/aeraki-mesh/aeraki/internal/model" "github.com/aeraki-mesh/aeraki/internal/model/protocol" + "github.com/aeraki-mesh/api/metaprotocol/v1alpha1" + metaprotocol "github.com/aeraki-mesh/client-go/pkg/apis/metaprotocol/v1alpha1" ) const ( diff --git a/internal/envoyfilter/network_filter.go b/internal/envoyfilter/network_filter.go index fb4b2d356..ffe81510e 100644 --- a/internal/envoyfilter/network_filter.go +++ b/internal/envoyfilter/network_filter.go @@ -19,9 +19,8 @@ import ( "strconv" "strings" - _struct "github.com/golang/protobuf/ptypes/struct" - "github.com/envoyproxy/go-control-plane/pkg/wellknown" + _struct "github.com/golang/protobuf/ptypes/struct" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" networking "istio.io/api/networking/v1alpha3" diff --git a/internal/envoyfilter/network_filter_test.go b/internal/envoyfilter/network_filter_test.go index d2f61332b..898beeef2 100644 --- a/internal/envoyfilter/network_filter_test.go +++ b/internal/envoyfilter/network_filter_test.go @@ -18,9 +18,8 @@ import ( "reflect" "testing" - istioconfig "istio.io/istio/pkg/config" - networking "istio.io/api/networking/v1alpha3" + istioconfig "istio.io/istio/pkg/config" "github.com/aeraki-mesh/aeraki/internal/model" ) diff --git a/internal/leaderelection/leaderelection.go b/internal/leaderelection/leaderelection.go index 88c39cb68..5a28b1dd0 100644 --- a/internal/leaderelection/leaderelection.go +++ b/internal/leaderelection/leaderelection.go @@ -18,10 +18,9 @@ import ( "context" "time" + "go.uber.org/atomic" "istio.io/istio/pilot/pkg/leaderelection/k8sleaderelection" "istio.io/istio/pilot/pkg/leaderelection/k8sleaderelection/k8sresourcelock" - - "go.uber.org/atomic" "istio.io/pkg/log" metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" diff --git a/internal/leaderelection/leaderelection_test.go b/internal/leaderelection/leaderelection_test.go index 01594b85b..5e100fa40 100644 --- a/internal/leaderelection/leaderelection_test.go +++ b/internal/leaderelection/leaderelection_test.go @@ -21,13 +21,12 @@ import ( "time" "go.uber.org/atomic" + "istio.io/istio/pkg/test/util/retry" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/fake" k8stesting "k8s.io/client-go/testing" - - "istio.io/istio/pkg/test/util/retry" ) const testLock = "test-lock" diff --git a/internal/model/utils.go b/internal/model/utils.go index 08ea7e5c9..39a085854 100644 --- a/internal/model/utils.go +++ b/internal/model/utils.go @@ -20,7 +20,6 @@ import ( "strings" networking "istio.io/api/networking/v1alpha3" - istiomodel "istio.io/istio/pilot/pkg/model" "istio.io/istio/pkg/config/host" ) diff --git a/internal/plugin/dubbo/authz/builder/builder.go b/internal/plugin/dubbo/authz/builder/builder.go index 166ad51bf..e9658efc8 100644 --- a/internal/plugin/dubbo/authz/builder/builder.go +++ b/internal/plugin/dubbo/authz/builder/builder.go @@ -18,21 +18,18 @@ import ( "context" "fmt" - "google.golang.org/protobuf/types/known/anypb" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - dubborulepb "github.com/aeraki-mesh/api/dubbo/v1alpha1" - dubboapi "github.com/aeraki-mesh/client-go/pkg/apis/dubbo/v1alpha1" - dubboclient "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1" - rbacpb "github.com/envoyproxy/go-control-plane/envoy/config/rbac/v3" dubbopb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/dubbo_proxy/v3" rbacdubbopb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/rbac/v3" + "google.golang.org/protobuf/types/known/anypb" "istio.io/istio/pilot/pkg/security/trustdomain" "istio.io/pkg/log" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" authzmodel "github.com/aeraki-mesh/aeraki/internal/plugin/dubbo/authz/model" + dubborulepb "github.com/aeraki-mesh/api/dubbo/v1alpha1" + dubboapi "github.com/aeraki-mesh/client-go/pkg/apis/dubbo/v1alpha1" + dubboclient "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1" ) var ( diff --git a/internal/plugin/dubbo/authz/model/generator.go b/internal/plugin/dubbo/authz/model/generator.go index bb38b5d34..c15dfdd74 100644 --- a/internal/plugin/dubbo/authz/model/generator.go +++ b/internal/plugin/dubbo/authz/model/generator.go @@ -19,7 +19,6 @@ import ( "strings" rbacpb "github.com/envoyproxy/go-control-plane/envoy/config/rbac/v3" - "istio.io/istio/pkg/spiffe" "github.com/aeraki-mesh/aeraki/internal/plugin/dubbo/authz/matcher" diff --git a/internal/plugin/dubbo/authz/model/model.go b/internal/plugin/dubbo/authz/model/model.go index 59d0841c1..482ea8585 100644 --- a/internal/plugin/dubbo/authz/model/model.go +++ b/internal/plugin/dubbo/authz/model/model.go @@ -18,10 +18,9 @@ import ( "fmt" rbacpb "github.com/envoyproxy/go-control-plane/envoy/config/rbac/v3" + "istio.io/istio/pilot/pkg/security/trustdomain" dubbopb "github.com/aeraki-mesh/api/dubbo/v1alpha1" - - "istio.io/istio/pilot/pkg/security/trustdomain" ) const ( diff --git a/internal/plugin/dubbo/dubboproxy.go b/internal/plugin/dubbo/dubboproxy.go index 413812334..9391b809c 100644 --- a/internal/plugin/dubbo/dubboproxy.go +++ b/internal/plugin/dubbo/dubboproxy.go @@ -19,10 +19,9 @@ import ( "istio.io/istio/pilot/pkg/security/trustdomain" "istio.io/istio/pkg/spiffe" - dubbov1alpha1 "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1" - "github.com/aeraki-mesh/aeraki/internal/model" "github.com/aeraki-mesh/aeraki/internal/plugin/dubbo/authz/builder" + dubbov1alpha1 "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1" ) func buildOutboundProxy(context *model.EnvoyFilterContext) *dubbo.DubboProxy { diff --git a/internal/plugin/dubbo/generator.go b/internal/plugin/dubbo/generator.go index 662306426..814b5e60c 100644 --- a/internal/plugin/dubbo/generator.go +++ b/internal/plugin/dubbo/generator.go @@ -15,15 +15,13 @@ package dubbo import ( - "k8s.io/client-go/rest" - - "github.com/aeraki-mesh/client-go/pkg/clientset/versioned" - dubbov1alpha1 "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1" - "istio.io/pkg/log" + "k8s.io/client-go/rest" "github.com/aeraki-mesh/aeraki/internal/envoyfilter" "github.com/aeraki-mesh/aeraki/internal/model" + "github.com/aeraki-mesh/client-go/pkg/clientset/versioned" + dubbov1alpha1 "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1" ) var generatorLog = log.RegisterScope("dubbo-generator", "dubbo generator", 0) diff --git a/internal/plugin/metaprotocol/accesslog.go b/internal/plugin/metaprotocol/accesslog.go index 25782f2db..84f6dfc70 100644 --- a/internal/plugin/metaprotocol/accesslog.go +++ b/internal/plugin/metaprotocol/accesslog.go @@ -15,17 +15,16 @@ package metaprotocol import ( - "google.golang.org/protobuf/types/known/structpb" - "istio.io/istio/pkg/util/protomarshal" - "istio.io/pkg/log" - - "github.com/aeraki-mesh/aeraki/internal/util/protoconv" - accesslog "github.com/envoyproxy/go-control-plane/envoy/config/accesslog/v3" envoyconfig "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" fileaccesslog "github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/file/v3" "github.com/envoyproxy/go-control-plane/pkg/wellknown" + "google.golang.org/protobuf/types/known/structpb" meshconfig "istio.io/api/mesh/v1alpha1" + "istio.io/istio/pkg/util/protomarshal" + "istio.io/pkg/log" + + "github.com/aeraki-mesh/aeraki/internal/util/protoconv" ) const ( diff --git a/internal/plugin/metaprotocol/filters.go b/internal/plugin/metaprotocol/filters.go index 08f415cd1..c3aea5c8c 100644 --- a/internal/plugin/metaprotocol/filters.go +++ b/internal/plugin/metaprotocol/filters.go @@ -24,19 +24,16 @@ import ( "github.com/golang/protobuf/ptypes/wrappers" "google.golang.org/protobuf/types/known/anypb" + "github.com/aeraki-mesh/aeraki/internal/xds" + userapi "github.com/aeraki-mesh/api/metaprotocol/v1alpha1" + mpclient "github.com/aeraki-mesh/client-go/pkg/apis/metaprotocol/v1alpha1" metaroute "github.com/aeraki-mesh/meta-protocol-control-plane-api/aeraki/meta_protocol_proxy/config/route/v1alpha" //nolint: lll grldpl "github.com/aeraki-mesh/meta-protocol-control-plane-api/aeraki/meta_protocol_proxy/filters/global_ratelimit/v1alpha" stats "github.com/aeraki-mesh/meta-protocol-control-plane-api/aeraki/meta_protocol_proxy/filters/istio_stats/v1alpha" - //nolint: lll lrldpl "github.com/aeraki-mesh/meta-protocol-control-plane-api/aeraki/meta_protocol_proxy/filters/local_ratelimit/v1alpha" mpdataplane "github.com/aeraki-mesh/meta-protocol-control-plane-api/aeraki/meta_protocol_proxy/v1alpha" - - userapi "github.com/aeraki-mesh/api/metaprotocol/v1alpha1" - mpclient "github.com/aeraki-mesh/client-go/pkg/apis/metaprotocol/v1alpha1" - - "github.com/aeraki-mesh/aeraki/internal/xds" ) func buildOutboundFilters(host string) []*mpdataplane.MetaProtocolFilter { diff --git a/internal/plugin/metaprotocol/metaprotocolproxy.go b/internal/plugin/metaprotocol/metaprotocolproxy.go index bb6a16f19..ff2fd759a 100644 --- a/internal/plugin/metaprotocol/metaprotocolproxy.go +++ b/internal/plugin/metaprotocol/metaprotocolproxy.go @@ -15,7 +15,6 @@ package metaprotocol import ( - metaprotocol "github.com/aeraki-mesh/meta-protocol-control-plane-api/aeraki/meta_protocol_proxy/v1alpha" accesslog "github.com/envoyproxy/go-control-plane/envoy/config/accesslog/v3" envoyconfig "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" envoytype "github.com/envoyproxy/go-control-plane/envoy/type/v3" @@ -23,6 +22,7 @@ import ( "github.com/aeraki-mesh/aeraki/internal/model" metaprotocolmodel "github.com/aeraki-mesh/aeraki/internal/model/metaprotocol" + metaprotocol "github.com/aeraki-mesh/meta-protocol-control-plane-api/aeraki/meta_protocol_proxy/v1alpha" ) const ( diff --git a/internal/plugin/metaprotocol/route.go b/internal/plugin/metaprotocol/route.go index c9cce2dea..412738cc3 100644 --- a/internal/plugin/metaprotocol/route.go +++ b/internal/plugin/metaprotocol/route.go @@ -17,9 +17,8 @@ package metaprotocol import ( istionetworking "istio.io/api/networking/v1alpha3" - metaroute "github.com/aeraki-mesh/meta-protocol-control-plane-api/aeraki/meta_protocol_proxy/config/route/v1alpha" - "github.com/aeraki-mesh/aeraki/internal/model" + metaroute "github.com/aeraki-mesh/meta-protocol-control-plane-api/aeraki/meta_protocol_proxy/config/route/v1alpha" ) func buildInboundRouteConfig(context *model.EnvoyFilterContext, diff --git a/internal/plugin/redis/generator.go b/internal/plugin/redis/generator.go index 5f4f8645d..39b3a8cdc 100644 --- a/internal/plugin/redis/generator.go +++ b/internal/plugin/redis/generator.go @@ -20,24 +20,21 @@ import ( "strings" "time" - _struct "github.com/golang/protobuf/ptypes/struct" - clusterv3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" - "k8s.io/client-go/kubernetes" - "k8s.io/client-go/rest" - - "github.com/aeraki-mesh/client-go/pkg/clientset/versioned" - redisv1alpha1 "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/typed/redis/v1alpha1" - + _struct "github.com/golang/protobuf/ptypes/struct" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" networking "istio.io/api/networking/v1alpha3" istiomodel "istio.io/istio/pilot/pkg/model" "istio.io/pkg/log" + "k8s.io/client-go/kubernetes" corev1 "k8s.io/client-go/kubernetes/typed/core/v1" + "k8s.io/client-go/rest" "github.com/aeraki-mesh/aeraki/internal/envoyfilter" "github.com/aeraki-mesh/aeraki/internal/model" + "github.com/aeraki-mesh/client-go/pkg/clientset/versioned" + redisv1alpha1 "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/typed/redis/v1alpha1" ) var generatorLog = log.RegisterScope("redis-generator", "redis generator", 0) diff --git a/internal/plugin/redis/outbound.go b/internal/plugin/redis/outbound.go index 76769aff2..ad7ee2454 100644 --- a/internal/plugin/redis/outbound.go +++ b/internal/plugin/redis/outbound.go @@ -19,22 +19,17 @@ import ( "strings" "time" + envoycore "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" + redis "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/redis_proxy/v3" "google.golang.org/protobuf/types/known/durationpb" - + networking "istio.io/api/networking/v1alpha3" + "istio.io/istio/pkg/config/schema/collections" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" + "github.com/aeraki-mesh/aeraki/internal/model" spec "github.com/aeraki-mesh/api/redis/v1alpha1" - - envoycore "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - networking "istio.io/api/networking/v1alpha3" - "istio.io/istio/pkg/config/schema/collections" - "github.com/aeraki-mesh/client-go/pkg/apis/redis/v1alpha1" - - "github.com/aeraki-mesh/aeraki/internal/model" - - redis "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/redis_proxy/v3" ) const ( diff --git a/internal/plugin/redis/outboundcluster.go b/internal/plugin/redis/outboundcluster.go index dad07cbe3..b63e2f904 100644 --- a/internal/plugin/redis/outboundcluster.go +++ b/internal/plugin/redis/outboundcluster.go @@ -20,7 +20,10 @@ import ( "strconv" "strings" + cluster "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" envoycore "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" + endpoint "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3" + redis "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/redis_proxy/v3" "github.com/envoyproxy/go-control-plane/pkg/wellknown" "github.com/golang/protobuf/ptypes/any" "github.com/golang/protobuf/ptypes/duration" @@ -31,13 +34,8 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" - spec "github.com/aeraki-mesh/api/redis/v1alpha1" - - cluster "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" - endpoint "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3" - redis "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/redis_proxy/v3" - "github.com/aeraki-mesh/aeraki/internal/model" + spec "github.com/aeraki-mesh/api/redis/v1alpha1" ) // nolint: funlen,gocyclo diff --git a/internal/plugin/redis/util.go b/internal/plugin/redis/util.go index edcb6fade..a1a503f95 100644 --- a/internal/plugin/redis/util.go +++ b/internal/plugin/redis/util.go @@ -26,9 +26,8 @@ import ( networking "istio.io/api/networking/v1alpha3" "istio.io/istio/pilot/pkg/networking/util" - spec "github.com/aeraki-mesh/api/redis/v1alpha1" - "github.com/aeraki-mesh/aeraki/internal/model" + spec "github.com/aeraki-mesh/api/redis/v1alpha1" ) func getOrCreateIstioMetadata(cluster *cluster.Cluster) *structpb.Struct { diff --git a/internal/util/protoconv/protoconv.go b/internal/util/protoconv/protoconv.go index f1e194f2f..6fed56301 100644 --- a/internal/util/protoconv/protoconv.go +++ b/internal/util/protoconv/protoconv.go @@ -21,7 +21,6 @@ import ( "google.golang.org/protobuf/encoding/prototext" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/anypb" - "istio.io/pkg/log" ) diff --git a/internal/webhook/validation/configuration.go b/internal/webhook/validation/configuration.go index 72e5b2b8b..cb3d09f1e 100644 --- a/internal/webhook/validation/configuration.go +++ b/internal/webhook/validation/configuration.go @@ -19,9 +19,8 @@ import ( "context" "reflect" - "k8s.io/apimachinery/pkg/api/errors" - admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" ctrl "sigs.k8s.io/controller-runtime" diff --git a/internal/webhook/validation/scheme/collections.go b/internal/webhook/validation/scheme/collections.go index 730c1e4a8..0d6809212 100755 --- a/internal/webhook/validation/scheme/collections.go +++ b/internal/webhook/validation/scheme/collections.go @@ -17,11 +17,11 @@ package scheme import ( "reflect" - githubcomaerakimeshaerakiapimetaprotocolv1alpha1 "github.com/aeraki-mesh/api/metaprotocol/v1alpha1" - istioioapimetav1alpha1 "istio.io/api/meta/v1alpha1" "istio.io/istio/pkg/config/schema/collection" "istio.io/istio/pkg/config/schema/resource" + + metaprotocolv1alpha1 "github.com/aeraki-mesh/api/metaprotocol/v1alpha1" ) var ( @@ -38,7 +38,7 @@ var ( Version: "v1alpha1", Proto: "aeraki.io.v1alpha1.ApplicationProtocol", //StatusProto: "istio.meta.v1alpha1.IstioStatus", - ReflectType: reflect.TypeOf(&githubcomaerakimeshaerakiapimetaprotocolv1alpha1.ApplicationProtocol{}).Elem(), + ReflectType: reflect.TypeOf(&metaprotocolv1alpha1.ApplicationProtocol{}).Elem(), StatusType: reflect.TypeOf(&istioioapimetav1alpha1.IstioStatus{}).Elem(), ProtoPackage: "github.com/aeraki-mesh/api/metaprotocol/v1alpha1", //StatusPackage: "istio.io/api/meta/v1alpha1", @@ -59,7 +59,7 @@ var ( Version: "v1alpha1", Proto: "aeraki.io.v1alpha1.MetaRouter", //StatusProto: "istio.meta.v1alpha1.IstioStatus", - ReflectType: reflect.TypeOf(&githubcomaerakimeshaerakiapimetaprotocolv1alpha1.MetaRouter{}).Elem(), + ReflectType: reflect.TypeOf(&metaprotocolv1alpha1.MetaRouter{}).Elem(), //StatusType: reflect.TypeOf(&istioioapimetav1alpha1.IstioStatus{}).Elem(), ProtoPackage: "github.com/aeraki-mesh/api/metaprotocol/v1alpha1", //StatusPackage: "istio.io/api/meta/v1alpha1", diff --git a/internal/webhook/validation/scheme/validation.go b/internal/webhook/validation/scheme/validation.go index 7e56f9247..0a3ac51d6 100644 --- a/internal/webhook/validation/scheme/validation.go +++ b/internal/webhook/validation/scheme/validation.go @@ -22,8 +22,6 @@ import ( "strconv" "strings" - metaprotocol "github.com/aeraki-mesh/api/metaprotocol/v1alpha1" - "github.com/hashicorp/go-multierror" networking "istio.io/api/networking/v1alpha3" "istio.io/istio/pkg/config" @@ -31,6 +29,8 @@ import ( "istio.io/istio/pkg/config/protocol" "istio.io/istio/pkg/config/validation" "istio.io/istio/pkg/config/visibility" + + metaprotocol "github.com/aeraki-mesh/api/metaprotocol/v1alpha1" ) // Validation holds errors and warnings. They can be joined with additional errors by called appendValidation diff --git a/internal/webhook/validation/server/server.go b/internal/webhook/validation/server/server.go index 3c147817b..15c364ded 100644 --- a/internal/webhook/validation/server/server.go +++ b/internal/webhook/validation/server/server.go @@ -22,19 +22,18 @@ import ( "net/http" multierror "github.com/hashicorp/go-multierror" - kubeApiAdmissionv1 "k8s.io/api/admission/v1" - kubeApiAdmissionv1beta1 "k8s.io/api/admission/v1beta1" - kubeApiApps "k8s.io/api/apps/v1beta1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/serializer" - "istio.io/istio/pilot/pkg/config/kube/crd" "istio.io/istio/pkg/config/schema/collection" "istio.io/istio/pkg/config/schema/resource" "istio.io/istio/pkg/config/validation" "istio.io/istio/pkg/kube" "istio.io/pkg/log" + kubeApiAdmissionv1 "k8s.io/api/admission/v1" + kubeApiAdmissionv1beta1 "k8s.io/api/admission/v1beta1" + kubeApiApps "k8s.io/api/apps/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/serializer" ) var scope = log.RegisterScope("aerakiValidationServer", "aeraki validation webhook server", 0) diff --git a/internal/xds/cache_mgr.go b/internal/xds/cache_mgr.go index f41b77ded..9bb9e4cc4 100644 --- a/internal/xds/cache_mgr.go +++ b/internal/xds/cache_mgr.go @@ -21,28 +21,21 @@ import ( "time" corev3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - - "github.com/golang/protobuf/ptypes/wrappers" - - "github.com/aeraki-mesh/aeraki/internal/model/protocol" - routev3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" + cachev3 "github.com/envoyproxy/go-control-plane/pkg/cache/v3" + "github.com/golang/protobuf/ptypes/wrappers" + "github.com/zhaohuabing/debounce" + networking "istio.io/api/networking/v1alpha3" + istiomodel "istio.io/istio/pilot/pkg/model" istioconfig "istio.io/istio/pkg/config" + "istio.io/istio/pkg/config/schema/collections" "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/aeraki-mesh/aeraki/internal/model" + "github.com/aeraki-mesh/aeraki/internal/model/protocol" metaprotocolapi "github.com/aeraki-mesh/api/metaprotocol/v1alpha1" metaprotocol "github.com/aeraki-mesh/client-go/pkg/apis/metaprotocol/v1alpha1" - - "github.com/aeraki-mesh/aeraki/internal/model" - - cachev3 "github.com/envoyproxy/go-control-plane/pkg/cache/v3" - networking "istio.io/api/networking/v1alpha3" - metaroute "github.com/aeraki-mesh/meta-protocol-control-plane-api/aeraki/meta_protocol_proxy/config/route/v1alpha" - - "github.com/zhaohuabing/debounce" - istiomodel "istio.io/istio/pilot/pkg/model" - "istio.io/istio/pkg/config/schema/collections" ) const ( diff --git a/internal/xds/callbacks.go b/internal/xds/callbacks.go index 111791bde..bb83cd2a9 100644 --- a/internal/xds/callbacks.go +++ b/internal/xds/callbacks.go @@ -18,7 +18,6 @@ import ( "context" core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" serverv3 "github.com/envoyproxy/go-control-plane/pkg/server/v3" ) diff --git a/internal/xds/utils.go b/internal/xds/utils.go index 1a089d60c..f7b710dd3 100644 --- a/internal/xds/utils.go +++ b/internal/xds/utils.go @@ -18,19 +18,15 @@ import ( "strconv" "time" - typev3 "github.com/envoyproxy/go-control-plane/envoy/type/v3" - "github.com/envoyproxy/go-control-plane/pkg/resource/v3" - httpcore "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - - matcher "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3" - - userapi "github.com/aeraki-mesh/api/metaprotocol/v1alpha1" - httproute "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" + matcher "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3" + typev3 "github.com/envoyproxy/go-control-plane/envoy/type/v3" "github.com/envoyproxy/go-control-plane/pkg/cache/types" "github.com/envoyproxy/go-control-plane/pkg/cache/v3" + "github.com/envoyproxy/go-control-plane/pkg/resource/v3" + userapi "github.com/aeraki-mesh/api/metaprotocol/v1alpha1" metaroute "github.com/aeraki-mesh/meta-protocol-control-plane-api/aeraki/meta_protocol_proxy/config/route/v1alpha" ) @@ -104,7 +100,7 @@ func httpRouteAction(route *metaroute.Route) *httproute.RouteAction { } } routeAction.RequestMirrorPolicies = make([]*httproute. - RouteAction_RequestMirrorPolicy, len(route.Route.RequestMirrorPolicies)) + RouteAction_RequestMirrorPolicy, len(route.Route.RequestMirrorPolicies)) for i, mirrorPolicy := range route.Route.RequestMirrorPolicies { routeAction.RequestMirrorPolicies[i] = &httproute.RouteAction_RequestMirrorPolicy{ Cluster: mirrorPolicy.Cluster, diff --git a/test/e2e/metaprotocolgateway/metaprotocol_gateway_test.go b/test/e2e/metaprotocolgateway/metaprotocol_gateway_test.go index a3d123a90..609205e09 100644 --- a/test/e2e/metaprotocolgateway/metaprotocol_gateway_test.go +++ b/test/e2e/metaprotocolgateway/metaprotocol_gateway_test.go @@ -22,10 +22,11 @@ import ( "testing" "time" - "github.com/aeraki-mesh/aeraki/test/e2e/metaprotocolgateway/gen-go/hello" - "github.com/aeraki-mesh/aeraki/test/e2e/util" "github.com/apache/thrift/lib/go/thrift" "istio.io/pkg/log" + + "github.com/aeraki-mesh/aeraki/test/e2e/metaprotocolgateway/gen-go/hello" + "github.com/aeraki-mesh/aeraki/test/e2e/util" ) func TestMain(m *testing.M) { diff --git a/test/e2e/util/common_utils.go b/test/e2e/util/common_utils.go index ae650b148..05db7db18 100644 --- a/test/e2e/util/common_utils.go +++ b/test/e2e/util/common_utils.go @@ -31,7 +31,6 @@ import ( "github.com/google/go-github/github" "github.com/pkg/errors" - "istio.io/istio/pkg/test/env" "istio.io/pkg/log" ) diff --git a/test/e2e/util/kube_utils.go b/test/e2e/util/kube_utils.go index a38be9f0f..040ef0e71 100644 --- a/test/e2e/util/kube_utils.go +++ b/test/e2e/util/kube_utils.go @@ -33,7 +33,6 @@ import ( "golang.org/x/net/context/ctxhttp" "golang.org/x/sync/errgroup" - "istio.io/pkg/log" )