├── .github └── workflows │ ├── ci.yaml │ └── publish.yaml ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── cmd └── consul2istio │ └── main.go ├── doc └── consul2istio.png ├── docker └── Dockerfile ├── go.mod ├── go.sum ├── k8s ├── consul.yaml ├── consul2istio.yaml └── demo.yaml └── pkg ├── constants └── constants.go ├── controller.go └── serviceregistry ├── consul ├── controller.go ├── controller_test.go ├── conversion.go ├── conversion_test.go ├── monitor.go ├── monitor_test.go └── options.go └── registry.go /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: ci 3 | on: [push, pull_request] 4 | jobs: 5 | build-and-test: 6 | name: build and test 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Check out code 10 | uses: actions/checkout@v2 11 | - name: Setup Go 12 | uses: actions/setup-go@v1 13 | with: 14 | go-version: 1.19 15 | - name: Build 16 | run: go build -race ./... 17 | - name: Test 18 | run: go test -race `go list ./... | grep -v e2e` 19 | go-lint: 20 | name: go-lint 21 | runs-on: ubuntu-latest 22 | steps: 23 | - name: Check out code into the Go module directory 24 | uses: actions/checkout@v2 25 | - name: golint 26 | uses: Jerome1337/golint-action@v1.0.2 27 | with: 28 | golint-path: './...' 29 | - name: Setup Go 30 | uses: actions/setup-go@v1 31 | with: 32 | go-version: 1.19 33 | - name: golangci-lint 34 | uses: golangci/golangci-lint-action@v3.1.0 35 | with: 36 | args: --timeout=10m --tests="false" 37 | version: v1.47.0 38 | style-check: 39 | name: gofmt and goimports 40 | runs-on: ubuntu-latest 41 | steps: 42 | - name: Check out code 43 | uses: actions/checkout@v2 44 | - name: Setup Go 45 | uses: actions/setup-go@v2 46 | with: 47 | go-version: 1.19 48 | - name: Install dependencies 49 | run: | 50 | go version 51 | go install golang.org/x/tools/cmd/goimports@latest 52 | - name: gofmt and goimports 53 | run: make style-check 54 | checkgomod: 55 | name: check go.mod and go.sum 56 | runs-on: ubuntu-latest 57 | steps: 58 | - uses: actions/checkout@v2 59 | - uses: actions/setup-go@v1 60 | with: 61 | go-version: 1.19 62 | - run: go mod tidy 63 | - name: Check for changes in go.mod or go.sum 64 | run: | 65 | git diff --name-only --exit-code go.mod || ( echo "Run go tidy" && false ) 66 | git diff --name-only --exit-code go.sum || ( echo "Run go tidy" && false ) 67 | -------------------------------------------------------------------------------- /.github/workflows/publish.yaml: -------------------------------------------------------------------------------- 1 | name: Auto Build and Push image 2 | 3 | on: 4 | create 5 | 6 | jobs: 7 | publish_image: 8 | name: Build and Push consul2istio image 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Check out code 12 | uses: actions/checkout@v2.3.5 13 | with: 14 | submodules: recursive 15 | 16 | - name: Extract Tags name 17 | if: ${{ startsWith(github.ref, 'refs/tags/') }} 18 | id: tag_env 19 | shell: bash 20 | run: | 21 | echo "##[set-output name=version;]$(echo ${GITHUB_REF##*/})" 22 | 23 | - name: Extract Tags Type 24 | if: ${{ startsWith(github.ref, 'refs/tags/') }} 25 | id: tag_type 26 | shell: bash 27 | run: | 28 | echo "##[set-output name=version;]$(echo ${GITHUB_REF#refs/tags/})" 29 | 30 | - name: Login to Docker Hub 31 | uses: docker/login-action@v1 32 | with: 33 | username: ${{ secrets.DOCKERHUB_USERNAME }} 34 | password: ${{ secrets.DOCKERHUB_TOKEN }} 35 | 36 | - name: Build consul2istio Docker Image 37 | if: ${{ startsWith(steps.tag_type.outputs.version, 'consul2istio/') }} 38 | run: | 39 | make docker-build tag=${{ steps.tag_env.outputs.version }} 40 | 41 | - name: Push Aeraki Docker image 42 | if: ${{ startsWith(steps.tag_type.outputs.version, 'aeraki/') }} 43 | run: | 44 | docker push ghcr.io/aeraki-mesh/consul2istio:${{ steps.tag_env.outputs.version }} 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/.DS_Store 2 | debug 3 | out 4 | .idea 5 | tmp 6 | .vscode 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "{}" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright 2016-2020 Istio Authors 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Go parameters 2 | GOCMD?=go 3 | GOBUILD?=$(GOCMD) build 4 | GOCLEAN?=$(GOCMD) clean 5 | GOTEST?=$(GOCMD) test 6 | GOGET?=$(GOCMD) get 7 | GOBIN?=$(GOPATH)/bin 8 | 9 | OUT?=./out 10 | IMAGE_REPO?=ghcr.io/aeraki-mesh 11 | IMAGE_NAME?=consul2istio 12 | IMAGE_TAG?=latest 13 | IMAGE?=$(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) 14 | MAIN_PATH=./cmd/consul2istio/main.go 15 | IMAGE_OS?=linux 16 | IMAGE_ARCH?=amd64 17 | IMAGE_DOCKERFILE_PATH?=docker/Dockerfile 18 | 19 | build: test 20 | CGO_ENABLED=0 GOOS=$(IMAGE_OS) GOARCH=$(IMAGE_ARCH) $(GOBUILD) -o $(OUT)/$(IMAGE_ARCH)/$(IMAGE_OS)/$(IMAGE_NAME) $(MAIN_PATH) 21 | docker-build: build 22 | docker build --build-arg CONSUL2ISTIO_BIN_DIR=${OUT} --build-arg ARCH=${IMAGE_ARCH} --build-arg OS=${IMAGE_OS} \ 23 | --no-cache --platform=${IMAGE_OS}/${IMAGE_ARCH} -t ${IMAGE} -f ${IMAGE_DOCKERFILE_PATH} . 24 | docker-push: docker-build 25 | docker push $(IMAGE) 26 | style-check: 27 | gofmt -l -d ./ 28 | goimports -l -d ./ 29 | lint: 30 | golangci-lint run -v 31 | test: 32 | go test --race ./... 33 | clean: 34 | rm -rf $(OUT) 35 | 36 | .PHONY: build docker-build docker-push clean 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Consul2Istio 2 | 3 | [![CI Tests](https://github.com/aeraki-framework/consul2istio/workflows/ci/badge.svg?branch=master)](https://github.com/aeraki-framework/consul2istio/actions?query=branch%3Amaster+event%3Apush+workflow%3A%22ci%22) 4 | 5 | Consul2istio watches Consul catalog and synchronize all the Consul services to Istio. 6 | 7 | Consul2istio will create a ServiceEntry resource for each service in the Consul catalog. 8 | 9 | ![ consul2istio ](doc/consul2istio.png) 10 | 11 | ## example 12 | 13 | Firstly, deploy consul and consul2istio to your Kubernetes cluster. 14 | 15 | ```bash 16 | kubectl apply -f k8s/consul.yaml 17 | kubectl apply -f k8s/consul2istio.yaml 18 | ``` 19 | 20 | Secondly, deploy consumer-demo and provider-demo to your Kubernetes cluster. 21 | The consumer-demo service *9999/echo-rest/* to us. 22 | 23 | ```bash 24 | kubectl apply -f k8s/sample.yaml 25 | ``` 26 | 27 | Finally, request from consumer-demo to provider-demo. 28 | ``` 29 | kubectl get pod -owide 30 | NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES 31 | consul-7bd648d9f-qpkrj 1/1 Running 0 58m 10.0.1.80 192.168.1.17 32 | consul2istio-75c9dd98fd-cqglr 1/1 Running 0 9m32s 10.0.1.89 192.168.1.17 33 | consumer-demo-66766c8d78-5stvw 2/2 Running 0 9m54s 10.0.1.88 192.168.1.17 34 | provider-demo-v1-59ddd86974-z4sln 2/2 Running 0 9m54s 10.0.1.86 192.168.1.17 35 | provider-demo-v2-5ccf64cdfd-dxdj5 2/2 Running 0 9m54s 10.0.1.87 192.168.1.17 36 | ``` 37 | 38 | the result of request. 39 | ``` 40 | kubectl exec -it consumer-demo-66766c8d78-5stvw -c istio-proxy -- curl 10.0.1.88:9999/echo-rest/aaaa 41 | echo() -> ip [ 10.0.1.86 ] param [ aaaa ] 42 | ``` 43 | -------------------------------------------------------------------------------- /cmd/consul2istio/main.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package main 16 | 17 | import ( 18 | "flag" 19 | "os" 20 | "os/signal" 21 | "syscall" 22 | 23 | "istio.io/pkg/log" 24 | 25 | "github.com/aeraki-framework/consul2istio/pkg" 26 | "github.com/aeraki-framework/consul2istio/pkg/constants" 27 | "github.com/aeraki-framework/consul2istio/pkg/serviceregistry/consul" 28 | ) 29 | 30 | func main() { 31 | args := consul.NewConsulBootStrapArgs() 32 | 33 | flag.StringVar(&args.ConsulAddress, "consulAddress", constants.DefaultConsulAddress, "Consul Address") 34 | flag.StringVar(&args.Namespace, "namespace", constants.ConfigRootNS, "namespace") 35 | flag.StringVar(&args.FQDN, "fqdn", "", "The FQDN for consul service") 36 | flag.BoolVar(&args.EnableDefaultPort, "enableDefaultPort", true, 37 | "The flag to start default port for consul service") 38 | 39 | flag.Parse() 40 | 41 | flag.VisitAll(func(flag *flag.Flag) { 42 | log.Infof("consul2istio parameter: %s: %v", flag.Name, flag.Value) 43 | }) 44 | 45 | initArgsWithEnv(args) 46 | log.Infof("consul2istio bootstrap parameter: %v", args) 47 | 48 | controller := pkg.NewController(args) 49 | 50 | // Create the stop channel for all of the servers. 51 | stopChan := make(chan struct{}, 1) 52 | err := controller.Run(stopChan) 53 | if err != nil { 54 | log.Errorf("Fialed to run controller: %v", err) 55 | return 56 | } 57 | 58 | signalChan := make(chan os.Signal, 1) 59 | signal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM) 60 | <-signalChan 61 | stopChan <- struct{}{} 62 | } 63 | 64 | func initArgsWithEnv(args *consul.BootStrapArgs) { 65 | consulAddress := os.Getenv("consulAddress") 66 | if consulAddress != "" { 67 | args.ConsulAddress = consulAddress 68 | } 69 | 70 | namespace := os.Getenv("namespace") 71 | if namespace != "" { 72 | args.Namespace = namespace 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /doc/consul2istio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aeraki-mesh/consul2istio/4d7043282512f983a3e32f7e732e9fef974ae60c/doc/consul2istio.png -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM alpine:3.17 16 | 17 | ARG CONSUL2ISTIO_BIN_DIR 18 | ARG ARCH 19 | ARG OS 20 | 21 | RUN apk update && \ 22 | apk add curl 23 | 24 | COPY ${CONSUL2ISTIO_BIN_DIR}/${ARCH}/${OS}/consul2istio /usr/local/bin/ 25 | ENTRYPOINT /usr/local/bin/consul2istio 26 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/aeraki-framework/consul2istio 2 | 3 | go 1.19 4 | 5 | // https://github.com/containerd/containerd/issues/5781 6 | exclude k8s.io/kubernetes v1.13.0 7 | 8 | // Client-go does not handle different versions of mergo due to some breaking changes - use the matching version 9 | replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.5 10 | 11 | require ( 12 | github.com/hashicorp/consul/api v1.8.1 13 | google.golang.org/protobuf v1.28.1 14 | istio.io/api v0.0.0-20230518153929-d0aebaa77ab8 15 | istio.io/client-go v1.16.4-0.20230518154329-f75cb9ff8e52 16 | istio.io/istio v0.0.0-20230519000352-ae8d5164776c 17 | istio.io/pkg v0.0.0-20221107183613-574f8d141535 18 | k8s.io/apimachinery v0.25.2 19 | sigs.k8s.io/controller-runtime v0.13.0 20 | ) 21 | 22 | require ( 23 | cloud.google.com/go v0.105.0 // indirect 24 | cloud.google.com/go/compute v1.14.0 // indirect 25 | cloud.google.com/go/compute/metadata v0.2.3 // indirect 26 | cloud.google.com/go/logging v1.6.1 // indirect 27 | cloud.google.com/go/longrunning v0.3.0 // indirect 28 | github.com/PuerkitoBio/purell v1.1.1 // indirect 29 | github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect 30 | github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da // indirect 31 | github.com/davecgh/go-spew v1.1.1 // indirect 32 | github.com/emicklei/go-restful/v3 v3.8.0 // indirect 33 | github.com/fatih/color v1.13.0 // indirect 34 | github.com/go-logr/logr v1.2.3 // indirect 35 | github.com/go-openapi/jsonpointer v0.19.5 // indirect 36 | github.com/go-openapi/jsonreference v0.19.6 // indirect 37 | github.com/go-openapi/swag v0.21.1 // indirect 38 | github.com/gogo/protobuf v1.3.2 // indirect 39 | github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect 40 | github.com/golang/protobuf v1.5.2 // indirect 41 | github.com/google/gnostic v0.5.7-v3refs // indirect 42 | github.com/google/go-cmp v0.5.9 // indirect 43 | github.com/google/gofuzz v1.2.0 // indirect 44 | github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect 45 | github.com/googleapis/gax-go/v2 v2.7.0 // indirect 46 | github.com/hashicorp/errwrap v1.1.0 // indirect 47 | github.com/hashicorp/go-cleanhttp v0.5.1 // indirect 48 | github.com/hashicorp/go-hclog v0.12.0 // indirect 49 | github.com/hashicorp/go-immutable-radix v1.0.0 // indirect 50 | github.com/hashicorp/go-multierror v1.1.1 // indirect 51 | github.com/hashicorp/go-rootcerts v1.0.2 // indirect 52 | github.com/hashicorp/golang-lru v0.5.4 // indirect 53 | github.com/hashicorp/serf v0.9.5 // indirect 54 | github.com/imdario/mergo v0.3.12 // indirect 55 | github.com/inconshreveable/mousetrap v1.0.0 // indirect 56 | github.com/josharian/intern v1.0.0 // indirect 57 | github.com/json-iterator/go v1.1.12 // indirect 58 | github.com/mailru/easyjson v0.7.7 // indirect 59 | github.com/mattn/go-colorable v0.1.12 // indirect 60 | github.com/mattn/go-isatty v0.0.16 // indirect 61 | github.com/mitchellh/go-homedir v1.1.0 // indirect 62 | github.com/mitchellh/mapstructure v1.5.0 // indirect 63 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 64 | github.com/modern-go/reflect2 v1.0.2 // indirect 65 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect 66 | github.com/natefinch/lumberjack v2.0.0+incompatible // indirect 67 | github.com/spf13/cobra v1.5.0 // indirect 68 | github.com/spf13/pflag v1.0.5 // indirect 69 | go.opencensus.io v0.24.0 // indirect 70 | go.uber.org/atomic v1.10.0 // indirect 71 | go.uber.org/multierr v1.8.0 // indirect 72 | go.uber.org/zap v1.22.0 // indirect 73 | golang.org/x/net v0.17.0 // indirect 74 | golang.org/x/oauth2 v0.3.0 // indirect 75 | golang.org/x/sync v0.1.0 // indirect 76 | golang.org/x/sys v0.13.0 // indirect 77 | golang.org/x/term v0.13.0 // indirect 78 | golang.org/x/text v0.13.0 // indirect 79 | golang.org/x/time v0.3.0 // indirect 80 | google.golang.org/api v0.103.0 // indirect 81 | google.golang.org/appengine v1.6.7 // indirect 82 | google.golang.org/genproto v0.0.0-20221202195650-67e5cbc046fd // indirect 83 | google.golang.org/grpc v1.50.1 // indirect 84 | gopkg.in/inf.v0 v0.9.1 // indirect 85 | gopkg.in/yaml.v2 v2.4.0 // indirect 86 | gopkg.in/yaml.v3 v3.0.1 // indirect 87 | k8s.io/api v0.25.2 // indirect 88 | k8s.io/client-go v0.25.2 // indirect 89 | k8s.io/klog/v2 v2.80.1 // indirect 90 | k8s.io/kube-openapi v0.0.0-20220803164354-a70c9af30aea // indirect 91 | k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73 // indirect 92 | sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect 93 | sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect 94 | sigs.k8s.io/yaml v1.3.0 // indirect 95 | ) 96 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 2 | cloud.google.com/go v0.105.0 h1:DNtEKRBAAzeS4KyIory52wWHuClNaXJ5x1F7xa4q+5Y= 3 | cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFOKM= 4 | cloud.google.com/go/compute v1.14.0 h1:hfm2+FfxVmnRlh6LpB7cg1ZNU+5edAHmW679JePztk0= 5 | cloud.google.com/go/compute v1.14.0/go.mod h1:YfLtxrj9sU4Yxv+sXzZkyPjEyPBZfXHUvjxega5vAdo= 6 | cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= 7 | cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= 8 | cloud.google.com/go/logging v1.6.1 h1:ZBsZK+JG+oCDT+vaxwqF2egKNRjz8soXiS6Xv79benI= 9 | cloud.google.com/go/logging v1.6.1/go.mod h1:5ZO0mHHbvm8gEmeEUHrmDlTDSu5imF6MUP9OfilNXBw= 10 | cloud.google.com/go/longrunning v0.3.0 h1:NjljC+FYPV3uh5/OwWT6pVU+doBqMg2x/rZlE+CamDs= 11 | cloud.google.com/go/longrunning v0.3.0/go.mod h1:qth9Y41RRSUE69rDcOn6DdK3HfQfsUI0YSmW3iIlLJc= 12 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 13 | github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I= 14 | github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= 15 | github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= 16 | github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= 17 | github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= 18 | github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= 19 | github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I= 20 | github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= 21 | github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= 22 | github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= 23 | github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= 24 | github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= 25 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 26 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 27 | github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= 28 | github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 29 | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 30 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 31 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 32 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 33 | github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= 34 | github.com/emicklei/go-restful/v3 v3.8.0 h1:eCZ8ulSerjdAiaNpF7GxXIE7ZCMo1moN1qX+S609eVw= 35 | github.com/emicklei/go-restful/v3 v3.8.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= 36 | github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 37 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 38 | github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= 39 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 40 | github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= 41 | github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= 42 | github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= 43 | github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= 44 | github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= 45 | github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= 46 | github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= 47 | github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= 48 | github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= 49 | github.com/go-logr/zapr v1.2.3 h1:a9vnzlIBPQBBkeaR9IuMUfmVOrQlkoC4YfPoFkX3T7A= 50 | github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= 51 | github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= 52 | github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= 53 | github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs= 54 | github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= 55 | github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= 56 | github.com/go-openapi/swag v0.21.1 h1:wm0rhTb5z7qpJRHBdPOMuY4QjVUMbF6/kwoYeRAOrKU= 57 | github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= 58 | github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= 59 | github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= 60 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 61 | github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 62 | github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= 63 | github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 64 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 65 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 66 | github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 67 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 68 | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= 69 | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= 70 | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= 71 | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= 72 | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= 73 | github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= 74 | github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 75 | github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= 76 | github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= 77 | github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= 78 | github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= 79 | github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= 80 | github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= 81 | github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= 82 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 83 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 84 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 85 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 86 | github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 87 | github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 88 | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 89 | github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= 90 | github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 91 | github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= 92 | github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= 93 | github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= 94 | github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 95 | github.com/googleapis/enterprise-certificate-proxy v0.2.0 h1:y8Yozv7SZtlU//QXbezB6QkpuE6jMD2/gfzk4AftXjs= 96 | github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= 97 | github.com/googleapis/gax-go/v2 v2.7.0 h1:IcsPKeInNvYi7eqSaDjiZqDDKu5rsmunY0Y1YupQSSQ= 98 | github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= 99 | github.com/hashicorp/consul/api v1.8.1 h1:BOEQaMWoGMhmQ29fC26bi0qb7/rId9JzZP2V0Xmx7m8= 100 | github.com/hashicorp/consul/api v1.8.1/go.mod h1:sDjTOq0yUyv5G4h+BqSea7Fn6BU+XbolEz1952UB+mk= 101 | github.com/hashicorp/consul/sdk v0.7.0 h1:H6R9d008jDcHPQPAqPNuydAshJ4v5/8URdFnUvK/+sc= 102 | github.com/hashicorp/consul/sdk v0.7.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM= 103 | github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= 104 | github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= 105 | github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= 106 | github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= 107 | github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= 108 | github.com/hashicorp/go-hclog v0.12.0 h1:d4QkX8FRTYaKaCZBoXYY8zJX2BXjWxurN/GA2tkrmZM= 109 | github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= 110 | github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= 111 | github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= 112 | github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4= 113 | github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= 114 | github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= 115 | github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= 116 | github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= 117 | github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= 118 | github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= 119 | github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= 120 | github.com/hashicorp/go-sockaddr v1.0.0 h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sLo0ICXs= 121 | github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= 122 | github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= 123 | github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 124 | github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= 125 | github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 126 | github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= 127 | github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= 128 | github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= 129 | github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= 130 | github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= 131 | github.com/hashicorp/memberlist v0.2.2 h1:5+RffWKwqJ71YPu9mWsF7ZOscZmwfasdA8kbdC7AO2g= 132 | github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= 133 | github.com/hashicorp/serf v0.9.5 h1:EBWvyu9tcRszt3Bxp3KNssBMP1KuHWyO51lz9+786iM= 134 | github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= 135 | github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q= 136 | github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= 137 | github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= 138 | github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= 139 | github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= 140 | github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= 141 | github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= 142 | github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= 143 | github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= 144 | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= 145 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 146 | github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= 147 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 148 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 149 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 150 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 151 | github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= 152 | github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= 153 | github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= 154 | github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= 155 | github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= 156 | github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= 157 | github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= 158 | github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= 159 | github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= 160 | github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= 161 | github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= 162 | github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= 163 | github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= 164 | github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= 165 | github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= 166 | github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= 167 | github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= 168 | github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= 169 | github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= 170 | github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= 171 | github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= 172 | github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA= 173 | github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= 174 | github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= 175 | github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= 176 | github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= 177 | github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= 178 | github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= 179 | github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= 180 | github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= 181 | github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= 182 | github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 183 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= 184 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 185 | github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= 186 | github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= 187 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= 188 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= 189 | github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM= 190 | github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk= 191 | github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= 192 | github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= 193 | github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= 194 | github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= 195 | github.com/onsi/gomega v1.20.2 h1:8uQq0zMgLEfa0vRrrBgaJF2gyW9Da9BmfGV+OyUzfkY= 196 | github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs= 197 | github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= 198 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 199 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 200 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 201 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 202 | github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= 203 | github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= 204 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 205 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 206 | github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= 207 | github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= 208 | github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= 209 | github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= 210 | github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= 211 | github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= 212 | github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= 213 | github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 214 | github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= 215 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 216 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 217 | github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 218 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 219 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 220 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 221 | github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= 222 | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 223 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 224 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 225 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 226 | github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= 227 | github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 228 | github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 229 | github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 230 | go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= 231 | go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= 232 | go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= 233 | go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= 234 | go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= 235 | go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= 236 | go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8= 237 | go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= 238 | go.uber.org/zap v1.22.0 h1:Zcye5DUgBloQ9BaT4qc9BnjOFog5TvBSAGkJ3Nf70c0= 239 | go.uber.org/zap v1.22.0/go.mod h1:H4siCOZOrAolnUPJEkfaSjDqyP+BDS0DdDWzwcgt3+U= 240 | golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 241 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 242 | golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= 243 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 244 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 245 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 246 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 247 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 248 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 249 | golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 250 | golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 251 | golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= 252 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 253 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 254 | golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 255 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 256 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 257 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 258 | golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= 259 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 260 | golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 261 | golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 262 | golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 263 | golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 264 | golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= 265 | golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= 266 | golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 267 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 268 | golang.org/x/oauth2 v0.3.0 h1:6l90koy8/LaBLmLu8jpHeHexzMwEita0zFfYlggy2F8= 269 | golang.org/x/oauth2 v0.3.0/go.mod h1:rQrIauxkUhJ6CuwEXwymO2/eh4xz2ZWF1nBkcxS+tGk= 270 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 271 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 272 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 273 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 274 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 275 | golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 276 | golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= 277 | golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 278 | golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 279 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 280 | golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 281 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 282 | golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 283 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 284 | golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 285 | golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 286 | golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 287 | golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 288 | golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 289 | golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 290 | golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 291 | golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 292 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 293 | golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 294 | golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 295 | golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 296 | golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 297 | golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= 298 | golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 299 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 300 | golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= 301 | golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= 302 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 303 | golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= 304 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 305 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 306 | golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= 307 | golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= 308 | golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= 309 | golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 310 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 311 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 312 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 313 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 314 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 315 | golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 316 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 317 | golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= 318 | golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 319 | golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= 320 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 321 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 322 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 323 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 324 | google.golang.org/api v0.103.0 h1:9yuVqlu2JCvcLg9p8S3fcFLZij8EPSyvODIY1rkMizQ= 325 | google.golang.org/api v0.103.0/go.mod h1:hGtW6nK1AC+d9si/UBhw8Xli+QMOf6xyNAyJw4qU9w0= 326 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 327 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 328 | google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= 329 | google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= 330 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 331 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 332 | google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= 333 | google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 334 | google.golang.org/genproto v0.0.0-20221202195650-67e5cbc046fd h1:OjndDrsik+Gt+e6fs45z9AxiewiKyLKYpA45W5Kpkks= 335 | google.golang.org/genproto v0.0.0-20221202195650-67e5cbc046fd/go.mod h1:cTsE614GARnxrLsqKREzmNYJACSWWpAWdNMwnD7c2BE= 336 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 337 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 338 | google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= 339 | google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 340 | google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= 341 | google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= 342 | google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= 343 | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= 344 | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= 345 | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= 346 | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= 347 | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= 348 | google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 349 | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 350 | google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 351 | google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= 352 | google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= 353 | google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= 354 | google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= 355 | google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= 356 | google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= 357 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 358 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 359 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 360 | gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= 361 | gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 362 | gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= 363 | gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= 364 | gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= 365 | gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= 366 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 367 | gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 368 | gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 369 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 370 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 371 | gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 372 | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 373 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 374 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 375 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 376 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 377 | istio.io/api v0.0.0-20230518153929-d0aebaa77ab8 h1:i86IfBRpZ5MqqiAOx7DbVkY4fHY36/crm6/12Bm7sKs= 378 | istio.io/api v0.0.0-20230518153929-d0aebaa77ab8/go.mod h1:hQkF0Q19MCmfOTre/Sg4KvrwwETq45oaFplnBm2p4j8= 379 | istio.io/client-go v1.16.4-0.20230518154329-f75cb9ff8e52 h1:S9Y35C+p1MtxK7Sr+SYU06baOfEIHi3pgHo5bnU/Vgo= 380 | istio.io/client-go v1.16.4-0.20230518154329-f75cb9ff8e52/go.mod h1:/Q5XkHUdYck8qQTsiHXnAthMuvxukBzeviAUgje335U= 381 | istio.io/istio v0.0.0-20230519000352-ae8d5164776c h1:Z25ZiElSql9rihCr3T7xivF69ErimeVykur76KV7JSc= 382 | istio.io/istio v0.0.0-20230519000352-ae8d5164776c/go.mod h1:AeO7WGaJrM0iqGzMEf53Hwpim4I3xvL9O6nGT6bat1w= 383 | istio.io/pkg v0.0.0-20221107183613-574f8d141535 h1:kmbIDhOWCyVV3o80NR2O9SiTDoN5sXjE+AtABDQrOxs= 384 | istio.io/pkg v0.0.0-20221107183613-574f8d141535/go.mod h1:Rom8KLVw76XZdvGZet+54VPZswL/XqX8x4MBH6khECw= 385 | k8s.io/api v0.25.2 h1:v6G8RyFcwf0HR5jQGIAYlvtRNrxMJQG1xJzaSeVnIS8= 386 | k8s.io/api v0.25.2/go.mod h1:qP1Rn4sCVFwx/xIhe+we2cwBLTXNcheRyYXwajonhy0= 387 | k8s.io/apimachinery v0.25.2 h1:WbxfAjCx+AeN8Ilp9joWnyJ6xu9OMeS/fsfjK/5zaQs= 388 | k8s.io/apimachinery v0.25.2/go.mod h1:hqqA1X0bsgsxI6dXsJ4HnNTBOmJNxyPp8dw3u2fSHwA= 389 | k8s.io/client-go v0.25.2 h1:SUPp9p5CwM0yXGQrwYurw9LWz+YtMwhWd0GqOsSiefo= 390 | k8s.io/client-go v0.25.2/go.mod h1:i7cNU7N+yGQmJkewcRD2+Vuj4iz7b30kI8OcL3horQ4= 391 | k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= 392 | k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= 393 | k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= 394 | k8s.io/kube-openapi v0.0.0-20220803164354-a70c9af30aea h1:3QOH5+2fGsY8e1qf+GIFpg+zw/JGNrgyZRQR7/m6uWg= 395 | k8s.io/kube-openapi v0.0.0-20220803164354-a70c9af30aea/go.mod h1:C/N6wCaBHeBHkHUesQOQy2/MZqGgMAFPqGsGQLdbZBU= 396 | k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73 h1:H9TCJUUx+2VA0ZiD9lvtaX8fthFsMoD+Izn93E/hm8U= 397 | k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= 398 | sigs.k8s.io/controller-runtime v0.13.0 h1:iqa5RNciy7ADWnIc8QxCbOX5FEKVR3uxVxKHRMc2WIQ= 399 | sigs.k8s.io/controller-runtime v0.13.0/go.mod h1:Zbz+el8Yg31jubvAEyglRZGdLAjplZl+PgtYNI6WNTI= 400 | sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k= 401 | sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= 402 | sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= 403 | sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= 404 | sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= 405 | sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= 406 | -------------------------------------------------------------------------------- /k8s/consul.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: consul 5 | labels: 6 | app: consul 7 | spec: 8 | selector: 9 | matchLabels: 10 | app: consul 11 | replicas: 1 12 | template: 13 | metadata: 14 | annotations: 15 | sidecar.istio.io/inject: "false" 16 | labels: 17 | app: consul 18 | spec: 19 | containers: 20 | - name: consul 21 | image: consul:1.9.17 22 | ports: 23 | - containerPort: 8500 24 | --- 25 | apiVersion: v1 26 | kind: Service 27 | metadata: 28 | name: consul 29 | spec: 30 | selector: 31 | app: consul 32 | ports: 33 | - name: tcp 34 | port: 8500 35 | protocol: TCP 36 | targetPort: 8500 37 | -------------------------------------------------------------------------------- /k8s/consul2istio.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: consul2istio 6 | labels: 7 | app: consul2istio 8 | spec: 9 | selector: 10 | matchLabels: 11 | app: consul2istio 12 | replicas: 1 13 | template: 14 | metadata: 15 | annotations: 16 | sidecar.istio.io/inject: "false" 17 | labels: 18 | app: consul2istio 19 | spec: 20 | serviceAccountName: consul2istio 21 | containers: 22 | - name: consul2istio 23 | image: ghcr.io/aeraki-mesh/consul2istio:latest 24 | args: 25 | - /usr/local/bin/consul2istio 26 | - --enableDefaultPort=true 27 | imagePullPolicy: Always 28 | env: 29 | - name: consulAddress 30 | value: "consul:8500" 31 | --- 32 | apiVersion: v1 33 | kind: ServiceAccount 34 | metadata: 35 | name: consul2istio 36 | --- 37 | apiVersion: rbac.authorization.k8s.io/v1 38 | kind: ClusterRole 39 | metadata: 40 | labels: 41 | app: consul2istio 42 | name: consul2istio 43 | rules: 44 | - apiGroups: 45 | - networking.istio.io 46 | resources: 47 | - serviceentries 48 | verbs: 49 | - get 50 | - watch 51 | - list 52 | - update 53 | - patch 54 | - create 55 | - delete 56 | --- 57 | apiVersion: rbac.authorization.k8s.io/v1 58 | kind: ClusterRoleBinding 59 | metadata: 60 | labels: 61 | app: consul2istio 62 | name: consul2istio 63 | roleRef: 64 | apiGroup: rbac.authorization.k8s.io 65 | kind: ClusterRole 66 | name: consul2istio 67 | subjects: 68 | - kind: ServiceAccount 69 | name: consul2istio 70 | namespace: default -------------------------------------------------------------------------------- /k8s/demo.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: provider-demo-v1 5 | labels: 6 | app: provider-demo 7 | spec: 8 | selector: 9 | matchLabels: 10 | app: provider-demo 11 | replicas: 1 12 | template: 13 | metadata: 14 | labels: 15 | app: provider-demo 16 | version: v1 17 | spec: 18 | containers: 19 | - name: provider-demo 20 | image: docker.io/tanjunchen/provider-demo:jd 21 | imagePullPolicy: Always 22 | ports: 23 | - containerPort: 10001 24 | --- 25 | apiVersion: apps/v1 26 | kind: Deployment 27 | metadata: 28 | name: provider-demo-v2 29 | labels: 30 | app: provider-demo 31 | spec: 32 | selector: 33 | matchLabels: 34 | app: provider-demo 35 | replicas: 1 36 | template: 37 | metadata: 38 | labels: 39 | app: provider-demo 40 | version: v2 41 | spec: 42 | containers: 43 | - name: provider-demo-v2 44 | image: docker.io/tanjunchen/provider-demo:jd 45 | imagePullPolicy: Always 46 | ports: 47 | - containerPort: 10001 48 | --- 49 | apiVersion: apps/v1 50 | kind: Deployment 51 | metadata: 52 | name: consumer-demo 53 | labels: 54 | app: consumer-demo 55 | spec: 56 | selector: 57 | matchLabels: 58 | app: consumer-demo 59 | replicas: 1 60 | template: 61 | metadata: 62 | labels: 63 | app: consumer-demo 64 | spec: 65 | containers: 66 | - name: consumer-demo 67 | image: docker.io/tanjunchen/consumer-demo:jd 68 | imagePullPolicy: Always 69 | ports: 70 | - containerPort: 9999 -------------------------------------------------------------------------------- /pkg/constants/constants.go: -------------------------------------------------------------------------------- 1 | package constants 2 | 3 | import "time" 4 | 5 | const ( 6 | // DefaultConsulAddress is the default address of the consul 7 | DefaultConsulAddress = "http://127.0.0.1:8500" 8 | 9 | // ConfigRootNS is the root config root namespace 10 | ConfigRootNS = "istio-system" 11 | ) 12 | 13 | const ( 14 | // DebounceAfter is the delay added to events to wait after a registry event for debouncing. 15 | // This will delay the push by at least this interval, plus the time getting subsequent events. 16 | // If no change is detected the push will happen, otherwise we'll keep delaying until things settle. 17 | DebounceAfter = 500 * time.Millisecond 18 | 19 | // DebounceMax is the maximum time to wait for events while debouncing. 20 | // Defaults to 10 seconds. If events keep showing up with no break for this time, we'll trigger a push. 21 | DebounceMax = 10 * time.Second 22 | 23 | // AerakiFieldManager is the FileldManager for Aeraki CRDs 24 | AerakiFieldManager = "Aeraki" 25 | 26 | // RegistryConsul is the registry category for Aeraki 27 | RegistryConsul = "consul" 28 | ) 29 | -------------------------------------------------------------------------------- /pkg/controller.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki Authors 2 | // 3 | // This file is mainly inspired by Istio xDS server 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | package pkg 18 | 19 | import ( 20 | "context" 21 | "fmt" 22 | "time" 23 | 24 | "google.golang.org/protobuf/proto" 25 | istio "istio.io/api/networking/v1alpha3" 26 | "istio.io/client-go/pkg/apis/networking/v1alpha3" 27 | versionedclient "istio.io/client-go/pkg/clientset/versioned" 28 | "istio.io/pkg/log" 29 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | "sigs.k8s.io/controller-runtime/pkg/client/config" 31 | 32 | "github.com/aeraki-framework/consul2istio/pkg/constants" 33 | "github.com/aeraki-framework/consul2istio/pkg/serviceregistry" 34 | "github.com/aeraki-framework/consul2istio/pkg/serviceregistry/consul" 35 | ) 36 | 37 | type changeEvent struct{} 38 | 39 | // Controller represents Consul service registry 40 | type Controller struct { 41 | consulAddress string 42 | namespace string 43 | fqdn string 44 | enableDefaultPort bool 45 | pushChannel chan *changeEvent 46 | registry serviceregistry.Registry 47 | } 48 | 49 | // NewController creates Consul Controller 50 | func NewController(args *consul.BootStrapArgs) *Controller { 51 | controller := &Controller{ 52 | consulAddress: args.ConsulAddress, 53 | fqdn: args.FQDN, 54 | namespace: args.Namespace, 55 | enableDefaultPort: args.EnableDefaultPort, 56 | pushChannel: make(chan *changeEvent), 57 | } 58 | return controller 59 | } 60 | 61 | // Run until a signal is received, this function won't block 62 | func (s *Controller) Run(stop <-chan struct{}) error { 63 | log.Infof("Watch Consul at %s", s.consulAddress) 64 | if err := s.watchRegistry(stop); err != nil { 65 | log.Errorf(err) 66 | return err 67 | } 68 | go func() { 69 | s.mainLoop(stop) 70 | }() 71 | return nil 72 | } 73 | 74 | func (s *Controller) watchRegistry(stop <-chan struct{}) error { 75 | var err error 76 | s.registry, err = consul.NewController(s.consulAddress, s.fqdn, s.enableDefaultPort) 77 | if err != nil { 78 | return err 79 | } 80 | 81 | s.registry.AppendServiceChangeHandler(func() { 82 | s.pushChannel <- &changeEvent{} 83 | }) 84 | // todo gracefully close the registry controller 85 | s.registry.Run(stop) 86 | return nil 87 | } 88 | 89 | func (s *Controller) mainLoop(stop <-chan struct{}) { 90 | var timeChan <-chan time.Time 91 | var startDebounce time.Time 92 | var lastResourceUpdateTime time.Time 93 | pushCounter := 0 94 | debouncedEvents := 0 95 | 96 | for { 97 | select { 98 | case <-stop: 99 | break 100 | case e := <-s.pushChannel: 101 | log.Debugf("Receive event from push chanel : %v", e) 102 | lastResourceUpdateTime = time.Now() 103 | if debouncedEvents == 0 { 104 | log.Debugf("This is the first debounced event") 105 | startDebounce = lastResourceUpdateTime 106 | } 107 | timeChan = time.After(constants.DebounceAfter) 108 | debouncedEvents++ 109 | case <-timeChan: 110 | log.Debugf("Receive event from time chanel") 111 | eventDelay := time.Since(startDebounce) 112 | quietTime := time.Since(lastResourceUpdateTime) 113 | // it has been too long since the first debounced event or quiet enough since the last debounced event 114 | if eventDelay >= constants.DebounceMax || quietTime >= constants.DebounceAfter { 115 | if debouncedEvents > 0 { 116 | pushCounter++ 117 | log.Infof("Push debounce stable[%d] %d: %v since last change, %v since last push", 118 | pushCounter, debouncedEvents, quietTime, eventDelay) 119 | err := s.pushConsulService2APIServer() 120 | if err != nil { 121 | log.Errorf("Failed to synchronize consul services to Istio: %v", err) 122 | // Retry if failed 123 | s.pushChannel <- &changeEvent{} 124 | } 125 | debouncedEvents = 0 126 | } 127 | } else { 128 | timeChan = time.After(constants.DebounceAfter - quietTime) 129 | } 130 | } 131 | } 132 | } 133 | 134 | func (s *Controller) pushConsulService2APIServer() error { 135 | serviceEntries, err := s.registry.ServiceEntries() 136 | if err != nil { 137 | return fmt.Errorf("failed to get servcies from consul: %v", err) 138 | } 139 | 140 | newServiceEntries := make(map[string]*istio.ServiceEntry) 141 | for _, serviceEntry := range serviceEntries { 142 | newServiceEntries[serviceEntry.Hosts[0]] = serviceEntry 143 | } 144 | 145 | config, err := config.GetConfig() 146 | if err != nil { 147 | return fmt.Errorf("can not get kubernetes config: %v", err) 148 | } 149 | 150 | ic, err := versionedclient.NewForConfig(config) 151 | if err != nil { 152 | return fmt.Errorf("failed to create istio client: %v", err) 153 | } 154 | 155 | existingServiceEntries, _ := ic.NetworkingV1alpha3().ServiceEntries(s.namespace).List(context.TODO(), v1.ListOptions{ 156 | LabelSelector: "manager=" + constants.AerakiFieldManager + ", registry=consul", 157 | }) 158 | 159 | for _, oldServiceEntry := range existingServiceEntries.Items { 160 | if newServiceEntry, ok := newServiceEntries[oldServiceEntry.Spec.Hosts[0]]; !ok { 161 | log.Infof("Deleting EnvoyFilter: %s", oldServiceEntry.Name) 162 | err = ic.NetworkingV1alpha3().ServiceEntries(s.namespace).Delete(context.TODO(), oldServiceEntry.Spec.Hosts[0], 163 | v1.DeleteOptions{}) 164 | if err != nil { 165 | err = fmt.Errorf("failed to create istio client: %v", err) 166 | } 167 | } else { 168 | if !proto.Equal(newServiceEntry, &oldServiceEntry.Spec) { 169 | log.Infof("Updating ServiceEntry: %v", newServiceEntry) 170 | _, err = ic.NetworkingV1alpha3().ServiceEntries(s.namespace).Update(context.TODO(), 171 | toServiceEntryCRD(newServiceEntry, oldServiceEntry), 172 | v1.UpdateOptions{FieldManager: constants.AerakiFieldManager}) 173 | if err != nil { 174 | err = fmt.Errorf("failed to update ServiceEntry: %v", err) 175 | } 176 | } else { 177 | log.Infof("ServiceEntry: %s unchanged", oldServiceEntry.Name) 178 | } 179 | delete(newServiceEntries, newServiceEntry.Hosts[0]) 180 | } 181 | } 182 | 183 | for _, newServiceEntry := range newServiceEntries { 184 | _, err = ic.NetworkingV1alpha3().ServiceEntries(s.namespace).Create(context.TODO(), 185 | toServiceEntryCRD(newServiceEntry, nil), 186 | v1.CreateOptions{FieldManager: constants.AerakiFieldManager}) 187 | log.Infof("Creating ServiceEntry: %v", newServiceEntry) 188 | if err != nil { 189 | err = fmt.Errorf("failed to create ServiceEntry: %v", err) 190 | } 191 | } 192 | return err 193 | } 194 | 195 | func toServiceEntryCRD(new *istio.ServiceEntry, old *v1alpha3.ServiceEntry) *v1alpha3.ServiceEntry { 196 | serviceEntry := v1alpha3.ServiceEntry{ 197 | ObjectMeta: v1.ObjectMeta{ 198 | Name: new.Hosts[0], 199 | //Namespace: configRootNS, 200 | Labels: map[string]string{ 201 | "manager": constants.AerakiFieldManager, 202 | "registry": constants.RegistryConsul, 203 | }, 204 | }, 205 | Spec: *new.DeepCopy(), 206 | } 207 | if old != nil { 208 | serviceEntry.ResourceVersion = old.ResourceVersion 209 | } 210 | return &serviceEntry 211 | } 212 | -------------------------------------------------------------------------------- /pkg/serviceregistry/consul/controller.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package consul 16 | 17 | import ( 18 | "sync" 19 | 20 | "github.com/hashicorp/consul/api" 21 | istio "istio.io/api/networking/v1alpha3" 22 | "istio.io/pkg/log" 23 | ) 24 | 25 | // Controller communicates with Consul and monitors for changes 26 | type Controller struct { 27 | client *api.Client 28 | monitor Monitor 29 | servicesList []*istio.ServiceEntry 30 | initDone bool 31 | fqdn string 32 | enableDefaultPort bool 33 | cacheMutex sync.Mutex 34 | } 35 | 36 | // NewController creates a new Consul controller 37 | func NewController(addr, fqdn string, enableDefaultPort bool) (*Controller, error) { 38 | conf := api.DefaultConfig() 39 | conf.Address = addr 40 | 41 | client, err := api.NewClient(conf) 42 | monitor := NewConsulMonitor(client) 43 | controller := Controller{ 44 | monitor: monitor, 45 | client: client, 46 | fqdn: fqdn, 47 | enableDefaultPort: enableDefaultPort, 48 | servicesList: make([]*istio.ServiceEntry, 0), 49 | } 50 | 51 | // Watch the change events to refresh local caches 52 | monitor.AppendServiceChangeHandler(controller.serviceChanged) 53 | return &controller, err 54 | } 55 | 56 | // Run until a stop signal is received 57 | func (c *Controller) Run(stop <-chan struct{}) { 58 | c.monitor.Start(stop) 59 | } 60 | 61 | // ServiceEntries Services list declarations of all services in the system 62 | func (c *Controller) ServiceEntries() ([]*istio.ServiceEntry, error) { 63 | c.cacheMutex.Lock() 64 | defer c.cacheMutex.Unlock() 65 | 66 | err := c.initCache() 67 | if err != nil { 68 | return nil, err 69 | } 70 | 71 | return c.servicesList, nil 72 | } 73 | 74 | // AppendServiceChangeHandler implements a service catalog operation 75 | func (c *Controller) AppendServiceChangeHandler(serviceChanged func()) { 76 | c.monitor.AppendServiceChangeHandler(func() error { 77 | serviceChanged() 78 | return nil 79 | }) 80 | } 81 | 82 | func (c *Controller) initCache() error { 83 | if c.initDone { 84 | return nil 85 | } 86 | 87 | // get all services from consul 88 | consulServices, err := c.getServices() 89 | if err != nil { 90 | return err 91 | } 92 | 93 | for serviceName := range consulServices { 94 | // get endpoints of a service from consul 95 | endpoints, err := c.getCatalogService(serviceName, nil) 96 | if err != nil { 97 | return nil 98 | } 99 | c.servicesList = append(c.servicesList, convertServiceEntry(c.enableDefaultPort, c.fqdn, serviceName, endpoints)) 100 | } 101 | 102 | c.initDone = true 103 | return nil 104 | } 105 | 106 | func (c *Controller) getServices() (map[string][]string, error) { 107 | data, _, err := c.client.Catalog().Services(nil) 108 | if err != nil { 109 | log.Warnf("Could not retrieve services from consul: %v", err) 110 | return nil, err 111 | } 112 | return data, nil 113 | } 114 | 115 | func (c *Controller) getCatalogService(name string, q *api.QueryOptions) ([]*api.CatalogService, error) { 116 | endpoints, _, err := c.client.Catalog().Service(name, "", q) 117 | if err != nil { 118 | log.Warnf("Could not retrieve service catalog from consul: %v", err) 119 | return nil, err 120 | } 121 | return endpoints, nil 122 | } 123 | 124 | func (c *Controller) serviceChanged() error { 125 | c.cacheMutex.Lock() 126 | defer c.cacheMutex.Unlock() 127 | c.initDone = false 128 | return nil 129 | } 130 | -------------------------------------------------------------------------------- /pkg/serviceregistry/consul/controller_test.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package consul 16 | 17 | import ( 18 | "encoding/json" 19 | "fmt" 20 | "net/http" 21 | "net/http/httptest" 22 | "strconv" 23 | "sync" 24 | "testing" 25 | 26 | "github.com/hashicorp/consul/api" 27 | istio "istio.io/api/networking/v1alpha3" 28 | ) 29 | 30 | type mockServer struct { 31 | server *httptest.Server 32 | services map[string][]string 33 | productpage []*api.CatalogService 34 | reviews []*api.CatalogService 35 | rating []*api.CatalogService 36 | lock sync.Mutex 37 | consulIndex int 38 | } 39 | 40 | func newServer() *mockServer { 41 | m := mockServer{ 42 | productpage: []*api.CatalogService{ 43 | { 44 | Node: "istio-node", 45 | Address: "172.19.0.5", 46 | ID: "istio-node-id", 47 | ServiceID: "productpage", 48 | ServiceName: "productpage", 49 | ServiceTags: []string{"version|v1"}, 50 | ServiceAddress: "172.19.0.11", 51 | ServicePort: 9080, 52 | }, 53 | }, 54 | reviews: []*api.CatalogService{ 55 | { 56 | Node: "istio-node", 57 | Address: "172.19.0.5", 58 | ID: "istio-node-id", 59 | ServiceID: "reviews-id", 60 | ServiceName: "reviews", 61 | ServiceTags: []string{"version|v1"}, 62 | ServiceAddress: "172.19.0.6", 63 | ServicePort: 9081, 64 | }, 65 | { 66 | Node: "istio-node", 67 | Address: "172.19.0.5", 68 | ID: "istio-node-id", 69 | ServiceID: "reviews-id", 70 | ServiceName: "reviews", 71 | ServiceTags: []string{"version|v2"}, 72 | ServiceAddress: "172.19.0.7", 73 | ServicePort: 9081, 74 | }, 75 | { 76 | Node: "istio-node", 77 | Address: "172.19.0.5", 78 | ID: "istio-node-id", 79 | ServiceID: "reviews-id", 80 | ServiceName: "reviews", 81 | ServiceTags: []string{"version|v3"}, 82 | ServiceAddress: "172.19.0.8", 83 | ServicePort: 9080, 84 | ServiceMeta: map[string]string{protocolTagName: "tcp"}, 85 | }, 86 | }, 87 | rating: []*api.CatalogService{ 88 | { 89 | Node: "istio-node", 90 | Address: "172.19.0.6", 91 | ID: "istio-node-id", 92 | ServiceID: "rating-id", 93 | ServiceName: "rating", 94 | ServiceTags: []string{"version|v1"}, 95 | ServiceAddress: "172.19.0.12", 96 | ServicePort: 9080, 97 | }, 98 | }, 99 | services: map[string][]string{ 100 | "productpage": {"version|v1"}, 101 | "reviews": {"version|v1", "version|v2", "version|v3"}, 102 | "rating": {"version|v1"}, 103 | }, 104 | consulIndex: 1, 105 | } 106 | 107 | server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 108 | if r.URL.Path == "/v1/catalog/services" { 109 | m.lock.Lock() 110 | data, _ := json.Marshal(&m.services) 111 | w.Header().Set("X-Consul-Index", strconv.Itoa(m.consulIndex)) 112 | m.lock.Unlock() 113 | w.Header().Set("Content-Type", "application/json") 114 | _, _ = fmt.Fprintln(w, string(data)) 115 | } else if r.URL.Path == "/v1/catalog/service/reviews" { 116 | m.lock.Lock() 117 | data, _ := json.Marshal(&m.reviews) 118 | w.Header().Set("X-Consul-Index", strconv.Itoa(m.consulIndex)) 119 | m.lock.Unlock() 120 | w.Header().Set("Content-Type", "application/json") 121 | _, _ = fmt.Fprintln(w, string(data)) 122 | } else if r.URL.Path == "/v1/catalog/service/productpage" { 123 | m.lock.Lock() 124 | data, _ := json.Marshal(&m.productpage) 125 | w.Header().Set("X-Consul-Index", strconv.Itoa(m.consulIndex)) 126 | m.lock.Unlock() 127 | w.Header().Set("Content-Type", "application/json") 128 | _, _ = fmt.Fprintln(w, string(data)) 129 | } else if r.URL.Path == "/v1/catalog/service/rating" { 130 | m.lock.Lock() 131 | data, _ := json.Marshal(&m.rating) 132 | w.Header().Set("X-Consul-Index", strconv.Itoa(m.consulIndex)) 133 | m.lock.Unlock() 134 | w.Header().Set("Content-Type", "application/json") 135 | _, _ = fmt.Fprintln(w, string(data)) 136 | } else { 137 | m.lock.Lock() 138 | data, _ := json.Marshal(&[]*api.CatalogService{}) 139 | w.Header().Set("X-Consul-Index", strconv.Itoa(m.consulIndex)) 140 | m.lock.Unlock() 141 | w.Header().Set("Content-Type", "application/json") 142 | _, _ = fmt.Fprintln(w, string(data)) 143 | } 144 | })) 145 | 146 | m.server = server 147 | return &m 148 | } 149 | 150 | func TestServiceEntries(t *testing.T) { 151 | ts := newServer() 152 | defer ts.server.Close() 153 | controller, err := NewController(ts.server.URL, "", false) 154 | if err != nil { 155 | t.Errorf("could not create Consul Controller: %v", err) 156 | } 157 | serviceEntries, err := controller.ServiceEntries() 158 | 159 | if err != nil { 160 | t.Errorf("client encountered error during ServiceEntries(): %v", err) 161 | } 162 | 163 | if len(serviceEntries) != 3 { 164 | t.Errorf("ServiceEntries() returned wrong number of service entry => %v, want 3", len(serviceEntries)) 165 | } 166 | 167 | hostnames := []string{serviceHostname("productpage", ""), 168 | serviceHostname("reviews", ""), 169 | serviceHostname("rating", "")} 170 | services := map[string]*istio.ServiceEntry{} 171 | for _, serviceEntry := range serviceEntries { 172 | if len(serviceEntry.Hosts) == 1 { 173 | services[serviceEntry.Hosts[0]] = serviceEntry 174 | } 175 | } 176 | 177 | for _, host := range hostnames { 178 | if services[host] == nil { 179 | t.Errorf("Want host %v, but it's not in the result of ServiceEntries()", host) 180 | } 181 | } 182 | 183 | if len(services[serviceHostname("reviews", "")].Endpoints) != 3 { 184 | t.Errorf("ServiceEntries() get %v endpoints f, want 3", len(serviceEntries)) 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /pkg/serviceregistry/consul/conversion.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package consul 16 | 17 | import ( 18 | "fmt" 19 | "strconv" 20 | "strings" 21 | 22 | "github.com/hashicorp/consul/api" 23 | istio "istio.io/api/networking/v1alpha3" 24 | "istio.io/istio/pkg/config/labels" 25 | "istio.io/istio/pkg/config/protocol" 26 | "istio.io/pkg/log" 27 | ) 28 | 29 | const ( 30 | protocolTagName = "protocol" 31 | externalTagName = "external" 32 | defaultServicePort = 80 33 | ) 34 | 35 | func convertServiceEntry(enableDefaultPort bool, fqdn, service string, endpoints []*api.CatalogService) *istio.ServiceEntry { 36 | name := "" 37 | location := istio.ServiceEntry_MESH_INTERNAL 38 | resolution := istio.ServiceEntry_STATIC 39 | ports := make(map[uint32]*istio.Port) 40 | workloadEntries := make([]*istio.WorkloadEntry, 0) 41 | 42 | for _, endpoint := range endpoints { 43 | name = endpoint.ServiceName 44 | 45 | port := convertPort(endpoint.ServicePort, endpoint.ServiceMeta[protocolTagName]) 46 | 47 | if svcPort, exists := ports[port.Number]; exists && svcPort.Protocol != port.Protocol { 48 | log.Infof("Service %v has two instances on same port %v but different protocols (%v, %v)", 49 | name, port.Number, svcPort.Protocol, port.Protocol) 50 | } else { 51 | ports[port.Number] = port 52 | } 53 | if enableDefaultPort { 54 | ports[defaultServicePort] = convertPort(defaultServicePort, "") 55 | } 56 | 57 | // TODO This will not work if service is a mix of external and local services 58 | // or if a service has more than one external name 59 | if endpoint.ServiceMeta[externalTagName] != "" { 60 | location = istio.ServiceEntry_MESH_EXTERNAL 61 | resolution = istio.ServiceEntry_NONE 62 | } 63 | 64 | workloadEntries = append(workloadEntries, convertWorkloadEntry(enableDefaultPort, endpoint)) 65 | } 66 | 67 | svcPorts := make([]*istio.Port, 0, len(ports)) 68 | for _, port := range ports { 69 | svcPorts = append(svcPorts, port) 70 | } 71 | 72 | hostname := serviceHostname(service, fqdn) 73 | out := &istio.ServiceEntry{ 74 | Hosts: []string{hostname}, 75 | Ports: svcPorts, 76 | Location: location, 77 | Resolution: resolution, 78 | Endpoints: workloadEntries, 79 | } 80 | return out 81 | } 82 | 83 | func convertWorkloadEntry(enableDefaultPort bool, endpoint *api.CatalogService) *istio.WorkloadEntry { 84 | svcLabels := convertLabels(endpoint.ServiceTags) 85 | addr := endpoint.ServiceAddress 86 | if addr == "" { 87 | addr = endpoint.Address 88 | } 89 | ports := make(map[string]uint32, 0) 90 | 91 | port := convertPort(endpoint.ServicePort, endpoint.ServiceMeta[protocolTagName]) 92 | ports[port.Name] = port.Number 93 | 94 | if enableDefaultPort { 95 | defaultPort := convertPort(defaultServicePort, "") 96 | ports[defaultPort.Name] = port.Number 97 | } 98 | 99 | return &istio.WorkloadEntry{ 100 | Address: addr, 101 | Ports: ports, 102 | Labels: svcLabels, 103 | Locality: endpoint.Datacenter, 104 | } 105 | } 106 | 107 | func convertLabels(labelsStr []string) labels.Instance { 108 | out := make(labels.Instance, len(labelsStr)) 109 | for _, tag := range labelsStr { 110 | vals := strings.Split(tag, "|") 111 | // Labels not of form "key|value" are ignored to avoid possible collisions 112 | if len(vals) > 1 { 113 | out[vals[0]] = vals[1] 114 | } else { 115 | log.Debugf("Tag %v ignored since it is not of form key|value", tag) 116 | } 117 | } 118 | return out 119 | } 120 | 121 | func convertPort(port int, name string) *istio.Port { 122 | if name == "" { 123 | name = "tcp" 124 | } 125 | 126 | sport := strconv.Itoa(port) 127 | protocol := convertProtocol(name) 128 | return &istio.Port{ 129 | Number: uint32(port), 130 | Protocol: protocol, 131 | Name: name + "-" + sport, 132 | TargetPort: uint32(port), 133 | } 134 | } 135 | 136 | // serviceHostname produces FQDN for a consul service 137 | func serviceHostname(name, fqdn string) string { 138 | // TODO include datacenter in Hostname? 139 | // consul DNS uses "redis.service.us-east-1.consul" -> "[]..service.[].consul" 140 | if len(fqdn) > 0 { 141 | return fmt.Sprintf("%s.%s", name, fqdn) 142 | } 143 | return name 144 | } 145 | 146 | func convertProtocol(name string) string { 147 | p := protocol.Parse(name) 148 | if p == protocol.Unsupported { 149 | log.Infof("unsupported protocol value: %s", name) 150 | return string(protocol.TCP) 151 | } 152 | return string(p) 153 | } 154 | -------------------------------------------------------------------------------- /pkg/serviceregistry/consul/conversion_test.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package consul 16 | 17 | import ( 18 | "fmt" 19 | "strconv" 20 | "testing" 21 | 22 | "github.com/hashicorp/consul/api" 23 | istio "istio.io/api/networking/v1alpha3" 24 | "istio.io/istio/pkg/config/protocol" 25 | ) 26 | 27 | var ( 28 | protocols = []struct { 29 | name string 30 | port int 31 | out protocol.Instance 32 | }{ 33 | {"tcp", 80, protocol.TCP}, 34 | {"http", 81, protocol.HTTP}, 35 | {"https", 443, protocol.HTTPS}, 36 | {"http2", 83, protocol.HTTP2}, 37 | {"grpc", 84, protocol.GRPC}, 38 | {"udp", 85, protocol.UDP}, 39 | {"", 86, protocol.TCP}, 40 | } 41 | 42 | goodLabels = []string{ 43 | "key1|val1", 44 | "version|v1", 45 | } 46 | 47 | badLabels = []string{ 48 | "badtag", 49 | "goodtag|goodvalue", 50 | } 51 | ) 52 | 53 | func TestConvertProtocol(t *testing.T) { 54 | for _, tt := range protocols { 55 | out := convertPort(tt.port, tt.name) 56 | if out.Protocol != string(tt.out) { 57 | t.Errorf("convertProtocol(%v, %q) => %q, want %q", tt.port, tt.name, out, tt.out) 58 | } 59 | } 60 | } 61 | 62 | func TestConvertLabels(t *testing.T) { 63 | out := convertLabels(goodLabels) 64 | if len(out) != len(goodLabels) { 65 | t.Errorf("convertLabels(%q) => length %v, want %v", goodLabels, len(out), len(goodLabels)) 66 | } 67 | 68 | out = convertLabels(badLabels) 69 | if len(out) == len(badLabels) { 70 | t.Errorf("convertLabels(%q) => length %v, want %v", badLabels, len(out), len(badLabels)-1) 71 | } 72 | } 73 | 74 | func TestServiceHostname(t *testing.T) { 75 | out := serviceHostname("productpage", "") 76 | 77 | if out != "productpage" { 78 | t.Errorf("serviceHostname() => %q, want %q", out, "productpage") 79 | } 80 | } 81 | 82 | func TestConvertWorkloadEntry(t *testing.T) { 83 | ip := "172.19.0.11" 84 | port := 9080 85 | p := "udp" 86 | name := "productpage" 87 | tagKey1 := "version" 88 | tagVal1 := "v1" 89 | tagKey2 := "zone" 90 | tagVal2 := "prod" 91 | dc := "dc1" 92 | consulServiceInst := api.CatalogService{ 93 | Node: "istio-node", 94 | Address: "172.19.0.5", 95 | ID: "1111-22-3333-444", 96 | ServiceName: name, 97 | ServiceTags: []string{ 98 | fmt.Sprintf("%v|%v", tagKey1, tagVal1), 99 | fmt.Sprintf("%v|%v", tagKey2, tagVal2), 100 | }, 101 | ServiceAddress: ip, 102 | ServicePort: port, 103 | Datacenter: dc, 104 | ServiceMeta: map[string]string{protocolTagName: p}, 105 | } 106 | 107 | out := convertWorkloadEntry(false, &consulServiceInst) 108 | 109 | if out.Ports[p+"-"+strconv.Itoa(9080)] != 9080 { 110 | t.Errorf("convertWorkloadEntry() => %v, want %v", out.Ports[p], protocol.UDP) 111 | } 112 | 113 | if out.Locality != dc { 114 | t.Errorf("convertWorkloadEntry() => %v, want %v", out.Locality, dc) 115 | } 116 | 117 | if out.Address != ip { 118 | t.Errorf("convertWorkloadEntry() => %v, want %v", out.Address, ip) 119 | } 120 | 121 | if len(out.Labels) != 2 { 122 | t.Errorf("convertWorkloadEntry() len(Labels) => %v, want %v", len(out.Labels), 2) 123 | } 124 | 125 | if out.Labels[tagKey1] != tagVal1 || out.Labels[tagKey2] != tagVal2 { 126 | t.Errorf("convertWorkloadEntry() => missing or incorrect tag in %q", out.Labels) 127 | } 128 | } 129 | 130 | func TestConverServiceEntry(t *testing.T) { 131 | name := "productpage" 132 | port := 9080 133 | p := "udp" 134 | 135 | consulServiceInsts := []*api.CatalogService{ 136 | { 137 | Node: "istio-node", 138 | Address: "172.19.0.5", 139 | ID: "1111-22-3333-444", 140 | ServiceName: name, 141 | ServiceTags: []string{ 142 | "version=v1", 143 | "zone=prod", 144 | }, 145 | ServiceAddress: "172.19.0.11", 146 | ServicePort: port, 147 | ServiceMeta: map[string]string{protocolTagName: p}, 148 | }, 149 | { 150 | Node: "istio-node", 151 | Address: "172.19.0.5", 152 | ID: "1111-22-3333-444", 153 | ServiceName: name, 154 | ServiceTags: []string{ 155 | "version=v2", 156 | }, 157 | ServiceAddress: "172.19.0.12", 158 | ServicePort: port, 159 | ServiceMeta: map[string]string{protocolTagName: p}, 160 | }, 161 | } 162 | 163 | out := convertServiceEntry(false, "", name, consulServiceInsts) 164 | 165 | if len(out.Endpoints) != 2 { 166 | t.Errorf("converServiceEntry() len(Endpoints) => %v, want %v", len(out.Endpoints), 2) 167 | } 168 | 169 | if out.Location == istio.ServiceEntry_MESH_EXTERNAL { 170 | t.Error("converServiceEntry() should not be an external service") 171 | } 172 | 173 | if len(out.Hosts) != 1 { 174 | t.Errorf("converServiceEntry() len(Hosts) => %v, want %v", len(out.Hosts), 0) 175 | } 176 | 177 | if out.Hosts[0] != serviceHostname(name, "") { 178 | t.Errorf("converServiceEntry() bad hostname => %q, want %q", 179 | out.Hosts[0], serviceHostname(name, "")) 180 | } 181 | 182 | if out.Resolution != istio.ServiceEntry_STATIC { 183 | t.Errorf("converServiceEntry() incorrect resolution => %v, want %v", out.Resolution, istio.ServiceEntry_STATIC) 184 | } 185 | 186 | //we assume there's no virtual IP for consul service 187 | if len(out.Addresses) != 0 { 188 | t.Errorf("converServiceEntry() len(Addresses) => %v, want %v", len(out.Addresses), 0) 189 | } 190 | 191 | if len(out.Ports) != 1 { 192 | t.Errorf("converServiceEntry() incorrect # of ports => %v, want %v", 193 | len(out.Ports), 1) 194 | } 195 | 196 | if out.Ports[0].Number != uint32(port) { 197 | t.Errorf("converServiceEntry() => %v, want %v", out.Ports[0].Number, protocol.UDP) 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /pkg/serviceregistry/consul/monitor.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package consul 16 | 17 | import ( 18 | "time" 19 | 20 | "github.com/hashicorp/consul/api" 21 | "istio.io/pkg/log" 22 | ) 23 | 24 | // Monitor handles service and instance changes 25 | type Monitor interface { 26 | Start(<-chan struct{}) 27 | AppendServiceChangeHandler(ServiceChangeHandler) 28 | } 29 | 30 | // ServiceChangeHandler processes service change events 31 | // It's just a notification, we don't need to pass the changed services 32 | type ServiceChangeHandler func() error 33 | 34 | type consulMonitor struct { 35 | discovery *api.Client 36 | ServiceChangeHandlers []ServiceChangeHandler 37 | } 38 | 39 | const blockQueryWaitTime time.Duration = 10 * time.Minute 40 | 41 | // NewConsulMonitor watches for changes in Consul services and CatalogServices 42 | func NewConsulMonitor(client *api.Client) Monitor { 43 | return &consulMonitor{ 44 | discovery: client, 45 | ServiceChangeHandlers: make([]ServiceChangeHandler, 0), 46 | } 47 | } 48 | 49 | func (m *consulMonitor) Start(stop <-chan struct{}) { 50 | go m.watchConsul(stop) 51 | } 52 | 53 | func (m *consulMonitor) watchConsul(stop <-chan struct{}) { 54 | var consulWaitIndex uint64 55 | 56 | for { 57 | select { 58 | case <-stop: 59 | return 60 | default: 61 | queryOptions := api.QueryOptions{ 62 | WaitIndex: consulWaitIndex, 63 | WaitTime: blockQueryWaitTime, 64 | } 65 | // This Consul REST API will block until service changes or timeout 66 | // https://www.consul.io/api/features/blocking 67 | _, queryMeta, err := m.discovery.Catalog().Services(&queryOptions) 68 | if err != nil { 69 | log.Warnf("Could not fetch services: %v", err) 70 | time.Sleep(time.Second) 71 | } else if consulWaitIndex != queryMeta.LastIndex { 72 | consulWaitIndex = queryMeta.LastIndex 73 | m.updateServiceRecord() 74 | } 75 | } 76 | } 77 | } 78 | 79 | func (m *consulMonitor) updateServiceRecord() { 80 | for _, f := range m.ServiceChangeHandlers { 81 | go func(handler ServiceChangeHandler) { 82 | if err := handler(); err != nil { 83 | log.Warnf("Error executing service handler function: %v", err) 84 | } 85 | }(f) 86 | } 87 | } 88 | 89 | func (m *consulMonitor) AppendServiceChangeHandler(h ServiceChangeHandler) { 90 | m.ServiceChangeHandlers = append(m.ServiceChangeHandlers, h) 91 | } 92 | -------------------------------------------------------------------------------- /pkg/serviceregistry/consul/monitor_test.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package consul 16 | 17 | import ( 18 | "testing" 19 | "time" 20 | 21 | "github.com/hashicorp/consul/api" 22 | ) 23 | 24 | const notifyThreshold = 2 * time.Second 25 | 26 | func TestController(t *testing.T) { 27 | ts := newServer() 28 | defer ts.server.Close() 29 | conf := api.DefaultConfig() 30 | conf.Address = ts.server.URL 31 | 32 | cl, err := api.NewClient(conf) 33 | if err != nil { 34 | t.Errorf("could not create Consul Controller: %v", err) 35 | } 36 | 37 | updateChannel := make(chan struct{}, 10) 38 | 39 | ctl := NewConsulMonitor(cl) 40 | ctl.AppendServiceChangeHandler(func() error { 41 | updateChannel <- struct{}{} 42 | return nil 43 | }) 44 | 45 | stop := make(chan struct{}) 46 | go ctl.Start(stop) 47 | defer close(stop) 48 | 49 | expectNotify := func(t *testing.T, times int) { 50 | t.Helper() 51 | for i := 0; i <= times; i++ { 52 | select { 53 | case <-updateChannel: 54 | continue 55 | case <-time.After(notifyThreshold): 56 | if i != times { 57 | t.Fatalf("got %d notifications from controller, want %d", i, times) 58 | } 59 | } 60 | } 61 | } 62 | 63 | //The first query from monitor to Consul always doesn't block because the index is 0 64 | expectNotify(t, 1) 65 | 66 | //There won't be any notifications if X-Consul-Index doesn't change 67 | expectNotify(t, 0) 68 | 69 | //X-Consul-Index change means that the Consul Catalog changes, so there will be notifications 70 | ts.lock.Lock() 71 | ts.consulIndex++ 72 | ts.lock.Unlock() 73 | expectNotify(t, 1) 74 | } 75 | -------------------------------------------------------------------------------- /pkg/serviceregistry/consul/options.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package consul 16 | 17 | // BootStrapArgs is a struct for passing arguments to the consul 18 | type BootStrapArgs struct { 19 | ConsulAddress string 20 | Namespace string 21 | FQDN string 22 | EnableDefaultPort bool 23 | } 24 | 25 | // NewConsulBootStrapArgs constructs consulArgs with default value. 26 | func NewConsulBootStrapArgs() *BootStrapArgs { 27 | return &BootStrapArgs{} 28 | } 29 | -------------------------------------------------------------------------------- /pkg/serviceregistry/registry.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package serviceregistry 16 | 17 | import istio "istio.io/api/networking/v1alpha3" 18 | 19 | // Controller defines an event controller loop. Proxy agent registers itself 20 | // with the controller loop and receives notifications on changes to the 21 | // service topology or changes to the configuration artifacts. 22 | // 23 | // The controller guarantees the following consistency requirement: registry 24 | // view in the controller is as AT LEAST as fresh as the moment notification 25 | // arrives, but MAY BE more fresh (e.g. "delete" cancels an "add" event). For 26 | // example, an event for a service creation will see a service registry without 27 | // the service if the event is immediately followed by the service deletion 28 | // event. 29 | // 30 | // Handlers execute on the single worker queue in the order they are appended. 31 | // Handlers receive the notification event and the associated object. Note 32 | // that all handlers must be appended before starting the controller. 33 | type Controller interface { 34 | // AppendServiceChangeHandler notifies about changes to the service catalog. 35 | AppendServiceChangeHandler(serviceChanged func()) 36 | 37 | // Run until a signal is received 38 | Run(stop <-chan struct{}) 39 | } 40 | 41 | // ServiceDiscovery provides interface for all service discovery mechanisms. 42 | type ServiceDiscovery interface { 43 | // ServiceEntries list declarations of all services in this registry 44 | ServiceEntries() ([]*istio.ServiceEntry, error) 45 | } 46 | 47 | // Registry provides interface for service registry operations. 48 | type Registry interface { 49 | Controller 50 | ServiceDiscovery 51 | } 52 | --------------------------------------------------------------------------------