diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 000000000..c6b600b62 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,144 @@ +# Copyright Aeraki Authors +# +# Licensed 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. + +--- +linters-settings: + depguard: + list-type: blacklist + packages: + # logging is allowed only by logutils.Log, logrus + # is allowed to use only in logutils package + - github.com/sirupsen/logrus + packages-with-error-message: + - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log" + dupl: + threshold: 200 + funlen: + lines: 100 + statements: 50 + goconst: + min-len: 2 + min-occurrences: 3 + gocritic: + enabled-tags: + - diagnostic + - experimental + - opinionated + - performance + - style + disabled-checks: + - dupImport # https://github.com/go-critic/go-critic/issues/845 + - ifElseChain + - octalLiteral + - whyNoLint + - wrapperFunc + gocyclo: + min-complexity: 20 + goimports: + local-prefixes: github.com/aeraki-mesh/aeraki + gomnd: + # don't include the "operation" and "assign" + checks: + - argument + - case + - condition + - return + ignored-numbers: + - '0' + - '1' + - '2' + - '3' + ignored-functions: + - strings.SplitN + + govet: + check-shadowing: true + settings: + printf: + funcs: + lll: + line-length: 140 + misspell: + locale: US + nolintlint: + allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space) + allow-unused: false # report any unused nolint directives + require-explanation: false # don't require an explanation for nolint directives + require-specific: false # don't require nolint directives to be specific about which linter is being skipped + +linters: + disable-all: true + enable: + - bodyclose + - deadcode + - depguard + - dogsled + - dupl + - errcheck + - exportloopref + - funlen + - gochecknoinits + - goconst +# - gocritic + - gocyclo + - gofmt + - goimports +# - gomnd + - goprintffuncname + - gosec + - gosimple + - govet + - ineffassign + - lll + - misspell + - nakedret + - noctx + - nolintlint + - staticcheck + - structcheck + - stylecheck + - typecheck + - unconvert +# - unparam + - unused + - varcheck + - whitespace + + # don't enable: + # - asciicheck + # - scopelint + # - gochecknoglobals + # - gocognit + # - godot + # - godox + # - goerr113 + # - interfacer + # - maligned + # - nestif + # - prealloc + # - testpackage + # - revive + # - wsl + +issues: + exclude: + - 'declaration of "(err|ctx)" shadows declaration at' + +run: + timeout: 5m + go: '1.17' + skip-dirs: + - api + - client-go + - test diff --git a/api/dubbo/v1alpha1/dubbo_authorization_policy.pb.go b/api/dubbo/v1alpha1/dubbo_authorization_policy.pb.go index 1336a1083..277638f72 100644 --- a/api/dubbo/v1alpha1/dubbo_authorization_policy.pb.go +++ b/api/dubbo/v1alpha1/dubbo_authorization_policy.pb.go @@ -12,11 +12,12 @@ package v1alpha1 import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" io "io" - _ "istio.io/gogo-genproto/googleapis/google/api" math "math" math_bits "math/bits" + + proto "github.com/gogo/protobuf/proto" + _ "istio.io/gogo-genproto/googleapis/google/api" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/dubbo/v1alpha1/dubbo_authorization_policy_deepcopy.gen.go b/api/dubbo/v1alpha1/dubbo_authorization_policy_deepcopy.gen.go index 3326b6c10..61d05581b 100644 --- a/api/dubbo/v1alpha1/dubbo_authorization_policy_deepcopy.gen.go +++ b/api/dubbo/v1alpha1/dubbo_authorization_policy_deepcopy.gen.go @@ -12,9 +12,10 @@ package v1alpha1 import ( fmt "fmt" + math "math" + proto "github.com/gogo/protobuf/proto" _ "istio.io/gogo-genproto/googleapis/google/api" - math "math" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/dubbo/v1alpha1/dubbo_authorization_policy_json.gen.go b/api/dubbo/v1alpha1/dubbo_authorization_policy_json.gen.go index d9cc07409..75cbe3139 100644 --- a/api/dubbo/v1alpha1/dubbo_authorization_policy_json.gen.go +++ b/api/dubbo/v1alpha1/dubbo_authorization_policy_json.gen.go @@ -13,10 +13,11 @@ package v1alpha1 import ( bytes "bytes" fmt "fmt" + math "math" + github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" proto "github.com/gogo/protobuf/proto" _ "istio.io/gogo-genproto/googleapis/google/api" - math "math" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/metaprotocol/v1alpha1/metaprotocol_application_protocol.pb.go b/api/metaprotocol/v1alpha1/metaprotocol_application_protocol.pb.go index ea3a080bc..0871596e4 100644 --- a/api/metaprotocol/v1alpha1/metaprotocol_application_protocol.pb.go +++ b/api/metaprotocol/v1alpha1/metaprotocol_application_protocol.pb.go @@ -22,10 +22,11 @@ package v1alpha1 import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/metaprotocol/v1alpha1/metaprotocol_application_protocol_deepcopy.gen.go b/api/metaprotocol/v1alpha1/metaprotocol_application_protocol_deepcopy.gen.go index d5771ec11..f652010b5 100644 --- a/api/metaprotocol/v1alpha1/metaprotocol_application_protocol_deepcopy.gen.go +++ b/api/metaprotocol/v1alpha1/metaprotocol_application_protocol_deepcopy.gen.go @@ -22,8 +22,9 @@ package v1alpha1 import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" math "math" + + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/metaprotocol/v1alpha1/metaprotocol_application_protocol_json.gen.go b/api/metaprotocol/v1alpha1/metaprotocol_application_protocol_json.gen.go index 67b3568b6..8194afa12 100644 --- a/api/metaprotocol/v1alpha1/metaprotocol_application_protocol_json.gen.go +++ b/api/metaprotocol/v1alpha1/metaprotocol_application_protocol_json.gen.go @@ -23,9 +23,10 @@ package v1alpha1 import ( bytes "bytes" fmt "fmt" + math "math" + github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" proto "github.com/gogo/protobuf/proto" - math "math" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/metaprotocol/v1alpha1/metaprotocol_metarouter.pb.go b/api/metaprotocol/v1alpha1/metaprotocol_metarouter.pb.go index 11d4ef5f2..c760bd876 100644 --- a/api/metaprotocol/v1alpha1/metaprotocol_metarouter.pb.go +++ b/api/metaprotocol/v1alpha1/metaprotocol_metarouter.pb.go @@ -62,12 +62,13 @@ package v1alpha1 import ( encoding_binary "encoding/binary" fmt "fmt" - proto "github.com/gogo/protobuf/proto" - types "github.com/gogo/protobuf/types" io "io" - _ "istio.io/gogo-genproto/googleapis/google/api" math "math" math_bits "math/bits" + + proto "github.com/gogo/protobuf/proto" + types "github.com/gogo/protobuf/types" + _ "istio.io/gogo-genproto/googleapis/google/api" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/metaprotocol/v1alpha1/metaprotocol_metarouter_deepcopy.gen.go b/api/metaprotocol/v1alpha1/metaprotocol_metarouter_deepcopy.gen.go index b32c4ffe2..2a2be7f1a 100644 --- a/api/metaprotocol/v1alpha1/metaprotocol_metarouter_deepcopy.gen.go +++ b/api/metaprotocol/v1alpha1/metaprotocol_metarouter_deepcopy.gen.go @@ -61,10 +61,11 @@ package v1alpha1 import ( fmt "fmt" + math "math" + proto "github.com/gogo/protobuf/proto" _ "github.com/gogo/protobuf/types" _ "istio.io/gogo-genproto/googleapis/google/api" - math "math" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/metaprotocol/v1alpha1/metaprotocol_metarouter_json.gen.go b/api/metaprotocol/v1alpha1/metaprotocol_metarouter_json.gen.go index 2ee17f845..7de8448e7 100644 --- a/api/metaprotocol/v1alpha1/metaprotocol_metarouter_json.gen.go +++ b/api/metaprotocol/v1alpha1/metaprotocol_metarouter_json.gen.go @@ -62,11 +62,12 @@ package v1alpha1 import ( bytes "bytes" fmt "fmt" + math "math" + github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" proto "github.com/gogo/protobuf/proto" _ "github.com/gogo/protobuf/types" _ "istio.io/gogo-genproto/googleapis/google/api" - math "math" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/redis/v1alpha1/redisdestination.pb.go b/api/redis/v1alpha1/redisdestination.pb.go index 99ec7376d..e587f84b8 100644 --- a/api/redis/v1alpha1/redisdestination.pb.go +++ b/api/redis/v1alpha1/redisdestination.pb.go @@ -7,13 +7,14 @@ package v1alpha1 import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + proto "github.com/gogo/protobuf/proto" _ "github.com/gogo/protobuf/types" - io "io" v1alpha3 "istio.io/api/networking/v1alpha3" _ "istio.io/gogo-genproto/googleapis/google/api" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/redis/v1alpha1/redisdestination_deepcopy.gen.go b/api/redis/v1alpha1/redisdestination_deepcopy.gen.go index 5f9715d26..afc34e4fe 100644 --- a/api/redis/v1alpha1/redisdestination_deepcopy.gen.go +++ b/api/redis/v1alpha1/redisdestination_deepcopy.gen.go @@ -7,11 +7,12 @@ package v1alpha1 import ( fmt "fmt" + math "math" + proto "github.com/gogo/protobuf/proto" _ "github.com/gogo/protobuf/types" _ "istio.io/api/networking/v1alpha3" _ "istio.io/gogo-genproto/googleapis/google/api" - math "math" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/redis/v1alpha1/redisdestination_json.gen.go b/api/redis/v1alpha1/redisdestination_json.gen.go index a1becee88..cf4819927 100644 --- a/api/redis/v1alpha1/redisdestination_json.gen.go +++ b/api/redis/v1alpha1/redisdestination_json.gen.go @@ -8,12 +8,13 @@ package v1alpha1 import ( bytes "bytes" fmt "fmt" + math "math" + github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" proto "github.com/gogo/protobuf/proto" _ "github.com/gogo/protobuf/types" _ "istio.io/api/networking/v1alpha3" _ "istio.io/gogo-genproto/googleapis/google/api" - math "math" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/redis/v1alpha1/redisservice.pb.go b/api/redis/v1alpha1/redisservice.pb.go index 0646e7a1f..e6cfd12e0 100644 --- a/api/redis/v1alpha1/redisservice.pb.go +++ b/api/redis/v1alpha1/redisservice.pb.go @@ -8,12 +8,13 @@ package v1alpha1 import ( encoding_binary "encoding/binary" fmt "fmt" - proto "github.com/gogo/protobuf/proto" - types "github.com/gogo/protobuf/types" io "io" - _ "istio.io/gogo-genproto/googleapis/google/api" math "math" math_bits "math/bits" + + proto "github.com/gogo/protobuf/proto" + types "github.com/gogo/protobuf/types" + _ "istio.io/gogo-genproto/googleapis/google/api" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/redis/v1alpha1/redisservice_deepcopy.gen.go b/api/redis/v1alpha1/redisservice_deepcopy.gen.go index 7d651537a..c8092c376 100644 --- a/api/redis/v1alpha1/redisservice_deepcopy.gen.go +++ b/api/redis/v1alpha1/redisservice_deepcopy.gen.go @@ -7,10 +7,11 @@ package v1alpha1 import ( fmt "fmt" + math "math" + proto "github.com/gogo/protobuf/proto" _ "github.com/gogo/protobuf/types" _ "istio.io/gogo-genproto/googleapis/google/api" - math "math" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/redis/v1alpha1/redisservice_json.gen.go b/api/redis/v1alpha1/redisservice_json.gen.go index 2f605cc73..0e95ecff5 100644 --- a/api/redis/v1alpha1/redisservice_json.gen.go +++ b/api/redis/v1alpha1/redisservice_json.gen.go @@ -8,11 +8,12 @@ package v1alpha1 import ( bytes "bytes" fmt "fmt" + math "math" + github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" proto "github.com/gogo/protobuf/proto" _ "github.com/gogo/protobuf/types" _ "istio.io/gogo-genproto/googleapis/google/api" - math "math" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/client-go/pkg/apis/dubbo/v1alpha1/types.gen.go b/client-go/pkg/apis/dubbo/v1alpha1/types.gen.go index ee46a5759..fc7697789 100644 --- a/client-go/pkg/apis/dubbo/v1alpha1/types.gen.go +++ b/client-go/pkg/apis/dubbo/v1alpha1/types.gen.go @@ -19,9 +19,10 @@ limitations under the License. package v1alpha1 import ( - dubbov1alpha1 "github.com/aeraki-mesh/aeraki/api/dubbo/v1alpha1" metav1alpha1 "istio.io/api/meta/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + dubbov1alpha1 "github.com/aeraki-mesh/aeraki/api/dubbo/v1alpha1" ) // diff --git a/client-go/pkg/apis/metaprotocol/v1alpha1/types.gen.go b/client-go/pkg/apis/metaprotocol/v1alpha1/types.gen.go index 1377f64f3..a722b8a55 100644 --- a/client-go/pkg/apis/metaprotocol/v1alpha1/types.gen.go +++ b/client-go/pkg/apis/metaprotocol/v1alpha1/types.gen.go @@ -19,9 +19,10 @@ limitations under the License. package v1alpha1 import ( - metaprotocolv1alpha1 "github.com/aeraki-mesh/aeraki/api/metaprotocol/v1alpha1" metav1alpha1 "istio.io/api/meta/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + metaprotocolv1alpha1 "github.com/aeraki-mesh/aeraki/api/metaprotocol/v1alpha1" ) // please upgrade the proto package diff --git a/client-go/pkg/apis/redis/v1alpha1/types.gen.go b/client-go/pkg/apis/redis/v1alpha1/types.gen.go index 16ecca6cd..bc954bf02 100644 --- a/client-go/pkg/apis/redis/v1alpha1/types.gen.go +++ b/client-go/pkg/apis/redis/v1alpha1/types.gen.go @@ -19,9 +19,10 @@ limitations under the License. package v1alpha1 import ( - redisv1alpha1 "github.com/aeraki-mesh/aeraki/api/redis/v1alpha1" metav1alpha1 "istio.io/api/meta/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + redisv1alpha1 "github.com/aeraki-mesh/aeraki/api/redis/v1alpha1" ) // diff --git a/client-go/pkg/clientset/versioned/clientset.gen.go b/client-go/pkg/clientset/versioned/clientset.gen.go index 298cc2223..af7605e32 100644 --- a/client-go/pkg/clientset/versioned/clientset.gen.go +++ b/client-go/pkg/clientset/versioned/clientset.gen.go @@ -19,12 +19,13 @@ package versioned import ( "fmt" - dubbov1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1" - metaprotocolv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1" - redisv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/redis/v1alpha1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" + + dubbov1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1" + metaprotocolv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1" + redisv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/redis/v1alpha1" ) type Interface interface { diff --git a/client-go/pkg/clientset/versioned/fake/clientset_generated.gen.go b/client-go/pkg/clientset/versioned/fake/clientset_generated.gen.go index a8edf9ea2..bb9013316 100644 --- a/client-go/pkg/clientset/versioned/fake/clientset_generated.gen.go +++ b/client-go/pkg/clientset/versioned/fake/clientset_generated.gen.go @@ -17,6 +17,12 @@ package fake import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" + clientset "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" dubbov1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1" fakedubbov1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/fake" @@ -24,11 +30,6 @@ import ( fakemetaprotocolv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/fake" redisv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/redis/v1alpha1" fakeredisv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/fake" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/discovery" - fakediscovery "k8s.io/client-go/discovery/fake" - "k8s.io/client-go/testing" ) // NewSimpleClientset returns a clientset that will respond with the provided objects. diff --git a/client-go/pkg/clientset/versioned/fake/register.gen.go b/client-go/pkg/clientset/versioned/fake/register.gen.go index 6fd414384..18fd15aa0 100644 --- a/client-go/pkg/clientset/versioned/fake/register.gen.go +++ b/client-go/pkg/clientset/versioned/fake/register.gen.go @@ -17,14 +17,15 @@ package fake import ( - dubbov1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/dubbo/v1alpha1" - metaprotocolv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" - redisv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + + dubbov1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/dubbo/v1alpha1" + metaprotocolv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" + redisv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" ) var scheme = runtime.NewScheme() diff --git a/client-go/pkg/clientset/versioned/scheme/register.gen.go b/client-go/pkg/clientset/versioned/scheme/register.gen.go index 73556442c..e2eaa932a 100644 --- a/client-go/pkg/clientset/versioned/scheme/register.gen.go +++ b/client-go/pkg/clientset/versioned/scheme/register.gen.go @@ -17,14 +17,15 @@ package scheme import ( - dubbov1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/dubbo/v1alpha1" - metaprotocolv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" - redisv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + + dubbov1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/dubbo/v1alpha1" + metaprotocolv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" + redisv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" ) var Scheme = runtime.NewScheme() diff --git a/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/dubbo_client.gen.go b/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/dubbo_client.gen.go index d3f63b914..28de252e3 100644 --- a/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/dubbo_client.gen.go +++ b/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/dubbo_client.gen.go @@ -17,9 +17,10 @@ package v1alpha1 import ( + rest "k8s.io/client-go/rest" + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/dubbo/v1alpha1" "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" ) type DubboV1alpha1Interface interface { diff --git a/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/dubboauthorizationpolicy.gen.go b/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/dubboauthorizationpolicy.gen.go index a07deb2ba..b66acc205 100644 --- a/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/dubboauthorizationpolicy.gen.go +++ b/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/dubboauthorizationpolicy.gen.go @@ -20,12 +20,13 @@ import ( "context" "time" - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/dubbo/v1alpha1" - scheme "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/dubbo/v1alpha1" + scheme "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/scheme" ) // DubboAuthorizationPoliciesGetter has a method to return a DubboAuthorizationPolicyInterface. diff --git a/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/fake/fake_dubbo_client.gen.go b/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/fake/fake_dubbo_client.gen.go index 4d1b286b5..c29d517f1 100644 --- a/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/fake/fake_dubbo_client.gen.go +++ b/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/fake/fake_dubbo_client.gen.go @@ -17,9 +17,10 @@ package fake import ( - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1" ) type FakeDubboV1alpha1 struct { diff --git a/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/fake/fake_dubboauthorizationpolicy.gen.go b/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/fake/fake_dubboauthorizationpolicy.gen.go index 61b34adaa..3cfc7a627 100644 --- a/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/fake/fake_dubboauthorizationpolicy.gen.go +++ b/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1/fake/fake_dubboauthorizationpolicy.gen.go @@ -19,13 +19,14 @@ package fake import ( "context" - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/dubbo/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/dubbo/v1alpha1" ) // FakeDubboAuthorizationPolicies implements DubboAuthorizationPolicyInterface diff --git a/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/applicationprotocol.gen.go b/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/applicationprotocol.gen.go index 006548690..26d549c51 100644 --- a/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/applicationprotocol.gen.go +++ b/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/applicationprotocol.gen.go @@ -20,12 +20,13 @@ import ( "context" "time" - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" - scheme "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" + scheme "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/scheme" ) // ApplicationProtocolsGetter has a method to return a ApplicationProtocolInterface. diff --git a/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/fake/fake_applicationprotocol.gen.go b/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/fake/fake_applicationprotocol.gen.go index 14f68601e..2ce95bf27 100644 --- a/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/fake/fake_applicationprotocol.gen.go +++ b/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/fake/fake_applicationprotocol.gen.go @@ -19,13 +19,14 @@ package fake import ( "context" - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" ) // FakeApplicationProtocols implements ApplicationProtocolInterface diff --git a/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/fake/fake_metaprotocol_client.gen.go b/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/fake/fake_metaprotocol_client.gen.go index d4e3d9c23..b960007d2 100644 --- a/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/fake/fake_metaprotocol_client.gen.go +++ b/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/fake/fake_metaprotocol_client.gen.go @@ -17,9 +17,10 @@ package fake import ( - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1" ) type FakeMetaprotocolV1alpha1 struct { diff --git a/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/fake/fake_metarouter.gen.go b/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/fake/fake_metarouter.gen.go index 1cbcd5c6d..9901b28a4 100644 --- a/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/fake/fake_metarouter.gen.go +++ b/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/fake/fake_metarouter.gen.go @@ -19,13 +19,14 @@ package fake import ( "context" - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" ) // FakeMetaRouters implements MetaRouterInterface diff --git a/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/metaprotocol_client.gen.go b/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/metaprotocol_client.gen.go index 57624b5f1..4608085f8 100644 --- a/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/metaprotocol_client.gen.go +++ b/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/metaprotocol_client.gen.go @@ -17,9 +17,10 @@ package v1alpha1 import ( + rest "k8s.io/client-go/rest" + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" ) type MetaprotocolV1alpha1Interface interface { diff --git a/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/metarouter.gen.go b/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/metarouter.gen.go index 638fb1477..1d5446a56 100644 --- a/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/metarouter.gen.go +++ b/client-go/pkg/clientset/versioned/typed/metaprotocol/v1alpha1/metarouter.gen.go @@ -20,12 +20,13 @@ import ( "context" "time" - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" - scheme "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" + scheme "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/scheme" ) // MetaRoutersGetter has a method to return a MetaRouterInterface. diff --git a/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/fake/fake_redis_client.gen.go b/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/fake/fake_redis_client.gen.go index f31332b3f..f112fd785 100644 --- a/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/fake/fake_redis_client.gen.go +++ b/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/fake/fake_redis_client.gen.go @@ -17,9 +17,10 @@ package fake import ( - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/redis/v1alpha1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/redis/v1alpha1" ) type FakeRedisV1alpha1 struct { diff --git a/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/fake/fake_redisdestination.gen.go b/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/fake/fake_redisdestination.gen.go index 1e7f977c2..6457d0a10 100644 --- a/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/fake/fake_redisdestination.gen.go +++ b/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/fake/fake_redisdestination.gen.go @@ -19,13 +19,14 @@ package fake import ( "context" - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" ) // FakeRedisDestinations implements RedisDestinationInterface diff --git a/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/fake/fake_redisservice.gen.go b/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/fake/fake_redisservice.gen.go index c3a2bbc6c..10e6b095b 100644 --- a/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/fake/fake_redisservice.gen.go +++ b/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/fake/fake_redisservice.gen.go @@ -19,13 +19,14 @@ package fake import ( "context" - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" ) // FakeRedisServices implements RedisServiceInterface diff --git a/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/redis_client.gen.go b/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/redis_client.gen.go index a9048da6f..93d996562 100644 --- a/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/redis_client.gen.go +++ b/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/redis_client.gen.go @@ -17,9 +17,10 @@ package v1alpha1 import ( + rest "k8s.io/client-go/rest" + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" ) type RedisV1alpha1Interface interface { diff --git a/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/redisdestination.gen.go b/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/redisdestination.gen.go index 99a9ae575..d22e5b677 100644 --- a/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/redisdestination.gen.go +++ b/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/redisdestination.gen.go @@ -20,12 +20,13 @@ import ( "context" "time" - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" - scheme "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" + scheme "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/scheme" ) // RedisDestinationsGetter has a method to return a RedisDestinationInterface. diff --git a/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/redisservice.gen.go b/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/redisservice.gen.go index ca98def94..01d220277 100644 --- a/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/redisservice.gen.go +++ b/client-go/pkg/clientset/versioned/typed/redis/v1alpha1/redisservice.gen.go @@ -20,12 +20,13 @@ import ( "context" "time" - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" - scheme "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" + scheme "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/scheme" ) // RedisServicesGetter has a method to return a RedisServiceInterface. diff --git a/client-go/pkg/informers/externalversions/dubbo/v1alpha1/dubboauthorizationpolicy.gen.go b/client-go/pkg/informers/externalversions/dubbo/v1alpha1/dubboauthorizationpolicy.gen.go index abd733fc0..0d0b89c7e 100644 --- a/client-go/pkg/informers/externalversions/dubbo/v1alpha1/dubboauthorizationpolicy.gen.go +++ b/client-go/pkg/informers/externalversions/dubbo/v1alpha1/dubboauthorizationpolicy.gen.go @@ -20,14 +20,15 @@ import ( "context" time "time" - dubbov1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/dubbo/v1alpha1" - versioned "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" - internalinterfaces "github.com/aeraki-mesh/aeraki/client-go/pkg/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/listers/dubbo/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" + + dubbov1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/dubbo/v1alpha1" + versioned "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" + internalinterfaces "github.com/aeraki-mesh/aeraki/client-go/pkg/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/listers/dubbo/v1alpha1" ) // DubboAuthorizationPolicyInformer provides access to a shared informer and lister for diff --git a/client-go/pkg/informers/externalversions/factory.gen.go b/client-go/pkg/informers/externalversions/factory.gen.go index 123e4e72a..6674257bc 100644 --- a/client-go/pkg/informers/externalversions/factory.gen.go +++ b/client-go/pkg/informers/externalversions/factory.gen.go @@ -21,15 +21,16 @@ import ( sync "sync" time "time" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + versioned "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" dubbo "github.com/aeraki-mesh/aeraki/client-go/pkg/informers/externalversions/dubbo" internalinterfaces "github.com/aeraki-mesh/aeraki/client-go/pkg/informers/externalversions/internalinterfaces" metaprotocol "github.com/aeraki-mesh/aeraki/client-go/pkg/informers/externalversions/metaprotocol" redis "github.com/aeraki-mesh/aeraki/client-go/pkg/informers/externalversions/redis" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - cache "k8s.io/client-go/tools/cache" ) // SharedInformerOption defines the functional option type for SharedInformerFactory. diff --git a/client-go/pkg/informers/externalversions/generic.gen.go b/client-go/pkg/informers/externalversions/generic.gen.go index 58e34dfcd..4335fbfdc 100644 --- a/client-go/pkg/informers/externalversions/generic.gen.go +++ b/client-go/pkg/informers/externalversions/generic.gen.go @@ -19,11 +19,12 @@ package externalversions import ( "fmt" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/dubbo/v1alpha1" metaprotocolv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" redisv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" - schema "k8s.io/apimachinery/pkg/runtime/schema" - cache "k8s.io/client-go/tools/cache" ) // GenericInformer is type of SharedIndexInformer which will locate and delegate to other diff --git a/client-go/pkg/informers/externalversions/internalinterfaces/factory_interfaces.gen.go b/client-go/pkg/informers/externalversions/internalinterfaces/factory_interfaces.gen.go index 2de7462d3..8ce17363f 100644 --- a/client-go/pkg/informers/externalversions/internalinterfaces/factory_interfaces.gen.go +++ b/client-go/pkg/informers/externalversions/internalinterfaces/factory_interfaces.gen.go @@ -19,10 +19,11 @@ package internalinterfaces import ( time "time" - versioned "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" cache "k8s.io/client-go/tools/cache" + + versioned "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" ) // NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. diff --git a/client-go/pkg/informers/externalversions/metaprotocol/v1alpha1/applicationprotocol.gen.go b/client-go/pkg/informers/externalversions/metaprotocol/v1alpha1/applicationprotocol.gen.go index dfb5de6b5..b1fda7e08 100644 --- a/client-go/pkg/informers/externalversions/metaprotocol/v1alpha1/applicationprotocol.gen.go +++ b/client-go/pkg/informers/externalversions/metaprotocol/v1alpha1/applicationprotocol.gen.go @@ -20,14 +20,15 @@ import ( "context" time "time" - metaprotocolv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" - versioned "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" - internalinterfaces "github.com/aeraki-mesh/aeraki/client-go/pkg/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/listers/metaprotocol/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" + + metaprotocolv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" + versioned "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" + internalinterfaces "github.com/aeraki-mesh/aeraki/client-go/pkg/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/listers/metaprotocol/v1alpha1" ) // ApplicationProtocolInformer provides access to a shared informer and lister for diff --git a/client-go/pkg/informers/externalversions/metaprotocol/v1alpha1/metarouter.gen.go b/client-go/pkg/informers/externalversions/metaprotocol/v1alpha1/metarouter.gen.go index 71ed437cd..f7a2bd0b2 100644 --- a/client-go/pkg/informers/externalversions/metaprotocol/v1alpha1/metarouter.gen.go +++ b/client-go/pkg/informers/externalversions/metaprotocol/v1alpha1/metarouter.gen.go @@ -20,14 +20,15 @@ import ( "context" time "time" - metaprotocolv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" - versioned "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" - internalinterfaces "github.com/aeraki-mesh/aeraki/client-go/pkg/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/listers/metaprotocol/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" + + metaprotocolv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" + versioned "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" + internalinterfaces "github.com/aeraki-mesh/aeraki/client-go/pkg/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/listers/metaprotocol/v1alpha1" ) // MetaRouterInformer provides access to a shared informer and lister for diff --git a/client-go/pkg/informers/externalversions/redis/v1alpha1/redisdestination.gen.go b/client-go/pkg/informers/externalversions/redis/v1alpha1/redisdestination.gen.go index 1370aafce..63037c6b3 100644 --- a/client-go/pkg/informers/externalversions/redis/v1alpha1/redisdestination.gen.go +++ b/client-go/pkg/informers/externalversions/redis/v1alpha1/redisdestination.gen.go @@ -20,14 +20,15 @@ import ( "context" time "time" - redisv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" - versioned "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" - internalinterfaces "github.com/aeraki-mesh/aeraki/client-go/pkg/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/listers/redis/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" + + redisv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" + versioned "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" + internalinterfaces "github.com/aeraki-mesh/aeraki/client-go/pkg/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/listers/redis/v1alpha1" ) // RedisDestinationInformer provides access to a shared informer and lister for diff --git a/client-go/pkg/informers/externalversions/redis/v1alpha1/redisservice.gen.go b/client-go/pkg/informers/externalversions/redis/v1alpha1/redisservice.gen.go index 82c3c0306..ac97e631e 100644 --- a/client-go/pkg/informers/externalversions/redis/v1alpha1/redisservice.gen.go +++ b/client-go/pkg/informers/externalversions/redis/v1alpha1/redisservice.gen.go @@ -20,14 +20,15 @@ import ( "context" time "time" - redisv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" - versioned "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" - internalinterfaces "github.com/aeraki-mesh/aeraki/client-go/pkg/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/listers/redis/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" + + redisv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" + versioned "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" + internalinterfaces "github.com/aeraki-mesh/aeraki/client-go/pkg/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/listers/redis/v1alpha1" ) // RedisServiceInformer provides access to a shared informer and lister for diff --git a/client-go/pkg/listers/dubbo/v1alpha1/dubboauthorizationpolicy.gen.go b/client-go/pkg/listers/dubbo/v1alpha1/dubboauthorizationpolicy.gen.go index ae2b54bcf..e3e54b61b 100644 --- a/client-go/pkg/listers/dubbo/v1alpha1/dubboauthorizationpolicy.gen.go +++ b/client-go/pkg/listers/dubbo/v1alpha1/dubboauthorizationpolicy.gen.go @@ -17,10 +17,11 @@ package v1alpha1 import ( - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/dubbo/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/dubbo/v1alpha1" ) // DubboAuthorizationPolicyLister helps list DubboAuthorizationPolicies. diff --git a/client-go/pkg/listers/metaprotocol/v1alpha1/applicationprotocol.gen.go b/client-go/pkg/listers/metaprotocol/v1alpha1/applicationprotocol.gen.go index 4a54a0e30..f3e448cc5 100644 --- a/client-go/pkg/listers/metaprotocol/v1alpha1/applicationprotocol.gen.go +++ b/client-go/pkg/listers/metaprotocol/v1alpha1/applicationprotocol.gen.go @@ -17,10 +17,11 @@ package v1alpha1 import ( - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" ) // ApplicationProtocolLister helps list ApplicationProtocols. diff --git a/client-go/pkg/listers/metaprotocol/v1alpha1/metarouter.gen.go b/client-go/pkg/listers/metaprotocol/v1alpha1/metarouter.gen.go index f5cac1ec7..0804d3867 100644 --- a/client-go/pkg/listers/metaprotocol/v1alpha1/metarouter.gen.go +++ b/client-go/pkg/listers/metaprotocol/v1alpha1/metarouter.gen.go @@ -17,10 +17,11 @@ package v1alpha1 import ( - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" ) // MetaRouterLister helps list MetaRouters. diff --git a/client-go/pkg/listers/redis/v1alpha1/redisdestination.gen.go b/client-go/pkg/listers/redis/v1alpha1/redisdestination.gen.go index 6f6a07abc..bec6ce901 100644 --- a/client-go/pkg/listers/redis/v1alpha1/redisdestination.gen.go +++ b/client-go/pkg/listers/redis/v1alpha1/redisdestination.gen.go @@ -17,10 +17,11 @@ package v1alpha1 import ( - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" ) // RedisDestinationLister helps list RedisDestinations. diff --git a/client-go/pkg/listers/redis/v1alpha1/redisservice.gen.go b/client-go/pkg/listers/redis/v1alpha1/redisservice.gen.go index 1090672ba..e2bb1bc17 100644 --- a/client-go/pkg/listers/redis/v1alpha1/redisservice.gen.go +++ b/client-go/pkg/listers/redis/v1alpha1/redisservice.gen.go @@ -17,10 +17,11 @@ package v1alpha1 import ( - v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" + + v1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" ) // RedisServiceLister helps list RedisServices. diff --git a/pkg/bootstrap/server.go b/pkg/bootstrap/server.go index 5c01da8ac..e3d2a1830 100644 --- a/pkg/bootstrap/server.go +++ b/pkg/bootstrap/server.go @@ -30,11 +30,6 @@ import ( "github.com/aeraki-mesh/aeraki/pkg/controller/istio" "github.com/aeraki-mesh/aeraki/pkg/controller/kube" - "github.com/aeraki-mesh/aeraki/pkg/envoyfilter" - "github.com/aeraki-mesh/aeraki/pkg/model/protocol" - "github.com/aeraki-mesh/aeraki/pkg/xds" - "github.com/aeraki-mesh/aeraki/plugin/dubbo" - "github.com/aeraki-mesh/aeraki/plugin/redis" istioscheme "istio.io/client-go/pkg/apis/networking/v1alpha3" "istio.io/client-go/pkg/clientset/versioned" "istio.io/istio/pilot/pkg/model" @@ -46,6 +41,12 @@ import ( "k8s.io/client-go/tools/clientcmd" kubeconfig "sigs.k8s.io/controller-runtime/pkg/client/config" "sigs.k8s.io/controller-runtime/pkg/manager" + + "github.com/aeraki-mesh/aeraki/pkg/envoyfilter" + "github.com/aeraki-mesh/aeraki/pkg/model/protocol" + "github.com/aeraki-mesh/aeraki/pkg/xds" + "github.com/aeraki-mesh/aeraki/plugin/dubbo" + "github.com/aeraki-mesh/aeraki/plugin/redis" ) var ( @@ -93,13 +94,13 @@ func NewServer(args *AerakiArgs) (*Server, error) { // envoyFilterController watches changes on config and create/update corresponding EnvoyFilters envoyFilterController := envoyfilter.NewController(client, configController.Store, args.Protocols, args.EnableEnvoyFilterNSScope) - configController.RegisterEventHandler(func(_, curr istioconfig.Config, event model.Event) { + configController.RegisterEventHandler(func(_, curr *istioconfig.Config, event model.Event) { envoyFilterController.ConfigUpdated(event) }) // routeCacheMgr watches service entry and generate the routes for meta protocol services routeCacheMgr := xds.NewCacheMgr(configController.Store) - configController.RegisterEventHandler(func(prev istioconfig.Config, curr istioconfig.Config, + configController.RegisterEventHandler(func(prev *istioconfig.Config, curr *istioconfig.Config, event model.Event) { routeCacheMgr.ConfigUpdated(prev, curr, event) }) diff --git a/pkg/bootstrap/validation.go b/pkg/bootstrap/validation.go index 64ed2b5ff..13272493e 100644 --- a/pkg/bootstrap/validation.go +++ b/pkg/bootstrap/validation.go @@ -15,9 +15,10 @@ package bootstrap import ( + "istio.io/pkg/log" + "github.com/aeraki-mesh/aeraki/pkg/webhook/validation/scheme" "github.com/aeraki-mesh/aeraki/pkg/webhook/validation/server" - "istio.io/pkg/log" ) func (s *Server) initConfigValidation(args *AerakiArgs) error { diff --git a/pkg/controller/istio/controller.go b/pkg/controller/istio/controller.go index 522ea923b..87d6cd624 100644 --- a/pkg/controller/istio/controller.go +++ b/pkg/controller/istio/controller.go @@ -26,7 +26,6 @@ import ( "istio.io/istio/security/pkg/nodeagent/cache" - "github.com/aeraki-mesh/aeraki/pkg/model/protocol" "github.com/cenkalti/backoff" discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" networking "istio.io/api/networking/v1alpha3" @@ -38,6 +37,8 @@ import ( "istio.io/istio/pkg/config/schema/collections" citadel "istio.io/istio/security/pkg/nodeagent/caclient/providers/citadel" "istio.io/pkg/log" + + "github.com/aeraki-mesh/aeraki/pkg/model/protocol" ) const ( @@ -160,7 +161,7 @@ func (c *Controller) configInitialRequests() []*discovery.DiscoveryRequest { } // RegisterEventHandler adds a handler to receive config update events for a configuration type -func (c *Controller) RegisterEventHandler(handler func(istioconfig.Config, istioconfig.Config, istiomodel.Event)) { +func (c *Controller) RegisterEventHandler(handler func(*istioconfig.Config, *istioconfig.Config, istiomodel.Event)) { handlerWrapper := func(prev istioconfig.Config, curr istioconfig.Config, event istiomodel.Event) { if event == istiomodel.EventUpdate && reflect.DeepEqual(prev.Spec, curr.Spec) { return @@ -173,23 +174,23 @@ func (c *Controller) RegisterEventHandler(handler func(istioconfig.Config, istio if curr.GroupVersionKind == collections.IstioNetworkingV1Alpha3Serviceentries.Resource().GroupVersionKind() { //controllerLog.Infof("Service Entry changed: %s %s", event.String(), curr.Name) if c.shouldHandleSeChange(curr) { - handler(prev, curr, event) + handler(&prev, &curr, event) } else if c.shouldHandleSeChange(prev) { - handler(prev, curr, event) + handler(&prev, &curr, event) } } else if curr.GroupVersionKind == collections.IstioNetworkingV1Alpha3Virtualservices.Resource().GroupVersionKind() { controllerLog.Infof("virtual service changed: %s %s", event.String(), curr.Name) if c.shouldHandleVsChange(curr) { - handler(prev, curr, event) + handler(&prev, &curr, event) } else if c.shouldHandleVsChange(prev) { - handler(prev, curr, event) + handler(&prev, &curr, event) } } else if curr.GroupVersionKind == collections.IstioNetworkingV1Alpha3Destinationrules.Resource().GroupVersionKind() { controllerLog.Infof("Destination rules changed: %s %s", event.String(), curr.Name) if c.shouldHandleDrChange(curr) { - handler(prev, curr, event) + handler(&prev, &curr, event) } else if c.shouldHandleDrChange(prev) { - handler(prev, curr, event) + handler(&prev, &curr, event) } } } diff --git a/pkg/controller/kube/dubbo.go b/pkg/controller/kube/dubbo.go index 5bfea8a97..f40b66caa 100644 --- a/pkg/controller/kube/dubbo.go +++ b/pkg/controller/kube/dubbo.go @@ -18,7 +18,6 @@ import ( "context" "reflect" - "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/dubbo/v1alpha1" "istio.io/pkg/log" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/event" @@ -27,6 +26,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/client-go/pkg/apis/dubbo/v1alpha1" ) var dubboLog = log.RegisterScope("dubbo-controller", "dubbo-controller debugging", 0) diff --git a/pkg/controller/kube/metaprotocol.go b/pkg/controller/kube/metaprotocol.go index 7d7ebff58..0c13991c8 100644 --- a/pkg/controller/kube/metaprotocol.go +++ b/pkg/controller/kube/metaprotocol.go @@ -18,10 +18,10 @@ import ( "context" "reflect" - metaprotocolmodel "github.com/aeraki-mesh/aeraki/pkg/model/metaprotocol" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" + metaprotocolmodel "github.com/aeraki-mesh/aeraki/pkg/model/metaprotocol" + "istio.io/pkg/log" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/event" @@ -30,6 +30,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/client-go/pkg/apis/metaprotocol/v1alpha1" ) var metaProtocolLog = log.RegisterScope("meta-protocol-controller", "meta-protocol-controller debugging", 0) diff --git a/pkg/controller/kube/metarouter.go b/pkg/controller/kube/metarouter.go index 5173c1e2e..43f240be2 100644 --- a/pkg/controller/kube/metarouter.go +++ b/pkg/controller/kube/metarouter.go @@ -20,7 +20,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" "istio.io/pkg/log" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/event" @@ -29,6 +28,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/client-go/pkg/apis/metaprotocol/v1alpha1" ) var metaRouterLog = log.RegisterScope("meta-router-controller", "meta-routerl-controller debugging", 0) diff --git a/pkg/controller/kube/namesapce.go b/pkg/controller/kube/namesapce.go index ade2c1813..d4a0ec906 100644 --- a/pkg/controller/kube/namesapce.go +++ b/pkg/controller/kube/namesapce.go @@ -18,12 +18,12 @@ import ( "context" "fmt" - "github.com/aeraki-mesh/aeraki/pkg/config/constants" "k8s.io/apimachinery/pkg/api/errors" + "github.com/aeraki-mesh/aeraki/pkg/config/constants" + "istio.io/pkg/log" v1 "k8s.io/api/core/v1" - "sigs.k8s.io/controller-runtime/pkg/client" controllerclient "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/event" @@ -49,7 +49,7 @@ var ( // namespaceController creates bootstrap configMap for sidecar proxies type namespaceController struct { - client.Client + controllerclient.Client } // Reconcile watch namespace change and create bootstrap configmap for sidecar proxies diff --git a/pkg/controller/kube/redis.go b/pkg/controller/kube/redis.go index f09f160ec..801be72ad 100644 --- a/pkg/controller/kube/redis.go +++ b/pkg/controller/kube/redis.go @@ -18,7 +18,6 @@ import ( "context" "reflect" - "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" "istio.io/pkg/log" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/event" @@ -27,6 +26,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/client-go/pkg/apis/redis/v1alpha1" ) var redisLog = log.RegisterScope("redis-controller", "redis-controller debugging", 0) diff --git a/pkg/controller/kube/serviceentry.go b/pkg/controller/kube/serviceentry.go index fc009c24d..0bbe126b9 100644 --- a/pkg/controller/kube/serviceentry.go +++ b/pkg/controller/kube/serviceentry.go @@ -25,8 +25,6 @@ import ( "github.com/aeraki-mesh/aeraki/pkg/config/constants" "github.com/aeraki-mesh/aeraki/pkg/model" - "sigs.k8s.io/controller-runtime/pkg/client" - istionapi "istio.io/api/networking/v1alpha3" networking "istio.io/client-go/pkg/apis/networking/v1alpha3" "istio.io/pkg/log" @@ -70,8 +68,8 @@ var ( // serviceEntryController allocate VIPs to service entries type serviceEntryController struct { - client.Client - serviceIPs map[string]client.ObjectKey + controllerclient.Client + serviceIPs map[string]controllerclient.ObjectKey maxIP int } @@ -99,7 +97,7 @@ func (c *serviceEntryController) Reconcile(ctx context.Context, request reconcil func AddServiceEntryController(mgr manager.Manager) error { serviceEntryCtrl := &serviceEntryController{ Client: mgr.GetClient(), - serviceIPs: make(map[string]client.ObjectKey), + serviceIPs: make(map[string]controllerclient.ObjectKey), } c, err := controller.New("aeraki-service-entry-controller", mgr, controller.Options{Reconciler: serviceEntryCtrl}) @@ -121,7 +119,7 @@ func AddServiceEntryController(mgr manager.Manager) error { // The IPs are allocated from the reserved Class E subnet (240.240.0.0/16) that is not reachable outside the pod. // When DNS capture is enabled, Envoy will resolve the DNS to these IPs. // The listeners for TCP services will also be set up on these IPs. -func (c *serviceEntryController) autoAllocateIP(key client.ObjectKey, s *networking.ServiceEntry) { +func (c *serviceEntryController) autoAllocateIP(key controllerclient.ObjectKey, s *networking.ServiceEntry) { if s.Spec.Resolution == istionapi.ServiceEntry_NONE { return } @@ -157,7 +155,7 @@ func (c *serviceEntryController) autoAllocateIP(key client.ObjectKey, s *network } } -func (c *serviceEntryController) updateServiceEntry(s *networking.ServiceEntry, key client.ObjectKey) { +func (c *serviceEntryController) updateServiceEntry(s *networking.ServiceEntry, key controllerclient.ObjectKey) { err := c.Client.Update(context.TODO(), s, &controllerclient.UpdateOptions{ FieldManager: constants.AerakiFieldManager, diff --git a/pkg/envoyfilter/controller.go b/pkg/envoyfilter/controller.go index 9a5aa1eb2..2b335f05a 100644 --- a/pkg/envoyfilter/controller.go +++ b/pkg/envoyfilter/controller.go @@ -24,9 +24,6 @@ import ( "github.com/gogo/protobuf/proto" "sigs.k8s.io/controller-runtime/pkg/client" - metaprotocol "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" - "github.com/aeraki-mesh/aeraki/pkg/model" - "github.com/aeraki-mesh/aeraki/pkg/model/protocol" "github.com/zhaohuabing/debounce" networking "istio.io/api/networking/v1alpha3" "istio.io/client-go/pkg/apis/networking/v1alpha3" @@ -35,6 +32,10 @@ import ( "istio.io/istio/pkg/config/schema/collections" "istio.io/pkg/log" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + metaprotocol "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" + "github.com/aeraki-mesh/aeraki/pkg/model" + "github.com/aeraki-mesh/aeraki/pkg/model/protocol" ) const ( @@ -126,14 +127,15 @@ func (c *Controller) pushEnvoyFilters2APIServer() error { } // Changed envoyFilters - for _, oldEnvoyFilter := range existingEnvoyFilters.Items { + for i := range existingEnvoyFilters.Items { + oldEnvoyFilter := &existingEnvoyFilters.Items[i] mapKey := envoyFilterMapKey(oldEnvoyFilter.Name, oldEnvoyFilter.Namespace) if newEnvoyFilter, ok := generatedEnvoyFilters[mapKey]; ok { if !proto.Equal(newEnvoyFilter.Envoyfilter, &oldEnvoyFilter.Spec) { controllerLog.Infof("updating EnvoyFilter: namespace: %s name: %s %v", newEnvoyFilter.Namespace, newEnvoyFilter.Name, model.Struct2JSON(*newEnvoyFilter.Envoyfilter)) _, err = c.istioClientset.NetworkingV1alpha3().EnvoyFilters(newEnvoyFilter.Namespace).Update(context.TODO(), - c.toEnvoyFilterCRD(newEnvoyFilter, &oldEnvoyFilter), + c.toEnvoyFilterCRD(newEnvoyFilter, oldEnvoyFilter), v1.UpdateOptions{FieldManager: constants.AerakiFieldManager}) } else { controllerLog.Infof("envoyFilter: namespace: %s name: %s unchanged", oldEnvoyFilter.Namespace, diff --git a/pkg/envoyfilter/network_filter.go b/pkg/envoyfilter/network_filter.go index cf47f845b..04220f7f9 100644 --- a/pkg/envoyfilter/network_filter.go +++ b/pkg/envoyfilter/network_filter.go @@ -19,7 +19,6 @@ import ( "strconv" "strings" - "github.com/aeraki-mesh/aeraki/pkg/model" "github.com/envoyproxy/go-control-plane/pkg/wellknown" gogojsonpb "github.com/gogo/protobuf/jsonpb" "github.com/gogo/protobuf/types" @@ -27,6 +26,8 @@ import ( "google.golang.org/protobuf/proto" networking "istio.io/api/networking/v1alpha3" "istio.io/pkg/log" + + "github.com/aeraki-mesh/aeraki/pkg/model" ) var generatorLog = log.RegisterScope("aeraki-generator", "aeraki generator", 0) @@ -49,7 +50,8 @@ func GenerateReplaceNetworkFilter(service *model.ServiceEntryWrapper, port *netw // GenerateReplaceNetworkFilter generates an EnvoyFilter that replaces the default tcp proxy with a protocol specified proxy func generateNetworkFilter(service *model.ServiceEntryWrapper, port *networking.Port, outboundProxy proto.Message, - inboundProxy proto.Message, filterName string, filterType string, operation networking.EnvoyFilter_Patch_Operation) []*model.EnvoyFilterWrapper { + inboundProxy proto.Message, filterName string, filterType string, + operation networking.EnvoyFilter_Patch_Operation) []*model.EnvoyFilterWrapper { var envoyFilters []*model.EnvoyFilterWrapper var outboundProxyPatch, inboundProxyPatch *networking.EnvoyFilter_EnvoyConfigObjectPatch diff --git a/pkg/envoyfilter/network_filter_test.go b/pkg/envoyfilter/network_filter_test.go index 492f6a3e3..2416dcc4e 100644 --- a/pkg/envoyfilter/network_filter_test.go +++ b/pkg/envoyfilter/network_filter_test.go @@ -20,8 +20,9 @@ import ( istioconfig "istio.io/istio/pkg/config" - "github.com/aeraki-mesh/aeraki/pkg/model" networking "istio.io/api/networking/v1alpha3" + + "github.com/aeraki-mesh/aeraki/pkg/model" ) func Test_inboudEnvoyFilterWorkloadSelector(t *testing.T) { diff --git a/pkg/model/config.go b/pkg/model/config.go index 93731f1b0..7728bdeef 100644 --- a/pkg/model/config.go +++ b/pkg/model/config.go @@ -15,9 +15,10 @@ package model import ( - metaprotocol "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" networking "istio.io/api/networking/v1alpha3" istioconfig "istio.io/istio/pkg/config" + + metaprotocol "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" ) // ServiceEntryWrapper wraps an Istio ServiceEntry and its metadata, including name, annotations and labels. diff --git a/pkg/model/metaprotocol/application_protocol.go b/pkg/model/metaprotocol/application_protocol.go index b9ef1a6bd..808abb401 100644 --- a/pkg/model/metaprotocol/application_protocol.go +++ b/pkg/model/metaprotocol/application_protocol.go @@ -27,7 +27,7 @@ var applicationProtocols = map[string]string{ } // SetApplicationProtocolCodec sets the codec for a specific protocol -func SetApplicationProtocolCodec(protocol string, codec string) { +func SetApplicationProtocolCodec(protocol, codec string) { lock.Lock() defer lock.Unlock() applicationProtocols[protocol] = codec diff --git a/pkg/model/protocol/instance.go b/pkg/model/protocol/instance.go index b333cdcf6..a54cf15a9 100644 --- a/pkg/model/protocol/instance.go +++ b/pkg/model/protocol/instance.go @@ -44,6 +44,7 @@ const ( var protocolMap = make(map[string]Instance) +// nolint: gochecknoinits func init() { protocolMap["dubbo"] = Dubbo protocolMap["thrift"] = Thrift diff --git a/pkg/model/utils.go b/pkg/model/utils.go index f43a863e2..8ac9ad31b 100644 --- a/pkg/model/utils.go +++ b/pkg/model/utils.go @@ -16,10 +16,11 @@ package model import ( "encoding/json" - networking "istio.io/api/networking/v1alpha3" "strconv" "strings" + networking "istio.io/api/networking/v1alpha3" + istiomodel "istio.io/istio/pilot/pkg/model" "istio.io/istio/pkg/config/host" ) @@ -34,7 +35,8 @@ const ( TrafficDirectionOutbound TrafficDirection = "outbound" ) -// BuildClusterName the cluster name referencing service instances for a given service name, a subset and a port, which is the same as the cluster name generated by Istio. +// BuildClusterName the cluster name referencing service instances for a given service name, a subset and a port, +// which is the same as the cluster name generated by Istio. func BuildClusterName(direction TrafficDirection, subsetName string, hostname string, port int) string { if direction == TrafficDirectionInbound { // On 1.8+ Proxies, Istio uses format inbound|port||. Telemetry no longer requires the hostname diff --git a/pkg/webhook/validation/scheme/collections.go b/pkg/webhook/validation/scheme/collections.go index 071bf0744..c458d1504 100755 --- a/pkg/webhook/validation/scheme/collections.go +++ b/pkg/webhook/validation/scheme/collections.go @@ -39,7 +39,8 @@ var ( Version: "v1alpha1", Proto: "aeraki.io.v1alpha1.ApplicationProtocol", //StatusProto: "istio.meta.v1alpha1.IstioStatus", - ReflectType: reflect.TypeOf(&githubcomaerakimeshaerakiapimetaprotocolv1alpha1.ApplicationProtocol{}).Elem(), StatusType: reflect.TypeOf(&istioioapimetav1alpha1.IstioStatus{}).Elem(), + ReflectType: reflect.TypeOf(&githubcomaerakimeshaerakiapimetaprotocolv1alpha1.ApplicationProtocol{}).Elem(), + StatusType: reflect.TypeOf(&istioioapimetav1alpha1.IstioStatus{}).Elem(), ProtoPackage: "github.com/aeraki-mesh/aeraki/api/metaprotocol/v1alpha1", //StatusPackage: "istio.io/api/meta/v1alpha1", ClusterScoped: false, diff --git a/pkg/webhook/validation/scheme/validation.go b/pkg/webhook/validation/scheme/validation.go index 3bf4686b2..4025c1fd1 100644 --- a/pkg/webhook/validation/scheme/validation.go +++ b/pkg/webhook/validation/scheme/validation.go @@ -179,7 +179,7 @@ func validateExportTo(namespace string, exportTo []string) (errs error) { } } - return + return errs } // ValidateMetaRouter checks that a v1alpha1 route rule is well-formed. @@ -355,7 +355,7 @@ func validateMetaRoute(route *metaprotocol.MetaRoute) (errs Validation) { errs = appendValidation(errs, validateDestination(route.Mirror)) errs = appendValidation(errs, validateMetaRouteDestinations(route.Route)) - return + return errs } func validateMetaRouteMatch(match *metaprotocol.MetaRouteMatch) (errs error) { @@ -368,7 +368,7 @@ func validateMetaRouteMatch(match *metaprotocol.MetaRouteMatch) (errs error) { errs = appendErrors(errs, validateStringMatchRegexp(attribute, "attributes")) } } - return + return errs } func analyzeUnreachableMetaRules(routes []*metaprotocol.MetaRoute, diff --git a/pkg/webhook/validation/server/monitoring.go b/pkg/webhook/validation/server/monitoring.go index 31a644871..019b8406a 100644 --- a/pkg/webhook/validation/server/monitoring.go +++ b/pkg/webhook/validation/server/monitoring.go @@ -64,6 +64,7 @@ var ( ) ) +// nolint: gochecknoinits func init() { monitoring.MustRegister( metricValidationPassed, diff --git a/pkg/webhook/validation/server/server.go b/pkg/webhook/validation/server/server.go index 11f79c0a7..76ac7496e 100644 --- a/pkg/webhook/validation/server/server.go +++ b/pkg/webhook/validation/server/server.go @@ -54,6 +54,7 @@ var ( } ) +// nolint: gochecknoinits func init() { _ = kubeApiApps.AddToScheme(runtimeScheme) _ = kubeApiAdmissionv1.AddToScheme(runtimeScheme) diff --git a/pkg/xds/cache_mgr.go b/pkg/xds/cache_mgr.go index f73f12740..e0c40e9c2 100644 --- a/pkg/xds/cache_mgr.go +++ b/pkg/xds/cache_mgr.go @@ -24,15 +24,15 @@ import ( "github.com/aeraki-mesh/aeraki/pkg/model/protocol" - metaprotocolapi "github.com/aeraki-mesh/aeraki/api/metaprotocol/v1alpha1" - metaprotocol "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" corev3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" routev3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" istioconfig "istio.io/istio/pkg/config" "sigs.k8s.io/controller-runtime/pkg/client" + metaprotocolapi "github.com/aeraki-mesh/aeraki/api/metaprotocol/v1alpha1" + metaprotocol "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" + "github.com/aeraki-mesh/aeraki/pkg/model" - httproute "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" metaroute "github.com/aeraki-mesh/meta-protocol-control-plane-api/meta_protocol_proxy/config/route/v1alpha" cachev3 "github.com/envoyproxy/go-control-plane/pkg/cache/v3" @@ -105,7 +105,6 @@ func (c *CacheMgr) mainLoop(stop <-chan struct{}) { case <-stop: break } - } } @@ -306,7 +305,7 @@ func (c *CacheMgr) defaultRoute(service *networking.ServiceEntry, port *networki { Name: "default", Match: &metaroute.RouteMatch{ - Metadata: []*httproute.HeaderMatcher{}, + Metadata: []*routev3.HeaderMatcher{}, }, Route: &metaroute.RouteAction{ ClusterSpecifier: &metaroute.RouteAction_Cluster{ @@ -392,7 +391,7 @@ func (c *CacheMgr) findRelatedDestinationRule(service *model.ServiceEntryWrapper } // ConfigUpdated sends a config change event to the pushChannel when Istio config changed -func (c *CacheMgr) ConfigUpdated(prev istioconfig.Config, curr istioconfig.Config, event istiomodel.Event) { +func (c *CacheMgr) ConfigUpdated(prev *istioconfig.Config, curr *istioconfig.Config, event istiomodel.Event) { if c.shouldUpdateCache(curr) { c.pushChannel <- event } else if c.shouldUpdateCache(prev) { @@ -400,7 +399,7 @@ func (c *CacheMgr) ConfigUpdated(prev istioconfig.Config, curr istioconfig.Confi } } -func (c *CacheMgr) shouldUpdateCache(config istioconfig.Config) bool { +func (c *CacheMgr) shouldUpdateCache(config *istioconfig.Config) bool { var serviceEntry *networking.ServiceEntry if config.GroupVersionKind == collections.IstioNetworkingV1Alpha3Serviceentries.Resource().GroupVersionKind() { service, ok := config.Spec.(*networking.ServiceEntry) diff --git a/pkg/xds/utils.go b/pkg/xds/utils.go index 6d2f337bc..5e7ea4130 100644 --- a/pkg/xds/utils.go +++ b/pkg/xds/utils.go @@ -23,9 +23,10 @@ import ( httpcore "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - userapi "github.com/aeraki-mesh/aeraki/api/metaprotocol/v1alpha1" matcher "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3" + userapi "github.com/aeraki-mesh/aeraki/api/metaprotocol/v1alpha1" + metaroute "github.com/aeraki-mesh/meta-protocol-control-plane-api/meta_protocol_proxy/config/route/v1alpha" httproute "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" "github.com/envoyproxy/go-control-plane/pkg/cache/types" diff --git a/plugin/dubbo/authz/builder/builder.go b/plugin/dubbo/authz/builder/builder.go index bc365cad8..f1d0e4aa2 100644 --- a/plugin/dubbo/authz/builder/builder.go +++ b/plugin/dubbo/authz/builder/builder.go @@ -20,17 +20,19 @@ import ( "google.golang.org/protobuf/types/known/anypb" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + dubborulepb "github.com/aeraki-mesh/aeraki/api/dubbo/v1alpha1" dubboapi "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/dubbo/v1alpha1" dubboclient "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - authzmodel "github.com/aeraki-mesh/aeraki/plugin/dubbo/authz/model" 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" "istio.io/istio/pilot/pkg/security/trustdomain" "istio.io/pkg/log" + + authzmodel "github.com/aeraki-mesh/aeraki/plugin/dubbo/authz/model" ) var ( diff --git a/plugin/dubbo/authz/model/generator.go b/plugin/dubbo/authz/model/generator.go index e2297791e..ba5dfd044 100644 --- a/plugin/dubbo/authz/model/generator.go +++ b/plugin/dubbo/authz/model/generator.go @@ -20,8 +20,9 @@ import ( rbacpb "github.com/envoyproxy/go-control-plane/envoy/config/rbac/v3" - "github.com/aeraki-mesh/aeraki/plugin/dubbo/authz/matcher" "istio.io/istio/pkg/spiffe" + + "github.com/aeraki-mesh/aeraki/plugin/dubbo/authz/matcher" ) type generator interface { @@ -64,7 +65,6 @@ func (srcNamespaceGenerator) principal(_, value string) (*rbacpb.Principal, erro v := strings.Replace(value, "*", ".*", -1) m := matcher.StringMatcherRegex(fmt.Sprintf(".*/ns/%s/.*", v)) return principalAuthenticated(m), nil - } type srcPrincipalGenerator struct { diff --git a/plugin/dubbo/authz/model/model.go b/plugin/dubbo/authz/model/model.go index 9aa2535fe..b9a07dd30 100644 --- a/plugin/dubbo/authz/model/model.go +++ b/plugin/dubbo/authz/model/model.go @@ -17,9 +17,10 @@ package model import ( "fmt" - dubbopb "github.com/aeraki-mesh/aeraki/api/dubbo/v1alpha1" rbacpb "github.com/envoyproxy/go-control-plane/envoy/config/rbac/v3" + dubbopb "github.com/aeraki-mesh/aeraki/api/dubbo/v1alpha1" + "istio.io/istio/pilot/pkg/security/trustdomain" ) @@ -106,7 +107,7 @@ func (m *Model) MigrateTrustDomain(tdBundle trustdomain.Bundle) { } // Generate generates the Envoy RBAC config from the model. -func (m Model) Generate(action rbacpb.RBAC_Action) (*rbacpb.Policy, error) { +func (m *Model) Generate(action rbacpb.RBAC_Action) (*rbacpb.Policy, error) { var permissions []*rbacpb.Permission for _, rl := range m.permissions { permission, err := generatePermission(rl, action) @@ -167,7 +168,7 @@ func generatePrincipal(rl ruleList, action rbacpb.RBAC_Action) (*rbacpb.Principa return principalAnd(and), nil } -func (r rule) permission(action rbacpb.RBAC_Action) ([]*rbacpb.Permission, error) { +func (r *rule) permission(action rbacpb.RBAC_Action) ([]*rbacpb.Permission, error) { var permissions []*rbacpb.Permission var or []*rbacpb.Permission for _, value := range r.values { @@ -199,7 +200,7 @@ func (r rule) permission(action rbacpb.RBAC_Action) ([]*rbacpb.Permission, error return permissions, nil } -func (r rule) principal(action rbacpb.RBAC_Action) ([]*rbacpb.Principal, error) { +func (r *rule) principal(action rbacpb.RBAC_Action) ([]*rbacpb.Principal, error) { var principals []*rbacpb.Principal var or []*rbacpb.Principal for _, value := range r.values { @@ -231,7 +232,7 @@ func (r rule) principal(action rbacpb.RBAC_Action) ([]*rbacpb.Principal, error) return principals, nil } -func (r rule) checkError(action rbacpb.RBAC_Action, err error) error { +func (r *rule) checkError(action rbacpb.RBAC_Action, err error) error { if action == rbacpb.RBAC_ALLOW { // Return the error as-is for allow policy. This will make all rules in the current permission ignored, effectively // result in a smaller allow policy (i.e. less likely to allow a request). diff --git a/plugin/dubbo/dubboproxy.go b/plugin/dubbo/dubboproxy.go index d558176c6..99187bef0 100644 --- a/plugin/dubbo/dubboproxy.go +++ b/plugin/dubbo/dubboproxy.go @@ -15,12 +15,13 @@ package dubbo import ( - dubbov1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1" - "github.com/aeraki-mesh/aeraki/pkg/model" - "github.com/aeraki-mesh/aeraki/plugin/dubbo/authz/builder" dubbo "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/dubbo_proxy/v3" "istio.io/istio/pilot/pkg/security/trustdomain" "istio.io/istio/pkg/spiffe" + + dubbov1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1" + "github.com/aeraki-mesh/aeraki/pkg/model" + "github.com/aeraki-mesh/aeraki/plugin/dubbo/authz/builder" ) func buildOutboundProxy(context *model.EnvoyFilterContext) *dubbo.DubboProxy { diff --git a/plugin/dubbo/generator.go b/plugin/dubbo/generator.go index 1d57cb49b..aae4f760e 100644 --- a/plugin/dubbo/generator.go +++ b/plugin/dubbo/generator.go @@ -15,13 +15,15 @@ package dubbo import ( + "k8s.io/client-go/rest" + "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" dubbov1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1" - "k8s.io/client-go/rest" + + "istio.io/pkg/log" "github.com/aeraki-mesh/aeraki/pkg/envoyfilter" "github.com/aeraki-mesh/aeraki/pkg/model" - "istio.io/pkg/log" ) var generatorLog = log.RegisterScope("dubbo-generator", "dubbo generator", 0) diff --git a/plugin/dubbo/route.go b/plugin/dubbo/route.go index dd324263a..862e07916 100644 --- a/plugin/dubbo/route.go +++ b/plugin/dubbo/route.go @@ -17,13 +17,13 @@ package dubbo import ( "fmt" - "github.com/aeraki-mesh/aeraki/pkg/model" - envoy "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" routepb "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" dubbo "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/dubbo_proxy/v3" matcher "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3" "github.com/golang/protobuf/ptypes/wrappers" networking "istio.io/api/networking/v1alpha3" + + "github.com/aeraki-mesh/aeraki/pkg/model" ) var ( @@ -43,7 +43,8 @@ func buildOutboundRouteConfig(context *model.EnvoyFilterContext) (*dubbo.RouteCo } var route []*dubbo.Route - clusterName := model.BuildClusterName(model.TrafficDirectionOutbound, "", context.ServiceEntry.Spec.Hosts[0], int(context.ServiceEntry.Spec.Ports[0].Number)) + clusterName := model.BuildClusterName(model.TrafficDirectionOutbound, "", + context.ServiceEntry.Spec.Hosts[0], int(context.ServiceEntry.Spec.Ports[0].Number)) if context.VirtualService == nil { route = []*dubbo.Route{defaultRoute(clusterName)} @@ -198,7 +199,8 @@ func buildHeaderMatch(route *networking.HTTPRoute) []*routepb.HeaderMatcher { } func buildSingleCluster(http *networking.HTTPRoute, service *networking.ServiceEntry) *dubbo.RouteAction { - clusterName := model.BuildClusterName(model.TrafficDirectionOutbound, http.Route[0].Destination.Subset, service.Hosts[0], int(service.Ports[0].Number)) + clusterName := model.BuildClusterName(model.TrafficDirectionOutbound, http.Route[0].Destination.Subset, + service.Hosts[0], int(service.Ports[0].Number)) return &dubbo.RouteAction{ ClusterSpecifier: &dubbo.RouteAction_Cluster{ Cluster: clusterName, @@ -207,12 +209,13 @@ func buildSingleCluster(http *networking.HTTPRoute, service *networking.ServiceE } func buildWeightedCluster(http *networking.HTTPRoute, service *networking.ServiceEntry) *dubbo.RouteAction { - var clusterWeights []*envoy.WeightedCluster_ClusterWeight + var clusterWeights []*routepb.WeightedCluster_ClusterWeight var totalWeight uint32 for _, route := range http.Route { - clusterName := model.BuildClusterName(model.TrafficDirectionOutbound, route.Destination.Subset, service.Hosts[0], int(service.Ports[0].Number)) - clusterWeight := &envoy.WeightedCluster_ClusterWeight{ + clusterName := model.BuildClusterName(model.TrafficDirectionOutbound, route.Destination.Subset, + service.Hosts[0], int(service.Ports[0].Number)) + clusterWeight := &routepb.WeightedCluster_ClusterWeight{ Name: clusterName, Weight: &wrappers.UInt32Value{Value: uint32(route.Weight)}, } @@ -222,7 +225,7 @@ func buildWeightedCluster(http *networking.HTTPRoute, service *networking.Servic return &dubbo.RouteAction{ ClusterSpecifier: &dubbo.RouteAction_WeightedClusters{ - WeightedClusters: &envoy.WeightedCluster{ + WeightedClusters: &routepb.WeightedCluster{ Clusters: clusterWeights, TotalWeight: &wrappers.UInt32Value{Value: totalWeight}, }, diff --git a/plugin/kafka/kafkafilter.go b/plugin/kafka/kafkafilter.go index c01b3bbb5..b810e9f2f 100644 --- a/plugin/kafka/kafkafilter.go +++ b/plugin/kafka/kafkafilter.go @@ -15,8 +15,9 @@ package kafka import ( - "github.com/aeraki-mesh/aeraki/pkg/model" kafka "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/filters/network/kafka_broker/v3" + + "github.com/aeraki-mesh/aeraki/pkg/model" ) func buildOutboundProxy(context *model.EnvoyFilterContext) *kafka.KafkaBroker { diff --git a/plugin/metaprotocol/filters.go b/plugin/metaprotocol/filters.go index 708d35247..9325f55de 100644 --- a/plugin/metaprotocol/filters.go +++ b/plugin/metaprotocol/filters.go @@ -17,9 +17,6 @@ package metaprotocol import ( "fmt" - userapi "github.com/aeraki-mesh/aeraki/api/metaprotocol/v1alpha1" - mpclient "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" - "github.com/aeraki-mesh/aeraki/pkg/xds" metaroute "github.com/aeraki-mesh/meta-protocol-control-plane-api/meta_protocol_proxy/config/route/v1alpha" grldataplane "github.com/aeraki-mesh/meta-protocol-control-plane-api/meta_protocol_proxy/filters/global_ratelimit/v1alpha" lrldataplane "github.com/aeraki-mesh/meta-protocol-control-plane-api/meta_protocol_proxy/filters/local_ratelimit/v1alpha" @@ -30,6 +27,10 @@ import ( "github.com/golang/protobuf/ptypes/duration" "github.com/golang/protobuf/ptypes/wrappers" "google.golang.org/protobuf/types/known/anypb" + + userapi "github.com/aeraki-mesh/aeraki/api/metaprotocol/v1alpha1" + mpclient "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/metaprotocol/v1alpha1" + "github.com/aeraki-mesh/aeraki/pkg/xds" ) func buildOutboundFilters(metaRouter *mpclient.MetaRouter) []*mpdataplane.MetaProtocolFilter { diff --git a/plugin/metaprotocol/generator.go b/plugin/metaprotocol/generator.go index 3128c35ed..1c7a1737d 100644 --- a/plugin/metaprotocol/generator.go +++ b/plugin/metaprotocol/generator.go @@ -15,10 +15,11 @@ package metaprotocol import ( + "istio.io/pkg/log" + "github.com/aeraki-mesh/aeraki/pkg/envoyfilter" "github.com/aeraki-mesh/aeraki/pkg/model" "github.com/aeraki-mesh/aeraki/pkg/model/protocol" - "istio.io/pkg/log" ) var generatorLog = log.RegisterScope("metaprotocol-generator", "metaprotocol generator", 0) diff --git a/plugin/metaprotocol/metaprotocolproxy.go b/plugin/metaprotocol/metaprotocolproxy.go index cc6cadd8a..1ca337958 100644 --- a/plugin/metaprotocol/metaprotocolproxy.go +++ b/plugin/metaprotocol/metaprotocolproxy.go @@ -15,11 +15,12 @@ package metaprotocol import ( - "github.com/aeraki-mesh/aeraki/pkg/model" - metaprotocolmodel "github.com/aeraki-mesh/aeraki/pkg/model/metaprotocol" metaprotocol "github.com/aeraki-mesh/meta-protocol-control-plane-api/meta_protocol_proxy/v1alpha" envoyconfig "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" istionetworking "istio.io/api/networking/v1alpha3" + + "github.com/aeraki-mesh/aeraki/pkg/model" + metaprotocolmodel "github.com/aeraki-mesh/aeraki/pkg/model/metaprotocol" ) func buildOutboundProxy(context *model.EnvoyFilterContext, port *istionetworking.Port) (*metaprotocol.MetaProtocolProxy, error) { diff --git a/plugin/metaprotocol/route.go b/plugin/metaprotocol/route.go index 554158bfa..16328e7af 100644 --- a/plugin/metaprotocol/route.go +++ b/plugin/metaprotocol/route.go @@ -15,9 +15,10 @@ package metaprotocol import ( - "github.com/aeraki-mesh/aeraki/pkg/model" metaroute "github.com/aeraki-mesh/meta-protocol-control-plane-api/meta_protocol_proxy/config/route/v1alpha" istionetworking "istio.io/api/networking/v1alpha3" + + "github.com/aeraki-mesh/aeraki/pkg/model" ) func buildInboundRouteConfig(context *model.EnvoyFilterContext, port *istionetworking.Port) (*metaroute.RouteConfiguration, error) { diff --git a/plugin/redis/generator.go b/plugin/redis/generator.go index 9e7430e89..5a1273711 100644 --- a/plugin/redis/generator.go +++ b/plugin/redis/generator.go @@ -21,15 +21,14 @@ import ( "strings" "time" - "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" - redisv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/redis/v1alpha1" clusterv3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" "github.com/gogo/protobuf/types" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" - "github.com/aeraki-mesh/aeraki/pkg/envoyfilter" - "github.com/aeraki-mesh/aeraki/pkg/model" + "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned" + redisv1alpha1 "github.com/aeraki-mesh/aeraki/client-go/pkg/clientset/versioned/typed/redis/v1alpha1" + gogojsonpb "github.com/gogo/protobuf/jsonpb" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" @@ -37,6 +36,9 @@ import ( istiomodel "istio.io/istio/pilot/pkg/model" "istio.io/pkg/log" corev1 "k8s.io/client-go/kubernetes/typed/core/v1" + + "github.com/aeraki-mesh/aeraki/pkg/envoyfilter" + "github.com/aeraki-mesh/aeraki/pkg/model" ) var generatorLog = log.RegisterScope("redis-generator", "redis generator", 0) @@ -90,7 +92,8 @@ func (g *Generator) Generate(filterContext *model.EnvoyFilterContext) (filters [ return filters, nil } -func (g *Generator) generate(ctx context.Context, filterContext *model.EnvoyFilterContext, targetPort *networking.Port) []*model.EnvoyFilterWrapper { +func (g *Generator) generate(ctx context.Context, filterContext *model.EnvoyFilterContext, + targetPort *networking.Port) []*model.EnvoyFilterWrapper { port := targetPort.Number portName := targetPort.Name generatorLog.Debugf("generate %s/%s/%s", filterContext.ServiceEntry.Namespace, filterContext.ServiceEntry.Name, portName) diff --git a/plugin/redis/inbound.go b/plugin/redis/inbound.go index a4b208f36..a07bbe740 100644 --- a/plugin/redis/inbound.go +++ b/plugin/redis/inbound.go @@ -15,8 +15,9 @@ package redis import ( - "github.com/aeraki-mesh/aeraki/pkg/model" redis "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/redis_proxy/v3" + + "github.com/aeraki-mesh/aeraki/pkg/model" ) func (g *Generator) buildInboundProxy(context *model.EnvoyFilterContext, port uint32, portName string) *redis.RedisProxy { diff --git a/plugin/redis/outbound.go b/plugin/redis/outbound.go index c13e53322..18a304b80 100644 --- a/plugin/redis/outbound.go +++ b/plugin/redis/outbound.go @@ -19,18 +19,20 @@ import ( "strings" "time" - spec "github.com/aeraki-mesh/aeraki/api/redis/v1alpha1" "github.com/gogo/protobuf/types" "istio.io/istio/pkg/util/gogo" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" - "github.com/aeraki-mesh/aeraki/client-go/pkg/apis/redis/v1alpha1" - "github.com/aeraki-mesh/aeraki/pkg/model" + spec "github.com/aeraki-mesh/aeraki/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/aeraki/client-go/pkg/apis/redis/v1alpha1" + "github.com/aeraki-mesh/aeraki/pkg/model" + redis "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/redis_proxy/v3" ) @@ -45,7 +47,8 @@ var ( defaultInboundOpTimeout = gogo.DurationToProtoDuration(types.DurationProto(time.Hour)) ) -func (g *Generator) buildOutboundProxyWithFallback(ctx context.Context, c *model.EnvoyFilterContext, listenPort uint32, listenPortName string) *redis.RedisProxy { +func (g *Generator) buildOutboundProxyWithFallback(ctx context.Context, c *model.EnvoyFilterContext, listenPort uint32, + listenPortName string) *redis.RedisProxy { proxy, err := g.buildOutboundProxy(ctx, c, listenPort, listenPortName) if err != nil { generatorLog.Errorf("build outbound %s/%s :%e", c.ServiceEntry.Namespace, c.ServiceEntry.Name, err) @@ -67,7 +70,8 @@ func (g *Generator) buildOutboundProxyWithFallback(ctx context.Context, c *model return proxy } -func (g *Generator) buildOutboundProxy(ctx context.Context, c *model.EnvoyFilterContext, listenPort uint32, listenPortName string) (*redis.RedisProxy, error) { +func (g *Generator) buildOutboundProxy(ctx context.Context, c *model.EnvoyFilterContext, listenPort uint32, + listenPortName string) (*redis.RedisProxy, error) { targetHost, rs, err := g.findTargetHostAndRedisService(ctx, c.ServiceEntry.Namespace, c.ServiceEntry.Spec.Hosts) if err != nil { return nil, err @@ -170,7 +174,8 @@ func (g *Generator) buildAuth(proxy *redis.RedisProxy, rs *v1alpha1.RedisService return nil } -func (g *Generator) findTargetHostAndRedisService(ctx context.Context, ns string, hosts []string) (targetHost string, rs *v1alpha1.RedisService, err error) { +func (g *Generator) findTargetHostAndRedisService(ctx context.Context, ns string, hosts []string) (targetHost string, + rs *v1alpha1.RedisService, err error) { generatorLog.Debugf("try find target host and RedisService %s %v", ns, hosts) redisServices, err := g.redis.RedisServices(ns).List(ctx, v1.ListOptions{ LabelSelector: labels.Everything().String(), @@ -224,7 +229,8 @@ func (g *Generator) convertPolicy(policy spec.RedisService_ReadPolicy) redis.Red return redis.RedisProxy_ConnPoolSettings_MASTER } -func (g *Generator) buildPrefixRoute(r *spec.RedisService_Route, hostServices map[string]*networking.ServiceEntry, listenPort uint32, listenPortName string) (route *redis.RedisProxy_PrefixRoutes_Route, all bool) { +func (g *Generator) buildPrefixRoute(r *spec.RedisService_Route, hostServices map[string]*networking.ServiceEntry, + listenPort uint32, listenPortName string) (route *redis.RedisProxy_PrefixRoutes_Route, all bool) { port := r.Route.Port if port == 0 { port = findServicePort(hostServices[r.Route.Host], listenPort, listenPortName) diff --git a/plugin/redis/outboundcluster.go b/plugin/redis/outboundcluster.go index 4bf171ab8..54a13df17 100644 --- a/plugin/redis/outboundcluster.go +++ b/plugin/redis/outboundcluster.go @@ -20,7 +20,6 @@ import ( "strconv" "strings" - spec "github.com/aeraki-mesh/aeraki/api/redis/v1alpha1" envoycore "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" "github.com/envoyproxy/go-control-plane/pkg/wellknown" "github.com/golang/protobuf/ptypes/any" @@ -33,13 +32,18 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" - "github.com/aeraki-mesh/aeraki/pkg/model" + spec "github.com/aeraki-mesh/aeraki/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/pkg/model" ) -func (g *Generator) buildOutboundCluster(ctx context.Context, c *model.EnvoyFilterContext, listenPort uint32, listenPortName string) *cluster.Cluster { +// nolint: funlen,gocyclo +func (g *Generator) buildOutboundCluster(ctx context.Context, c *model.EnvoyFilterContext, + listenPort uint32, listenPortName string) *cluster.Cluster { cl := &cluster.Cluster{ Name: outboundClusterName(c.ServiceEntry.Spec.Hosts[0], listenPort), ConnectTimeout: &duration.Duration{Seconds: 10}, diff --git a/plugin/redis/util.go b/plugin/redis/util.go index b544c83d7..3ce9b19eb 100644 --- a/plugin/redis/util.go +++ b/plugin/redis/util.go @@ -17,8 +17,6 @@ package redis import ( "math" - spec "github.com/aeraki-mesh/aeraki/api/redis/v1alpha1" - "github.com/aeraki-mesh/aeraki/pkg/model" 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" @@ -27,6 +25,9 @@ import ( "github.com/golang/protobuf/ptypes/wrappers" networking "istio.io/api/networking/v1alpha3" "istio.io/istio/pilot/pkg/networking/util" + + spec "github.com/aeraki-mesh/aeraki/api/redis/v1alpha1" + "github.com/aeraki-mesh/aeraki/pkg/model" ) func getOrCreateIstioMetadata(cluster *cluster.Cluster) *structpb.Struct { @@ -117,7 +118,20 @@ type HostPort struct { func toLbEndpoints(addrs ...HostPort) (endpoints []*endpoint.LbEndpoint) { for _, addr := range addrs { - ep := &endpoint.LbEndpoint{HostIdentifier: &endpoint.LbEndpoint_Endpoint{Endpoint: &endpoint.Endpoint{Address: &envoycore.Address{Address: &envoycore.Address_SocketAddress{SocketAddress: &envoycore.SocketAddress{Address: addr.Host, PortSpecifier: &envoycore.SocketAddress_PortValue{PortValue: addr.Port}}}}}}} + ep := &endpoint.LbEndpoint{ + HostIdentifier: &endpoint.LbEndpoint_Endpoint{ + Endpoint: &endpoint.Endpoint{ + Address: &envoycore.Address{ + Address: &envoycore.Address_SocketAddress{ + SocketAddress: &envoycore.SocketAddress{ + Address: addr.Host, + PortSpecifier: &envoycore.SocketAddress_PortValue{PortValue: addr.Port}, + }, + }, + }, + }, + }, + } endpoints = append(endpoints, ep) } return endpoints diff --git a/plugin/thrift/generator.go b/plugin/thrift/generator.go index d9e1c0307..175bbb029 100644 --- a/plugin/thrift/generator.go +++ b/plugin/thrift/generator.go @@ -15,9 +15,10 @@ package thrift import ( + "istio.io/pkg/log" + "github.com/aeraki-mesh/aeraki/pkg/envoyfilter" "github.com/aeraki-mesh/aeraki/pkg/model" - "istio.io/pkg/log" ) var generatorLog = log.RegisterScope("thrift-generator", "thrift generator", 0) diff --git a/plugin/thrift/route.go b/plugin/thrift/route.go index 57cad8f5a..a0e333e17 100644 --- a/plugin/thrift/route.go +++ b/plugin/thrift/route.go @@ -15,15 +15,17 @@ package thrift import ( - "github.com/aeraki-mesh/aeraki/pkg/model" thrift "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/thrift_proxy/v3" "github.com/golang/protobuf/ptypes/wrappers" networking "istio.io/api/networking/v1alpha3" + + "github.com/aeraki-mesh/aeraki/pkg/model" ) func buildOutboundRouteConfig(context *model.EnvoyFilterContext) (*thrift.RouteConfiguration, error) { var route []*thrift.Route - clusterName := model.BuildClusterName(model.TrafficDirectionOutbound, "", context.ServiceEntry.Spec.Hosts[0], int(context.ServiceEntry.Spec.Ports[0].Number)) + clusterName := model.BuildClusterName(model.TrafficDirectionOutbound, "", + context.ServiceEntry.Spec.Hosts[0], int(context.ServiceEntry.Spec.Ports[0].Number)) if context.VirtualService == nil { route = []*thrift.Route{defaultRoute(clusterName)} @@ -38,7 +40,8 @@ func buildOutboundRouteConfig(context *model.EnvoyFilterContext) (*thrift.RouteC } func buildInboundRouteConfig(context *model.EnvoyFilterContext) (*thrift.RouteConfiguration, error) { - clusterName := model.BuildClusterName(model.TrafficDirectionInbound, "", context.ServiceEntry.Spec.Hosts[0], int(context.ServiceEntry.Spec.Ports[0].Number)) + clusterName := model.BuildClusterName(model.TrafficDirectionInbound, "", + context.ServiceEntry.Spec.Hosts[0], int(context.ServiceEntry.Spec.Ports[0].Number)) return &thrift.RouteConfiguration{ Name: clusterName, @@ -91,7 +94,8 @@ func buildRoute(context *model.EnvoyFilterContext) []*thrift.Route { } func buildSingleCluster(http *networking.HTTPRoute, service *networking.ServiceEntry) *thrift.RouteAction { - clusterName := model.BuildClusterName(model.TrafficDirectionOutbound, http.Route[0].Destination.Subset, service.Hosts[0], int(service.Ports[0].Number)) + clusterName := model.BuildClusterName(model.TrafficDirectionOutbound, http.Route[0].Destination.Subset, + service.Hosts[0], int(service.Ports[0].Number)) return &thrift.RouteAction{ ClusterSpecifier: &thrift.RouteAction_Cluster{ Cluster: clusterName, @@ -104,7 +108,8 @@ func buildWeightedCluster(http *networking.HTTPRoute, service *networking.Servic var totalWeight uint32 for _, route := range http.Route { - clusterName := model.BuildClusterName(model.TrafficDirectionOutbound, route.Destination.Subset, service.Hosts[0], int(service.Ports[0].Number)) + clusterName := model.BuildClusterName(model.TrafficDirectionOutbound, route.Destination.Subset, + service.Hosts[0], int(service.Ports[0].Number)) clusterWeight := &thrift.WeightedCluster_ClusterWeight{ Name: clusterName, Weight: &wrappers.UInt32Value{Value: uint32(route.Weight)}, diff --git a/plugin/thrift/thriftproxy.go b/plugin/thrift/thriftproxy.go index 36935a4b1..8159166fa 100644 --- a/plugin/thrift/thriftproxy.go +++ b/plugin/thrift/thriftproxy.go @@ -15,8 +15,9 @@ package thrift import ( - "github.com/aeraki-mesh/aeraki/pkg/model" thrift "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/thrift_proxy/v3" + + "github.com/aeraki-mesh/aeraki/pkg/model" ) func buildOutboundProxy(context *model.EnvoyFilterContext) *thrift.ThriftProxy { @@ -26,18 +27,7 @@ func buildOutboundProxy(context *model.EnvoyFilterContext) *thrift.ThriftProxy { return nil } - return &thrift.ThriftProxy{ - StatPrefix: model.BuildClusterName(model.TrafficDirectionOutbound, "", - context.ServiceEntry.Spec.Hosts[0], int(context.ServiceEntry.Spec.Ports[0].Number)), - Transport: thrift.TransportType_AUTO_TRANSPORT, - Protocol: thrift.ProtocolType_AUTO_PROTOCOL, - RouteConfig: route, - ThriftFilters: []*thrift.ThriftFilter{ - { - Name: "envoy.filters.thrift.router", - }, - }, - } + return newThriftProxy(context, route, model.TrafficDirectionOutbound) } func buildInboundProxy(context *model.EnvoyFilterContext) *thrift.ThriftProxy { @@ -47,8 +37,13 @@ func buildInboundProxy(context *model.EnvoyFilterContext) *thrift.ThriftProxy { return nil } + return newThriftProxy(context, route, model.TrafficDirectionInbound) +} + +func newThriftProxy(context *model.EnvoyFilterContext, route *thrift.RouteConfiguration, + trafficDirection model.TrafficDirection) *thrift.ThriftProxy { return &thrift.ThriftProxy{ - StatPrefix: model.BuildClusterName(model.TrafficDirectionInbound, "", + StatPrefix: model.BuildClusterName(trafficDirection, "", context.ServiceEntry.Spec.Hosts[0], int(context.ServiceEntry.Spec.Ports[0].Number)), Transport: thrift.TransportType_AUTO_TRANSPORT, Protocol: thrift.ProtocolType_AUTO_PROTOCOL, diff --git a/plugin/zookeeper/zookeeperfilter.go b/plugin/zookeeper/zookeeperfilter.go index c26cf45b6..4514f5c49 100644 --- a/plugin/zookeeper/zookeeperfilter.go +++ b/plugin/zookeeper/zookeeperfilter.go @@ -15,8 +15,9 @@ package zookeeper import ( - "github.com/aeraki-mesh/aeraki/pkg/model" zookeeper "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/zookeeper_proxy/v3" + + "github.com/aeraki-mesh/aeraki/pkg/model" ) func buildOutboundProxy(context *model.EnvoyFilterContext) *zookeeper.ZooKeeperProxy { diff --git a/test/e2e/dubbo/dubbo_test.go b/test/e2e/dubbo/dubbo_test.go index 7278a0178..f35b8999c 100644 --- a/test/e2e/dubbo/dubbo_test.go +++ b/test/e2e/dubbo/dubbo_test.go @@ -20,8 +20,9 @@ import ( "testing" "time" + "istio.io/pkg/log" + "github.com/aeraki-mesh/aeraki/test/e2e/util" - "istio.io/pkg/log" ) func TestMain(m *testing.M) { diff --git a/test/e2e/metaprotocol/metaprotocol_test.go b/test/e2e/metaprotocol/metaprotocol_test.go index d53d40fc2..6be0eeb70 100644 --- a/test/e2e/metaprotocol/metaprotocol_test.go +++ b/test/e2e/metaprotocol/metaprotocol_test.go @@ -20,8 +20,9 @@ import ( "testing" "time" - "github.com/aeraki-mesh/aeraki/test/e2e/util" "istio.io/pkg/log" + + "github.com/aeraki-mesh/aeraki/test/e2e/util" ) func TestMain(m *testing.M) { diff --git a/test/e2e/redis/redis_test.go b/test/e2e/redis/redis_test.go index 637c55284..25afbd68f 100644 --- a/test/e2e/redis/redis_test.go +++ b/test/e2e/redis/redis_test.go @@ -23,8 +23,9 @@ import ( "testing" "time" - "github.com/aeraki-mesh/aeraki/test/e2e/util" "k8s.io/client-go/util/jsonpath" + + "github.com/aeraki-mesh/aeraki/test/e2e/util" ) func TestMain(m *testing.M) { diff --git a/test/e2e/thrift/thrift_test.go b/test/e2e/thrift/thrift_test.go index 0080140fb..8ac0008c3 100644 --- a/test/e2e/thrift/thrift_test.go +++ b/test/e2e/thrift/thrift_test.go @@ -20,8 +20,9 @@ import ( "testing" "time" - "github.com/aeraki-mesh/aeraki/test/e2e/util" "istio.io/pkg/log" + + "github.com/aeraki-mesh/aeraki/test/e2e/util" ) func TestMain(m *testing.M) {