From 2f92c7b47cae9d10ac753fa32237857ba9bc2027 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Petersen" Date: Wed, 28 Aug 2019 16:36:41 -0400 Subject: [PATCH 1/2] Bump library-go to fix bug 1737315 - secrets in pod log --- glide.lock | 19 +- glide.yaml | 8 +- vendor/github.com/go-test/deep/.travis.yml | 2 +- vendor/github.com/go-test/deep/CHANGES.md | 19 +- vendor/github.com/go-test/deep/deep.go | 28 +- vendor/github.com/go-test/deep/deep_test.go | 184 + vendor/github.com/go-test/deep/go.mod | 1 + .../github.com/openshift/api/Dockerfile.build | 2 +- vendor/github.com/openshift/api/Makefile | 2 +- vendor/github.com/openshift/api/OWNERS | 3 +- .../api/authorization/v1/generated.proto | 4 + .../openshift/api/authorization/v1/types.go | 4 + .../openshift/api/build/v1/generated.proto | 6 +- .../openshift/api/build/v1/types.go | 6 +- .../v1/zz_generated.swagger_doc_generated.go | 4 +- .../api/config/v1/types_apiserver.go | 9 - .../api/config/v1/types_cluster_version.go | 16 + .../openshift/api/config/v1/types_feature.go | 6 - .../api/config/v1/types_infrastructure.go | 53 +- .../api/config/v1/zz_generated.deepcopy.go | 45 +- .../v1/zz_generated.swagger_doc_generated.go | 36 +- .../openshift/api/hack/update-protobuf.sh | 1 + .../openshift/api/operator/v1/types.go | 2 - .../openshift/api/operator/v1/types_etcd.go | 5 - .../api/operator/v1/types_network.go | 4 + .../api/operator/v1/types_serviceca.go | 4 +- .../v1/zz_generated.swagger_doc_generated.go | 9 +- .../openshift/api/route/v1/generated.pb.go | 183 +- .../openshift/api/route/v1/generated.proto | 18 +- .../openshift/api/route/v1/types.go | 18 +- .../v1/zz_generated.swagger_doc_generated.go | 3 +- .../openshift/api/security/v1/generated.proto | 11 + .../openshift/api/security/v1/types.go | 11 + .../cmd/crd-schema-gen/generator/generator.go | 4 +- .../openshift/library-go/glide.lock | 10 +- .../openshift/library-go/glide.yaml | 4 +- .../pkg/assets/create/create_test.go | 2 +- .../library-go/pkg/assets/create/creater.go | 10 +- .../config/leaderelection/leaderelection.go | 6 +- .../library-go/pkg/config/serving/server.go | 44 +- .../pkg/controller/controllercmd/builder.go | 2 +- .../pkg/controller/controllercmd/cmd.go | 26 +- .../client_cert_rotation_controller.go | 48 +- .../cloudprovider/observe_cloudprovider.go | 8 +- .../observe_cloudprovider_test.go | 3 + .../config_observer_controller.go | 20 +- .../config_observer_controller_test.go | 8 +- .../pkg/operator/events/recorder_in_memory.go | 5 +- .../operator/loglevel/logging_controller.go | 34 +- .../loglevel/logging_controller_test.go | 68 + .../library-go/pkg/operator/loglevel/util.go | 73 +- .../management/management_state_controller.go | 18 +- .../resource/resourceapply/apiregistration.go | 8 +- .../operator/resource/resourceapply/core.go | 23 +- .../operator/resource/resourceapply/rbac.go | 2 +- .../resourcesync_controller.go | 19 +- .../resourcesync_controller_test.go | 2 +- .../remove_stale_conditions.go | 116 + .../staticpod/certsyncpod/certsync_cmd.go | 12 +- .../certsyncpod/certsync_controller.go | 6 + .../backing_resource_controller.go | 53 +- .../installer/installer_controller.go | 197 +- .../installer/installer_controller_test.go | 368 +- .../staticpod/controller/installer/int32.go | 187 + .../monitoring_resource_controller.go | 66 +- .../monitoring_resource_controller_test.go | 2 + .../controller/node/node_controller.go | 31 +- .../controller/node/node_controller_test.go | 1 + .../controller/prune/prune_controller.go | 23 +- .../controller/prune/prune_controller_test.go | 38 +- .../revision/revision_controller.go | 84 +- .../revision/revision_controller_test.go | 50 + .../staticpodstate_controller.go | 44 +- .../pkg/operator/staticpod/controllers.go | 1 + .../operator/staticpod/installerpod/cmd.go | 2 +- .../pkg/operator/status/status_controller.go | 25 +- .../library-go/pkg/operator/status/version.go | 7 +- .../unsupportedconfigoverrides_controller.go | 21 +- .../pkg/operator/v1helpers/helpers.go | 43 +- .../pkg/operator/v1helpers/interfaces.go | 6 +- .../pkg/operator/v1helpers/test_helpers.go | 25 +- .../spf13/cobra/.circleci/config.yml | 73 +- vendor/github.com/spf13/cobra/.travis.yml | 26 +- vendor/github.com/spf13/cobra/README.md | 52 +- vendor/github.com/spf13/cobra/args.go | 12 - vendor/github.com/spf13/cobra/args_test.go | 46 - .../spf13/cobra/bash_completions.go | 44 +- .../spf13/cobra/bash_completions.md | 41 +- .../spf13/cobra/bash_completions_test.go | 26 +- vendor/github.com/spf13/cobra/cobra.go | 7 - .../spf13/cobra/cobra/cmd/golden_test.go | 7 +- .../github.com/spf13/cobra/cobra/cmd/init.go | 2 +- vendor/github.com/spf13/cobra/command.go | 16 +- vendor/github.com/spf13/cobra/command_test.go | 131 +- vendor/github.com/spf13/cobra/command_win.go | 8 +- vendor/github.com/spf13/cobra/doc/man_docs.go | 21 +- .../spf13/cobra/doc/man_docs_test.go | 36 - vendor/github.com/spf13/cobra/doc/md_docs.go | 4 +- .../spf13/cobra/doc/md_docs_test.go | 24 - .../github.com/spf13/cobra/doc/rest_docs.go | 4 +- .../spf13/cobra/doc/rest_docs_test.go | 23 - vendor/github.com/spf13/cobra/go.mod | 13 - vendor/github.com/spf13/cobra/go.sum | 51 - vendor/golang.org/x/tools/CONTRIBUTING.md | 15 +- vendor/golang.org/x/tools/README | 10 - vendor/golang.org/x/tools/README.md | 27 + vendor/golang.org/x/tools/blog/blog.go | 44 +- vendor/golang.org/x/tools/blog/blog_test.go | 44 + .../x/tools/cmd/auth/authtest/authtest.go | 231 + .../x/tools/cmd/auth/cookieauth/cookieauth.go | 166 + .../x/tools/cmd/auth/gitauth/gitauth.go | 149 + .../x/tools/cmd/auth/netrcauth/netrcauth.go | 123 + .../golang.org/x/tools/cmd/bundle/.gitignore | 1 + vendor/golang.org/x/tools/cmd/bundle/main.go | 107 +- .../x/tools/cmd/bundle/main_test.go | 2 + .../x/tools/cmd/bundle/testdata/out.golden | 27 +- .../cmd/bundle/testdata/src/initial/a.go | 18 +- .../cmd/bundle/testdata/src/initial/b.go | 11 +- .../golang.org/x/tools/cmd/callgraph/main.go | 60 +- .../x/tools/cmd/callgraph/main_test.go | 84 +- .../callgraph/testdata/src/pkg/pkg_test.go | 5 +- .../x/tools/cmd/compilebench/main.go | 360 +- .../golang.org/x/tools/cmd/digraph/digraph.go | 318 +- .../x/tools/cmd/digraph/digraph_test.go | 208 +- vendor/golang.org/x/tools/cmd/eg/eg.go | 4 +- .../golang.org/x/tools/cmd/fiximports/main.go | 15 +- .../x/tools/cmd/fiximports/main_test.go | 26 +- .../x/tools/cmd/getgo/.dockerignore | 5 + .../golang.org/x/tools/cmd/getgo/.gitignore | 3 + .../golang.org/x/tools/cmd/getgo/Dockerfile | 20 + .../webcomponents => cmd/getgo}/LICENSE | 4 +- vendor/golang.org/x/tools/cmd/getgo/README.md | 71 + .../golang.org/x/tools/cmd/getgo/download.go | 184 + .../x/tools/cmd/getgo/download_test.go | 36 + vendor/golang.org/x/tools/cmd/getgo/main.go | 117 + .../golang.org/x/tools/cmd/getgo/main_test.go | 173 + vendor/golang.org/x/tools/cmd/getgo/make.bash | 13 + vendor/golang.org/x/tools/cmd/getgo/path.go | 155 + .../golang.org/x/tools/cmd/getgo/path_test.go | 58 + .../x/tools/cmd/getgo/server/.gcloudignore | 25 + .../x/tools/cmd/getgo/server/README.md | 7 + .../x/tools/cmd/getgo/server/app.yaml | 2 + .../x/tools/cmd/getgo/server/main.go | 73 + vendor/golang.org/x/tools/cmd/getgo/steps.go | 133 + vendor/golang.org/x/tools/cmd/getgo/system.go | 38 + .../x/tools/cmd/getgo/system_unix.go | 55 + .../x/tools/cmd/getgo/system_windows.go | 86 + .../golang.org/x/tools/cmd/getgo/upload.bash | 19 + .../x/tools/cmd/go-contrib-init/contrib.go | 289 + .../tools/cmd/go-contrib-init/contrib_test.go | 35 + vendor/golang.org/x/tools/cmd/godex/print.go | 36 +- .../x/tools/cmd/godoc/README.godoc-app | 56 - .../golang.org/x/tools/cmd/godoc/appinit.go | 82 - .../golang.org/x/tools/cmd/godoc/autocert.go | 77 - vendor/golang.org/x/tools/cmd/godoc/blog.go | 26 +- .../golang.org/x/tools/cmd/godoc/codewalk.go | 3 +- vendor/golang.org/x/tools/cmd/godoc/dl.go | 2 - vendor/golang.org/x/tools/cmd/godoc/doc.go | 70 +- .../x/tools/cmd/godoc/godoc_test.go | 304 +- vendor/golang.org/x/tools/cmd/godoc/goroot.go | 74 + .../golang.org/x/tools/cmd/godoc/handlers.go | 60 +- vendor/golang.org/x/tools/cmd/godoc/main.go | 203 +- vendor/golang.org/x/tools/cmd/godoc/play.go | 2 - .../x/tools/cmd/godoc/remotesearch.go | 72 - .../x/tools/cmd/godoc/setup-godoc-app.bash | 134 - vendor/golang.org/x/tools/cmd/godoc/x.go | 90 - .../golang.org/x/tools/cmd/goimports/doc.go | 8 +- .../x/tools/cmd/goimports/goimports.go | 29 +- vendor/golang.org/x/tools/cmd/gomvpkg/main.go | 2 +- .../cmd/gopls/integration/vscode/.gitignore | 3 + .../cmd/gopls/integration/vscode/README.md | 21 + .../integration/vscode/package-lock.json | 2065 + .../cmd/gopls/integration/vscode/package.json | 58 + .../gopls/integration/vscode/src/extension.ts | 96 + .../gopls/integration/vscode/tsconfig.json | 15 + .../cmd/gopls/integration/vscode/tslint.json | 12 + vendor/golang.org/x/tools/cmd/gopls/main.go | 23 + .../godoc19_test.go => gorename/cgo_test.go} | 6 +- .../x/tools/cmd/gorename/gorename_test.go | 385 + vendor/golang.org/x/tools/cmd/goyacc/yacc.go | 7 +- vendor/golang.org/x/tools/cmd/guru/callees.go | 2 +- vendor/golang.org/x/tools/cmd/guru/callers.go | 2 +- .../golang.org/x/tools/cmd/guru/callstack.go | 2 +- .../golang.org/x/tools/cmd/guru/describe.go | 70 +- vendor/golang.org/x/tools/cmd/guru/guru.go | 2 +- .../golang.org/x/tools/cmd/guru/guru_test.go | 128 +- .../golang.org/x/tools/cmd/guru/implements.go | 2 +- vendor/golang.org/x/tools/cmd/guru/main.go | 10 + .../golang.org/x/tools/cmd/guru/referrers.go | 352 +- .../x/tools/cmd/guru/serial/serial.go | 7 +- .../guru/testdata/src/definition-json/main.go | 2 + .../testdata/src/definition-json/main.golden | 17 +- .../testdata/src/definition-json/main19.go | 5 - .../src/definition-json/main19.golden | 5 - .../guru/testdata/src/describe-json/main.go | 4 +- .../testdata/src/describe-json/main.golden | 40 +- .../cmd/guru/testdata/src/describe/main.go | 32 +- .../guru/testdata/src/describe/main.golden | 47 +- .../cmd/guru/testdata/src/describe/main19.go | 13 - .../guru/testdata/src/describe/main19.golden | 6 - .../testdata/src/referrers-json/main.golden | 18 +- .../guru/testdata/src/referrers/int_test.go | 2 + .../cmd/guru/testdata/src/referrers/main.go | 2 + .../guru/testdata/src/referrers/main.golden | 6 +- vendor/golang.org/x/tools/cmd/guru/what.go | 3 +- .../x/tools/cmd/heapview/client/.clang-format | 1 - .../x/tools/cmd/heapview/client/.gitignore | 1 - .../x/tools/cmd/heapview/client/README.md | 45 - .../x/tools/cmd/heapview/client/main.ts | 195 - .../x/tools/cmd/heapview/client/main_test.ts | 29 - .../x/tools/cmd/heapview/client/package.json | 35 - .../cmd/heapview/client/testing/karma.conf.js | 22 - .../cmd/heapview/client/testing/test_main.js | 32 - .../x/tools/cmd/heapview/client/tsconfig.json | 16 - .../x/tools/cmd/heapview/client/tslint.json | 40 - .../cmd/heapview/internal/core/mmapfile.go | 145 - .../heapview/internal/core/mmapfile_other.go | 14 - .../x/tools/cmd/heapview/internal/core/raw.go | 308 - .../golang.org/x/tools/cmd/heapview/main.go | 83 - .../x/tools/cmd/present/appengine.go | 22 - vendor/golang.org/x/tools/cmd/present/dir.go | 27 +- vendor/golang.org/x/tools/cmd/present/doc.go | 37 +- .../x/tools/cmd/present/{local.go => main.go} | 39 +- vendor/golang.org/x/tools/cmd/present/play.go | 46 + .../x/tools/cmd/present/play_http.go | 23 - .../x/tools/cmd/present/play_socket.go | 36 - .../x/tools/cmd/present/static/notes.js | 114 +- .../x/tools/cmd/present/static/slides.js | 53 +- .../x/tools/cmd/present/static/styles.css | 28 +- .../x/tools/cmd/present/templates/slides.tmpl | 5 +- .../cmd/splitdwarf/internal/macho/fat.go | 141 + .../cmd/splitdwarf/internal/macho/file.go | 1303 + .../splitdwarf/internal/macho/file_test.go | 389 + .../cmd/splitdwarf/internal/macho/macho.go | 468 + .../splitdwarf/internal/macho/reloctype.go | 72 + .../internal/macho/reloctype_string.go | 49 + .../testdata/clang-386-darwin-exec-with-rpath | Bin 0 -> 8416 bytes .../macho/testdata/clang-386-darwin.obj | Bin 0 -> 464 bytes .../clang-amd64-darwin-exec-with-rpath | Bin 0 -> 8432 bytes .../macho/testdata/clang-amd64-darwin.obj | Bin 0 -> 768 bytes .../testdata/fat-gcc-386-amd64-darwin-exec | Bin 0 -> 28992 bytes .../macho/testdata/gcc-386-darwin-exec | Bin 0 -> 12588 bytes .../macho/testdata/gcc-amd64-darwin-exec | Bin 0 -> 8512 bytes .../testdata/gcc-amd64-darwin-exec-debug | Bin 0 -> 4540 bytes .../internal/macho/testdata/hello.c | 8 + .../x/tools/cmd/splitdwarf/splitdwarf.go | 408 + vendor/golang.org/x/tools/cmd/ssadump/main.go | 141 +- .../golang.org/x/tools/cmd/stress/stress.go | 27 +- .../x/tools/cmd/stringer/endtoend_test.go | 131 +- .../x/tools/cmd/stringer/golden_test.go | 224 +- .../x/tools/cmd/stringer/importer18.go | 16 - .../x/tools/cmd/stringer/importer19.go | 16 - .../x/tools/cmd/stringer/stringer.go | 234 +- .../x/tools/cmd/stringer/testdata/conv.go | 41 + .../x/tools/cmd/stringer/testdata/tag_main.go | 11 + .../x/tools/cmd/stringer/testdata/tag_tag.go | 7 + .../x/tools/cmd/stringer/testdata/vary_day.go | 39 + .../x/tools/cmd/stringer/util_test.go | 2 +- vendor/golang.org/x/tools/cmd/tip/Dockerfile | 15 - vendor/golang.org/x/tools/cmd/tip/Makefile | 15 - vendor/golang.org/x/tools/cmd/tip/README | 32 - vendor/golang.org/x/tools/cmd/tip/godoc.go | 73 - vendor/golang.org/x/tools/cmd/tip/godoc.yaml | 17 - vendor/golang.org/x/tools/cmd/tip/talks.go | 73 - vendor/golang.org/x/tools/cmd/tip/talks.yaml | 18 - vendor/golang.org/x/tools/cmd/tip/tip-rc.yaml | 40 - .../x/tools/cmd/tip/tip-service.yaml | 16 - vendor/golang.org/x/tools/cmd/tip/tip.go | 404 - vendor/golang.org/x/tools/cmd/tip/tip_test.go | 25 - .../golang.org/x/tools/cmd/toolstash/main.go | 32 +- .../x/tools/container/intsets/sparse.go | 480 +- .../x/tools/container/intsets/sparse_test.go | 82 +- vendor/golang.org/x/tools/cover/profile.go | 23 + vendor/golang.org/x/tools/go.mod | 9 + vendor/golang.org/x/tools/go.sum | 9 + .../x/tools/go/analysis/analysis.go | 215 + .../go/analysis/analysistest/analysistest.go | 388 + .../analysistest/analysistest_test.go | 99 + .../x/tools/go/analysis/cmd/vet/README | 33 + .../x/tools/go/analysis/cmd/vet/vet.go | 83 + .../x/tools/go/analysis/diagnostic.go | 48 + vendor/golang.org/x/tools/go/analysis/doc.go | 336 + .../tools/go/analysis/doc/suggested_fixes.md | 80 + .../analysis/internal/analysisflags/flags.go | 388 + .../internal/analysisflags/flags_test.go | 67 + .../analysis/internal/analysisflags/help.go | 92 + .../go/analysis/internal/checker/checker.go | 857 + .../analysis/internal/checker/checker_test.go | 88 + .../tools/go/analysis/internal/facts/facts.go | 319 + .../go/analysis/internal/facts/facts_test.go | 224 + .../go/analysis/internal/facts/imports.go | 88 + .../go/analysis/multichecker/multichecker.go | 60 + .../multichecker/multichecker_test.go | 82 + .../x/tools/go/analysis/passes/README | 8 + .../go/analysis/passes/asmdecl/asmdecl.go | 783 + .../analysis/passes/asmdecl/asmdecl_test.go | 37 + .../passes/asmdecl/testdata/src/a/asm.go | 49 + .../passes/asmdecl/testdata/src/a/asm1.s | 326 + .../passes/asmdecl/testdata/src/a/asm2.s | 256 + .../passes/asmdecl/testdata/src/a/asm3.s | 191 + .../passes/asmdecl/testdata/src/a/asm4.s | 25 + .../passes/asmdecl/testdata/src/a/asm5.s | 192 + .../passes/asmdecl/testdata/src/a/asm6.s | 192 + .../passes/asmdecl/testdata/src/a/asm7.s | 192 + .../passes/asmdecl/testdata/src/a/asm8.s | 165 + .../passes/asmdecl/testdata/src/a/asm9.s | 13 + .../tools/go/analysis/passes/assign/assign.go | 68 + .../go/analysis/passes/assign/assign_test.go | 17 + .../passes/assign/testdata/src/a/a.go | 31 + .../tools/go/analysis/passes/atomic/atomic.go | 96 + .../go/analysis/passes/atomic/atomic_test.go | 17 + .../passes/atomic/testdata/src/a/a.go | 62 + .../passes/atomicalign/atomicalign.go | 126 + .../passes/atomicalign/atomicalign_test.go | 17 + .../passes/atomicalign/testdata/src/a/a.go | 230 + .../passes/atomicalign/testdata/src/a/stub.go | 7 + .../passes/atomicalign/testdata/src/b/b.go | 19 + .../passes/atomicalign/testdata/src/b/stub.go | 7 + .../x/tools/go/analysis/passes/bools/bools.go | 219 + .../go/analysis/passes/bools/bools_test.go | 17 + .../analysis/passes/bools/testdata/src/a/a.go | 132 + .../go/analysis/passes/buildssa/buildssa.go | 117 + .../analysis/passes/buildssa/buildssa_test.go | 29 + .../passes/buildssa/testdata/src/a/a.go | 16 + .../go/analysis/passes/buildtag/buildtag.go | 159 + .../analysis/passes/buildtag/buildtag_test.go | 17 + .../buildtag/testdata/src/a/buildtag.go | 21 + .../go/analysis/passes/cgocall/cgocall.go | 388 + .../analysis/passes/cgocall/cgocall_test.go | 17 + .../passes/cgocall/testdata/src/a/cgo.go | 71 + .../passes/cgocall/testdata/src/a/cgo3.go | 21 + .../passes/cgocall/testdata/src/b/b.go | 20 + .../passes/cgocall/testdata/src/c/c.go | 14 + .../go/analysis/passes/composite/composite.go | 117 + .../passes/composite/composite_test.go | 17 + .../passes/composite/testdata/src/a/a.go | 127 + .../go/analysis/passes/composite/whitelist.go | 34 + .../go/analysis/passes/copylock/copylock.go | 300 + .../analysis/passes/copylock/copylock_test.go | 17 + .../copylock/testdata/src/a/copylock.go | 188 + .../copylock/testdata/src/a/copylock_func.go | 136 + .../copylock/testdata/src/a/copylock_range.go | 67 + .../go/analysis/passes/ctrlflow/ctrlflow.go | 226 + .../analysis/passes/ctrlflow/ctrlflow_test.go | 35 + .../passes/ctrlflow/testdata/src/a/a.go | 109 + .../passes/ctrlflow/testdata/src/lib/lib.go | 8 + .../passes/deepequalerrors/deepequalerrors.go | 115 + .../deepequalerrors/deepequalerrors_test.go | 17 + .../deepequalerrors/testdata/src/a/a.go | 55 + .../go/analysis/passes/errorsas/errorsas.go | 75 + .../analysis/passes/errorsas/errorsas_test.go | 19 + .../passes/errorsas/testdata/src/a/a.go | 43 + .../passes/findcall/cmd/findcall/main.go | 9 + .../go/analysis/passes/findcall/findcall.go | 80 + .../analysis/passes/findcall/findcall_test.go | 64 + .../passes/findcall/testdata/src/a/a.go | 6 + .../passes/httpresponse/httpresponse.go | 177 + .../passes/httpresponse/httpresponse_test.go | 17 + .../passes/httpresponse/testdata/src/a/a.go | 85 + .../go/analysis/passes/inspect/inspect.go | 49 + .../passes/internal/analysisutil/util.go | 106 + .../passes/loopclosure/loopclosure.go | 130 + .../passes/loopclosure/loopclosure_test.go | 17 + .../passes/loopclosure/testdata/src/a/a.go | 90 + .../passes/lostcancel/cmd/lostcancel/main.go | 10 + .../analysis/passes/lostcancel/lostcancel.go | 330 + .../passes/lostcancel/lostcancel_test.go | 17 + .../passes/lostcancel/testdata/src/a/a.go | 192 + .../passes/lostcancel/testdata/src/b/b.go | 26 + .../go/analysis/passes/nilfunc/nilfunc.go | 74 + .../analysis/passes/nilfunc/nilfunc_test.go | 17 + .../passes/nilfunc/testdata/src/a/a.go | 35 + .../passes/nilness/cmd/nilness/main.go | 10 + .../go/analysis/passes/nilness/nilness.go | 271 + .../analysis/passes/nilness/nilness_test.go | 17 + .../passes/nilness/testdata/src/a/a.go | 91 + .../go/analysis/passes/pkgfact/pkgfact.go | 127 + .../analysis/passes/pkgfact/pkgfact_test.go | 17 + .../passes/pkgfact/testdata/src/a/a.go | 4 + .../passes/pkgfact/testdata/src/b/b.go | 5 + .../passes/pkgfact/testdata/src/c/c.go | 5 + .../tools/go/analysis/passes/printf/printf.go | 1056 + .../go/analysis/passes/printf/printf_test.go | 14 + .../passes/printf/testdata/src/a/a.go | 802 + .../passes/printf/testdata/src/b/b.go | 33 + .../passes/printf/testdata/src/nofmt/nofmt.go | 10 + .../tools/go/analysis/passes/printf/types.go | 242 + .../analysis/passes/shadow/cmd/shadow/main.go | 9 + .../tools/go/analysis/passes/shadow/shadow.go | 288 + .../go/analysis/passes/shadow/shadow_test.go | 13 + .../passes/shadow/testdata/src/a/a.go | 91 + .../x/tools/go/analysis/passes/shift/dead.go | 101 + .../x/tools/go/analysis/passes/shift/shift.go | 99 + .../go/analysis/passes/shift/shift_test.go | 17 + .../analysis/passes/shift/testdata/src/a/a.go | 155 + .../analysis/passes/stdmethods/stdmethods.go | 187 + .../passes/stdmethods/stdmethods_test.go | 21 + .../passes/stdmethods/testdata/src/a/a.go | 38 + .../go/analysis/passes/structtag/structtag.go | 309 + .../passes/structtag/structtag_test.go | 17 + .../passes/structtag/testdata/src/a/a.go | 138 + .../passes/structtag/testdata/src/a/b/b.go | 9 + .../analysis/passes/tests/testdata/src/a/a.go | 3 + .../passes/tests/testdata/src/a/a_test.go | 78 + .../passes/tests/testdata/src/a/ax_test.go | 7 + .../analysis/passes/tests/testdata/src/b/b.go | 8 + .../tests/testdata/src/b_x_test/b_test.go | 20 + .../tests/testdata/src/divergent/buf.go | 17 + .../tests/testdata/src/divergent/buf_test.go | 35 + .../x/tools/go/analysis/passes/tests/tests.go | 188 + .../go/analysis/passes/tests/tests_test.go | 22 + .../passes/unmarshal/cmd/unmarshal/main.go | 9 + .../passes/unmarshal/testdata/src/a/a.go | 58 + .../go/analysis/passes/unmarshal/unmarshal.go | 99 + .../passes/unmarshal/unmarshal_test.go | 17 + .../passes/unreachable/testdata/src/a/a.go | 2133 + .../passes/unreachable/unreachable.go | 314 + .../passes/unreachable/unreachable_test.go | 17 + .../passes/unsafeptr/testdata/src/a/a.go | 63 + .../go/analysis/passes/unsafeptr/unsafeptr.go | 130 + .../passes/unsafeptr/unsafeptr_test.go | 17 + .../passes/unusedresult/testdata/src/a/a.go | 27 + .../passes/unusedresult/unusedresult.go | 131 + .../passes/unusedresult/unusedresult_test.go | 17 + .../analysis/singlechecker/singlechecker.go | 77 + .../x/tools/go/analysis/unitchecker/main.go | 64 + .../go/analysis/unitchecker/unitchecker.go | 396 + .../go/analysis/unitchecker/unitchecker112.go | 9 + .../analysis/unitchecker/unitchecker_test.go | 133 + .../x/tools/go/analysis/validate.go | 104 + .../x/tools/go/ast/astutil/imports.go | 85 +- .../x/tools/go/ast/astutil/imports_test.go | 395 +- .../x/tools/go/ast/astutil/rewrite.go | 477 + .../x/tools/go/ast/astutil/rewrite_test.go | 248 + .../x/tools/go/ast/inspector/inspector.go | 182 + .../tools/go/ast/inspector/inspector_test.go | 220 + .../x/tools/go/ast/inspector/typeof.go | 216 + .../x/tools/go/buildutil/allpackages_test.go | 25 +- .../x/tools/go/buildutil/fakecontext.go | 1 + .../x/tools/go/buildutil/util_test.go | 26 +- .../x/tools/go/callgraph/cha/cha.go | 30 +- .../x/tools/go/callgraph/cha/cha_test.go | 1 + .../go/callgraph/cha/testdata/issue23925.go | 38 + .../x/tools/go/callgraph/rta/rta.go | 2 +- vendor/golang.org/x/tools/go/cfg/builder.go | 510 + vendor/golang.org/x/tools/go/cfg/cfg.go | 150 + vendor/golang.org/x/tools/go/cfg/cfg_test.go | 177 + vendor/golang.org/x/tools/go/expect/expect.go | 149 + .../x/tools/go/expect/expect_test.go | 135 + .../golang.org/x/tools/go/expect/extract.go | 263 + .../x/tools/go/expect/testdata/test.go | 37 + .../x/tools/go/gcexportdata/example_test.go | 38 +- .../x/tools/go/gcexportdata/gcexportdata.go | 23 +- .../x/tools/go/gcexportdata/main.go | 99 + .../x/tools/go/gcimporter15/bexport19_test.go | 93 - .../x/tools/go/gcimporter15/isAlias18.go | 13 - .../x/tools/go/gcimporter15/isAlias19.go | 13 - .../tools/go/{loader => internal/cgo}/cgo.go | 29 +- .../{loader => internal/cgo}/cgo_pkgconfig.go | 2 +- .../x/tools/go/internal/gccgoimporter/ar.go | 151 + .../go/internal/gccgoimporter/backdoor.go | 6 +- .../gccgoimporter/gccgoinstallation.go | 7 +- .../gccgoimporter/gccgoinstallation_test.go | 40 +- .../go/internal/gccgoimporter/importer.go | 113 +- .../internal/gccgoimporter/importer19_test.go | 15 - .../internal/gccgoimporter/importer_test.go | 127 +- .../internal/gccgoimporter/newInterface10.go | 21 + .../internal/gccgoimporter/newInterface11.go | 13 + .../tools/go/internal/gccgoimporter/parser.go | 657 +- .../go/internal/gccgoimporter/parser_test.go | 13 +- .../internal/gccgoimporter/testdata/alias.gox | 4 - .../gccgoimporter/testdata/aliases.go | 65 + .../gccgoimporter/testdata/aliases.gox | 33 + .../gccgoimporter/testdata/escapeinfo.go | 13 + .../gccgoimporter/testdata/escapeinfo.gox | Bin 0 -> 824 bytes .../gccgoimporter/testdata/issue27856.go | 9 + .../gccgoimporter/testdata/issue27856.gox | 9 + .../gccgoimporter/testdata/issue29198.go | 37 + .../gccgoimporter/testdata/issue29198.gox | 86 + .../gccgoimporter/testdata/issue30628.go | 18 + .../gccgoimporter/testdata/issue30628.gox | 28 + .../gccgoimporter/testdata/issue31540.go | 26 + .../gccgoimporter/testdata/issue31540.gox | 16 + .../gccgoimporter/testdata/libimportsar.a | Bin 0 -> 9302 bytes .../gccgoimporter/testdata/nointerface.go | 12 + .../gccgoimporter/testdata/nointerface.gox | 8 + .../gccgoimporter/testdata/v1reflect.gox | Bin 0 -> 10872 bytes .../go/internal/gccgoimporter/testenv_test.go | 31 +- .../gcimporter}/bexport.go | 60 +- .../gcimporter}/bexport_test.go | 99 +- .../gcimporter}/bimport.go | 246 +- .../gcimporter}/exportdata.go | 0 .../gcimporter}/gcimporter.go | 123 +- .../internal/gcimporter/gcimporter11_test.go | 129 + .../gcimporter}/gcimporter_test.go | 170 +- .../x/tools/go/internal/gcimporter/iexport.go | 723 + .../go/internal/gcimporter/iexport_test.go | 308 + .../x/tools/go/internal/gcimporter/iimport.go | 606 + .../internal/gcimporter/israce_test.go} | 8 +- .../go/internal/gcimporter/newInterface10.go | 21 + .../go/internal/gcimporter/newInterface11.go | 13 + .../gcimporter}/testdata/a.go | 0 .../gcimporter}/testdata/b.go | 0 .../gcimporter}/testdata/exports.go | 0 .../gcimporter}/testdata/issue15920.go | 0 .../gcimporter}/testdata/issue20046.go | 0 .../gcimporter/testdata/issue25301.go | 17 + .../gcimporter}/testdata/p.go | 0 .../gcimporter}/testdata/versions/test.go | 7 +- .../testdata/versions/test_go1.11_0i.a | Bin 0 -> 2420 bytes .../testdata/versions/test_go1.11_6b.a | Bin 0 -> 2426 bytes .../testdata/versions/test_go1.11_999b.a | Bin 0 -> 2600 bytes .../testdata/versions/test_go1.11_999i.a | Bin 0 -> 2420 bytes .../testdata/versions/test_go1.7_0.a | Bin .../testdata/versions/test_go1.7_1.a | Bin .../testdata/versions/test_go1.8_4.a | Bin 0 -> 1658 bytes .../testdata/versions/test_go1.8_5.a | Bin 0 -> 1658 bytes .../tools/go/internal/packagesdriver/sizes.go | 173 + vendor/golang.org/x/tools/go/loader/doc.go | 5 +- vendor/golang.org/x/tools/go/loader/loader.go | 35 +- .../x/tools/go/loader/loader_test.go | 23 + .../x/tools/go/loader/stdlib_test.go | 4 +- vendor/golang.org/x/tools/go/packages/doc.go | 222 + .../x/tools/go/packages/example_test.go | 34 + .../x/tools/go/packages/external.go | 94 + .../golang.org/x/tools/go/packages/golist.go | 997 + .../x/tools/go/packages/golist_overlay.go | 293 + .../x/tools/go/packages/gopackages/main.go | 230 + .../x/tools/go/packages/packages.go | 1092 + .../x/tools/go/packages/packages110_test.go | 11 + .../x/tools/go/packages/packages_test.go | 2275 + .../x/tools/go/packages/packagescgo_test.go | 61 + .../tools/go/packages/packagestest/expect.go | 404 + .../go/packages/packagestest/expect_test.go | 67 + .../tools/go/packages/packagestest/export.go | 323 + .../go/packages/packagestest/export_test.go | 76 + .../tools/go/packages/packagestest/gopath.go | 74 + .../go/packages/packagestest/gopath_test.go | 28 + .../tools/go/packages/packagestest/modules.go | 221 + .../go/packages/packagestest/modules_111.go | 7 + .../go/packages/packagestest/modules_112.go | 17 + .../go/packages/packagestest/modules_113.go | 21 + .../go/packages/packagestest/modules_test.go | 32 + .../go/packages/packagestest/testdata/test.go | 24 + .../x/tools/go/packages/stdlib_test.go | 136 + .../x/tools/go/packages/testdata/README | 3 + .../github.com/heschik/tools-testrepo/@v/list | 1 + .../heschik/tools-testrepo/@v/v1.0.0.info | 1 + .../heschik/tools-testrepo/@v/v1.0.0.mod | 1 + .../heschik/tools-testrepo/@v/v1.0.0.zip | Bin 0 -> 467 bytes .../heschik/tools-testrepo/@v/v1.0.0.ziphash | 1 + .../heschik/tools-testrepo/v2/@v/list | 1 + .../heschik/tools-testrepo/v2/@v/v2.0.0.info | 1 + .../heschik/tools-testrepo/v2/@v/v2.0.0.mod | 1 + .../heschik/tools-testrepo/v2/@v/v2.0.0.zip | Bin 0 -> 482 bytes .../tools-testrepo/v2/@v/v2.0.0.ziphash | 1 + .../heschik/tools-testrepo/v2@v2.0.0/go.mod | 3 + .../tools-testrepo/v2@v2.0.0/pkg/pkg.go | 1 + .../heschik/tools-testrepo@v1.0.0/go.mod | 3 + .../heschik/tools-testrepo@v1.0.0/pkg/pkg.go | 1 + .../TestName_Modules/src/b/pkg/pkg.go | 1 + .../github.com/heschik/tools-testrepo/@v/list | 1 + .../heschik/tools-testrepo/@v/v1.0.0.info | 1 + .../heschik/tools-testrepo/@v/v1.0.0.mod | 1 + .../heschik/tools-testrepo/@v/v1.0.0.zip | Bin 0 -> 467 bytes .../heschik/tools-testrepo/@v/v1.0.0.ziphash | 1 + .../heschik/tools-testrepo/v2/@v/list | 2 + .../heschik/tools-testrepo/v2/@v/v2.0.1.info | 1 + .../heschik/tools-testrepo/v2/@v/v2.0.1.mod | 1 + .../heschik/tools-testrepo/v2/@v/v2.0.1.zip | Bin 0 -> 482 bytes .../tools-testrepo/v2/@v/v2.0.1.ziphash | 1 + .../heschik/tools-testrepo/v2/@v/v2.0.2.info | 1 + .../heschik/tools-testrepo/v2/@v/v2.0.2.mod | 1 + .../heschik/tools-testrepo/v2/@v/v2.0.2.zip | Bin 0 -> 482 bytes .../tools-testrepo/v2/@v/v2.0.2.ziphash | 1 + .../heschik/tools-testrepo/v2@v2.0.1/go.mod | 3 + .../tools-testrepo/v2@v2.0.1/pkg/pkg.go | 1 + .../heschik/tools-testrepo/v2@v2.0.2/go.mod | 3 + .../tools-testrepo/v2@v2.0.2/pkg/pkg.go | 1 + .../heschik/tools-testrepo@v1.0.0/go.mod | 3 + .../heschik/tools-testrepo@v1.0.0/pkg/pkg.go | 1 + .../golang.org/x/tools/go/packages/visit.go | 55 + vendor/golang.org/x/tools/go/pointer/api.go | 2 +- vendor/golang.org/x/tools/go/pointer/doc.go | 2 +- .../x/tools/go/pointer/pointer_test.go | 10 +- vendor/golang.org/x/tools/go/pointer/query.go | 4 +- .../x/tools/go/pointer/query_test.go | 26 +- .../golang.org/x/tools/go/pointer/reflect.go | 10 +- vendor/golang.org/x/tools/go/ssa/builder.go | 20 +- vendor/golang.org/x/tools/go/ssa/const.go | 44 +- vendor/golang.org/x/tools/go/ssa/create.go | 17 +- vendor/golang.org/x/tools/go/ssa/doc.go | 12 +- vendor/golang.org/x/tools/go/ssa/emit.go | 2 +- .../golang.org/x/tools/go/ssa/example_test.go | 64 +- vendor/golang.org/x/tools/go/ssa/identical.go | 7 + .../golang.org/x/tools/go/ssa/identical_17.go | 7 + .../x/tools/go/ssa/identical_test.go | 9 + .../x/tools/go/ssa/interp/external.go | 522 +- .../x/tools/go/ssa/interp/external_darwin.go | 35 - .../x/tools/go/ssa/interp/external_unix.go | 256 - .../x/tools/go/ssa/interp/interp.go | 55 +- .../x/tools/go/ssa/interp/interp_test.go | 231 +- .../golang.org/x/tools/go/ssa/interp/ops.go | 22 +- .../x/tools/go/ssa/interp/reflect.go | 5 - .../x/tools/go/ssa/interp/testdata/a_test.go | 17 - .../x/tools/go/ssa/interp/testdata/b_test.go | 11 - .../tools/go/ssa/interp/testdata/boundmeth.go | 9 +- .../x/tools/go/ssa/interp/testdata/c_test.go | 17 - .../tools/go/ssa/interp/testdata/callstack.go | 52 - .../x/tools/go/ssa/interp/testdata/complit.go | 8 +- .../tools/go/ssa/interp/testdata/coverage.go | 7 +- .../x/tools/go/ssa/interp/testdata/range.go | 2 +- .../ssa/interp/testdata/src/errors/errors.go | 7 + .../go/ssa/interp/testdata/src/fmt/fmt.go | 26 + .../go/ssa/interp/testdata/src/math/math.go | 13 + .../tools/go/ssa/interp/testdata/src/os/os.go | 5 + .../interp/testdata/src/reflect/reflect.go | 16 + .../interp/testdata/src/runtime/runtime.go | 22 + .../interp/testdata/src/strings/strings.go | 9 + .../go/ssa/interp/testdata/src/time/time.go | 5 + .../interp/testdata/src/unicode/utf8/utf8.go | 9 + .../ssa/interp/testdata/src/unsafe/unsafe.go | 1 + vendor/golang.org/x/tools/go/ssa/lift.go | 44 +- vendor/golang.org/x/tools/go/ssa/methods.go | 4 +- vendor/golang.org/x/tools/go/ssa/print.go | 6 +- vendor/golang.org/x/tools/go/ssa/sanity.go | 25 +- vendor/golang.org/x/tools/go/ssa/source.go | 2 +- .../golang.org/x/tools/go/ssa/source_test.go | 105 +- vendor/golang.org/x/tools/go/ssa/ssa.go | 19 +- .../golang.org/x/tools/go/ssa/ssautil/load.go | 82 +- .../x/tools/go/ssa/ssautil/load_test.go | 56 + .../golang.org/x/tools/go/ssa/stdlib_test.go | 2 +- .../x/tools/go/ssa/testdata/objlookup.go | 150 +- .../x/tools/go/ssa/testdata/structconv.go | 24 + .../x/tools/go/ssa/testdata/valueforexpr.go | 11 +- vendor/golang.org/x/tools/go/ssa/testmain.go | 14 +- vendor/golang.org/x/tools/go/ssa/wrappers.go | 6 +- .../x/tools/go/types/objectpath/objectpath.go | 523 + .../go/types/objectpath/objectpath_test.go | 301 + .../x/tools/go/types/typeutil/callee.go | 46 + .../x/tools/go/types/typeutil/callee_test.go | 89 + vendor/golang.org/x/tools/go/vcs/discovery.go | 9 +- vendor/golang.org/x/tools/go/vcs/vcs.go | 77 +- vendor/golang.org/x/tools/go/vcs/vcs_test.go | 167 + vendor/golang.org/x/tools/godoc/README.md | 2 +- .../golang.org/x/tools/godoc/analysis/README | 2 +- .../x/tools/godoc/analysis/analysis.go | 6 +- vendor/golang.org/x/tools/godoc/appengine.go | 13 - vendor/golang.org/x/tools/godoc/cmdline.go | 207 - .../golang.org/x/tools/godoc/cmdline_test.go | 294 - vendor/golang.org/x/tools/godoc/corpus.go | 17 +- vendor/golang.org/x/tools/godoc/dirtrees.go | 84 +- .../golang.org/x/tools/godoc/dirtrees_test.go | 64 + vendor/golang.org/x/tools/godoc/dl/dl.go | 554 - vendor/golang.org/x/tools/godoc/dl/dl_test.go | 137 - vendor/golang.org/x/tools/godoc/dl/tmpl.go | 286 - vendor/golang.org/x/tools/godoc/format.go | 2 +- vendor/golang.org/x/tools/godoc/godoc.go | 258 +- vendor/golang.org/x/tools/godoc/godoc_test.go | 100 + .../tools/godoc/golangorgenv/golangorgenv.go | 42 + vendor/golang.org/x/tools/godoc/index.go | 3 +- vendor/golang.org/x/tools/godoc/linkify.go | 86 +- vendor/golang.org/x/tools/godoc/page.go | 46 +- vendor/golang.org/x/tools/godoc/parser.go | 2 +- vendor/golang.org/x/tools/godoc/pres.go | 18 +- .../golang.org/x/tools/godoc/proxy/proxy.go | 169 - .../x/tools/godoc/redirect/redirect.go | 86 +- .../x/tools/godoc/redirect/redirect_test.go | 19 +- .../x/tools/godoc/redirect/rietveld.go | 1093 + vendor/golang.org/x/tools/godoc/search.go | 59 +- vendor/golang.org/x/tools/godoc/server.go | 83 +- .../golang.org/x/tools/godoc/server_test.go | 69 + .../golang.org/x/tools/godoc/short/short.go | 173 - vendor/golang.org/x/tools/godoc/short/tmpl.go | 121 - vendor/golang.org/x/tools/godoc/snippet.go | 2 +- vendor/golang.org/x/tools/godoc/spec.go | 2 +- vendor/golang.org/x/tools/godoc/spec_test.go | 22 + .../x/tools/godoc/static/example.html | 2 +- vendor/golang.org/x/tools/godoc/static/gen.go | 102 + .../x/tools/godoc/static/gen_test.go | 53 + .../x/tools/godoc/static/godoc.html | 71 +- .../golang.org/x/tools/godoc/static/godocs.js | 78 +- .../x/tools/godoc/static/makestatic.go | 107 +- .../x/tools/godoc/static/package.html | 99 +- .../x/tools/godoc/static/package.txt | 116 - .../x/tools/godoc/static/packageroot.html | 150 + .../x/tools/godoc/static/playground.js | 109 +- .../x/tools/godoc/static/search.html | 48 + .../x/tools/godoc/static/search.txt | 54 - .../golang.org/x/tools/godoc/static/static.go | 3689 +- .../golang.org/x/tools/godoc/static/style.css | 463 +- vendor/golang.org/x/tools/godoc/template.go | 2 +- vendor/golang.org/x/tools/godoc/util/util.go | 1 + vendor/golang.org/x/tools/godoc/versions.go | 224 + .../golang.org/x/tools/godoc/versions_test.go | 132 + .../golang.org/x/tools/godoc/vfs/emptyvfs.go | 4 + .../x/tools/godoc/vfs/gatefs/gatefs.go | 4 + .../x/tools/godoc/vfs/gatefs/gatefs_test.go | 39 + .../x/tools/godoc/vfs/mapfs/mapfs.go | 4 + .../golang.org/x/tools/godoc/vfs/namespace.go | 14 + vendor/golang.org/x/tools/godoc/vfs/os.go | 48 +- .../golang.org/x/tools/godoc/vfs/os_test.go | 38 + vendor/golang.org/x/tools/godoc/vfs/vfs.go | 13 + .../x/tools/godoc/vfs/zipfs/zipfs.go | 27 + .../x/tools/godoc/vfs/zipfs/zipfs_test.go | 17 + vendor/golang.org/x/tools/gopls/README.md | 39 + vendor/golang.org/x/tools/gopls/doc/acme.md | 7 + .../x/tools/gopls/doc/contributing.md | 26 + vendor/golang.org/x/tools/gopls/doc/design.md | 400 + vendor/golang.org/x/tools/gopls/doc/emacs.md | 29 + vendor/golang.org/x/tools/gopls/doc/faq.md | 7 + .../x/tools/gopls/doc/implementation.md | 49 + .../x/tools/gopls/doc/integrating.md | 91 + vendor/golang.org/x/tools/gopls/doc/status.md | 46 + vendor/golang.org/x/tools/gopls/doc/subl.md | 11 + .../x/tools/gopls/doc/troubleshooting.md | 42 + vendor/golang.org/x/tools/gopls/doc/user.md | 148 + vendor/golang.org/x/tools/gopls/doc/vim.md | 104 + vendor/golang.org/x/tools/gopls/doc/vscode.md | 46 + vendor/golang.org/x/tools/gopls/go.mod | 7 + vendor/golang.org/x/tools/gopls/go.sum | 10 + vendor/golang.org/x/tools/gopls/main.go | 21 + vendor/golang.org/x/tools/imports/fix.go | 974 - vendor/golang.org/x/tools/imports/fix_test.go | 1754 - vendor/golang.org/x/tools/imports/forward.go | 62 + vendor/golang.org/x/tools/imports/zstdlib.go | 9376 --- .../x/tools/internal/apidiff/README.md | 624 + .../x/tools/internal/apidiff/apidiff.go | 220 + .../x/tools/internal/apidiff/apidiff_test.go | 168 + .../x/tools/internal/apidiff/compatibility.go | 361 + .../tools/internal/apidiff/correspondence.go | 219 + .../x/tools/internal/apidiff/messageset.go | 79 + .../x/tools/internal/apidiff/report.go | 71 + .../apidiff/testdata/exported_fields/ef.go | 37 + .../tools/internal/apidiff/testdata/tests.go | 924 + .../fastwalk}/fastwalk.go | 43 +- .../fastwalk}/fastwalk_dirent_fileno.go | 2 +- .../fastwalk}/fastwalk_dirent_ino.go | 5 +- .../fastwalk/fastwalk_dirent_namlen_bsd.go | 13 + .../fastwalk/fastwalk_dirent_namlen_linux.go | 29 + .../fastwalk}/fastwalk_portable.go | 10 +- .../fastwalk}/fastwalk_test.go | 118 +- .../fastwalk}/fastwalk_unix.go | 21 +- .../x/tools/internal/gopathwalk/walk.go | 250 + .../x/tools/internal/gopathwalk/walk_test.go | 135 + .../x/tools/internal/imports/fix.go | 1385 + .../x/tools/internal/imports/fix_test.go | 2502 + .../x/tools/{ => internal}/imports/imports.go | 153 +- .../x/tools/internal/imports/imports_test.go | 74 + .../x/tools/{ => internal}/imports/mkindex.go | 2 +- .../tools/{ => internal}/imports/mkstdlib.go | 80 +- .../x/tools/internal/imports/mod.go | 434 + .../x/tools/internal/imports/mod_112_test.go | 21 + .../x/tools/internal/imports/mod_cache.go | 99 + .../x/tools/internal/imports/mod_test.go | 714 + .../tools/internal/imports/proxy_112_test.go | 20 + .../tools/internal/imports/proxy_113_test.go | 24 + .../{ => internal}/imports/sortimports.go | 98 +- .../testdata/mod/example.com_v1.0.0.txt | 9 + ...ext_v0.0.0-20170915032832-14c0d48ead0c.txt | 47 + .../testdata/mod/rsc.io_!q!u!o!t!e_v1.5.2.txt | 88 + .../mod/rsc.io_!q!u!o!t!e_v1.5.3-!p!r!e.txt | 88 + .../testdata/mod/rsc.io_quote_v1.5.1.txt | 86 + .../testdata/mod/rsc.io_quote_v1.5.2.txt | 98 + .../testdata/mod/rsc.io_quote_v2_v2.0.1.txt | 86 + .../testdata/mod/rsc.io_quote_v3_v3.0.0.txt | 45 + .../testdata/mod/rsc.io_sampler_v1.3.0.txt | 202 + .../testdata/mod/rsc.io_sampler_v1.3.1.txt | 201 + .../x/tools/internal/imports/zstdlib.go | 10325 +++ .../x/tools/internal/jsonrpc2/handler.go | 124 + .../x/tools/internal/jsonrpc2/jsonrpc2.go | 406 + .../tools/internal/jsonrpc2/jsonrpc2_test.go | 202 + .../x/tools/internal/jsonrpc2/stream.go | 150 + .../x/tools/internal/jsonrpc2/wire.go | 138 + .../x/tools/internal/lsp/browser/README.md | 1 + .../x/tools/internal/lsp/browser/browser.go | 67 + .../x/tools/internal/lsp/cache/cache.go | 122 + .../x/tools/internal/lsp/cache/check.go | 380 + .../x/tools/internal/lsp/cache/external.go | 68 + .../x/tools/internal/lsp/cache/file.go | 68 + .../x/tools/internal/lsp/cache/gofile.go | 295 + .../x/tools/internal/lsp/cache/load.go | 315 + .../x/tools/internal/lsp/cache/modfile.go | 25 + .../x/tools/internal/lsp/cache/parse.go | 305 + .../x/tools/internal/lsp/cache/pkg.go | 193 + .../x/tools/internal/lsp/cache/session.go | 407 + .../x/tools/internal/lsp/cache/sumfile.go | 25 + .../x/tools/internal/lsp/cache/token.go | 94 + .../x/tools/internal/lsp/cache/view.go | 537 + .../x/tools/internal/lsp/cache/watcher.go | 62 + .../x/tools/internal/lsp/cmd/check.go | 77 + .../x/tools/internal/lsp/cmd/check_test.go | 70 + .../x/tools/internal/lsp/cmd/cmd.go | 388 + .../x/tools/internal/lsp/cmd/cmd_test.go | 160 + .../x/tools/internal/lsp/cmd/definition.go | 138 + .../tools/internal/lsp/cmd/definition_test.go | 101 + .../x/tools/internal/lsp/cmd/export_test.go | 11 + .../x/tools/internal/lsp/cmd/format.go | 107 + .../x/tools/internal/lsp/cmd/format_test.go | 61 + .../x/tools/internal/lsp/cmd/info.go | 84 + .../x/tools/internal/lsp/cmd/query.go | 71 + .../x/tools/internal/lsp/cmd/serve.go | 278 + .../x/tools/internal/lsp/code_action.go | 261 + .../x/tools/internal/lsp/completion.go | 133 + .../x/tools/internal/lsp/debug/info.1.11.go | 16 + .../x/tools/internal/lsp/debug/info.1.12.go | 38 + .../x/tools/internal/lsp/debug/info.go | 61 + .../x/tools/internal/lsp/debug/metrics.go | 49 + .../x/tools/internal/lsp/debug/rpc.go | 216 + .../x/tools/internal/lsp/debug/serve.go | 418 + .../x/tools/internal/lsp/debug/trace.go | 171 + .../x/tools/internal/lsp/definition.go | 97 + .../x/tools/internal/lsp/diagnostics.go | 100 + .../x/tools/internal/lsp/diff/diff_test.go | 15 + .../internal/lsp/diff/difftest/difftest.go | 51 + .../x/tools/internal/lsp/diff/hooks.go | 32 + .../x/tools/internal/lsp/diff/myers.go | 80 + .../x/tools/internal/lsp/diff/myers/diff.go | 227 + .../internal/lsp/diff/myers/diff_test.go | 204 + .../tools/internal/lsp/diff/myers/unified.go | 148 + .../golang.org/x/tools/internal/lsp/format.go | 71 + .../x/tools/internal/lsp/fuzzy/input.go | 185 + .../x/tools/internal/lsp/fuzzy/input_test.go | 186 + .../x/tools/internal/lsp/fuzzy/matcher.go | 421 + .../tools/internal/lsp/fuzzy/matcher_test.go | 352 + .../x/tools/internal/lsp/general.go | 326 + .../x/tools/internal/lsp/highlight.go | 55 + .../golang.org/x/tools/internal/lsp/hover.go | 109 + .../golang.org/x/tools/internal/lsp/link.go | 135 + .../x/tools/internal/lsp/lsp_test.go | 818 + .../x/tools/internal/lsp/protocol/context.go | 45 + .../x/tools/internal/lsp/protocol/doc.go | 16 + .../x/tools/internal/lsp/protocol/enums.go | 246 + .../x/tools/internal/lsp/protocol/protocol.go | 63 + .../x/tools/internal/lsp/protocol/span.go | 142 + .../x/tools/internal/lsp/protocol/tsclient.go | 207 + .../tools/internal/lsp/protocol/tsprotocol.go | 4054 ++ .../x/tools/internal/lsp/protocol/tsserver.go | 813 + .../lsp/protocol/typescript/README.md | 34 + .../internal/lsp/protocol/typescript/go.ts | 1011 + .../lsp/protocol/typescript/requests.ts | 479 + .../x/tools/internal/lsp/references.go | 85 + .../golang.org/x/tools/internal/lsp/rename.go | 60 + .../x/tools/internal/lsp/reset_golden.sh | 4 + .../golang.org/x/tools/internal/lsp/server.go | 285 + .../x/tools/internal/lsp/signature_help.go | 66 + .../internal/lsp/snippet/snippet_builder.go | 87 + .../lsp/snippet/snippet_builder_test.go | 49 + .../x/tools/internal/lsp/source/analysis.go | 314 + .../x/tools/internal/lsp/source/completion.go | 1291 + .../internal/lsp/source/completion_format.go | 280 + .../internal/lsp/source/completion_snippet.go | 98 + .../internal/lsp/source/deep_completion.go | 173 + .../tools/internal/lsp/source/diagnostics.go | 393 + .../internal/lsp/source/diagnostics_test.go | 52 + .../x/tools/internal/lsp/source/enums.go | 87 + .../x/tools/internal/lsp/source/format.go | 255 + .../x/tools/internal/lsp/source/highlight.go | 48 + .../x/tools/internal/lsp/source/hover.go | 163 + .../x/tools/internal/lsp/source/identifier.go | 352 + .../x/tools/internal/lsp/source/imports.go | 253 + .../tools/internal/lsp/source/imports_test.go | 332 + .../x/tools/internal/lsp/source/references.go | 99 + .../x/tools/internal/lsp/source/rename.go | 293 + .../tools/internal/lsp/source/rename_check.go | 945 + .../internal/lsp/source/signature_help.go | 189 + .../tools/internal/lsp/source/source_test.go | 669 + .../internal/lsp/source/suggested_fix.go | 26 + .../x/tools/internal/lsp/source/symbols.go | 312 + .../x/tools/internal/lsp/source/util.go | 349 + .../x/tools/internal/lsp/source/view.go | 312 + .../x/tools/internal/lsp/symbols.go | 83 + .../tools/internal/lsp/telemetry/telemetry.go | 37 + .../lsp/testdata/analyzer/bad_test.go | 18 + .../internal/lsp/testdata/anon/anon.go.in | 23 + .../x/tools/internal/lsp/testdata/bad/bad0.go | 21 + .../x/tools/internal/lsp/testdata/bad/bad1.go | 27 + .../internal/lsp/testdata/badstmt/badstmt.go | 10 + .../tools/internal/lsp/testdata/bar/bar.go.in | 47 + .../lsp/testdata/basiclit/basiclit.go | 13 + .../tools/internal/lsp/testdata/baz/baz.go.in | 31 + .../lsp/testdata/builtins/builtins.go | 46 + .../internal/lsp/testdata/cast/cast.go.in | 11 + .../internal/lsp/testdata/channel/channel.go | 25 + .../lsp/testdata/comments/comments.go | 27 + .../lsp/testdata/complit/complit.go.in | 71 + .../lsp/testdata/constant/constant.go | 14 + .../testdata/deepcomplete/deep_complete.go | 72 + .../internal/lsp/testdata/errors/errors.go | 10 + .../x/tools/internal/lsp/testdata/foo/foo.go | 30 + .../lsp/testdata/format/bad_format.go.golden | 43 + .../lsp/testdata/format/bad_format.go.in | 22 + .../lsp/testdata/format/good_format.go | 9 + .../lsp/testdata/format/good_format.go.golden | 13 + .../testdata/format/newline_format.go.golden | 13 + .../lsp/testdata/format/newline_format.go.in | 2 + .../lsp/testdata/format/one_line.go.golden | 11 + .../lsp/testdata/format/one_line.go.in | 1 + .../lsp/testdata/func_rank/func_rank.go.in | 44 + .../lsp/testdata/funcvalue/func_value.go | 27 + .../lsp/testdata/generated/generated.go | 7 + .../lsp/testdata/generated/generator.go | 5 + .../tools/internal/lsp/testdata/godef/a/a.go | 19 + .../internal/lsp/testdata/godef/a/a.go.golden | 74 + .../tools/internal/lsp/testdata/godef/a/d.go | 39 + .../internal/lsp/testdata/godef/a/d.go.golden | 120 + .../tools/internal/lsp/testdata/godef/a/f.go | 15 + .../internal/lsp/testdata/godef/a/f.go.golden | 48 + .../internal/lsp/testdata/godef/a/random.go | 23 + .../lsp/testdata/godef/a/random.go.golden | 70 + .../tools/internal/lsp/testdata/godef/b/b.go | 35 + .../internal/lsp/testdata/godef/b/b.go.golden | 253 + .../tools/internal/lsp/testdata/godef/b/c.go | 8 + .../internal/lsp/testdata/godef/b/c.go.golden | 55 + .../internal/lsp/testdata/godef/b/c.go.saved | 7 + .../tools/internal/lsp/testdata/godef/b/e.go | 21 + .../internal/lsp/testdata/godef/b/e.go.golden | 97 + .../godef/broken/unclosedIf.go.golden | 23 + .../testdata/godef/broken/unclosedIf.go.in | 9 + .../tools/internal/lsp/testdata/good/good0.go | 6 + .../tools/internal/lsp/testdata/good/good1.go | 19 + .../lsp/testdata/highlights/highlights.go | 15 + .../importedcomplit/imported_complit.go | 26 + .../lsp/testdata/imports/good_imports.go | 7 + .../testdata/imports/good_imports.go.golden | 11 + .../lsp/testdata/imports/needs_imports.go | 6 + .../testdata/imports/needs_imports.go.golden | 27 + .../internal/lsp/testdata/index/index.go | 21 + .../testdata/interfacerank/interface_rank.go | 23 + .../internal/lsp/testdata/links/links.go | 19 + .../nested_complit/nested_complit.go.in | 13 + .../tools/internal/lsp/testdata/nodisk/empty | 1 + .../lsp/testdata/nodisk/nodisk.overlay.go | 9 + .../lsp/testdata/noparse/noparse.go.in | 11 + .../noparse_format/noparse_format.go.golden | 4 + .../noparse_format/noparse_format.go.in | 9 + .../noparse_format/parse_format.go.golden | 9 + .../noparse_format/parse_format.go.in | 5 + .../lsp/testdata/rank/assign_rank.go.in | 19 + .../lsp/testdata/rank/binexpr_rank.go.in | 8 + .../lsp/testdata/rank/convert_rank.go.in | 39 + .../lsp/testdata/rank/switch_rank.go.in | 12 + .../lsp/testdata/rank/type_assert_rank.go.in | 8 + .../lsp/testdata/rank/type_switch_rank.go.in | 11 + .../internal/lsp/testdata/references/refs.go | 11 + .../lsp/testdata/rename/a/random.go.golden | 630 + .../lsp/testdata/rename/a/random.go.in | 42 + .../tools/internal/lsp/testdata/rename/b/b.go | 3 + .../lsp/testdata/rename/b/b.go.golden | 2 + .../lsp/testdata/rename/bad/bad.go.golden | 2 + .../lsp/testdata/rename/bad/bad.go.in | 8 + .../lsp/testdata/rename/bad/bad_test.go.in | 1 + .../lsp/testdata/rename/testy/testy.go | 7 + .../lsp/testdata/rename/testy/testy.go.golden | 20 + .../lsp/testdata/rename/testy/testy_test.go | 8 + .../rename/testy/testy_test.go.golden | 31 + .../lsp/testdata/selector/selector.go.in | 66 + .../lsp/testdata/signature/signature.go | 70 + .../lsp/testdata/snippets/snippets.go | 39 + .../internal/lsp/testdata/symbols/main.go | 56 + .../internal/lsp/testdata/testy/testy.go | 5 + .../internal/lsp/testdata/testy/testy_test.go | 8 + .../lsp/testdata/typeassert/type_assert.go | 24 + .../internal/lsp/testdata/types/types.go | 16 + .../lsp/testdata/unimported/mkunimported.go | 115 + .../lsp/testdata/unimported/unimported.go | 151 + .../lsp/testdata/unresolved/unresolved.go.in | 6 + .../internal/lsp/testdata/unsafe/unsafe.go | 14 + .../x/tools/internal/lsp/tests/tests.go | 640 + .../internal/lsp/text_synchronization.go | 183 + .../golang.org/x/tools/internal/lsp/util.go | 38 + .../x/tools/internal/lsp/watched_files.go | 53 + .../x/tools/internal/lsp/workspace.go | 42 + .../x/tools/internal/memoize/memoize.go | 259 + .../x/tools/internal/memoize/memoize_test.go | 234 + .../x/tools/internal/memoize/nocopy.go | 24 + .../x/tools/internal/module/module.go | 540 + .../x/tools/internal/module/module_test.go | 319 + .../x/tools/internal/semver/semver.go | 388 + .../x/tools/internal/semver/semver_test.go | 182 + .../golang.org/x/tools/internal/span/parse.go | 100 + .../golang.org/x/tools/internal/span/span.go | 280 + .../x/tools/internal/span/span_test.go | 71 + .../golang.org/x/tools/internal/span/token.go | 148 + .../x/tools/internal/span/token111.go | 39 + .../x/tools/internal/span/token112.go | 16 + .../x/tools/internal/span/token_test.go | 75 + .../golang.org/x/tools/internal/span/uri.go | 148 + .../x/tools/internal/span/uri_test.go | 50 + .../golang.org/x/tools/internal/span/utf16.go | 91 + .../x/tools/internal/span/utf16_test.go | 322 + .../x/tools/internal/telemetry/context.go | 25 + .../x/tools/internal/telemetry/doc.go | 15 + .../x/tools/internal/telemetry/event.go | 34 + .../tools/internal/telemetry/export/export.go | 100 + .../x/tools/internal/telemetry/export/log.go | 38 + .../tools/internal/telemetry/export/multi.go | 55 + .../x/tools/internal/telemetry/export/null.go | 24 + .../telemetry/export/ocagent/ocagent.go | 288 + .../telemetry/export/ocagent/ocagent_test.go | 152 + .../telemetry/export/ocagent/wire/common.go | 101 + .../telemetry/export/ocagent/wire/core.go | 17 + .../telemetry/export/ocagent/wire/metrics.go | 130 + .../telemetry/export/ocagent/wire/trace.go | 112 + .../telemetry/export/prometheus/prometheus.go | 125 + .../x/tools/internal/telemetry/id.go | 71 + .../x/tools/internal/telemetry/log/log.go | 56 + .../x/tools/internal/telemetry/metric.go | 17 + .../tools/internal/telemetry/metric/metric.go | 360 + .../x/tools/internal/telemetry/stats/stats.go | 98 + .../tools/internal/telemetry/stats/worker.go | 40 + .../x/tools/internal/telemetry/tag.go | 71 + .../x/tools/internal/telemetry/tag/key.go | 45 + .../x/tools/internal/telemetry/tag/tag.go | 59 + .../x/tools/internal/telemetry/trace.go | 37 + .../x/tools/internal/telemetry/trace/trace.go | 39 + .../x/tools/internal/telemetry/unit/unit.go | 19 + .../golang.org/x/tools/internal/tool/tool.go | 196 + .../x/tools/internal/txtar/archive.go | 140 + .../x/tools/internal/txtar/archive_test.go | 67 + .../x/tools/internal/xcontext/xcontext.go | 23 + .../x/tools/playground/appengine.go | 26 - .../golang.org/x/tools/playground/common.go | 63 - vendor/golang.org/x/tools/playground/local.go | 20 - .../x/tools/playground/playground.go | 90 + vendor/golang.org/x/tools/present/args.go | 3 +- .../golang.org/x/tools/present/background.go | 25 - vendor/golang.org/x/tools/present/doc.go | 15 +- vendor/golang.org/x/tools/present/link.go | 5 +- vendor/golang.org/x/tools/present/parse.go | 42 +- vendor/golang.org/x/tools/refactor/eg/eg.go | 33 +- .../golang.org/x/tools/refactor/eg/eg_test.go | 10 +- .../golang.org/x/tools/refactor/eg/match.go | 8 +- .../golang.org/x/tools/refactor/eg/rewrite.go | 152 +- .../x/tools/refactor/eg/testdata/I.template | 14 + .../x/tools/refactor/eg/testdata/I1.go | 9 + .../x/tools/refactor/eg/testdata/I1.golden | 14 + .../x/tools/refactor/eg/testdata/J.template | 11 + .../x/tools/refactor/eg/testdata/J1.go | 10 + .../x/tools/refactor/eg/testdata/J1.golden | 11 + .../eg/testdata/no_after_return.template | 2 - .../tools/refactor/importgraph/graph_test.go | 22 +- .../x/tools/refactor/rename/mvpkg.go | 22 +- .../x/tools/refactor/rename/mvpkg_test.go | 31 +- .../x/tools/refactor/rename/rename.go | 74 +- .../x/tools/refactor/rename/rename_test.go | 60 +- .../x/tools/refactor/rename/spec.go | 31 +- .../x/tools/third_party/moduleloader/LICENSE | 22 - .../third_party/moduleloader/moduleloader.js | 7 - .../x/tools/third_party/typescript/LICENSE | 55 - .../third_party/typescript/typescript.js | 60312 ---------------- .../webcomponents/customelements.js | 1029 - .../google.golang.org/appengine/.travis.yml | 26 +- .../appengine/CONTRIBUTING.md | 90 + vendor/google.golang.org/appengine/README.md | 73 +- .../appengine/aetest/instance.go | 10 + .../appengine/aetest/instance_test.go | 3 + .../appengine/aetest/instance_vm.go | 55 +- .../google.golang.org/appengine/appengine.go | 65 +- .../appengine/appengine_vm.go | 36 - .../appengine/blobstore/blobstore.go | 30 + .../appengine/blobstore/blobstore_test.go | 106 + .../appengine/capability/capability.go | 17 +- .../appengine/channel/channel.go | 4 + .../appengine/cmd/aebundler/aebundler.go | 2 +- .../appengine/cmd/aedeploy/aedeploy.go | 238 +- .../appengine/datastore/datastore.go | 5 +- .../appengine/datastore/datastore_test.go | 277 +- .../appengine/datastore/doc.go | 42 +- .../datastore/internal/cloudkey/cloudkey.go | 120 + .../datastore/internal/cloudpb/entity.pb.go | 344 + .../appengine/datastore/key.go | 91 + .../appengine/datastore/keycompat.go | 89 + .../appengine/datastore/keycompat_test.go | 89 + .../appengine/datastore/load.go | 175 +- .../appengine/datastore/load_test.go | 656 + .../appengine/datastore/metadata.go | 9 +- .../appengine/datastore/prop.go | 126 +- .../appengine/datastore/prop_test.go | 380 +- .../appengine/datastore/query.go | 82 +- .../appengine/datastore/query_test.go | 11 +- .../appengine/datastore/save.go | 71 +- .../appengine/datastore/transaction.go | 11 +- .../appengine/delay/delay.go | 99 +- .../appengine/delay/delay_test.go | 219 + .../google.golang.org/appengine/file/file.go | 2 +- vendor/google.golang.org/appengine/go.mod | 10 + vendor/google.golang.org/appengine/go.sum | 22 + .../appengine/internal/api.go | 201 +- .../appengine/internal/api_classic.go | 16 +- .../appengine/internal/api_common.go | 39 +- .../appengine/internal/api_test.go | 115 +- .../app_identity/app_identity_service.pb.go | 411 +- .../appengine/internal/base/api_base.pb.go | 237 +- .../blobstore/blobstore_service.pb.go | 429 +- .../capability/capability_service.pb.go | 116 +- .../internal/channel/channel_service.pb.go | 167 +- .../internal/datastore/datastore_v3.pb.go | 2217 +- .../internal/datastore/datastore_v3.proto | 10 + .../appengine/internal/identity.go | 47 +- .../appengine/internal/identity_classic.go | 52 +- .../appengine/internal/identity_flex.go | 11 + .../appengine/internal/identity_vm.go | 49 +- .../internal/image/images_service.pb.go | 728 +- .../appengine/internal/internal.go | 34 - .../{internal_test.go => internal_vm_test.go} | 2 + .../appengine/internal/log/log_service.pb.go | 638 +- .../internal/mail/mail_service.pb.go | 192 +- .../appengine/internal/main.go | 16 + .../appengine/internal/main_common.go | 7 + .../appengine/internal/main_test.go | 18 + .../appengine/internal/main_vm.go | 69 + .../internal/memcache/memcache_service.pb.go | 850 +- .../appengine/internal/metadata.go | 3 +- .../internal/modules/modules_service.pb.go | 539 +- .../internal/remote_api/remote_api.pb.go | 192 +- .../appengine/internal/search/search.pb.go | 1822 +- .../appengine/internal/search/search.proto | 6 + .../internal/socket/socket_service.pb.go | 1294 +- .../internal/system/system_service.pb.go | 218 +- .../taskqueue/taskqueue_service.pb.go | 1767 +- .../appengine/internal/transaction.go | 22 +- .../internal/urlfetch/urlfetch_service.pb.go | 216 +- .../internal/user/user_service.pb.go | 334 +- .../internal/xmpp/xmpp_service.pb.go | 407 +- vendor/google.golang.org/appengine/log/log.go | 4 +- .../google.golang.org/appengine/mail/mail.go | 2 +- .../appengine/remote_api/client.go | 60 +- .../appengine/remote_api/client_test.go | 19 + .../appengine/remote_api/remote_api.go | 2 +- .../appengine/runtime/runtime.go | 2 +- .../google.golang.org/appengine/search/doc.go | 2 +- .../appengine/search/search.go | 129 +- .../appengine/search/search_test.go | 311 +- .../appengine/taskqueue/taskqueue.go | 45 + .../appengine/taskqueue/taskqueue_test.go | 57 + .../appengine/travis_install.sh | 18 + .../appengine/travis_test.sh | 12 + .../appengine/user/user_classic.go | 13 +- .../pkg/apiserver/apiserver.go | 1 + .../pkg/apiserver/customresource_handler.go | 103 +- .../test/integration/change_test.go | 162 + .../test/integration/scope_test.go | 161 + 1143 files changed, 125350 insertions(+), 90128 deletions(-) create mode 100644 vendor/github.com/go-test/deep/go.mod create mode 100644 vendor/github.com/openshift/library-go/pkg/operator/loglevel/logging_controller_test.go create mode 100644 vendor/github.com/openshift/library-go/pkg/operator/staleconditions/remove_stale_conditions.go create mode 100644 vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installer/int32.go delete mode 100644 vendor/github.com/spf13/cobra/go.mod delete mode 100644 vendor/github.com/spf13/cobra/go.sum delete mode 100644 vendor/golang.org/x/tools/README create mode 100644 vendor/golang.org/x/tools/README.md create mode 100644 vendor/golang.org/x/tools/blog/blog_test.go create mode 100644 vendor/golang.org/x/tools/cmd/auth/authtest/authtest.go create mode 100644 vendor/golang.org/x/tools/cmd/auth/cookieauth/cookieauth.go create mode 100644 vendor/golang.org/x/tools/cmd/auth/gitauth/gitauth.go create mode 100644 vendor/golang.org/x/tools/cmd/auth/netrcauth/netrcauth.go create mode 100644 vendor/golang.org/x/tools/cmd/bundle/.gitignore create mode 100644 vendor/golang.org/x/tools/cmd/getgo/.dockerignore create mode 100644 vendor/golang.org/x/tools/cmd/getgo/.gitignore create mode 100644 vendor/golang.org/x/tools/cmd/getgo/Dockerfile rename vendor/golang.org/x/tools/{third_party/webcomponents => cmd/getgo}/LICENSE (95%) create mode 100644 vendor/golang.org/x/tools/cmd/getgo/README.md create mode 100644 vendor/golang.org/x/tools/cmd/getgo/download.go create mode 100644 vendor/golang.org/x/tools/cmd/getgo/download_test.go create mode 100644 vendor/golang.org/x/tools/cmd/getgo/main.go create mode 100644 vendor/golang.org/x/tools/cmd/getgo/main_test.go create mode 100755 vendor/golang.org/x/tools/cmd/getgo/make.bash create mode 100644 vendor/golang.org/x/tools/cmd/getgo/path.go create mode 100644 vendor/golang.org/x/tools/cmd/getgo/path_test.go create mode 100644 vendor/golang.org/x/tools/cmd/getgo/server/.gcloudignore create mode 100644 vendor/golang.org/x/tools/cmd/getgo/server/README.md create mode 100644 vendor/golang.org/x/tools/cmd/getgo/server/app.yaml create mode 100644 vendor/golang.org/x/tools/cmd/getgo/server/main.go create mode 100644 vendor/golang.org/x/tools/cmd/getgo/steps.go create mode 100644 vendor/golang.org/x/tools/cmd/getgo/system.go create mode 100644 vendor/golang.org/x/tools/cmd/getgo/system_unix.go create mode 100644 vendor/golang.org/x/tools/cmd/getgo/system_windows.go create mode 100755 vendor/golang.org/x/tools/cmd/getgo/upload.bash create mode 100644 vendor/golang.org/x/tools/cmd/go-contrib-init/contrib.go create mode 100644 vendor/golang.org/x/tools/cmd/go-contrib-init/contrib_test.go delete mode 100644 vendor/golang.org/x/tools/cmd/godoc/README.godoc-app delete mode 100644 vendor/golang.org/x/tools/cmd/godoc/appinit.go delete mode 100644 vendor/golang.org/x/tools/cmd/godoc/autocert.go create mode 100644 vendor/golang.org/x/tools/cmd/godoc/goroot.go delete mode 100644 vendor/golang.org/x/tools/cmd/godoc/remotesearch.go delete mode 100755 vendor/golang.org/x/tools/cmd/godoc/setup-godoc-app.bash delete mode 100644 vendor/golang.org/x/tools/cmd/godoc/x.go create mode 100644 vendor/golang.org/x/tools/cmd/gopls/integration/vscode/.gitignore create mode 100644 vendor/golang.org/x/tools/cmd/gopls/integration/vscode/README.md create mode 100644 vendor/golang.org/x/tools/cmd/gopls/integration/vscode/package-lock.json create mode 100644 vendor/golang.org/x/tools/cmd/gopls/integration/vscode/package.json create mode 100644 vendor/golang.org/x/tools/cmd/gopls/integration/vscode/src/extension.ts create mode 100644 vendor/golang.org/x/tools/cmd/gopls/integration/vscode/tsconfig.json create mode 100644 vendor/golang.org/x/tools/cmd/gopls/integration/vscode/tslint.json create mode 100644 vendor/golang.org/x/tools/cmd/gopls/main.go rename vendor/golang.org/x/tools/cmd/{godoc/godoc19_test.go => gorename/cgo_test.go} (79%) create mode 100644 vendor/golang.org/x/tools/cmd/gorename/gorename_test.go delete mode 100644 vendor/golang.org/x/tools/cmd/guru/testdata/src/definition-json/main19.go delete mode 100644 vendor/golang.org/x/tools/cmd/guru/testdata/src/definition-json/main19.golden delete mode 100644 vendor/golang.org/x/tools/cmd/guru/testdata/src/describe/main19.go delete mode 100644 vendor/golang.org/x/tools/cmd/guru/testdata/src/describe/main19.golden delete mode 100644 vendor/golang.org/x/tools/cmd/heapview/client/.clang-format delete mode 100644 vendor/golang.org/x/tools/cmd/heapview/client/.gitignore delete mode 100644 vendor/golang.org/x/tools/cmd/heapview/client/README.md delete mode 100644 vendor/golang.org/x/tools/cmd/heapview/client/main.ts delete mode 100644 vendor/golang.org/x/tools/cmd/heapview/client/main_test.ts delete mode 100644 vendor/golang.org/x/tools/cmd/heapview/client/package.json delete mode 100644 vendor/golang.org/x/tools/cmd/heapview/client/testing/karma.conf.js delete mode 100644 vendor/golang.org/x/tools/cmd/heapview/client/testing/test_main.js delete mode 100644 vendor/golang.org/x/tools/cmd/heapview/client/tsconfig.json delete mode 100644 vendor/golang.org/x/tools/cmd/heapview/client/tslint.json delete mode 100644 vendor/golang.org/x/tools/cmd/heapview/internal/core/mmapfile.go delete mode 100644 vendor/golang.org/x/tools/cmd/heapview/internal/core/mmapfile_other.go delete mode 100644 vendor/golang.org/x/tools/cmd/heapview/internal/core/raw.go delete mode 100644 vendor/golang.org/x/tools/cmd/heapview/main.go delete mode 100644 vendor/golang.org/x/tools/cmd/present/appengine.go rename vendor/golang.org/x/tools/cmd/present/{local.go => main.go} (66%) delete mode 100644 vendor/golang.org/x/tools/cmd/present/play_http.go delete mode 100644 vendor/golang.org/x/tools/cmd/present/play_socket.go create mode 100644 vendor/golang.org/x/tools/cmd/splitdwarf/internal/macho/fat.go create mode 100644 vendor/golang.org/x/tools/cmd/splitdwarf/internal/macho/file.go create mode 100644 vendor/golang.org/x/tools/cmd/splitdwarf/internal/macho/file_test.go create mode 100644 vendor/golang.org/x/tools/cmd/splitdwarf/internal/macho/macho.go create mode 100644 vendor/golang.org/x/tools/cmd/splitdwarf/internal/macho/reloctype.go create mode 100644 vendor/golang.org/x/tools/cmd/splitdwarf/internal/macho/reloctype_string.go create mode 100644 vendor/golang.org/x/tools/cmd/splitdwarf/internal/macho/testdata/clang-386-darwin-exec-with-rpath create mode 100644 vendor/golang.org/x/tools/cmd/splitdwarf/internal/macho/testdata/clang-386-darwin.obj create mode 100644 vendor/golang.org/x/tools/cmd/splitdwarf/internal/macho/testdata/clang-amd64-darwin-exec-with-rpath create mode 100644 vendor/golang.org/x/tools/cmd/splitdwarf/internal/macho/testdata/clang-amd64-darwin.obj create mode 100644 vendor/golang.org/x/tools/cmd/splitdwarf/internal/macho/testdata/fat-gcc-386-amd64-darwin-exec create mode 100644 vendor/golang.org/x/tools/cmd/splitdwarf/internal/macho/testdata/gcc-386-darwin-exec create mode 100644 vendor/golang.org/x/tools/cmd/splitdwarf/internal/macho/testdata/gcc-amd64-darwin-exec create mode 100644 vendor/golang.org/x/tools/cmd/splitdwarf/internal/macho/testdata/gcc-amd64-darwin-exec-debug create mode 100644 vendor/golang.org/x/tools/cmd/splitdwarf/internal/macho/testdata/hello.c create mode 100644 vendor/golang.org/x/tools/cmd/splitdwarf/splitdwarf.go delete mode 100644 vendor/golang.org/x/tools/cmd/stringer/importer18.go delete mode 100644 vendor/golang.org/x/tools/cmd/stringer/importer19.go create mode 100644 vendor/golang.org/x/tools/cmd/stringer/testdata/conv.go create mode 100644 vendor/golang.org/x/tools/cmd/stringer/testdata/tag_main.go create mode 100644 vendor/golang.org/x/tools/cmd/stringer/testdata/tag_tag.go create mode 100644 vendor/golang.org/x/tools/cmd/stringer/testdata/vary_day.go delete mode 100644 vendor/golang.org/x/tools/cmd/tip/Dockerfile delete mode 100644 vendor/golang.org/x/tools/cmd/tip/Makefile delete mode 100644 vendor/golang.org/x/tools/cmd/tip/README delete mode 100644 vendor/golang.org/x/tools/cmd/tip/godoc.go delete mode 100644 vendor/golang.org/x/tools/cmd/tip/godoc.yaml delete mode 100644 vendor/golang.org/x/tools/cmd/tip/talks.go delete mode 100644 vendor/golang.org/x/tools/cmd/tip/talks.yaml delete mode 100644 vendor/golang.org/x/tools/cmd/tip/tip-rc.yaml delete mode 100644 vendor/golang.org/x/tools/cmd/tip/tip-service.yaml delete mode 100644 vendor/golang.org/x/tools/cmd/tip/tip.go delete mode 100644 vendor/golang.org/x/tools/cmd/tip/tip_test.go create mode 100644 vendor/golang.org/x/tools/go.mod create mode 100644 vendor/golang.org/x/tools/go.sum create mode 100644 vendor/golang.org/x/tools/go/analysis/analysis.go create mode 100644 vendor/golang.org/x/tools/go/analysis/analysistest/analysistest.go create mode 100644 vendor/golang.org/x/tools/go/analysis/analysistest/analysistest_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/cmd/vet/README create mode 100644 vendor/golang.org/x/tools/go/analysis/cmd/vet/vet.go create mode 100644 vendor/golang.org/x/tools/go/analysis/diagnostic.go create mode 100644 vendor/golang.org/x/tools/go/analysis/doc.go create mode 100644 vendor/golang.org/x/tools/go/analysis/doc/suggested_fixes.md create mode 100644 vendor/golang.org/x/tools/go/analysis/internal/analysisflags/flags.go create mode 100644 vendor/golang.org/x/tools/go/analysis/internal/analysisflags/flags_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/internal/analysisflags/help.go create mode 100644 vendor/golang.org/x/tools/go/analysis/internal/checker/checker.go create mode 100644 vendor/golang.org/x/tools/go/analysis/internal/checker/checker_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/internal/facts/facts.go create mode 100644 vendor/golang.org/x/tools/go/analysis/internal/facts/facts_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/internal/facts/imports.go create mode 100644 vendor/golang.org/x/tools/go/analysis/multichecker/multichecker.go create mode 100644 vendor/golang.org/x/tools/go/analysis/multichecker/multichecker_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/README create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/asmdecl/testdata/src/a/asm.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/asmdecl/testdata/src/a/asm1.s create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/asmdecl/testdata/src/a/asm2.s create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/asmdecl/testdata/src/a/asm3.s create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/asmdecl/testdata/src/a/asm4.s create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/asmdecl/testdata/src/a/asm5.s create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/asmdecl/testdata/src/a/asm6.s create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/asmdecl/testdata/src/a/asm7.s create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/asmdecl/testdata/src/a/asm8.s create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/asmdecl/testdata/src/a/asm9.s create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/assign/assign.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/assign/assign_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/assign/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/atomic/atomic.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/atomic/atomic_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/atomic/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/atomicalign/atomicalign.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/atomicalign/atomicalign_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/atomicalign/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/atomicalign/testdata/src/a/stub.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/atomicalign/testdata/src/b/b.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/atomicalign/testdata/src/b/stub.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/bools/bools.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/bools/bools_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/bools/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/buildssa/buildssa.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/buildssa/buildssa_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/buildssa/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/buildtag/testdata/src/a/buildtag.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/cgocall/cgocall.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/cgocall/cgocall_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/cgocall/testdata/src/a/cgo.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/cgocall/testdata/src/a/cgo3.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/cgocall/testdata/src/b/b.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/cgocall/testdata/src/c/c.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/composite/composite.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/composite/composite_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/composite/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/composite/whitelist.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/copylock/copylock.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/copylock/copylock_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/copylock/testdata/src/a/copylock.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/copylock/testdata/src/a/copylock_func.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/copylock/testdata/src/a/copylock_range.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/ctrlflow/ctrlflow.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/ctrlflow/ctrlflow_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/ctrlflow/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/ctrlflow/testdata/src/lib/lib.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/deepequalerrors/deepequalerrors.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/deepequalerrors/deepequalerrors_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/deepequalerrors/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/errorsas/errorsas.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/errorsas/errorsas_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/errorsas/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/findcall/cmd/findcall/main.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/findcall/findcall.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/findcall/findcall_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/findcall/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/httpresponse/httpresponse.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/httpresponse/httpresponse_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/httpresponse/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/inspect/inspect.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/internal/analysisutil/util.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/loopclosure/loopclosure.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/loopclosure/loopclosure_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/loopclosure/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/lostcancel/cmd/lostcancel/main.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/lostcancel/lostcancel.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/lostcancel/lostcancel_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/lostcancel/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/lostcancel/testdata/src/b/b.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/nilfunc/nilfunc.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/nilfunc/nilfunc_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/nilfunc/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/nilness/cmd/nilness/main.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/nilness/nilness.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/nilness/nilness_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/nilness/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/pkgfact/pkgfact.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/pkgfact/pkgfact_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/pkgfact/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/pkgfact/testdata/src/b/b.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/pkgfact/testdata/src/c/c.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/printf/printf_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/printf/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/printf/testdata/src/b/b.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/printf/testdata/src/nofmt/nofmt.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/printf/types.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow/main.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/shadow/shadow.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/shadow/shadow_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/shadow/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/shift/dead.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/shift/shift.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/shift/shift_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/shift/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/stdmethods/stdmethods.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/stdmethods/stdmethods_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/stdmethods/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/structtag/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/structtag/testdata/src/a/b/b.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/tests/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/tests/testdata/src/a/a_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/tests/testdata/src/a/ax_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/tests/testdata/src/b/b.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/tests/testdata/src/b_x_test/b_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/tests/testdata/src/divergent/buf.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/tests/testdata/src/divergent/buf_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/tests/tests.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/tests/tests_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/unmarshal/cmd/unmarshal/main.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/unmarshal/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/unmarshal/unmarshal.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/unmarshal/unmarshal_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/unreachable/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/unreachable/unreachable.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/unreachable/unreachable_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/unsafeptr/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/unsafeptr/unsafeptr.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/unsafeptr/unsafeptr_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/unusedresult/testdata/src/a/a.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/unusedresult/unusedresult.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/unusedresult/unusedresult_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/singlechecker/singlechecker.go create mode 100644 vendor/golang.org/x/tools/go/analysis/unitchecker/main.go create mode 100644 vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go create mode 100644 vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker112.go create mode 100644 vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker_test.go create mode 100644 vendor/golang.org/x/tools/go/analysis/validate.go create mode 100644 vendor/golang.org/x/tools/go/ast/astutil/rewrite.go create mode 100644 vendor/golang.org/x/tools/go/ast/astutil/rewrite_test.go create mode 100644 vendor/golang.org/x/tools/go/ast/inspector/inspector.go create mode 100644 vendor/golang.org/x/tools/go/ast/inspector/inspector_test.go create mode 100644 vendor/golang.org/x/tools/go/ast/inspector/typeof.go create mode 100644 vendor/golang.org/x/tools/go/callgraph/cha/testdata/issue23925.go create mode 100644 vendor/golang.org/x/tools/go/cfg/builder.go create mode 100644 vendor/golang.org/x/tools/go/cfg/cfg.go create mode 100644 vendor/golang.org/x/tools/go/cfg/cfg_test.go create mode 100644 vendor/golang.org/x/tools/go/expect/expect.go create mode 100644 vendor/golang.org/x/tools/go/expect/expect_test.go create mode 100644 vendor/golang.org/x/tools/go/expect/extract.go create mode 100644 vendor/golang.org/x/tools/go/expect/testdata/test.go create mode 100644 vendor/golang.org/x/tools/go/gcexportdata/main.go delete mode 100644 vendor/golang.org/x/tools/go/gcimporter15/bexport19_test.go delete mode 100644 vendor/golang.org/x/tools/go/gcimporter15/isAlias18.go delete mode 100644 vendor/golang.org/x/tools/go/gcimporter15/isAlias19.go rename vendor/golang.org/x/tools/go/{loader => internal/cgo}/cgo.go (85%) rename vendor/golang.org/x/tools/go/{loader => internal/cgo}/cgo_pkgconfig.go (98%) create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/ar.go delete mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/importer19_test.go create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/newInterface10.go create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/newInterface11.go delete mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/alias.gox create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/aliases.go create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/aliases.gox create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/escapeinfo.go create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/escapeinfo.gox create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/issue27856.go create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/issue27856.gox create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/issue29198.go create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/issue29198.gox create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/issue30628.go create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/issue30628.gox create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/issue31540.go create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/issue31540.gox create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/libimportsar.a create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/nointerface.go create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/nointerface.gox create mode 100644 vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata/v1reflect.gox rename vendor/golang.org/x/tools/go/{gcimporter15 => internal/gcimporter}/bexport.go (91%) rename vendor/golang.org/x/tools/go/{gcimporter15 => internal/gcimporter}/bexport_test.go (80%) rename vendor/golang.org/x/tools/go/{gcimporter15 => internal/gcimporter}/bimport.go (81%) rename vendor/golang.org/x/tools/go/{gcimporter15 => internal/gcimporter}/exportdata.go (100%) rename vendor/golang.org/x/tools/go/{gcimporter15 => internal/gcimporter}/gcimporter.go (90%) create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter11_test.go rename vendor/golang.org/x/tools/go/{gcimporter15 => internal/gcimporter}/gcimporter_test.go (81%) create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/iexport_test.go create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go rename vendor/golang.org/x/tools/{playground/appenginevm.go => go/internal/gcimporter/israce_test.go} (51%) create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go rename vendor/golang.org/x/tools/go/{gcimporter15 => internal/gcimporter}/testdata/a.go (100%) rename vendor/golang.org/x/tools/go/{gcimporter15 => internal/gcimporter}/testdata/b.go (100%) rename vendor/golang.org/x/tools/go/{gcimporter15 => internal/gcimporter}/testdata/exports.go (100%) rename vendor/golang.org/x/tools/go/{gcimporter15 => internal/gcimporter}/testdata/issue15920.go (100%) rename vendor/golang.org/x/tools/go/{gcimporter15 => internal/gcimporter}/testdata/issue20046.go (100%) create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/testdata/issue25301.go rename vendor/golang.org/x/tools/go/{gcimporter15 => internal/gcimporter}/testdata/p.go (100%) rename vendor/golang.org/x/tools/go/{gcimporter15 => internal/gcimporter}/testdata/versions/test.go (72%) create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/testdata/versions/test_go1.11_0i.a create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/testdata/versions/test_go1.11_6b.a create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/testdata/versions/test_go1.11_999b.a create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/testdata/versions/test_go1.11_999i.a rename vendor/golang.org/x/tools/go/{gcimporter15 => internal/gcimporter}/testdata/versions/test_go1.7_0.a (100%) rename vendor/golang.org/x/tools/go/{gcimporter15 => internal/gcimporter}/testdata/versions/test_go1.7_1.a (100%) create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/testdata/versions/test_go1.8_4.a create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/testdata/versions/test_go1.8_5.a create mode 100644 vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go create mode 100644 vendor/golang.org/x/tools/go/packages/doc.go create mode 100644 vendor/golang.org/x/tools/go/packages/example_test.go create mode 100644 vendor/golang.org/x/tools/go/packages/external.go create mode 100644 vendor/golang.org/x/tools/go/packages/golist.go create mode 100644 vendor/golang.org/x/tools/go/packages/golist_overlay.go create mode 100644 vendor/golang.org/x/tools/go/packages/gopackages/main.go create mode 100644 vendor/golang.org/x/tools/go/packages/packages.go create mode 100644 vendor/golang.org/x/tools/go/packages/packages110_test.go create mode 100644 vendor/golang.org/x/tools/go/packages/packages_test.go create mode 100644 vendor/golang.org/x/tools/go/packages/packagescgo_test.go create mode 100644 vendor/golang.org/x/tools/go/packages/packagestest/expect.go create mode 100644 vendor/golang.org/x/tools/go/packages/packagestest/expect_test.go create mode 100644 vendor/golang.org/x/tools/go/packages/packagestest/export.go create mode 100644 vendor/golang.org/x/tools/go/packages/packagestest/export_test.go create mode 100644 vendor/golang.org/x/tools/go/packages/packagestest/gopath.go create mode 100644 vendor/golang.org/x/tools/go/packages/packagestest/gopath_test.go create mode 100644 vendor/golang.org/x/tools/go/packages/packagestest/modules.go create mode 100644 vendor/golang.org/x/tools/go/packages/packagestest/modules_111.go create mode 100644 vendor/golang.org/x/tools/go/packages/packagestest/modules_112.go create mode 100644 vendor/golang.org/x/tools/go/packages/packagestest/modules_113.go create mode 100644 vendor/golang.org/x/tools/go/packages/packagestest/modules_test.go create mode 100644 vendor/golang.org/x/tools/go/packages/packagestest/testdata/test.go create mode 100644 vendor/golang.org/x/tools/go/packages/stdlib_test.go create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/README create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/@v/list create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/@v/v1.0.0.info create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/@v/v1.0.0.mod create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/@v/v1.0.0.zip create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/@v/v1.0.0.ziphash create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/list create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/v2.0.0.info create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/v2.0.0.mod create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/v2.0.0.zip create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/v2.0.0.ziphash create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_Modules/pkg/mod/github.com/heschik/tools-testrepo/v2@v2.0.0/go.mod create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_Modules/pkg/mod/github.com/heschik/tools-testrepo/v2@v2.0.0/pkg/pkg.go create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_Modules/pkg/mod/github.com/heschik/tools-testrepo@v1.0.0/go.mod create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_Modules/pkg/mod/github.com/heschik/tools-testrepo@v1.0.0/pkg/pkg.go create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_Modules/src/b/pkg/pkg.go create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/cache/download/github.com/heschik/tools-testrepo/@v/list create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/cache/download/github.com/heschik/tools-testrepo/@v/v1.0.0.info create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/cache/download/github.com/heschik/tools-testrepo/@v/v1.0.0.mod create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/cache/download/github.com/heschik/tools-testrepo/@v/v1.0.0.zip create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/cache/download/github.com/heschik/tools-testrepo/@v/v1.0.0.ziphash create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/list create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/v2.0.1.info create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/v2.0.1.mod create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/v2.0.1.zip create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/v2.0.1.ziphash create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/v2.0.2.info create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/v2.0.2.mod create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/v2.0.2.zip create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/v2.0.2.ziphash create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/github.com/heschik/tools-testrepo/v2@v2.0.1/go.mod create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/github.com/heschik/tools-testrepo/v2@v2.0.1/pkg/pkg.go create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/github.com/heschik/tools-testrepo/v2@v2.0.2/go.mod create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/github.com/heschik/tools-testrepo/v2@v2.0.2/pkg/pkg.go create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/github.com/heschik/tools-testrepo@v1.0.0/go.mod create mode 100644 vendor/golang.org/x/tools/go/packages/testdata/TestName_ModulesDedup/pkg/mod/github.com/heschik/tools-testrepo@v1.0.0/pkg/pkg.go create mode 100644 vendor/golang.org/x/tools/go/packages/visit.go create mode 100644 vendor/golang.org/x/tools/go/ssa/identical.go create mode 100644 vendor/golang.org/x/tools/go/ssa/identical_17.go create mode 100644 vendor/golang.org/x/tools/go/ssa/identical_test.go delete mode 100644 vendor/golang.org/x/tools/go/ssa/interp/external_darwin.go delete mode 100644 vendor/golang.org/x/tools/go/ssa/interp/external_unix.go delete mode 100644 vendor/golang.org/x/tools/go/ssa/interp/testdata/a_test.go delete mode 100644 vendor/golang.org/x/tools/go/ssa/interp/testdata/b_test.go delete mode 100644 vendor/golang.org/x/tools/go/ssa/interp/testdata/c_test.go delete mode 100644 vendor/golang.org/x/tools/go/ssa/interp/testdata/callstack.go create mode 100644 vendor/golang.org/x/tools/go/ssa/interp/testdata/src/errors/errors.go create mode 100644 vendor/golang.org/x/tools/go/ssa/interp/testdata/src/fmt/fmt.go create mode 100644 vendor/golang.org/x/tools/go/ssa/interp/testdata/src/math/math.go create mode 100644 vendor/golang.org/x/tools/go/ssa/interp/testdata/src/os/os.go create mode 100644 vendor/golang.org/x/tools/go/ssa/interp/testdata/src/reflect/reflect.go create mode 100644 vendor/golang.org/x/tools/go/ssa/interp/testdata/src/runtime/runtime.go create mode 100644 vendor/golang.org/x/tools/go/ssa/interp/testdata/src/strings/strings.go create mode 100644 vendor/golang.org/x/tools/go/ssa/interp/testdata/src/time/time.go create mode 100644 vendor/golang.org/x/tools/go/ssa/interp/testdata/src/unicode/utf8/utf8.go create mode 100644 vendor/golang.org/x/tools/go/ssa/interp/testdata/src/unsafe/unsafe.go create mode 100644 vendor/golang.org/x/tools/go/ssa/testdata/structconv.go create mode 100644 vendor/golang.org/x/tools/go/types/objectpath/objectpath.go create mode 100644 vendor/golang.org/x/tools/go/types/objectpath/objectpath_test.go create mode 100644 vendor/golang.org/x/tools/go/types/typeutil/callee.go create mode 100644 vendor/golang.org/x/tools/go/types/typeutil/callee_test.go delete mode 100644 vendor/golang.org/x/tools/godoc/appengine.go delete mode 100644 vendor/golang.org/x/tools/godoc/cmdline.go delete mode 100644 vendor/golang.org/x/tools/godoc/cmdline_test.go create mode 100644 vendor/golang.org/x/tools/godoc/dirtrees_test.go delete mode 100644 vendor/golang.org/x/tools/godoc/dl/dl.go delete mode 100644 vendor/golang.org/x/tools/godoc/dl/dl_test.go delete mode 100644 vendor/golang.org/x/tools/godoc/dl/tmpl.go create mode 100644 vendor/golang.org/x/tools/godoc/golangorgenv/golangorgenv.go delete mode 100644 vendor/golang.org/x/tools/godoc/proxy/proxy.go create mode 100644 vendor/golang.org/x/tools/godoc/redirect/rietveld.go create mode 100644 vendor/golang.org/x/tools/godoc/server_test.go delete mode 100644 vendor/golang.org/x/tools/godoc/short/short.go delete mode 100644 vendor/golang.org/x/tools/godoc/short/tmpl.go create mode 100644 vendor/golang.org/x/tools/godoc/spec_test.go create mode 100644 vendor/golang.org/x/tools/godoc/static/gen_test.go delete mode 100644 vendor/golang.org/x/tools/godoc/static/package.txt create mode 100644 vendor/golang.org/x/tools/godoc/static/packageroot.html delete mode 100644 vendor/golang.org/x/tools/godoc/static/search.txt create mode 100644 vendor/golang.org/x/tools/godoc/versions.go create mode 100644 vendor/golang.org/x/tools/godoc/versions_test.go create mode 100644 vendor/golang.org/x/tools/godoc/vfs/gatefs/gatefs_test.go create mode 100644 vendor/golang.org/x/tools/godoc/vfs/os_test.go create mode 100644 vendor/golang.org/x/tools/gopls/README.md create mode 100644 vendor/golang.org/x/tools/gopls/doc/acme.md create mode 100644 vendor/golang.org/x/tools/gopls/doc/contributing.md create mode 100644 vendor/golang.org/x/tools/gopls/doc/design.md create mode 100644 vendor/golang.org/x/tools/gopls/doc/emacs.md create mode 100644 vendor/golang.org/x/tools/gopls/doc/faq.md create mode 100644 vendor/golang.org/x/tools/gopls/doc/implementation.md create mode 100644 vendor/golang.org/x/tools/gopls/doc/integrating.md create mode 100644 vendor/golang.org/x/tools/gopls/doc/status.md create mode 100644 vendor/golang.org/x/tools/gopls/doc/subl.md create mode 100644 vendor/golang.org/x/tools/gopls/doc/troubleshooting.md create mode 100644 vendor/golang.org/x/tools/gopls/doc/user.md create mode 100644 vendor/golang.org/x/tools/gopls/doc/vim.md create mode 100644 vendor/golang.org/x/tools/gopls/doc/vscode.md create mode 100644 vendor/golang.org/x/tools/gopls/go.mod create mode 100644 vendor/golang.org/x/tools/gopls/go.sum create mode 100644 vendor/golang.org/x/tools/gopls/main.go delete mode 100644 vendor/golang.org/x/tools/imports/fix.go delete mode 100644 vendor/golang.org/x/tools/imports/fix_test.go create mode 100644 vendor/golang.org/x/tools/imports/forward.go delete mode 100644 vendor/golang.org/x/tools/imports/zstdlib.go create mode 100644 vendor/golang.org/x/tools/internal/apidiff/README.md create mode 100644 vendor/golang.org/x/tools/internal/apidiff/apidiff.go create mode 100644 vendor/golang.org/x/tools/internal/apidiff/apidiff_test.go create mode 100644 vendor/golang.org/x/tools/internal/apidiff/compatibility.go create mode 100644 vendor/golang.org/x/tools/internal/apidiff/correspondence.go create mode 100644 vendor/golang.org/x/tools/internal/apidiff/messageset.go create mode 100644 vendor/golang.org/x/tools/internal/apidiff/report.go create mode 100644 vendor/golang.org/x/tools/internal/apidiff/testdata/exported_fields/ef.go create mode 100644 vendor/golang.org/x/tools/internal/apidiff/testdata/tests.go rename vendor/golang.org/x/tools/{imports => internal/fastwalk}/fastwalk.go (79%) rename vendor/golang.org/x/tools/{imports => internal/fastwalk}/fastwalk_dirent_fileno.go (94%) rename vendor/golang.org/x/tools/{imports => internal/fastwalk}/fastwalk_dirent_ino.go (80%) create mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go create mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go rename vendor/golang.org/x/tools/{imports => internal/fastwalk}/fastwalk_portable.go (82%) rename vendor/golang.org/x/tools/{imports => internal/fastwalk}/fastwalk_test.go (56%) rename vendor/golang.org/x/tools/{imports => internal/fastwalk}/fastwalk_unix.go (90%) create mode 100644 vendor/golang.org/x/tools/internal/gopathwalk/walk.go create mode 100644 vendor/golang.org/x/tools/internal/gopathwalk/walk_test.go create mode 100644 vendor/golang.org/x/tools/internal/imports/fix.go create mode 100644 vendor/golang.org/x/tools/internal/imports/fix_test.go rename vendor/golang.org/x/tools/{ => internal}/imports/imports.go (65%) create mode 100644 vendor/golang.org/x/tools/internal/imports/imports_test.go rename vendor/golang.org/x/tools/{ => internal}/imports/mkindex.go (99%) rename vendor/golang.org/x/tools/{ => internal}/imports/mkstdlib.go (50%) create mode 100644 vendor/golang.org/x/tools/internal/imports/mod.go create mode 100644 vendor/golang.org/x/tools/internal/imports/mod_112_test.go create mode 100644 vendor/golang.org/x/tools/internal/imports/mod_cache.go create mode 100644 vendor/golang.org/x/tools/internal/imports/mod_test.go create mode 100644 vendor/golang.org/x/tools/internal/imports/proxy_112_test.go create mode 100644 vendor/golang.org/x/tools/internal/imports/proxy_113_test.go rename vendor/golang.org/x/tools/{ => internal}/imports/sortimports.go (62%) create mode 100644 vendor/golang.org/x/tools/internal/imports/testdata/mod/example.com_v1.0.0.txt create mode 100644 vendor/golang.org/x/tools/internal/imports/testdata/mod/golang.org_x_text_v0.0.0-20170915032832-14c0d48ead0c.txt create mode 100644 vendor/golang.org/x/tools/internal/imports/testdata/mod/rsc.io_!q!u!o!t!e_v1.5.2.txt create mode 100644 vendor/golang.org/x/tools/internal/imports/testdata/mod/rsc.io_!q!u!o!t!e_v1.5.3-!p!r!e.txt create mode 100644 vendor/golang.org/x/tools/internal/imports/testdata/mod/rsc.io_quote_v1.5.1.txt create mode 100644 vendor/golang.org/x/tools/internal/imports/testdata/mod/rsc.io_quote_v1.5.2.txt create mode 100644 vendor/golang.org/x/tools/internal/imports/testdata/mod/rsc.io_quote_v2_v2.0.1.txt create mode 100644 vendor/golang.org/x/tools/internal/imports/testdata/mod/rsc.io_quote_v3_v3.0.0.txt create mode 100644 vendor/golang.org/x/tools/internal/imports/testdata/mod/rsc.io_sampler_v1.3.0.txt create mode 100644 vendor/golang.org/x/tools/internal/imports/testdata/mod/rsc.io_sampler_v1.3.1.txt create mode 100644 vendor/golang.org/x/tools/internal/imports/zstdlib.go create mode 100644 vendor/golang.org/x/tools/internal/jsonrpc2/handler.go create mode 100644 vendor/golang.org/x/tools/internal/jsonrpc2/jsonrpc2.go create mode 100644 vendor/golang.org/x/tools/internal/jsonrpc2/jsonrpc2_test.go create mode 100644 vendor/golang.org/x/tools/internal/jsonrpc2/stream.go create mode 100644 vendor/golang.org/x/tools/internal/jsonrpc2/wire.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/browser/README.md create mode 100644 vendor/golang.org/x/tools/internal/lsp/browser/browser.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cache/cache.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cache/check.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cache/external.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cache/file.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cache/gofile.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cache/load.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cache/modfile.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cache/parse.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cache/pkg.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cache/session.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cache/sumfile.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cache/token.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cache/view.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cache/watcher.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cmd/check.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cmd/check_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cmd/cmd.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cmd/cmd_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cmd/definition.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cmd/definition_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cmd/export_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cmd/format.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cmd/format_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cmd/info.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cmd/query.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/cmd/serve.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/code_action.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/completion.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/debug/info.1.11.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/debug/info.1.12.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/debug/info.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/debug/metrics.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/debug/rpc.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/debug/serve.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/debug/trace.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/definition.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/diagnostics.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/diff/diff_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/diff/difftest/difftest.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/diff/hooks.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/diff/myers.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/diff/myers/diff.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/diff/myers/diff_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/diff/myers/unified.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/format.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/fuzzy/input.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/fuzzy/input_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/fuzzy/matcher.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/fuzzy/matcher_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/general.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/highlight.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/hover.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/link.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/lsp_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/protocol/context.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/protocol/doc.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/protocol/enums.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/protocol/protocol.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/protocol/span.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/protocol/tsclient.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/protocol/tsprotocol.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/protocol/tsserver.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/protocol/typescript/README.md create mode 100644 vendor/golang.org/x/tools/internal/lsp/protocol/typescript/go.ts create mode 100644 vendor/golang.org/x/tools/internal/lsp/protocol/typescript/requests.ts create mode 100644 vendor/golang.org/x/tools/internal/lsp/references.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/rename.go create mode 100755 vendor/golang.org/x/tools/internal/lsp/reset_golden.sh create mode 100644 vendor/golang.org/x/tools/internal/lsp/server.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/signature_help.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/snippet/snippet_builder.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/snippet/snippet_builder_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/analysis.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/completion.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/completion_format.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/completion_snippet.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/deep_completion.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/diagnostics.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/diagnostics_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/enums.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/format.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/highlight.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/hover.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/identifier.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/imports.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/imports_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/references.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/rename.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/rename_check.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/signature_help.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/source_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/suggested_fix.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/symbols.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/util.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/source/view.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/symbols.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/telemetry/telemetry.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/analyzer/bad_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/anon/anon.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/bad/bad0.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/bad/bad1.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/badstmt/badstmt.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/bar/bar.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/basiclit/basiclit.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/baz/baz.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/builtins/builtins.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/cast/cast.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/channel/channel.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/comments/comments.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/complit/complit.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/constant/constant.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/deepcomplete/deep_complete.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/errors/errors.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/foo/foo.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/format/bad_format.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/format/bad_format.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/format/good_format.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/format/good_format.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/format/newline_format.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/format/newline_format.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/format/one_line.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/format/one_line.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/func_rank/func_rank.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/funcvalue/func_value.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/generated/generated.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/generated/generator.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/a/a.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/a/a.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/a/d.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/a/d.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/a/f.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/a/f.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/a/random.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/a/random.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/b/b.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/b/b.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/b/c.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/b/c.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/b/c.go.saved create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/b/e.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/b/e.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/broken/unclosedIf.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/godef/broken/unclosedIf.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/good/good0.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/good/good1.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/highlights/highlights.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/importedcomplit/imported_complit.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/imports/good_imports.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/imports/good_imports.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/imports/needs_imports.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/imports/needs_imports.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/index/index.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/interfacerank/interface_rank.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/links/links.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/nested_complit/nested_complit.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/nodisk/empty create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/nodisk/nodisk.overlay.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/noparse/noparse.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/noparse_format/noparse_format.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/noparse_format/noparse_format.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/noparse_format/parse_format.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/noparse_format/parse_format.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rank/assign_rank.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rank/binexpr_rank.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rank/convert_rank.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rank/switch_rank.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rank/type_assert_rank.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rank/type_switch_rank.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/references/refs.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rename/a/random.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rename/a/random.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rename/b/b.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rename/b/b.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rename/bad/bad.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rename/bad/bad.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rename/bad/bad_test.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rename/testy/testy.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rename/testy/testy.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rename/testy/testy_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/rename/testy/testy_test.go.golden create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/selector/selector.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/signature/signature.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/snippets/snippets.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/symbols/main.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/testy/testy.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/testy/testy_test.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/typeassert/type_assert.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/types/types.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/unimported/mkunimported.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/unimported/unimported.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/unresolved/unresolved.go.in create mode 100644 vendor/golang.org/x/tools/internal/lsp/testdata/unsafe/unsafe.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/tests/tests.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/text_synchronization.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/util.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/watched_files.go create mode 100644 vendor/golang.org/x/tools/internal/lsp/workspace.go create mode 100644 vendor/golang.org/x/tools/internal/memoize/memoize.go create mode 100644 vendor/golang.org/x/tools/internal/memoize/memoize_test.go create mode 100644 vendor/golang.org/x/tools/internal/memoize/nocopy.go create mode 100644 vendor/golang.org/x/tools/internal/module/module.go create mode 100644 vendor/golang.org/x/tools/internal/module/module_test.go create mode 100644 vendor/golang.org/x/tools/internal/semver/semver.go create mode 100644 vendor/golang.org/x/tools/internal/semver/semver_test.go create mode 100644 vendor/golang.org/x/tools/internal/span/parse.go create mode 100644 vendor/golang.org/x/tools/internal/span/span.go create mode 100644 vendor/golang.org/x/tools/internal/span/span_test.go create mode 100644 vendor/golang.org/x/tools/internal/span/token.go create mode 100644 vendor/golang.org/x/tools/internal/span/token111.go create mode 100644 vendor/golang.org/x/tools/internal/span/token112.go create mode 100644 vendor/golang.org/x/tools/internal/span/token_test.go create mode 100644 vendor/golang.org/x/tools/internal/span/uri.go create mode 100644 vendor/golang.org/x/tools/internal/span/uri_test.go create mode 100644 vendor/golang.org/x/tools/internal/span/utf16.go create mode 100644 vendor/golang.org/x/tools/internal/span/utf16_test.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/context.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/doc.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/event.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/export/export.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/export/log.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/export/multi.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/export/null.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/export/ocagent/ocagent.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/export/ocagent/ocagent_test.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/export/ocagent/wire/common.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/export/ocagent/wire/core.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/export/ocagent/wire/metrics.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/export/ocagent/wire/trace.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/export/prometheus/prometheus.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/id.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/log/log.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/metric.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/metric/metric.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/stats/stats.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/stats/worker.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/tag.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/tag/key.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/tag/tag.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/trace.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/trace/trace.go create mode 100644 vendor/golang.org/x/tools/internal/telemetry/unit/unit.go create mode 100644 vendor/golang.org/x/tools/internal/tool/tool.go create mode 100644 vendor/golang.org/x/tools/internal/txtar/archive.go create mode 100644 vendor/golang.org/x/tools/internal/txtar/archive_test.go create mode 100644 vendor/golang.org/x/tools/internal/xcontext/xcontext.go delete mode 100644 vendor/golang.org/x/tools/playground/appengine.go delete mode 100644 vendor/golang.org/x/tools/playground/common.go delete mode 100644 vendor/golang.org/x/tools/playground/local.go create mode 100644 vendor/golang.org/x/tools/playground/playground.go delete mode 100644 vendor/golang.org/x/tools/present/background.go create mode 100644 vendor/golang.org/x/tools/refactor/eg/testdata/I.template create mode 100644 vendor/golang.org/x/tools/refactor/eg/testdata/I1.go create mode 100644 vendor/golang.org/x/tools/refactor/eg/testdata/I1.golden create mode 100644 vendor/golang.org/x/tools/refactor/eg/testdata/J.template create mode 100644 vendor/golang.org/x/tools/refactor/eg/testdata/J1.go create mode 100644 vendor/golang.org/x/tools/refactor/eg/testdata/J1.golden delete mode 100644 vendor/golang.org/x/tools/third_party/moduleloader/LICENSE delete mode 100644 vendor/golang.org/x/tools/third_party/moduleloader/moduleloader.js delete mode 100644 vendor/golang.org/x/tools/third_party/typescript/LICENSE delete mode 100644 vendor/golang.org/x/tools/third_party/typescript/typescript.js delete mode 100644 vendor/golang.org/x/tools/third_party/webcomponents/customelements.js create mode 100644 vendor/google.golang.org/appengine/CONTRIBUTING.md create mode 100644 vendor/google.golang.org/appengine/datastore/internal/cloudkey/cloudkey.go create mode 100644 vendor/google.golang.org/appengine/datastore/internal/cloudpb/entity.pb.go create mode 100644 vendor/google.golang.org/appengine/datastore/keycompat.go create mode 100644 vendor/google.golang.org/appengine/datastore/keycompat_test.go create mode 100644 vendor/google.golang.org/appengine/datastore/load_test.go create mode 100644 vendor/google.golang.org/appengine/go.mod create mode 100644 vendor/google.golang.org/appengine/go.sum create mode 100644 vendor/google.golang.org/appengine/internal/identity_flex.go rename vendor/google.golang.org/appengine/internal/{internal_test.go => internal_vm_test.go} (98%) create mode 100644 vendor/google.golang.org/appengine/internal/main.go create mode 100644 vendor/google.golang.org/appengine/internal/main_common.go create mode 100644 vendor/google.golang.org/appengine/internal/main_test.go create mode 100644 vendor/google.golang.org/appengine/internal/main_vm.go create mode 100755 vendor/google.golang.org/appengine/travis_install.sh create mode 100755 vendor/google.golang.org/appengine/travis_test.sh create mode 100644 vendor/k8s.io/apiextensions-apiserver/test/integration/change_test.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/test/integration/scope_test.go diff --git a/glide.lock b/glide.lock index 964b9dea1b..254a07f794 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: f567b9830f081e56a769abb7a719b954157be1a00e8b35824308ba1a704f5330 -updated: 2019-04-18T11:44:52.715519-04:00 +hash: 822aa01113cd0e35b53731519a897210a61eecd1831460cdef57dc23399d4a81 +updated: 2019-08-28T16:32:42.894501-04:00 imports: - name: bitbucket.org/ww/goautoneg version: 75cd24fc2f2c2a2088577d12123ddee5f54e0675 @@ -128,7 +128,7 @@ imports: - name: github.com/go-openapi/swag version: 5899d5c5e619fda5fa86e14795a835f473ca284c - name: github.com/go-test/deep - version: 042da051cf3189d80f667339b822c7effac29cd6 + version: 597fd8504439ea8b0a72c2557de5c6cab932e8f0 - name: github.com/gogo/protobuf version: 342cbe0a04158f6dcb03ca0079991a51a4248c02 subpackages: @@ -193,7 +193,7 @@ imports: - name: github.com/NYTimes/gziphandler version: 56545f4a5d46df9a6648819d1664c3a03a13ffdb - name: github.com/openshift/api - version: 55a3077b7d6ca97aee00a064de38065fdc280cee + version: 9ea19f9dd57858bb3fd8ec7051a99ca5e1ae88d6 subpackages: - apps - apps/v1 @@ -274,7 +274,7 @@ imports: - route/informers/externalversions/route/v1 - route/listers/route/v1 - name: github.com/openshift/library-go - version: ea6360154514f20ae0d722d21ced35021a931e6f + version: a8b3af87bfde83643053d9d1c1da9b9593ffe20e subpackages: - pkg/config/client - pkg/config/clusteroperator/v1helpers @@ -305,6 +305,7 @@ imports: version: e7e903064f5e9eb5da98208bae10b475d4db0f8c subpackages: - prometheus + - prometheus/promhttp - name: github.com/prometheus/client_model version: fa8ad6fec33561be4280a8f0514318c79d7f6cb6 subpackages: @@ -326,7 +327,7 @@ imports: - name: github.com/sirupsen/logrus version: 89742aefa4b206dcf400792f3bd35b542998eb3b - name: github.com/spf13/cobra - version: 67fc4837d267bc9bfd6e47f77783fcc3dffc68de + version: c439c4fa093711d42e1b01acb1235b52004753c1 - name: github.com/spf13/pflag version: 583c0c0531f06d5278b7d917446061adc344b5cd - name: golang.org/x/crypto @@ -382,11 +383,11 @@ imports: subpackages: - rate - name: golang.org/x/tools - version: 2382e3994d48b1d22acc2c86bcad0a2aff028e32 + version: b29f5f60c37a1dd56e6942c2717b85b976e4a592 subpackages: - imports - name: google.golang.org/appengine - version: 267c27e7492265b84fc6719503b14a1e17975d79 + version: 5f2a59506353b8d5ba8cbbcd9f3c1f41f1eaf079 subpackages: - internal - internal/base @@ -472,7 +473,7 @@ imports: - storage/v1alpha1 - storage/v1beta1 - name: k8s.io/apiextensions-apiserver - version: 3c74db8dd172051b029f91536c681a1b43694809 + version: f221ef6dc2779b4f80d2821997dfacaf927b73ee repo: https://github.com/openshift/kubernetes-apiextensions-apiserver subpackages: - pkg/apis/apiextensions diff --git a/glide.yaml b/glide.yaml index d6fc2115b9..30b76bef97 100644 --- a/glide.yaml +++ b/glide.yaml @@ -17,13 +17,13 @@ import: # openshift - package: github.com/openshift/api - version: master + version: release-4.1 - package: github.com/openshift/client-go - version: master + version: release-4.1 - package: github.com/openshift/library-go - version: master + version: release-4.1 -# codegen + # codegen - package: k8s.io/gengo/args version: 01a732e01d00cb9a81bb0ca050d3e6d2b947927b - package: golang.org/x/tools/imports diff --git a/vendor/github.com/go-test/deep/.travis.yml b/vendor/github.com/go-test/deep/.travis.yml index 89dc9815e2..df3972fc9b 100644 --- a/vendor/github.com/go-test/deep/.travis.yml +++ b/vendor/github.com/go-test/deep/.travis.yml @@ -1,9 +1,9 @@ language: go go: - - "1.9" - "1.10" - "1.11" + - "1.12" before_install: - go get github.com/mattn/goveralls diff --git a/vendor/github.com/go-test/deep/CHANGES.md b/vendor/github.com/go-test/deep/CHANGES.md index 4351819d68..b4306986a3 100644 --- a/vendor/github.com/go-test/deep/CHANGES.md +++ b/vendor/github.com/go-test/deep/CHANGES.md @@ -1,8 +1,25 @@ # go-test/deep Changelog +## v1.0.3 released 2019-08-18 + +* Fixed issue #31: panic on typed primitives that implement error interface + +## v1.0.2 released 2019-07-14 + +* Enabled Go module (@radeksimko) +* Changed supported and tested Go versions: 1.10, 1.11, and 1.12 (dropped 1.9) +* Changed Error equality: additional struct fields are compared too (PR #29) (@andrewmostello) +* Fixed typos and ineffassign issues (PR #25) (@tariq1890) +* Fixed diff order for nil comparison (PR #16) (@gmarik) +* Fixed slice equality when slices are extracted from the same array (PR #11) (@risteli) +* Fixed test spelling and messages (PR #19) (@sofuture) +* Fixed issue #15: panic on comparing struct with anonymous time.Time +* Fixed issue #18: Panic when comparing structs with time.Time value and CompareUnexportedFields is true +* Fixed issue #21: Set default MaxDepth = 0 (disabled) (PR #23) + ## v1.0.1 released 2018-01-28 -* Fixed #12: Arrays are not properly compared (samlitowitz) +* Fixed issue #12: Arrays are not properly compared (@samlitowitz) ## v1.0.0 releaesd 2017-10-27 diff --git a/vendor/github.com/go-test/deep/deep.go b/vendor/github.com/go-test/deep/deep.go index 3d2591819b..1df803ae03 100644 --- a/vendor/github.com/go-test/deep/deep.go +++ b/vendor/github.com/go-test/deep/deep.go @@ -27,7 +27,7 @@ var ( LogErrors = false // CompareUnexportedFields causes unexported struct fields, like s in - // T{s int}, to be comparsed when true. + // T{s int}, to be compared when true. CompareUnexportedFields = false ) @@ -99,7 +99,7 @@ func (c *cmp) equals(a, b reflect.Value, level int) { return } - // If differenet types, they can't be equal + // If different types, they can't be equal aType := a.Type() bType := b.Type() if aType != bType { @@ -112,32 +112,33 @@ func (c *cmp) equals(a, b reflect.Value, level int) { aKind := a.Kind() bKind := b.Kind() + // Do a and b have underlying elements? Yes if they're ptr or interface. + aElem := aKind == reflect.Ptr || aKind == reflect.Interface + bElem := bKind == reflect.Ptr || bKind == reflect.Interface + // If both types implement the error interface, compare the error strings. // This must be done before dereferencing because the interface is on a - // pointer receiver. + // pointer receiver. Re https://github.com/go-test/deep/issues/31, a/b might + // be primitive kinds; see TestErrorPrimitiveKind. if aType.Implements(errorType) && bType.Implements(errorType) { - if a.Elem().IsValid() && b.Elem().IsValid() { // both err != nil + if (!aElem || !a.IsNil()) && (!bElem || !b.IsNil()) { aString := a.MethodByName("Error").Call(nil)[0].String() bString := b.MethodByName("Error").Call(nil)[0].String() if aString != bString { c.saveDiff(aString, bString) + return } - return } } // Dereference pointers and interface{} - if aElem, bElem := (aKind == reflect.Ptr || aKind == reflect.Interface), - (bKind == reflect.Ptr || bKind == reflect.Interface); aElem || bElem { - + if aElem || bElem { if aElem { a = a.Elem() } - if bElem { b = b.Elem() } - c.equals(a, b, level+1) return } @@ -282,12 +283,13 @@ func (c *cmp) equals(a, b reflect.Value, level int) { return } - if a.Pointer() == b.Pointer() { + aLen := a.Len() + bLen := b.Len() + + if a.Pointer() == b.Pointer() && aLen == bLen { return } - aLen := a.Len() - bLen := b.Len() n := aLen if bLen > aLen { n = bLen diff --git a/vendor/github.com/go-test/deep/deep_test.go b/vendor/github.com/go-test/deep/deep_test.go index b73c6da266..a8b049d87e 100644 --- a/vendor/github.com/go-test/deep/deep_test.go +++ b/vendor/github.com/go-test/deep/deep_test.go @@ -187,7 +187,11 @@ func TestDeepRecursion(t *testing.T) { }, }, } + // No diffs because MaxDepth=2 prevents seeing the diff at 3rd level down diff := deep.Equal(foo, bar) + if diff != nil { + t.Errorf("got %d diffs, expected none: %v", len(diff), diff) + } defaultMaxDepth := deep.MaxDepth deep.MaxDepth = 4 @@ -607,6 +611,77 @@ func TestSlice(t *testing.T) { } } +func TestSiblingSlices(t *testing.T) { + father := []int{1, 2, 3, 4} + a := father[0:3] + b := father[0:3] + + diff := deep.Equal(a, b) + if len(diff) > 0 { + t.Error("should be equal:", diff) + } + diff = deep.Equal(b, a) + if len(diff) > 0 { + t.Error("should be equal:", diff) + } + + a = father[0:3] + b = father[0:2] + diff = deep.Equal(a, b) + if diff == nil { + t.Fatal("no diff") + } + if len(diff) != 1 { + t.Error("too many diff:", diff) + } + if diff[0] != "slice[2]: 3 != " { + t.Error("wrong diff:", diff[0]) + } + + a = father[0:2] + b = father[0:3] + + diff = deep.Equal(a, b) + if diff == nil { + t.Fatal("no diff") + } + if len(diff) != 1 { + t.Error("too many diff:", diff) + } + if diff[0] != "slice[2]: != 3" { + t.Error("wrong diff:", diff[0]) + } + + a = father[0:2] + b = father[2:4] + + diff = deep.Equal(a, b) + if diff == nil { + t.Fatal("no diff") + } + if len(diff) != 2 { + t.Error("too many diff:", diff) + } + if diff[0] != "slice[0]: 1 != 3" { + t.Error("wrong diff:", diff[0]) + } + if diff[1] != "slice[1]: 2 != 4" { + t.Error("wrong diff:", diff[1]) + } + + a = father[0:0] + b = father[1:1] + + diff = deep.Equal(a, b) + if len(diff) > 0 { + t.Error("should be equal:", diff) + } + diff = deep.Equal(b, a) + if len(diff) > 0 { + t.Error("should be equal:", diff) + } +} + func TestNilInterface(t *testing.T) { type T struct{ i int } @@ -891,6 +966,115 @@ func TestError(t *testing.T) { } } +func TestErrorWithOtherFields(t *testing.T) { + a := errors.New("it broke") + b := errors.New("it broke") + + diff := deep.Equal(a, b) + if len(diff) != 0 { + t.Fatalf("expected zero diffs, got %d: %s", len(diff), diff) + } + + b = errors.New("it fell apart") + diff = deep.Equal(a, b) + if len(diff) != 1 { + t.Fatalf("expected 1 diff, got %d: %s", len(diff), diff) + } + if diff[0] != "it broke != it fell apart" { + t.Errorf("got '%s', expected 'it broke != it fell apart'", diff[0]) + } + + // Both errors set + type tWithError struct { + Error error + Other string + } + t1 := tWithError{ + Error: a, + Other: "ok", + } + t2 := tWithError{ + Error: b, + Other: "ok", + } + diff = deep.Equal(t1, t2) + if len(diff) != 1 { + t.Fatalf("expected 1 diff, got %d: %s", len(diff), diff) + } + if diff[0] != "Error: it broke != it fell apart" { + t.Errorf("got '%s', expected 'Error: it broke != it fell apart'", diff[0]) + } + + // Both errors nil + t1 = tWithError{ + Error: nil, + Other: "ok", + } + t2 = tWithError{ + Error: nil, + Other: "ok", + } + diff = deep.Equal(t1, t2) + if len(diff) != 0 { + t.Log(diff) + t.Fatalf("expected 0 diff, got %d: %s", len(diff), diff) + } + + // Different Other value + t1 = tWithError{ + Error: nil, + Other: "ok", + } + t2 = tWithError{ + Error: nil, + Other: "nope", + } + diff = deep.Equal(t1, t2) + if len(diff) != 1 { + t.Fatalf("expected 1 diff, got %d: %s", len(diff), diff) + } + if diff[0] != "Other: ok != nope" { + t.Errorf("got '%s', expected 'Other: ok != nope'", diff[0]) + } + + // Different Other value, same error + t1 = tWithError{ + Error: a, + Other: "ok", + } + t2 = tWithError{ + Error: a, + Other: "nope", + } + diff = deep.Equal(t1, t2) + if len(diff) != 1 { + t.Fatalf("expected 1 diff, got %d: %s", len(diff), diff) + } + if diff[0] != "Other: ok != nope" { + t.Errorf("got '%s', expected 'Other: ok != nope'", diff[0]) + } +} + +type primKindError string + +func (e primKindError) Error() string { + return string(e) +} + +func TestErrorPrimitiveKind(t *testing.T) { + // The primKindError type above is valid and used by Go, e.g. + // url.EscapeError and url.InvalidHostError. Before fixing this bug + // (https://github.com/go-test/deep/issues/31), we presumed a and b + // were ptr or interface (and not nil), so a.Elem() worked. But when + // a/b are primitive kinds, Elem() causes a panic. + var err1 primKindError = "abc" + var err2 primKindError = "abc" + diff := deep.Equal(err1, err2) + if len(diff) != 0 { + t.Fatalf("expected zero diffs, got %d: %s", len(diff), diff) + } +} + func TestNil(t *testing.T) { type student struct { name string diff --git a/vendor/github.com/go-test/deep/go.mod b/vendor/github.com/go-test/deep/go.mod new file mode 100644 index 0000000000..6e8ca1d2b9 --- /dev/null +++ b/vendor/github.com/go-test/deep/go.mod @@ -0,0 +1 @@ +module github.com/go-test/deep diff --git a/vendor/github.com/openshift/api/Dockerfile.build b/vendor/github.com/openshift/api/Dockerfile.build index 0e40b66191..1b01504405 100644 --- a/vendor/github.com/openshift/api/Dockerfile.build +++ b/vendor/github.com/openshift/api/Dockerfile.build @@ -1,4 +1,4 @@ -FROM fedora:28 +FROM fedora:29 ENV GOPATH=/go ENV PATH=/go/bin:$PATH diff --git a/vendor/github.com/openshift/api/Makefile b/vendor/github.com/openshift/api/Makefile index 4e8e1580af..1667fa5f9d 100644 --- a/vendor/github.com/openshift/api/Makefile +++ b/vendor/github.com/openshift/api/Makefile @@ -24,7 +24,7 @@ update-deps: generate-with-container: Dockerfile.build $(RUNTIME) build -t $(RUNTIME_IMAGE_NAME) -f Dockerfile.build . - $(RUNTIME) run -ti --rm -v $(PWD):/go/src/github.com/openshift/api -w /go/src/github.com/openshift/api $(RUNTIME_IMAGE_NAME) make generate + $(RUNTIME) run -ti --rm -v $(PWD):/go/src/github.com/openshift/api:z -w /go/src/github.com/openshift/api $(RUNTIME_IMAGE_NAME) make generate generate: hack/update-deepcopy.sh diff --git a/vendor/github.com/openshift/api/OWNERS b/vendor/github.com/openshift/api/OWNERS index e47019b22b..70b782d9e5 100644 --- a/vendor/github.com/openshift/api/OWNERS +++ b/vendor/github.com/openshift/api/OWNERS @@ -9,4 +9,5 @@ approvers: - jwforres - knobunc - sjenning - - soltysh \ No newline at end of file + - soltysh + - bparees diff --git a/vendor/github.com/openshift/api/authorization/v1/generated.proto b/vendor/github.com/openshift/api/authorization/v1/generated.proto index 12c2d27885..9816838461 100644 --- a/vendor/github.com/openshift/api/authorization/v1/generated.proto +++ b/vendor/github.com/openshift/api/authorization/v1/generated.proto @@ -116,9 +116,11 @@ message GroupRestriction { // Groups is a list of groups used to match against an individual user's // groups. If the user is a member of one of the whitelisted groups, the user // is allowed to be bound to a role. + // +nullable repeated string groups = 1; // Selectors specifies a list of label selectors over group labels. + // +nullable repeated k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector labels = 2; } @@ -470,9 +472,11 @@ message UserRestriction { repeated string users = 1; // Groups specifies a list of literal group names. + // +nullable repeated string groups = 2; // Selectors specifies a list of label selectors over user labels. + // +nullable repeated k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector labels = 3; } diff --git a/vendor/github.com/openshift/api/authorization/v1/types.go b/vendor/github.com/openshift/api/authorization/v1/types.go index 3e619df0a7..94b4aed0ce 100644 --- a/vendor/github.com/openshift/api/authorization/v1/types.go +++ b/vendor/github.com/openshift/api/authorization/v1/types.go @@ -493,9 +493,11 @@ type UserRestriction struct { Users []string `json:"users" protobuf:"bytes,1,rep,name=users"` // Groups specifies a list of literal group names. + // +nullable Groups []string `json:"groups" protobuf:"bytes,2,rep,name=groups"` // Selectors specifies a list of label selectors over user labels. + // +nullable Selectors []metav1.LabelSelector `json:"labels" protobuf:"bytes,3,rep,name=labels"` } @@ -505,9 +507,11 @@ type GroupRestriction struct { // Groups is a list of groups used to match against an individual user's // groups. If the user is a member of one of the whitelisted groups, the user // is allowed to be bound to a role. + // +nullable Groups []string `json:"groups" protobuf:"bytes,1,rep,name=groups"` // Selectors specifies a list of label selectors over group labels. + // +nullable Selectors []metav1.LabelSelector `json:"labels" protobuf:"bytes,2,rep,name=labels"` } diff --git a/vendor/github.com/openshift/api/build/v1/generated.proto b/vendor/github.com/openshift/api/build/v1/generated.proto index 31cedc6553..cb374e22e4 100644 --- a/vendor/github.com/openshift/api/build/v1/generated.proto +++ b/vendor/github.com/openshift/api/build/v1/generated.proto @@ -110,11 +110,13 @@ message BuildConfigSpec { optional CommonSpec commonSpec = 3; // successfulBuildsHistoryLimit is the number of old successful builds to retain. - // If not specified, all successful builds are retained. + // When a BuildConfig is created, the 5 most recent successful builds are retained unless this value is set. + // If removed after the BuildConfig has been created, all successful builds are retained. optional int32 successfulBuildsHistoryLimit = 4; // failedBuildsHistoryLimit is the number of old failed builds to retain. - // If not specified, all failed builds are retained. + // When a BuildConfig is created, the 5 most recent failed builds are retained unless this value is set. + // If removed after the BuildConfig has been created, all failed builds are retained. optional int32 failedBuildsHistoryLimit = 5; } diff --git a/vendor/github.com/openshift/api/build/v1/types.go b/vendor/github.com/openshift/api/build/v1/types.go index 391da409ed..82bb7883ad 100644 --- a/vendor/github.com/openshift/api/build/v1/types.go +++ b/vendor/github.com/openshift/api/build/v1/types.go @@ -902,11 +902,13 @@ type BuildConfigSpec struct { CommonSpec `json:",inline" protobuf:"bytes,3,opt,name=commonSpec"` // successfulBuildsHistoryLimit is the number of old successful builds to retain. - // If not specified, all successful builds are retained. + // When a BuildConfig is created, the 5 most recent successful builds are retained unless this value is set. + // If removed after the BuildConfig has been created, all successful builds are retained. SuccessfulBuildsHistoryLimit *int32 `json:"successfulBuildsHistoryLimit,omitempty" protobuf:"varint,4,opt,name=successfulBuildsHistoryLimit"` // failedBuildsHistoryLimit is the number of old failed builds to retain. - // If not specified, all failed builds are retained. + // When a BuildConfig is created, the 5 most recent failed builds are retained unless this value is set. + // If removed after the BuildConfig has been created, all failed builds are retained. FailedBuildsHistoryLimit *int32 `json:"failedBuildsHistoryLimit,omitempty" protobuf:"varint,5,opt,name=failedBuildsHistoryLimit"` } diff --git a/vendor/github.com/openshift/api/build/v1/zz_generated.swagger_doc_generated.go b/vendor/github.com/openshift/api/build/v1/zz_generated.swagger_doc_generated.go index cc926d4431..1436e65543 100644 --- a/vendor/github.com/openshift/api/build/v1/zz_generated.swagger_doc_generated.go +++ b/vendor/github.com/openshift/api/build/v1/zz_generated.swagger_doc_generated.go @@ -80,8 +80,8 @@ var map_BuildConfigSpec = map[string]string{ "": "BuildConfigSpec describes when and how builds are created", "triggers": "triggers determine how new Builds can be launched from a BuildConfig. If no triggers are defined, a new build can only occur as a result of an explicit client build creation.", "runPolicy": "RunPolicy describes how the new build created from this build configuration will be scheduled for execution. This is optional, if not specified we default to \"Serial\".", - "successfulBuildsHistoryLimit": "successfulBuildsHistoryLimit is the number of old successful builds to retain. If not specified, all successful builds are retained.", - "failedBuildsHistoryLimit": "failedBuildsHistoryLimit is the number of old failed builds to retain. If not specified, all failed builds are retained.", + "successfulBuildsHistoryLimit": "successfulBuildsHistoryLimit is the number of old successful builds to retain. When a BuildConfig is created, the 5 most recent successful builds are retained unless this value is set. If removed after the BuildConfig has been created, all successful builds are retained.", + "failedBuildsHistoryLimit": "failedBuildsHistoryLimit is the number of old failed builds to retain. When a BuildConfig is created, the 5 most recent failed builds are retained unless this value is set. If removed after the BuildConfig has been created, all failed builds are retained.", } func (BuildConfigSpec) SwaggerDoc() map[string]string { diff --git a/vendor/github.com/openshift/api/config/v1/types_apiserver.go b/vendor/github.com/openshift/api/config/v1/types_apiserver.go index 9a13b85274..52018d20bb 100644 --- a/vendor/github.com/openshift/api/config/v1/types_apiserver.go +++ b/vendor/github.com/openshift/api/config/v1/types_apiserver.go @@ -33,15 +33,6 @@ type APIServerSpec struct { } type APIServerServingCerts struct { - // defaultServingCertificate references a kubernetes.io/tls type secret containing the default TLS cert info for - // serving secure traffic. If no named certificates match the server name as understood by a client, this default - // certificate will be used. If defaultServingCertificate is not specified, then a operator managed certificate will - // be used. - // The secret must exist in the openshift-config namespace and contain the following required fields: - // - Secret.Data["tls.key"] - TLS private key. - // - Secret.Data["tls.crt"] - TLS certificate. - // +optional - DefaultServingCertificate SecretNameReference `json:"defaultServingCertificate"` // namedCertificates references secrets containing the TLS cert info for serving secure traffic to specific hostnames. // If no named certificates are provided, or no named certificates match the server name as understood by a client, // the defaultServingCertificate will be used. diff --git a/vendor/github.com/openshift/api/config/v1/types_cluster_version.go b/vendor/github.com/openshift/api/config/v1/types_cluster_version.go index d650816d26..6ab92365b9 100644 --- a/vendor/github.com/openshift/api/config/v1/types_cluster_version.go +++ b/vendor/github.com/openshift/api/config/v1/types_cluster_version.go @@ -158,6 +158,9 @@ type UpdateHistory struct { // image is a container image location that contains the update. This value // is always populated. Image string `json:"image"` + // verified indicates whether the provided update was properly verified + // before it was installed. If this is false the cluster may not be trusted. + Verified bool `json:"verified"` } // ClusterID is string RFC4122 uuid. @@ -202,6 +205,19 @@ type Update struct { // // +optional Image string `json:"image"` + // force allows an administrator to update to an image that has failed + // verification, does not appear in the availableUpdates list, or otherwise + // would be blocked by normal protections on update. This option should only + // be used when the authenticity of the provided image has been verified out + // of band because the provided image will run with full administrative access + // to the cluster. Do not use this flag with images that comes from unknown + // or potentially malicious sources. + // + // This flag does not override other forms of consistency checking that are + // required before a new update is deployed. + // + // +optional + Force bool `json:"force"` } // RetrievedUpdates reports whether available updates have been retrieved from diff --git a/vendor/github.com/openshift/api/config/v1/types_feature.go b/vendor/github.com/openshift/api/config/v1/types_feature.go index c3c63749b5..a072f13824 100644 --- a/vendor/github.com/openshift/api/config/v1/types_feature.go +++ b/vendor/github.com/openshift/api/config/v1/types_feature.go @@ -74,9 +74,6 @@ var FeatureSets = map[FeatureSet]*FeatureGateEnabledDisabled{ }, Disabled: []string{ "LocalStorageCapacityIsolation", // sig-pod, sjenning - "ResourceQuotaScopeSelectors", // sig-pod, ravig - "TaintNodesByCondition", // sig-pod, ravig - "TaintBasedEvictions", // sig-pod, ravig }, }, TechPreviewNoUpgrade: { @@ -88,9 +85,6 @@ var FeatureSets = map[FeatureSet]*FeatureGateEnabledDisabled{ }, Disabled: []string{ "LocalStorageCapacityIsolation", // sig-pod, sjenning - "ResourceQuotaScopeSelectors", // sig-pod, ravig - "TaintNodesByCondition", // sig-pod, ravig - "TaintBasedEvictions", // sig-pod, ravig }, }, } diff --git a/vendor/github.com/openshift/api/config/v1/types_infrastructure.go b/vendor/github.com/openshift/api/config/v1/types_infrastructure.go index 40e3f2c279..c59dc39c1e 100644 --- a/vendor/github.com/openshift/api/config/v1/types_infrastructure.go +++ b/vendor/github.com/openshift/api/config/v1/types_infrastructure.go @@ -37,25 +37,31 @@ type InfrastructureStatus struct { // alphanumeric or hyphen characters. InfrastructureName string `json:"infrastructureName"` - // platform is the underlying infrastructure provider for the cluster. This - // value controls whether infrastructure automation such as service load - // balancers, dynamic volume provisioning, machine creation and deletion, and - // other integrations are enabled. If None, no infrastructure automation is - // enabled. Allowed values are "AWS", "Azure", "BareMetal", "GCP", "Libvirt", - // "OpenStack", "VSphere", and "None". Individual components may not support - // all platforms, and must handle unrecognized platforms as None if they do - // not support that platform. + // platform is the underlying infrastructure provider for the cluster. + // + // Deprecated: Use platformStatus.type instead. Platform PlatformType `json:"platform,omitempty"` + // platformStatus holds status information specific to the underlying + // infrastructure provider. + // +optional + PlatformStatus *PlatformStatus `json:"platformStatus,omitempty"` + // etcdDiscoveryDomain is the domain used to fetch the SRV records for discovering // etcd servers and clients. // For more info: https://github.com/etcd-io/etcd/blob/329be66e8b3f9e2e6af83c123ff89297e49ebd15/Documentation/op-guide/clustering.md#dns-discovery EtcdDiscoveryDomain string `json:"etcdDiscoveryDomain"` - // apiServerURL is a valid URL with scheme(http/https), address and port. - // apiServerURL can be used by components like kubelet on machines, to contact the `apisever` - // using the infrastructure provider rather than the kubernetes networking. + // apiServerURL is a valid URI with scheme(http/https), address and + // port. apiServerURL can be used by components like the web console + // to tell users where to find the Kubernetes API. APIServerURL string `json:"apiServerURL"` + + // apiServerInternalURL is a valid URI with scheme(http/https), + // address and port. apiServerInternalURL can be used by components + // like kubelets, to contact the Kubernetes API server using the + // infrastructure provider rather than Kubernetes networking. + APIServerInternalURL string `json:"apiServerInternalURI"` } // PlatformType is a specific supported infrastructure provider. @@ -87,6 +93,31 @@ const ( VSpherePlatformType PlatformType = "VSphere" ) +// PlatformStatus holds the current status specific to the underlying infrastructure provider +// of the current cluster. Since these are used at status-level for the underlying cluster, it +// is supposed that only one of the status structs is set. +type PlatformStatus struct { + // type is the underlying infrastructure provider for the cluster. This + // value controls whether infrastructure automation such as service load + // balancers, dynamic volume provisioning, machine creation and deletion, and + // other integrations are enabled. If None, no infrastructure automation is + // enabled. Allowed values are "AWS", "Azure", "BareMetal", "GCP", "Libvirt", + // "OpenStack", "VSphere", and "None". Individual components may not support + // all platforms, and must handle unrecognized platforms as None if they do + // not support that platform. + Type PlatformType `json:"type"` + + // AWS contains settings specific to the Amazon Web Services infrastructure provider. + // +optional + AWS *AWSPlatformStatus `json:"aws,omitempty"` +} + +// AWSPlatformStatus holds the current status of the Amazon Web Services infrastructure provider. +type AWSPlatformStatus struct { + // region holds the default AWS region for new AWS resources created by the cluster. + Region string `json:"region"` +} + // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // InfrastructureList is diff --git a/vendor/github.com/openshift/api/config/v1/zz_generated.deepcopy.go b/vendor/github.com/openshift/api/config/v1/zz_generated.deepcopy.go index 3ad614c5e3..2addbc310e 100644 --- a/vendor/github.com/openshift/api/config/v1/zz_generated.deepcopy.go +++ b/vendor/github.com/openshift/api/config/v1/zz_generated.deepcopy.go @@ -95,7 +95,6 @@ func (in *APIServerNamedServingCert) DeepCopy() *APIServerNamedServingCert { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *APIServerServingCerts) DeepCopyInto(out *APIServerServingCerts) { *out = *in - out.DefaultServingCertificate = in.DefaultServingCertificate if in.NamedCertificates != nil { in, out := &in.NamedCertificates, &out.NamedCertificates *out = make([]APIServerNamedServingCert, len(*in)) @@ -150,6 +149,22 @@ func (in *APIServerStatus) DeepCopy() *APIServerStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AWSPlatformStatus) DeepCopyInto(out *AWSPlatformStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSPlatformStatus. +func (in *AWSPlatformStatus) DeepCopy() *AWSPlatformStatus { + if in == nil { + return nil + } + out := new(AWSPlatformStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AdmissionConfig) DeepCopyInto(out *AdmissionConfig) { *out = *in @@ -1613,7 +1628,7 @@ func (in *Infrastructure) DeepCopyInto(out *Infrastructure) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) out.Spec = in.Spec - out.Status = in.Status + in.Status.DeepCopyInto(&out.Status) return } @@ -1688,6 +1703,11 @@ func (in *InfrastructureSpec) DeepCopy() *InfrastructureSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InfrastructureStatus) DeepCopyInto(out *InfrastructureStatus) { *out = *in + if in.PlatformStatus != nil { + in, out := &in.PlatformStatus, &out.PlatformStatus + *out = new(PlatformStatus) + (*in).DeepCopyInto(*out) + } return } @@ -2271,6 +2291,27 @@ func (in *OperandVersion) DeepCopy() *OperandVersion { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlatformStatus) DeepCopyInto(out *PlatformStatus) { + *out = *in + if in.AWS != nil { + in, out := &in.AWS, &out.AWS + *out = new(AWSPlatformStatus) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlatformStatus. +func (in *PlatformStatus) DeepCopy() *PlatformStatus { + if in == nil { + return nil + } + out := new(PlatformStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Project) DeepCopyInto(out *Project) { *out = *in diff --git a/vendor/github.com/openshift/api/config/v1/zz_generated.swagger_doc_generated.go b/vendor/github.com/openshift/api/config/v1/zz_generated.swagger_doc_generated.go index 91f3a7353f..67c118265d 100644 --- a/vendor/github.com/openshift/api/config/v1/zz_generated.swagger_doc_generated.go +++ b/vendor/github.com/openshift/api/config/v1/zz_generated.swagger_doc_generated.go @@ -262,8 +262,7 @@ func (APIServerNamedServingCert) SwaggerDoc() map[string]string { } var map_APIServerServingCerts = map[string]string{ - "defaultServingCertificate": "defaultServingCertificate references a kubernetes.io/tls type secret containing the default TLS cert info for serving secure traffic. If no named certificates match the server name as understood by a client, this default certificate will be used. If defaultServingCertificate is not specified, then a operator managed certificate will be used. The secret must exist in the openshift-config namespace and contain the following required fields: - Secret.Data[\"tls.key\"] - TLS private key. - Secret.Data[\"tls.crt\"] - TLS certificate.", - "namedCertificates": "namedCertificates references secrets containing the TLS cert info for serving secure traffic to specific hostnames. If no named certificates are provided, or no named certificates match the server name as understood by a client, the defaultServingCertificate will be used.", + "namedCertificates": "namedCertificates references secrets containing the TLS cert info for serving secure traffic to specific hostnames. If no named certificates are provided, or no named certificates match the server name as understood by a client, the defaultServingCertificate will be used.", } func (APIServerServingCerts) SwaggerDoc() map[string]string { @@ -517,6 +516,7 @@ var map_Update = map[string]string{ "": "Update represents a release of the ClusterVersionOperator, referenced by the Image member.", "version": "version is a semantic versioning identifying the update version. When this field is part of spec, version is optional if image is specified.", "image": "image is a container image location that contains the update. When this field is part of spec, image is optional if version is specified and the availableUpdates field contains a matching version.", + "force": "force allows an administrator to update to an image that has failed verification, does not appear in the availableUpdates list, or otherwise would be blocked by normal protections on update. This option should only be used when the authenticity of the provided image has been verified out of band because the provided image will run with full administrative access to the cluster. Do not use this flag with images that comes from unknown or potentially malicious sources.\n\nThis flag does not override other forms of consistency checking that are required before a new update is deployed.", } func (Update) SwaggerDoc() map[string]string { @@ -530,6 +530,7 @@ var map_UpdateHistory = map[string]string{ "completionTime": "completionTime, if set, is when the update was fully applied. The update that is currently being applied will have a null completion time. Completion time will always be set for entries that are not the current update (usually to the started time of the next update).", "version": "version is a semantic versioning identifying the update version. If the requested image does not define a version, or if a failure occurs retrieving the image, this value may be empty.", "image": "image is a container image location that contains the update. This value is always populated.", + "verified": "verified indicates whether the provided update was properly verified before it was installed. If this is false the cluster may not be trusted.", } func (UpdateHistory) SwaggerDoc() map[string]string { @@ -697,6 +698,15 @@ func (RegistrySources) SwaggerDoc() map[string]string { return map_RegistrySources } +var map_AWSPlatformStatus = map[string]string{ + "": "AWSPlatformStatus holds the current status of the Amazon Web Services infrastructure provider.", + "region": "region holds the default AWS region for new AWS resources created by the cluster.", +} + +func (AWSPlatformStatus) SwaggerDoc() map[string]string { + return map_AWSPlatformStatus +} + var map_Infrastructure = map[string]string{ "": "Infrastructure holds cluster-wide information about Infrastructure. The canonical name is `cluster`", "metadata": "Standard object's metadata.", @@ -727,17 +737,29 @@ func (InfrastructureSpec) SwaggerDoc() map[string]string { } var map_InfrastructureStatus = map[string]string{ - "": "InfrastructureStatus describes the infrastructure the cluster is leveraging.", - "infrastructureName": "infrastructureName uniquely identifies a cluster with a human friendly name. Once set it should not be changed. Must be of max length 27 and must have only alphanumeric or hyphen characters.", - "platform": "platform is the underlying infrastructure provider for the cluster. This value controls whether infrastructure automation such as service load balancers, dynamic volume provisioning, machine creation and deletion, and other integrations are enabled. If None, no infrastructure automation is enabled. Allowed values are \"AWS\", \"Azure\", \"BareMetal\", \"GCP\", \"Libvirt\", \"OpenStack\", \"VSphere\", and \"None\". Individual components may not support all platforms, and must handle unrecognized platforms as None if they do not support that platform.", - "etcdDiscoveryDomain": "etcdDiscoveryDomain is the domain used to fetch the SRV records for discovering etcd servers and clients. For more info: https://github.com/etcd-io/etcd/blob/329be66e8b3f9e2e6af83c123ff89297e49ebd15/Documentation/op-guide/clustering.md#dns-discovery", - "apiServerURL": "apiServerURL is a valid URL with scheme(http/https), address and port. apiServerURL can be used by components like kubelet on machines, to contact the `apisever` using the infrastructure provider rather than the kubernetes networking.", + "": "InfrastructureStatus describes the infrastructure the cluster is leveraging.", + "infrastructureName": "infrastructureName uniquely identifies a cluster with a human friendly name. Once set it should not be changed. Must be of max length 27 and must have only alphanumeric or hyphen characters.", + "platform": "platform is the underlying infrastructure provider for the cluster.\n\nDeprecated: Use platformStatus.type instead.", + "platformStatus": "platformStatus holds status information specific to the underlying infrastructure provider.", + "etcdDiscoveryDomain": "etcdDiscoveryDomain is the domain used to fetch the SRV records for discovering etcd servers and clients. For more info: https://github.com/etcd-io/etcd/blob/329be66e8b3f9e2e6af83c123ff89297e49ebd15/Documentation/op-guide/clustering.md#dns-discovery", + "apiServerURL": "apiServerURL is a valid URI with scheme(http/https), address and port. apiServerURL can be used by components like the web console to tell users where to find the Kubernetes API.", + "apiServerInternalURI": "apiServerInternalURL is a valid URI with scheme(http/https), address and port. apiServerInternalURL can be used by components like kubelets, to contact the Kubernetes API server using the infrastructure provider rather than Kubernetes networking.", } func (InfrastructureStatus) SwaggerDoc() map[string]string { return map_InfrastructureStatus } +var map_PlatformStatus = map[string]string{ + "": "PlatformStatus holds the current status specific to the underlying infrastructure provider of the current cluster. Since these are used at status-level for the underlying cluster, it is supposed that only one of the status structs is set.", + "type": "type is the underlying infrastructure provider for the cluster. This value controls whether infrastructure automation such as service load balancers, dynamic volume provisioning, machine creation and deletion, and other integrations are enabled. If None, no infrastructure automation is enabled. Allowed values are \"AWS\", \"Azure\", \"BareMetal\", \"GCP\", \"Libvirt\", \"OpenStack\", \"VSphere\", and \"None\". Individual components may not support all platforms, and must handle unrecognized platforms as None if they do not support that platform.", + "aws": "AWS contains settings specific to the Amazon Web Services infrastructure provider.", +} + +func (PlatformStatus) SwaggerDoc() map[string]string { + return map_PlatformStatus +} + var map_Ingress = map[string]string{ "": "Ingress holds cluster-wide information about Ingress. The canonical name is `cluster`", "metadata": "Standard object's metadata.", diff --git a/vendor/github.com/openshift/api/hack/update-protobuf.sh b/vendor/github.com/openshift/api/hack/update-protobuf.sh index 1fca572cd6..93c4473047 100755 --- a/vendor/github.com/openshift/api/hack/update-protobuf.sh +++ b/vendor/github.com/openshift/api/hack/update-protobuf.sh @@ -11,6 +11,7 @@ install the platform appropriate Protobuf package for your OS: https://github.com/google/protobuf/releases To skip protobuf generation, set \$PROTO_OPTIONAL." + exit 1 fi rm -rf go-to-protobuf diff --git a/vendor/github.com/openshift/api/operator/v1/types.go b/vendor/github.com/openshift/api/operator/v1/types.go index 2a4fe24d84..3f5af652f6 100644 --- a/vendor/github.com/openshift/api/operator/v1/types.go +++ b/vendor/github.com/openshift/api/operator/v1/types.go @@ -133,8 +133,6 @@ var ( OperatorStatusTypeAvailable = "Available" // Progressing indicates that the operator is trying to transition the operand to a different state OperatorStatusTypeProgressing = "Progressing" - // Failing indicates that the operator (not the operand) is unable to fulfill the user intent - OperatorStatusTypeFailing = "Failing" // Degraded indicates that the operator (not the operand) is unable to fulfill the user intent OperatorStatusTypeDegraded = "Degraded" // PrereqsSatisfied indicates that the things this operator depends on are present and at levels compatible with the diff --git a/vendor/github.com/openshift/api/operator/v1/types_etcd.go b/vendor/github.com/openshift/api/operator/v1/types_etcd.go index b1e1adda68..83376ba4f9 100644 --- a/vendor/github.com/openshift/api/operator/v1/types_etcd.go +++ b/vendor/github.com/openshift/api/operator/v1/types_etcd.go @@ -21,11 +21,6 @@ type Etcd struct { type EtcdSpec struct { StaticPodOperatorSpec `json:",inline"` - - // forceRedeploymentReason can be used to force the redeployment of the kube-apiserver by providing a unique string. - // This provides a mechanism to kick a previously failed deployment and provide a reason why you think it will work - // this time instead of failing again on the same config. - ForceRedeploymentReason string `json:"forceRedeploymentReason"` } type EtcdStatus struct { diff --git a/vendor/github.com/openshift/api/operator/v1/types_network.go b/vendor/github.com/openshift/api/operator/v1/types_network.go index 53052e8b2a..8ba638ce9d 100644 --- a/vendor/github.com/openshift/api/operator/v1/types_network.go +++ b/vendor/github.com/openshift/api/operator/v1/types_network.go @@ -108,6 +108,10 @@ type AdditionalNetworkDefinition struct { // This must be unique. Name string `json:"name"` + // namespace is the namespace of the network. This will be populated in the resulting CRD + // If not given the network will be created in the default namespace. + Namespace string `json:"namespace,omitempty"` + // rawCNIConfig is the raw CNI configuration json to create in the // NetworkAttachmentDefinition CRD RawCNIConfig string `json:"rawCNIConfig"` diff --git a/vendor/github.com/openshift/api/operator/v1/types_serviceca.go b/vendor/github.com/openshift/api/operator/v1/types_serviceca.go index e6bb242aa2..6d7f7dd453 100644 --- a/vendor/github.com/openshift/api/operator/v1/types_serviceca.go +++ b/vendor/github.com/openshift/api/operator/v1/types_serviceca.go @@ -13,11 +13,11 @@ type ServiceCA struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata"` - // +required //spec holds user settable values for configuration + // +required Spec ServiceCASpec `json:"spec"` - // +optional // status holds observed values from the cluster. They may not be overridden. + // +optional Status ServiceCAStatus `json:"status"` } diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go b/vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go index da167ba6d2..5296f8dc23 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go @@ -188,14 +188,6 @@ func (EtcdList) SwaggerDoc() map[string]string { return map_EtcdList } -var map_EtcdSpec = map[string]string{ - "forceRedeploymentReason": "forceRedeploymentReason can be used to force the redeployment of the kube-apiserver by providing a unique string. This provides a mechanism to kick a previously failed deployment and provide a reason why you think it will work this time instead of failing again on the same config.", -} - -func (EtcdSpec) SwaggerDoc() map[string]string { - return map_EtcdSpec -} - var map_EndpointPublishingStrategy = map[string]string{ "": "EndpointPublishingStrategy is a way to publish the endpoints of an IngressController, and represents the type and any additional configuration for a specific type.", "type": "type is the publishing strategy to use. Valid values are:\n\n* LoadBalancerService\n\nPublishes the ingress controller using a Kubernetes LoadBalancer Service.\n\nIn this configuration, the ingress controller deployment uses container networking. A LoadBalancer Service is created to publish the deployment.\n\nSee: https://kubernetes.io/docs/concepts/services-networking/#loadbalancer\n\nIf domain is set, a wildcard DNS record will be managed to point at the LoadBalancer Service's external name. DNS records are managed only in DNS zones defined by dns.config.openshift.io/cluster .spec.publicZone and .spec.privateZone.\n\nWildcard DNS management is currently supported only on the AWS platform.\n\n* HostNetwork\n\nPublishes the ingress controller on node ports where the ingress controller is deployed.\n\nIn this configuration, the ingress controller deployment uses host networking, bound to node ports 80 and 443. The user is responsible for configuring an external load balancer to publish the ingress controller via the node ports.\n\n* Private\n\nDoes not publish the ingress controller.\n\nIn this configuration, the ingress controller deployment uses container networking, and is not explicitly published. The user must manually publish the ingress controller.", @@ -301,6 +293,7 @@ var map_AdditionalNetworkDefinition = map[string]string{ "": "AdditionalNetworkDefinition configures an extra network that is available but not created by default. Instead, pods must request them by name. type must be specified, along with exactly one \"Config\" that matches the type.", "type": "type is the type of network The only supported value is NetworkTypeRaw", "name": "name is the name of the network. This will be populated in the resulting CRD This must be unique.", + "namespace": "namespace is the namespace of the network. This will be populated in the resulting CRD If not given the network will be created in the default namespace.", "rawCNIConfig": "rawCNIConfig is the raw CNI configuration json to create in the NetworkAttachmentDefinition CRD", } diff --git a/vendor/github.com/openshift/api/route/v1/generated.pb.go b/vendor/github.com/openshift/api/route/v1/generated.pb.go index b0ad233717..dde33a9943 100644 --- a/vendor/github.com/openshift/api/route/v1/generated.pb.go +++ b/vendor/github.com/openshift/api/route/v1/generated.pb.go @@ -360,6 +360,10 @@ func (m *RouteSpec) MarshalTo(dAtA []byte) (int, error) { i++ i = encodeVarintGenerated(dAtA, i, uint64(len(m.WildcardPolicy))) i += copy(dAtA[i:], m.WildcardPolicy) + dAtA[i] = 0x42 + i++ + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Subdomain))) + i += copy(dAtA[i:], m.Subdomain) return i, nil } @@ -598,6 +602,8 @@ func (m *RouteSpec) Size() (n int) { } l = len(m.WildcardPolicy) n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Subdomain) + n += 1 + l + sovGenerated(uint64(l)) return n } @@ -740,6 +746,7 @@ func (this *RouteSpec) String() string { `Port:` + strings.Replace(fmt.Sprintf("%v", this.Port), "RoutePort", "RoutePort", 1) + `,`, `TLS:` + strings.Replace(fmt.Sprintf("%v", this.TLS), "TLSConfig", "TLSConfig", 1) + `,`, `WildcardPolicy:` + fmt.Sprintf("%v", this.WildcardPolicy) + `,`, + `Subdomain:` + fmt.Sprintf("%v", this.Subdomain) + `,`, `}`, }, "") return s @@ -1770,6 +1777,35 @@ func (m *RouteSpec) Unmarshal(dAtA []byte) error { } m.WildcardPolicy = WildcardPolicyType(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subdomain", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subdomain = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -2442,77 +2478,78 @@ func init() { } var fileDescriptorGenerated = []byte{ - // 1146 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0x8f, 0xff, 0xa6, 0x1e, 0xb7, 0x85, 0x0c, 0x94, 0xba, 0x91, 0x62, 0xa7, 0x7b, 0x40, 0x29, - 0x2a, 0xbb, 0x24, 0x14, 0xa8, 0x84, 0x38, 0xd4, 0x29, 0x82, 0x34, 0x4e, 0x1a, 0x8d, 0x2d, 0x2a, - 0xaa, 0x1e, 0x98, 0xec, 0x8e, 0xd7, 0x83, 0xed, 0x99, 0x65, 0x66, 0x9c, 0xe2, 0x0b, 0xaa, 0xc4, - 0x17, 0x28, 0x7c, 0x1a, 0x3e, 0x42, 0x8e, 0x3d, 0xf6, 0x80, 0x2c, 0x62, 0x8e, 0x7c, 0x83, 0x9c, - 0xd0, 0xcc, 0x8e, 0xbd, 0xeb, 0xc4, 0x49, 0x5d, 0xb8, 0xed, 0xbc, 0xf7, 0x7e, 0xbf, 0xf7, 0xe6, - 0xbd, 0xb7, 0xbf, 0x01, 0x9b, 0x21, 0x55, 0x9d, 0xc1, 0xa1, 0xeb, 0xf3, 0xbe, 0xc7, 0x23, 0xc2, - 0x64, 0x87, 0xb6, 0x95, 0x87, 0x23, 0xea, 0x09, 0x3e, 0x50, 0xc4, 0x3b, 0xda, 0xf4, 0x42, 0xc2, - 0x88, 0xc0, 0x8a, 0x04, 0x6e, 0x24, 0xb8, 0xe2, 0xf0, 0x76, 0x02, 0x71, 0xa7, 0x10, 0x17, 0x47, - 0xd4, 0x35, 0x10, 0xf7, 0x68, 0x73, 0xf5, 0xe3, 0x14, 0x6b, 0xc8, 0x43, 0xee, 0x19, 0xe4, 0xe1, - 0xa0, 0x6d, 0x4e, 0xe6, 0x60, 0xbe, 0x62, 0xc6, 0x55, 0xa7, 0x7b, 0x5f, 0xba, 0x94, 0x9b, 0xb4, - 0x3e, 0x17, 0xf3, 0xb2, 0xae, 0xde, 0x4b, 0x62, 0xfa, 0xd8, 0xef, 0x50, 0x46, 0xc4, 0xd0, 0x8b, - 0xba, 0xa1, 0x36, 0x48, 0xaf, 0x4f, 0x14, 0x9e, 0x87, 0xfa, 0xfc, 0x22, 0x94, 0x18, 0x30, 0x45, - 0xfb, 0xc4, 0x93, 0x7e, 0x87, 0xf4, 0xf1, 0x39, 0xdc, 0xa7, 0x17, 0xe1, 0x06, 0x8a, 0xf6, 0x3c, - 0xca, 0x94, 0x54, 0xe2, 0x2c, 0xc8, 0xf9, 0x2d, 0x0b, 0x0a, 0x48, 0xb7, 0x00, 0xfe, 0x00, 0xae, - 0xe8, 0x8a, 0x02, 0xac, 0x70, 0x25, 0xb3, 0x9e, 0xd9, 0x28, 0x6f, 0x7d, 0xe2, 0xc6, 0x8c, 0x6e, - 0x9a, 0xd1, 0x8d, 0xba, 0xa1, 0x36, 0x48, 0x57, 0x47, 0xbb, 0x47, 0x9b, 0xee, 0xe3, 0xc3, 0x1f, - 0x89, 0xaf, 0xf6, 0x88, 0xc2, 0x75, 0x78, 0x3c, 0xaa, 0x2d, 0x8d, 0x47, 0x35, 0x90, 0xd8, 0xd0, - 0x94, 0x15, 0xee, 0x83, 0xbc, 0x8c, 0x88, 0x5f, 0xc9, 0x1a, 0xf6, 0xbb, 0xee, 0x1b, 0x67, 0xe2, - 0x9a, 0xca, 0x9a, 0x11, 0xf1, 0xeb, 0x57, 0x2d, 0x73, 0x5e, 0x9f, 0x90, 0xe1, 0x81, 0xdf, 0x81, - 0xa2, 0x54, 0x58, 0x0d, 0x64, 0x25, 0x67, 0x18, 0xdd, 0x85, 0x19, 0x0d, 0xaa, 0x7e, 0xdd, 0x72, - 0x16, 0xe3, 0x33, 0xb2, 0x6c, 0xce, 0xaf, 0x39, 0x70, 0xd5, 0xc4, 0xed, 0xb0, 0x50, 0x10, 0x29, - 0xe1, 0x3a, 0xc8, 0x77, 0xb8, 0x54, 0xa6, 0x2d, 0xa5, 0xa4, 0x94, 0x6f, 0xb9, 0x54, 0xc8, 0x78, - 0xe0, 0x16, 0x00, 0x26, 0x85, 0xd8, 0xc7, 0x7d, 0x62, 0x2e, 0x58, 0x4a, 0x9a, 0x81, 0xa6, 0x1e, - 0x94, 0x8a, 0x82, 0x3d, 0x00, 0x7c, 0xce, 0x02, 0xaa, 0x28, 0x67, 0xfa, 0x0a, 0xb9, 0x8d, 0xf2, - 0xd6, 0xfd, 0x45, 0xaf, 0x60, 0x4b, 0xdb, 0x9e, 0x10, 0x24, 0xd9, 0xa6, 0x26, 0x89, 0x52, 0xfc, - 0xb0, 0x05, 0xae, 0x3f, 0xa7, 0xbd, 0xc0, 0xc7, 0x22, 0x38, 0xe0, 0x3d, 0xea, 0x0f, 0x2b, 0x79, - 0x53, 0xe5, 0x5d, 0x8b, 0xbb, 0xfe, 0x64, 0xc6, 0x7b, 0x3a, 0xaa, 0xc1, 0x59, 0x4b, 0x6b, 0x18, - 0x11, 0x74, 0x86, 0x03, 0x7e, 0x0f, 0x6e, 0xc6, 0x37, 0xda, 0xc6, 0x8c, 0x33, 0xea, 0xe3, 0x9e, - 0x6e, 0x0a, 0xd3, 0x4d, 0x28, 0x18, 0xfa, 0x9a, 0xa5, 0xbf, 0x89, 0xe6, 0x87, 0xa1, 0x8b, 0xf0, - 0xce, 0x3f, 0x59, 0x70, 0x63, 0xee, 0x55, 0xe1, 0x57, 0x20, 0xaf, 0x86, 0x11, 0xb1, 0xe3, 0xb8, - 0x33, 0x19, 0x87, 0x2e, 0xf0, 0x74, 0x54, 0xbb, 0x35, 0x17, 0x64, 0xaa, 0x37, 0x30, 0xd8, 0x98, - 0xae, 0x4d, 0x3c, 0xa7, 0x7b, 0xb3, 0x6b, 0x70, 0x3a, 0xaa, 0xcd, 0xf9, 0xb7, 0xdd, 0x29, 0xd3, - 0xec, 0xb2, 0xc0, 0x0f, 0x41, 0x51, 0x10, 0x2c, 0x39, 0x33, 0x4b, 0x58, 0x4a, 0x96, 0x0a, 0x19, - 0x2b, 0xb2, 0x5e, 0x78, 0x07, 0x2c, 0xf7, 0x89, 0x94, 0x38, 0x24, 0xb6, 0xf1, 0xef, 0xd8, 0xc0, - 0xe5, 0xbd, 0xd8, 0x8c, 0x26, 0x7e, 0x28, 0x00, 0xec, 0x61, 0xa9, 0x5a, 0x02, 0x33, 0x19, 0x17, - 0x4f, 0x6d, 0x3f, 0xcb, 0x5b, 0x1f, 0x2d, 0xf6, 0x4f, 0x6a, 0x44, 0xfd, 0x83, 0xf1, 0xa8, 0x06, - 0x1b, 0xe7, 0x98, 0xd0, 0x1c, 0x76, 0xe7, 0x8f, 0x0c, 0x28, 0x99, 0xc6, 0x35, 0xa8, 0x54, 0xf0, - 0xd9, 0x39, 0x2d, 0x70, 0x17, 0xcb, 0xab, 0xd1, 0x46, 0x09, 0xde, 0xb5, 0xb7, 0xbb, 0x32, 0xb1, - 0xa4, 0x74, 0x60, 0x0f, 0x14, 0xa8, 0x22, 0x7d, 0xdd, 0x7f, 0xbd, 0xf3, 0x1b, 0x8b, 0xee, 0x7c, - 0xfd, 0x9a, 0x25, 0x2d, 0xec, 0x68, 0x38, 0x8a, 0x59, 0x9c, 0x9f, 0x6c, 0xe5, 0x07, 0x5c, 0x28, - 0x18, 0x00, 0xa0, 0xb0, 0x08, 0x89, 0xd2, 0xa7, 0x37, 0xea, 0x98, 0x56, 0x46, 0x37, 0x56, 0x46, - 0x77, 0x87, 0xa9, 0xc7, 0xa2, 0xa9, 0x04, 0x65, 0x61, 0xf2, 0x33, 0xb5, 0xa6, 0x5c, 0x28, 0xc5, - 0xeb, 0xfc, 0x9e, 0xb7, 0x39, 0xb5, 0x1a, 0x2d, 0x20, 0x0f, 0xeb, 0x20, 0x1f, 0x61, 0xd5, 0xb1, - 0x0b, 0x37, 0x8d, 0x38, 0xc0, 0xaa, 0x83, 0x8c, 0x07, 0x36, 0x41, 0x56, 0x71, 0xab, 0x63, 0x5f, - 0x2c, 0xda, 0x90, 0xb8, 0x3a, 0x44, 0xda, 0x44, 0x10, 0xe6, 0x93, 0x3a, 0xb0, 0xc4, 0xd9, 0x16, - 0x47, 0x59, 0xc5, 0xe1, 0x8b, 0x0c, 0x58, 0xc1, 0x3d, 0x45, 0x04, 0xc3, 0x8a, 0xd4, 0xb1, 0xdf, - 0x25, 0x2c, 0x90, 0x95, 0xbc, 0xe9, 0xfa, 0x7f, 0x4e, 0x72, 0xcb, 0x26, 0x59, 0x79, 0x70, 0x96, - 0x19, 0x9d, 0x4f, 0x06, 0x1f, 0x81, 0x7c, 0xa4, 0x27, 0x51, 0x78, 0x3b, 0xcd, 0xd7, 0x5d, 0xae, - 0x5f, 0x31, 0x3d, 0xd2, 0xbd, 0x37, 0x1c, 0xf0, 0x1b, 0x90, 0x53, 0x3d, 0x59, 0x29, 0x2e, 0x4c, - 0xd5, 0x6a, 0x34, 0xb7, 0x39, 0x6b, 0xd3, 0xb0, 0xbe, 0x3c, 0x1e, 0xd5, 0x72, 0xad, 0x46, 0x13, - 0x69, 0x86, 0x39, 0x5a, 0xb8, 0xfc, 0xff, 0xb5, 0xd0, 0xa1, 0xa0, 0x9c, 0x7a, 0x5d, 0xe0, 0x53, - 0xb0, 0x4c, 0x63, 0x11, 0xaa, 0x64, 0x4c, 0xc7, 0xbd, 0xb7, 0xd4, 0xf6, 0x44, 0x21, 0xac, 0x01, - 0x4d, 0x08, 0x9d, 0x5f, 0xc0, 0xfb, 0xf3, 0x66, 0xa3, 0xf7, 0xac, 0x4b, 0x59, 0x70, 0x76, 0x13, - 0x77, 0x29, 0x0b, 0x90, 0xf1, 0xe8, 0x08, 0x96, 0x3c, 0x51, 0xd3, 0x08, 0xf3, 0x38, 0x19, 0x0f, - 0x74, 0x40, 0xf1, 0x39, 0xa1, 0x61, 0x47, 0x99, 0x6d, 0x2c, 0xd4, 0x81, 0x16, 0xb3, 0x27, 0xc6, - 0x82, 0xac, 0xc7, 0xe1, 0xf6, 0xaa, 0xa2, 0xd9, 0xc1, 0x22, 0x80, 0x1e, 0x28, 0x49, 0xfd, 0x61, - 0x1e, 0xbf, 0x38, 0xf7, 0x8a, 0x65, 0x2e, 0x35, 0x27, 0x0e, 0x94, 0xc4, 0x68, 0x40, 0xc0, 0x64, - 0x73, 0xd0, 0x6e, 0xd3, 0x9f, 0x6d, 0x29, 0x53, 0xc0, 0xc3, 0xfd, 0x66, 0xec, 0x40, 0x49, 0x8c, - 0xf3, 0x67, 0x0e, 0x94, 0xa6, 0xd3, 0x84, 0xbb, 0xa0, 0xac, 0x88, 0xe8, 0x53, 0x86, 0xb5, 0x7e, - 0x9d, 0x79, 0x07, 0xca, 0xad, 0xc4, 0xa5, 0x27, 0xd7, 0x6a, 0x34, 0x53, 0x16, 0x33, 0xb9, 0x34, - 0x1a, 0x7e, 0x06, 0xca, 0x3e, 0x11, 0x8a, 0xb6, 0xa9, 0x8f, 0xd5, 0xa4, 0x31, 0xef, 0x4d, 0xc8, - 0xb6, 0x13, 0x17, 0x4a, 0xc7, 0xc1, 0x35, 0x90, 0xeb, 0x92, 0xa1, 0x15, 0xfd, 0xb2, 0x0d, 0xcf, - 0xed, 0x92, 0x21, 0xd2, 0x76, 0xf8, 0x25, 0xb8, 0xe6, 0xe3, 0x14, 0xd8, 0x8a, 0xfe, 0x0d, 0x1b, - 0x78, 0x6d, 0xfb, 0x41, 0x9a, 0x79, 0x36, 0x16, 0x3e, 0x03, 0x95, 0x80, 0x48, 0x65, 0x2b, 0x9c, - 0x09, 0xb5, 0xcf, 0xea, 0xba, 0xe5, 0xa9, 0x3c, 0xbc, 0x20, 0x0e, 0x5d, 0xc8, 0x00, 0x5f, 0x66, - 0xc0, 0x1a, 0x65, 0x92, 0xf8, 0x03, 0x41, 0xbe, 0x0e, 0x42, 0x92, 0xea, 0x8e, 0xfd, 0x1b, 0x8a, - 0x26, 0xc7, 0x23, 0x9b, 0x63, 0x6d, 0xe7, 0xb2, 0xe0, 0xd3, 0x51, 0xed, 0xf6, 0xa5, 0x01, 0xa6, - 0xe3, 0x97, 0x27, 0xac, 0x6f, 0x1c, 0x9f, 0x54, 0x97, 0x5e, 0x9d, 0x54, 0x97, 0x5e, 0x9f, 0x54, - 0x97, 0x5e, 0x8c, 0xab, 0x99, 0xe3, 0x71, 0x35, 0xf3, 0x6a, 0x5c, 0xcd, 0xbc, 0x1e, 0x57, 0x33, - 0x7f, 0x8d, 0xab, 0x99, 0x97, 0x7f, 0x57, 0x97, 0x9e, 0x66, 0x8f, 0x36, 0xff, 0x0d, 0x00, 0x00, - 0xff, 0xff, 0x3b, 0x9e, 0x66, 0x71, 0xfc, 0x0b, 0x00, 0x00, + // 1164 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xfa, 0x5f, 0xe2, 0x71, 0x1b, 0xc8, 0x40, 0xa9, 0x1b, 0x29, 0x76, 0xba, 0x07, 0x94, + 0xa2, 0xb2, 0x4b, 0x42, 0x81, 0x4a, 0x88, 0x43, 0x9d, 0x22, 0x48, 0xe3, 0xa4, 0xd1, 0xd8, 0xa2, + 0xa2, 0xea, 0x81, 0xc9, 0xee, 0x78, 0x3d, 0xd8, 0x9e, 0x5d, 0x66, 0xc6, 0x29, 0xbe, 0xa0, 0x4a, + 0x7c, 0x81, 0xf2, 0x6d, 0xb8, 0x73, 0xc9, 0xb1, 0xc7, 0x1e, 0x90, 0x45, 0xcc, 0x91, 0x6f, 0x90, + 0x13, 0x9a, 0xd9, 0xb1, 0x77, 0xed, 0x38, 0xa9, 0x8b, 0xb8, 0xed, 0xbc, 0xf7, 0xfb, 0xfd, 0xde, + 0x9b, 0xf7, 0xde, 0xbe, 0x01, 0xdb, 0x01, 0x95, 0xed, 0xfe, 0xb1, 0xe3, 0x85, 0x3d, 0x37, 0x8c, + 0x08, 0x13, 0x6d, 0xda, 0x92, 0x2e, 0x8e, 0xa8, 0xcb, 0xc3, 0xbe, 0x24, 0xee, 0xc9, 0xb6, 0x1b, + 0x10, 0x46, 0x38, 0x96, 0xc4, 0x77, 0x22, 0x1e, 0xca, 0x10, 0xde, 0x4e, 0x28, 0xce, 0x84, 0xe2, + 0xe0, 0x88, 0x3a, 0x9a, 0xe2, 0x9c, 0x6c, 0xaf, 0x7f, 0x9c, 0x52, 0x0d, 0xc2, 0x20, 0x74, 0x35, + 0xf3, 0xb8, 0xdf, 0xd2, 0x27, 0x7d, 0xd0, 0x5f, 0xb1, 0xe2, 0xba, 0xdd, 0xb9, 0x2f, 0x1c, 0x1a, + 0xea, 0xb0, 0x5e, 0xc8, 0xe7, 0x45, 0x5d, 0xbf, 0x97, 0x60, 0x7a, 0xd8, 0x6b, 0x53, 0x46, 0xf8, + 0xc0, 0x8d, 0x3a, 0x81, 0x32, 0x08, 0xb7, 0x47, 0x24, 0x9e, 0xc7, 0xfa, 0xfc, 0x32, 0x16, 0xef, + 0x33, 0x49, 0x7b, 0xc4, 0x15, 0x5e, 0x9b, 0xf4, 0xf0, 0x05, 0xde, 0xa7, 0x97, 0xf1, 0xfa, 0x92, + 0x76, 0x5d, 0xca, 0xa4, 0x90, 0x7c, 0x96, 0x64, 0xff, 0x96, 0x01, 0x79, 0xa4, 0x4a, 0x00, 0x7f, + 0x00, 0x2b, 0x2a, 0x23, 0x1f, 0x4b, 0x5c, 0xb6, 0x36, 0xad, 0xad, 0xd2, 0xce, 0x27, 0x4e, 0xac, + 0xe8, 0xa4, 0x15, 0x9d, 0xa8, 0x13, 0x28, 0x83, 0x70, 0x14, 0xda, 0x39, 0xd9, 0x76, 0x1e, 0x1f, + 0xff, 0x48, 0x3c, 0x79, 0x40, 0x24, 0xae, 0xc1, 0xd3, 0x61, 0x75, 0x69, 0x34, 0xac, 0x82, 0xc4, + 0x86, 0x26, 0xaa, 0xf0, 0x10, 0xe4, 0x44, 0x44, 0xbc, 0x72, 0x46, 0xab, 0xdf, 0x75, 0xde, 0xd8, + 0x13, 0x47, 0x67, 0xd6, 0x88, 0x88, 0x57, 0xbb, 0x66, 0x94, 0x73, 0xea, 0x84, 0xb4, 0x0e, 0xfc, + 0x0e, 0x14, 0x84, 0xc4, 0xb2, 0x2f, 0xca, 0x59, 0xad, 0xe8, 0x2c, 0xac, 0xa8, 0x59, 0xb5, 0x55, + 0xa3, 0x59, 0x88, 0xcf, 0xc8, 0xa8, 0xd9, 0xbf, 0x66, 0xc1, 0x35, 0x8d, 0xdb, 0x63, 0x01, 0x27, + 0x42, 0xc0, 0x4d, 0x90, 0x6b, 0x87, 0x42, 0xea, 0xb2, 0x14, 0x93, 0x54, 0xbe, 0x0d, 0x85, 0x44, + 0xda, 0x03, 0x77, 0x00, 0xd0, 0x21, 0xf8, 0x21, 0xee, 0x11, 0x7d, 0xc1, 0x62, 0x52, 0x0c, 0x34, + 0xf1, 0xa0, 0x14, 0x0a, 0x76, 0x01, 0xf0, 0x42, 0xe6, 0x53, 0x49, 0x43, 0xa6, 0xae, 0x90, 0xdd, + 0x2a, 0xed, 0xdc, 0x5f, 0xf4, 0x0a, 0x26, 0xb5, 0xdd, 0xb1, 0x40, 0x12, 0x6d, 0x62, 0x12, 0x28, + 0xa5, 0x0f, 0x9b, 0x60, 0xf5, 0x39, 0xed, 0xfa, 0x1e, 0xe6, 0xfe, 0x51, 0xd8, 0xa5, 0xde, 0xa0, + 0x9c, 0xd3, 0x59, 0xde, 0x35, 0xbc, 0xd5, 0x27, 0x53, 0xde, 0xf3, 0x61, 0x15, 0x4e, 0x5b, 0x9a, + 0x83, 0x88, 0xa0, 0x19, 0x0d, 0xf8, 0x3d, 0xb8, 0x19, 0xdf, 0x68, 0x17, 0xb3, 0x90, 0x51, 0x0f, + 0x77, 0x55, 0x51, 0x98, 0x2a, 0x42, 0x5e, 0xcb, 0x57, 0x8d, 0xfc, 0x4d, 0x34, 0x1f, 0x86, 0x2e, + 0xe3, 0xdb, 0xff, 0x64, 0xc0, 0x8d, 0xb9, 0x57, 0x85, 0x5f, 0x81, 0x9c, 0x1c, 0x44, 0xc4, 0xb4, + 0xe3, 0xce, 0xb8, 0x1d, 0x2a, 0xc1, 0xf3, 0x61, 0xf5, 0xd6, 0x5c, 0x92, 0xce, 0x5e, 0xd3, 0x60, + 0x7d, 0x32, 0x36, 0x71, 0x9f, 0xee, 0x4d, 0x8f, 0xc1, 0xf9, 0xb0, 0x3a, 0xe7, 0xdf, 0x76, 0x26, + 0x4a, 0xd3, 0xc3, 0x02, 0x3f, 0x04, 0x05, 0x4e, 0xb0, 0x08, 0x99, 0x1e, 0xc2, 0x62, 0x32, 0x54, + 0x48, 0x5b, 0x91, 0xf1, 0xc2, 0x3b, 0x60, 0xb9, 0x47, 0x84, 0xc0, 0x01, 0x31, 0x85, 0x7f, 0xc7, + 0x00, 0x97, 0x0f, 0x62, 0x33, 0x1a, 0xfb, 0x21, 0x07, 0xb0, 0x8b, 0x85, 0x6c, 0x72, 0xcc, 0x44, + 0x9c, 0x3c, 0x35, 0xf5, 0x2c, 0xed, 0x7c, 0xb4, 0xd8, 0x3f, 0xa9, 0x18, 0xb5, 0x0f, 0x46, 0xc3, + 0x2a, 0xac, 0x5f, 0x50, 0x42, 0x73, 0xd4, 0xed, 0xdf, 0x2d, 0x50, 0xd4, 0x85, 0xab, 0x53, 0x21, + 0xe1, 0xb3, 0x0b, 0xbb, 0xc0, 0x59, 0x2c, 0xae, 0x62, 0xeb, 0x4d, 0xf0, 0xae, 0xb9, 0xdd, 0xca, + 0xd8, 0x92, 0xda, 0x03, 0x07, 0x20, 0x4f, 0x25, 0xe9, 0xa9, 0xfa, 0xab, 0x99, 0xdf, 0x5a, 0x74, + 0xe6, 0x6b, 0xd7, 0x8d, 0x68, 0x7e, 0x4f, 0xd1, 0x51, 0xac, 0x62, 0xff, 0x64, 0x32, 0x3f, 0x0a, + 0xb9, 0x84, 0x3e, 0x00, 0x12, 0xf3, 0x80, 0x48, 0x75, 0x7a, 0xe3, 0x1e, 0x53, 0x9b, 0xd1, 0x89, + 0x37, 0xa3, 0xb3, 0xc7, 0xe4, 0x63, 0xde, 0x90, 0x9c, 0xb2, 0x20, 0xf9, 0x99, 0x9a, 0x13, 0x2d, + 0x94, 0xd2, 0xb5, 0xff, 0xc8, 0x99, 0x98, 0x6a, 0x1b, 0x2d, 0xb0, 0x1e, 0x36, 0x41, 0x2e, 0xc2, + 0xb2, 0x6d, 0x06, 0x6e, 0x82, 0x38, 0xc2, 0xb2, 0x8d, 0xb4, 0x07, 0x36, 0x40, 0x46, 0x86, 0x66, + 0x8f, 0x7d, 0xb1, 0x68, 0x41, 0xe2, 0xec, 0x10, 0x69, 0x11, 0x4e, 0x98, 0x47, 0x6a, 0xc0, 0x08, + 0x67, 0x9a, 0x21, 0xca, 0xc8, 0x10, 0xbe, 0xb0, 0xc0, 0x1a, 0xee, 0x4a, 0xc2, 0x19, 0x96, 0xa4, + 0x86, 0xbd, 0x0e, 0x61, 0xbe, 0x28, 0xe7, 0x74, 0xd5, 0xff, 0x73, 0x90, 0x5b, 0x26, 0xc8, 0xda, + 0x83, 0x59, 0x65, 0x74, 0x31, 0x18, 0x7c, 0x04, 0x72, 0x91, 0xea, 0x44, 0xfe, 0xed, 0x76, 0xbe, + 0xaa, 0x72, 0x6d, 0x45, 0xd7, 0x48, 0xd5, 0x5e, 0x6b, 0xc0, 0x6f, 0x40, 0x56, 0x76, 0x45, 0xb9, + 0xb0, 0xb0, 0x54, 0xb3, 0xde, 0xd8, 0x0d, 0x59, 0x8b, 0x06, 0xb5, 0xe5, 0xd1, 0xb0, 0x9a, 0x6d, + 0xd6, 0x1b, 0x48, 0x29, 0xcc, 0xd9, 0x85, 0xcb, 0xff, 0xc3, 0x2e, 0x74, 0x41, 0x51, 0xf4, 0x8f, + 0xfd, 0xb0, 0x87, 0x29, 0x2b, 0xaf, 0x68, 0xc1, 0x35, 0x23, 0x58, 0x6c, 0x8c, 0x1d, 0x28, 0xc1, + 0xd8, 0x14, 0x94, 0x52, 0xcf, 0x11, 0x7c, 0x0a, 0x96, 0x69, 0xbc, 0xb5, 0xca, 0x96, 0x6e, 0x91, + 0xfb, 0x96, 0x8f, 0x41, 0xb2, 0x52, 0x8c, 0x01, 0x8d, 0x05, 0xed, 0x5f, 0xc0, 0xfb, 0xf3, 0x9a, + 0xa9, 0x06, 0xb3, 0x43, 0x99, 0x3f, 0x3b, 0xba, 0xfb, 0x94, 0xf9, 0x48, 0x7b, 0x14, 0x82, 0x25, + 0x6f, 0xda, 0x04, 0xa1, 0x5f, 0x33, 0xed, 0x81, 0x36, 0x28, 0x3c, 0x27, 0x34, 0x68, 0x4b, 0x3d, + 0xbe, 0xf9, 0x1a, 0x50, 0xdb, 0xef, 0x89, 0xb6, 0x20, 0xe3, 0xb1, 0x43, 0x73, 0x55, 0xde, 0x68, + 0x63, 0xee, 0xeb, 0x52, 0xa9, 0x0f, 0xfd, 0x5a, 0x5a, 0x33, 0xa5, 0x1a, 0x3b, 0x50, 0x82, 0x51, + 0x04, 0x9f, 0x89, 0x46, 0xbf, 0xd5, 0xa2, 0x3f, 0x9b, 0x54, 0x26, 0x84, 0x87, 0x87, 0x8d, 0xd8, + 0x81, 0x12, 0x8c, 0xfd, 0x67, 0x16, 0x14, 0x27, 0xed, 0x87, 0xfb, 0xa0, 0x24, 0x09, 0xef, 0x51, + 0x86, 0xd5, 0xc2, 0x9b, 0x79, 0x38, 0x4a, 0xcd, 0xc4, 0xa5, 0x5a, 0xdd, 0xac, 0x37, 0x52, 0x16, + 0xdd, 0xea, 0x34, 0x1b, 0x7e, 0x06, 0x4a, 0x1e, 0xe1, 0x92, 0xb6, 0xa8, 0x87, 0xe5, 0xb8, 0x30, + 0xef, 0x8d, 0xc5, 0x76, 0x13, 0x17, 0x4a, 0xe3, 0xe0, 0x06, 0xc8, 0x76, 0xc8, 0xc0, 0xbc, 0x12, + 0x25, 0x03, 0xcf, 0xee, 0x93, 0x01, 0x52, 0x76, 0xf8, 0x25, 0xb8, 0xee, 0xe1, 0x14, 0xd9, 0xbc, + 0x12, 0x37, 0x0c, 0xf0, 0xfa, 0xee, 0x83, 0xb4, 0xf2, 0x34, 0x16, 0x3e, 0x03, 0x65, 0x9f, 0x08, + 0x69, 0x32, 0x9c, 0x82, 0x9a, 0x77, 0x78, 0xd3, 0xe8, 0x94, 0x1f, 0x5e, 0x82, 0x43, 0x97, 0x2a, + 0xc0, 0x97, 0x16, 0xd8, 0xa0, 0x4c, 0x10, 0xaf, 0xcf, 0xc9, 0xd7, 0x7e, 0x40, 0x52, 0xd5, 0x31, + 0xbf, 0x4f, 0x41, 0xc7, 0x78, 0x64, 0x62, 0x6c, 0xec, 0x5d, 0x05, 0x3e, 0x1f, 0x56, 0x6f, 0x5f, + 0x09, 0xd0, 0x15, 0xbf, 0x3a, 0x60, 0x6d, 0xeb, 0xf4, 0xac, 0xb2, 0xf4, 0xea, 0xac, 0xb2, 0xf4, + 0xfa, 0xac, 0xb2, 0xf4, 0x62, 0x54, 0xb1, 0x4e, 0x47, 0x15, 0xeb, 0xd5, 0xa8, 0x62, 0xbd, 0x1e, + 0x55, 0xac, 0xbf, 0x46, 0x15, 0xeb, 0xe5, 0xdf, 0x95, 0xa5, 0xa7, 0x99, 0x93, 0xed, 0x7f, 0x03, + 0x00, 0x00, 0xff, 0xff, 0x6b, 0xe5, 0x21, 0x65, 0x2d, 0x0c, 0x00, 0x00, } diff --git a/vendor/github.com/openshift/api/route/v1/generated.proto b/vendor/github.com/openshift/api/route/v1/generated.proto index c75f8bb025..00d9751333 100644 --- a/vendor/github.com/openshift/api/route/v1/generated.proto +++ b/vendor/github.com/openshift/api/route/v1/generated.proto @@ -121,7 +121,23 @@ message RouteSpec { // Must follow DNS952 subdomain conventions. optional string host = 1; - // Path that the router watches for, to route traffic for to the service. Optional + // subdomain is a DNS subdomain that is requested within the ingress controller's + // domain (as a subdomain). If host is set this field is ignored. An ingress + // controller may choose to ignore this suggested name, in which case the controller + // will report the assigned name in the status.ingress array or refuse to admit the + // route. If this value is set and the server does not support this field host will + // be populated automatically. Otherwise host is left empty. The field may have + // multiple parts separated by a dot, but not all ingress controllers may honor + // the request. This field may not be changed after creation except by a user with + // the update routes/custom-host permission. + // + // Example: subdomain `frontend` automatically receives the router subdomain + // `apps.mycluster.com` to have a full hostname `frontend.apps.mycluster.com`. + // + // +optional + optional string subdomain = 8; + + // path that the router watches for, to route traffic for to the service. Optional optional string path = 2; // to is an object the route should use as the primary backend. Only the Service kind diff --git a/vendor/github.com/openshift/api/route/v1/types.go b/vendor/github.com/openshift/api/route/v1/types.go index 6c14ae7187..b7cee760ac 100644 --- a/vendor/github.com/openshift/api/route/v1/types.go +++ b/vendor/github.com/openshift/api/route/v1/types.go @@ -70,7 +70,23 @@ type RouteSpec struct { // chosen. // Must follow DNS952 subdomain conventions. Host string `json:"host" protobuf:"bytes,1,opt,name=host"` - // Path that the router watches for, to route traffic for to the service. Optional + // subdomain is a DNS subdomain that is requested within the ingress controller's + // domain (as a subdomain). If host is set this field is ignored. An ingress + // controller may choose to ignore this suggested name, in which case the controller + // will report the assigned name in the status.ingress array or refuse to admit the + // route. If this value is set and the server does not support this field host will + // be populated automatically. Otherwise host is left empty. The field may have + // multiple parts separated by a dot, but not all ingress controllers may honor + // the request. This field may not be changed after creation except by a user with + // the update routes/custom-host permission. + // + // Example: subdomain `frontend` automatically receives the router subdomain + // `apps.mycluster.com` to have a full hostname `frontend.apps.mycluster.com`. + // + // +optional + Subdomain string `json:"subdomain" protobuf:"bytes,8,opt,name=subdomain"` + + // path that the router watches for, to route traffic for to the service. Optional Path string `json:"path,omitempty" protobuf:"bytes,2,opt,name=path"` // to is an object the route should use as the primary backend. Only the Service kind diff --git a/vendor/github.com/openshift/api/route/v1/zz_generated.swagger_doc_generated.go b/vendor/github.com/openshift/api/route/v1/zz_generated.swagger_doc_generated.go index f0727d93fd..7d0cb5e2b4 100644 --- a/vendor/github.com/openshift/api/route/v1/zz_generated.swagger_doc_generated.go +++ b/vendor/github.com/openshift/api/route/v1/zz_generated.swagger_doc_generated.go @@ -70,7 +70,8 @@ func (RoutePort) SwaggerDoc() map[string]string { var map_RouteSpec = map[string]string{ "": "RouteSpec describes the hostname or path the route exposes, any security information, and one to four backends (services) the route points to. Requests are distributed among the backends depending on the weights assigned to each backend. When using roundrobin scheduling the portion of requests that go to each backend is the backend weight divided by the sum of all of the backend weights. When the backend has more than one endpoint the requests that end up on the backend are roundrobin distributed among the endpoints. Weights are between 0 and 256 with default 1. Weight 0 causes no requests to the backend. If all weights are zero the route will be considered to have no backends and return a standard 503 response.\n\nThe `tls` field is optional and allows specific certificates or behavior for the route. Routers typically configure a default certificate on a wildcard domain to terminate routes without explicit certificates, but custom hostnames usually must choose passthrough (send traffic directly to the backend via the TLS Server-Name- Indication field) or provide a certificate.", "host": "host is an alias/DNS that points to the service. Optional. If not specified a route name will typically be automatically chosen. Must follow DNS952 subdomain conventions.", - "path": "Path that the router watches for, to route traffic for to the service. Optional", + "subdomain": "subdomain is a DNS subdomain that is requested within the ingress controller's domain (as a subdomain). If host is set this field is ignored. An ingress controller may choose to ignore this suggested name, in which case the controller will report the assigned name in the status.ingress array or refuse to admit the route. If this value is set and the server does not support this field host will be populated automatically. Otherwise host is left empty. The field may have multiple parts separated by a dot, but not all ingress controllers may honor the request. This field may not be changed after creation except by a user with the update routes/custom-host permission.\n\nExample: subdomain `frontend` automatically receives the router subdomain `apps.mycluster.com` to have a full hostname `frontend.apps.mycluster.com`.", + "path": "path that the router watches for, to route traffic for to the service. Optional", "to": "to is an object the route should use as the primary backend. Only the Service kind is allowed, and it will be defaulted to Service. If the weight field (0-256 default 1) is set to zero, no traffic will be sent to this backend.", "alternateBackends": "alternateBackends allows up to 3 additional backends to be assigned to the route. Only the Service kind is allowed, and it will be defaulted to Service. Use the weight field in RouteTargetReference object to specify relative preference.", "port": "If specified, the port to be used by the router. Most routers will use all endpoints exposed by the service by default - set this value to instruct routers which port to use.", diff --git a/vendor/github.com/openshift/api/security/v1/generated.proto b/vendor/github.com/openshift/api/security/v1/generated.proto index 88ba36cdb8..0a16d746f5 100644 --- a/vendor/github.com/openshift/api/security/v1/generated.proto +++ b/vendor/github.com/openshift/api/security/v1/generated.proto @@ -178,6 +178,7 @@ message SELinuxContextStrategyOptions { // That exposure is deprecated and will be removed in a future release - users // should instead use the security.openshift.io group to manage // SecurityContextConstraints. +// +kubebuilder:singular=securitycontextconstraint message SecurityContextConstraints { // Standard object's metadata. // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata @@ -189,6 +190,7 @@ message SecurityContextConstraints { // for multiple SCCs are equal they will be sorted from most restrictive to // least restrictive. If both priorities and restrictions are equal the // SCCs will be sorted by name. + // +nullable optional int32 priority = 2; // AllowPrivilegedContainer determines if a container can request to be run as privileged. @@ -197,16 +199,19 @@ message SecurityContextConstraints { // DefaultAddCapabilities is the default set of capabilities that will be added to the container // unless the pod spec specifically drops the capability. You may not list a capabiility in both // DefaultAddCapabilities and RequiredDropCapabilities. + // +nullable repeated string defaultAddCapabilities = 4; // RequiredDropCapabilities are the capabilities that will be dropped from the container. These // are required to be dropped and cannot be added. + // +nullable repeated string requiredDropCapabilities = 5; // AllowedCapabilities is a list of capabilities that can be requested to add to the container. // Capabilities in this field maybe added at the pod author's discretion. // You must not list a capability in both AllowedCapabilities and RequiredDropCapabilities. // To allow all capabilities you may use '*'. + // +nullable repeated string allowedCapabilities = 6; // AllowHostDirVolumePlugin determines if the policy allow containers to use the HostDir volume plugin @@ -216,6 +221,7 @@ message SecurityContextConstraints { // Volumes is a white list of allowed volume plugins. FSType corresponds directly with the field names // of a VolumeSource (azureFile, configMap, emptyDir). To allow all volumes you may use "*". // To allow no volumes, set to ["none"]. + // +nullable repeated string volumes = 8; // AllowedFlexVolumes is a whitelist of allowed Flexvolumes. Empty or nil indicates that all @@ -250,15 +256,19 @@ message SecurityContextConstraints { optional bool allowPrivilegeEscalation = 23; // SELinuxContext is the strategy that will dictate what labels will be set in the SecurityContext. + // +nullable optional SELinuxContextStrategyOptions seLinuxContext = 13; // RunAsUser is the strategy that will dictate what RunAsUser is used in the SecurityContext. + // +nullable optional RunAsUserStrategyOptions runAsUser = 14; // SupplementalGroups is the strategy that will dictate what supplemental groups are used by the SecurityContext. + // +nullable optional SupplementalGroupsStrategyOptions supplementalGroups = 15; // FSGroup is the strategy that will dictate what fs group is used by the SecurityContext. + // +nullable optional FSGroupStrategyOptions fsGroup = 16; // ReadOnlyRootFilesystem when set to true will force containers to run with a read only root file @@ -283,6 +293,7 @@ message SecurityContextConstraints { // be specifid by the pod or container. The wildcard '*' may be used to allow all profiles. When // used to generate a value for a pod the first non-wildcard profile will be used as // the default. + // +nullable repeated string seccompProfiles = 20; // AllowedUnsafeSysctls is a list of explicitly allowed unsafe sysctls, defaults to none. diff --git a/vendor/github.com/openshift/api/security/v1/types.go b/vendor/github.com/openshift/api/security/v1/types.go index 06c48ce5f6..811a1820f8 100644 --- a/vendor/github.com/openshift/api/security/v1/types.go +++ b/vendor/github.com/openshift/api/security/v1/types.go @@ -20,6 +20,7 @@ var AllowAllCapabilities corev1.Capability = "*" // That exposure is deprecated and will be removed in a future release - users // should instead use the security.openshift.io group to manage // SecurityContextConstraints. +// +kubebuilder:singular=securitycontextconstraint type SecurityContextConstraints struct { metav1.TypeMeta `json:",inline"` // Standard object's metadata. @@ -32,6 +33,7 @@ type SecurityContextConstraints struct { // for multiple SCCs are equal they will be sorted from most restrictive to // least restrictive. If both priorities and restrictions are equal the // SCCs will be sorted by name. + // +nullable Priority *int32 `json:"priority" protobuf:"varint,2,opt,name=priority"` // AllowPrivilegedContainer determines if a container can request to be run as privileged. @@ -39,14 +41,17 @@ type SecurityContextConstraints struct { // DefaultAddCapabilities is the default set of capabilities that will be added to the container // unless the pod spec specifically drops the capability. You may not list a capabiility in both // DefaultAddCapabilities and RequiredDropCapabilities. + // +nullable DefaultAddCapabilities []corev1.Capability `json:"defaultAddCapabilities" protobuf:"bytes,4,rep,name=defaultAddCapabilities,casttype=Capability"` // RequiredDropCapabilities are the capabilities that will be dropped from the container. These // are required to be dropped and cannot be added. + // +nullable RequiredDropCapabilities []corev1.Capability `json:"requiredDropCapabilities" protobuf:"bytes,5,rep,name=requiredDropCapabilities,casttype=Capability"` // AllowedCapabilities is a list of capabilities that can be requested to add to the container. // Capabilities in this field maybe added at the pod author's discretion. // You must not list a capability in both AllowedCapabilities and RequiredDropCapabilities. // To allow all capabilities you may use '*'. + // +nullable AllowedCapabilities []corev1.Capability `json:"allowedCapabilities" protobuf:"bytes,6,rep,name=allowedCapabilities,casttype=Capability"` // AllowHostDirVolumePlugin determines if the policy allow containers to use the HostDir volume plugin // +k8s:conversion-gen=false @@ -54,6 +59,7 @@ type SecurityContextConstraints struct { // Volumes is a white list of allowed volume plugins. FSType corresponds directly with the field names // of a VolumeSource (azureFile, configMap, emptyDir). To allow all volumes you may use "*". // To allow no volumes, set to ["none"]. + // +nullable Volumes []FSType `json:"volumes" protobuf:"bytes,8,rep,name=volumes,casttype=FSType"` // AllowedFlexVolumes is a whitelist of allowed Flexvolumes. Empty or nil indicates that all // Flexvolumes may be used. This parameter is effective only when the usage of the Flexvolumes @@ -80,12 +86,16 @@ type SecurityContextConstraints struct { // +nullable AllowPrivilegeEscalation *bool `json:"allowPrivilegeEscalation,omitempty" protobuf:"varint,23,rep,name=allowPrivilegeEscalation"` // SELinuxContext is the strategy that will dictate what labels will be set in the SecurityContext. + // +nullable SELinuxContext SELinuxContextStrategyOptions `json:"seLinuxContext,omitempty" protobuf:"bytes,13,opt,name=seLinuxContext"` // RunAsUser is the strategy that will dictate what RunAsUser is used in the SecurityContext. + // +nullable RunAsUser RunAsUserStrategyOptions `json:"runAsUser,omitempty" protobuf:"bytes,14,opt,name=runAsUser"` // SupplementalGroups is the strategy that will dictate what supplemental groups are used by the SecurityContext. + // +nullable SupplementalGroups SupplementalGroupsStrategyOptions `json:"supplementalGroups,omitempty" protobuf:"bytes,15,opt,name=supplementalGroups"` // FSGroup is the strategy that will dictate what fs group is used by the SecurityContext. + // +nullable FSGroup FSGroupStrategyOptions `json:"fsGroup,omitempty" protobuf:"bytes,16,opt,name=fsGroup"` // ReadOnlyRootFilesystem when set to true will force containers to run with a read only root file // system. If the container specifically requests to run with a non-read only root file system @@ -108,6 +118,7 @@ type SecurityContextConstraints struct { // be specifid by the pod or container. The wildcard '*' may be used to allow all profiles. When // used to generate a value for a pod the first non-wildcard profile will be used as // the default. + // +nullable SeccompProfiles []string `json:"seccompProfiles,omitempty" protobuf:"bytes,20,opt,name=seccompProfiles"` // AllowedUnsafeSysctls is a list of explicitly allowed unsafe sysctls, defaults to none. diff --git a/vendor/github.com/openshift/library-go/cmd/crd-schema-gen/generator/generator.go b/vendor/github.com/openshift/library-go/cmd/crd-schema-gen/generator/generator.go index a56f07007a..cb37958a23 100755 --- a/vendor/github.com/openshift/library-go/cmd/crd-schema-gen/generator/generator.go +++ b/vendor/github.com/openshift/library-go/cmd/crd-schema-gen/generator/generator.go @@ -35,8 +35,8 @@ func Run() error { manifestDir := flag.String("manifests-dir", "manifests", "the directory with existing CRD manifests") outputDir := flag.String("output-dir", "", "optional directory to output the kubebuilder CRDs. By default a temporary directory is used.") verifyOnly := flag.Bool("verify-only", false, "do not write files, only compare and return with return code 1 if dirty") - domain := flag.String("domain", "", "the domain appended to group names (optional).") - repo := flag.String("repo", "", "the repository package name.") + domain := flag.String("domain", "", "the domain appended to group names.") + repo := flag.String("repo", "", "the repository package name (optional).") flag.Parse() diff --git a/vendor/github.com/openshift/library-go/glide.lock b/vendor/github.com/openshift/library-go/glide.lock index 483a42a5e9..e464abd448 100644 --- a/vendor/github.com/openshift/library-go/glide.lock +++ b/vendor/github.com/openshift/library-go/glide.lock @@ -1,5 +1,5 @@ -hash: 834b42ac04c13e26423b9cddffbd75a093f4d889cffb059911fae65aac364c7b -updated: 2019-04-17T10:52:09.03874547-04:00 +hash: 1b36cef95ede62447c3cd1c2b0d796865e909039e83803865c0b08ddea11494f +updated: 2019-05-16T16:08:16.187464+02:00 imports: - name: bitbucket.org/ww/goautoneg version: 75cd24fc2f2c2a2088577d12123ddee5f54e0675 @@ -234,7 +234,7 @@ imports: - name: github.com/NYTimes/gziphandler version: 56545f4a5d46df9a6648819d1664c3a03a13ffdb - name: github.com/openshift/api - version: 7924f9106f8e132f4f33a0c7fb8841b49bfc2d83 + version: 81d064c11ff2d62705dbb09ed9ac200ef9557716 subpackages: - apps - apps/v1 @@ -389,7 +389,7 @@ imports: - go/ast/astutil - imports - name: google.golang.org/appengine - version: 54a98f90d1c46b7731eb8fb305d2a321c30ef610 + version: 311d3c5cf9373249645db030e53c37c209a8b378 subpackages: - internal - internal/base @@ -840,7 +840,7 @@ imports: - pkg/util - pkg/util/proto - name: sigs.k8s.io/controller-tools - version: 4e23e49e5d401ca6ced86aa30262d0cf2488c504 + version: 72ae52c08b9dd626cfb64ebef0fbf40ce667939b repo: https://github.com/openshift/kubernetes-sigs-controller-tools subpackages: - pkg/crd/generator diff --git a/vendor/github.com/openshift/library-go/glide.yaml b/vendor/github.com/openshift/library-go/glide.yaml index 8f5129a9b3..4289ba73a9 100644 --- a/vendor/github.com/openshift/library-go/glide.yaml +++ b/vendor/github.com/openshift/library-go/glide.yaml @@ -11,9 +11,9 @@ import: - package: k8s.io/client-go version: kubernetes-1.13.4 - package: github.com/openshift/api - version: master + version: release-4.1 - package: github.com/openshift/client-go - version: master + version: release-4.1 # crd-schema-gen # TODO: we need to this to get nullable patch, but we will replace this with new repo soon. diff --git a/vendor/github.com/openshift/library-go/pkg/assets/create/create_test.go b/vendor/github.com/openshift/library-go/pkg/assets/create/create_test.go index 4ca9d1e16c..e9ce7e9641 100644 --- a/vendor/github.com/openshift/library-go/pkg/assets/create/create_test.go +++ b/vendor/github.com/openshift/library-go/pkg/assets/create/create_test.go @@ -132,7 +132,7 @@ func TestEnsureManifestsCreated(t *testing.T) { if !strings.Contains(out.String(), `no matches for kind "KubeAPIServerOperatorConfig"`) { t.Fatalf("expected error logged to output when verbose is on, got: %s\n", out.String()) } - if !strings.Contains(out.String(), `Created apiextensions.k8s.io/v1beta1`) { + if !strings.Contains(out.String(), `Created "0000_10_kube-apiserver-operator_01_config.crd.yaml" customresourcedefinitions.v1beta1.apiextensions.k8s.io`) { t.Fatalf("expected success logged to output when verbose is on, got: %s\n", out.String()) } } diff --git a/vendor/github.com/openshift/library-go/pkg/assets/create/creater.go b/vendor/github.com/openshift/library-go/pkg/assets/create/creater.go index 8eb944ff23..cec47ed26a 100644 --- a/vendor/github.com/openshift/library-go/pkg/assets/create/creater.go +++ b/vendor/github.com/openshift/library-go/pkg/assets/create/creater.go @@ -158,7 +158,7 @@ func create(ctx context.Context, manifests map[string]*unstructured.Unstructured gvk := manifests[path].GetObjectKind().GroupVersionKind() mappings, err := mapper.RESTMapping(gvk.GroupKind(), gvk.Version) if err != nil { - errs[path] = fmt.Errorf("unable to get REST mapping: %v", err) + errs[path] = fmt.Errorf("unable to get REST mapping for %q: %v", path, err) reloadDiscovery = true continue } @@ -169,11 +169,13 @@ func create(ctx context.Context, manifests map[string]*unstructured.Unstructured _, err = client.Resource(mappings.Resource).Namespace(manifests[path].GetNamespace()).Create(manifests[path], metav1.CreateOptions{}) } + resourceString := mappings.Resource.Resource + "." + mappings.Resource.Version + "." + mappings.Resource.Group + "/" + manifests[path].GetName() + " -n " + manifests[path].GetNamespace() + // Resource already exists means we already succeeded // This should never happen as we remove already created items from the manifest list, unless the resource existed beforehand. if kerrors.IsAlreadyExists(err) { if options.Verbose { - fmt.Fprintf(options.StdErr, "Skipped %s as it already exists\n", mappings.Resource.String()) + fmt.Fprintf(options.StdErr, "Skipped %q %s as it already exists\n", path, resourceString) } delete(manifests, path) continue @@ -181,14 +183,14 @@ func create(ctx context.Context, manifests map[string]*unstructured.Unstructured if err != nil { if options.Verbose { - fmt.Fprintf(options.StdErr, "Failed to create %s: %v\n", mappings.Resource.String(), err) + fmt.Fprintf(options.StdErr, "Failed to create %q %s: %v\n", path, resourceString, err) } errs[path] = fmt.Errorf("failed to create: %v", err) continue } if options.Verbose { - fmt.Fprintf(options.StdErr, "Created %s\n", mappings.Resource.String()) + fmt.Fprintf(options.StdErr, "Created %q %s\n", path, resourceString) } // Creation succeeded lets remove the manifest from the list to avoid creating it second time diff --git a/vendor/github.com/openshift/library-go/pkg/config/leaderelection/leaderelection.go b/vendor/github.com/openshift/library-go/pkg/config/leaderelection/leaderelection.go index 0382849ac3..f3399e867d 100644 --- a/vendor/github.com/openshift/library-go/pkg/config/leaderelection/leaderelection.go +++ b/vendor/github.com/openshift/library-go/pkg/config/leaderelection/leaderelection.go @@ -75,13 +75,13 @@ func LeaderElectionDefaulting(config configv1.LeaderElection, defaultNamespace, ret := *(&config).DeepCopy() if ret.LeaseDuration.Duration == 0 { - ret.LeaseDuration.Duration = 120 * time.Second + ret.LeaseDuration.Duration = 60 * time.Second } if ret.RenewDeadline.Duration == 0 { - ret.RenewDeadline.Duration = 90 * time.Second + ret.RenewDeadline.Duration = 35 * time.Second } if ret.RetryPeriod.Duration == 0 { - ret.RetryPeriod.Duration = 20 * time.Second + ret.RetryPeriod.Duration = 10 * time.Second } if len(ret.Namespace) == 0 { if len(defaultNamespace) > 0 { diff --git a/vendor/github.com/openshift/library-go/pkg/config/serving/server.go b/vendor/github.com/openshift/library-go/pkg/config/serving/server.go index af74b74d50..3869d5c2e9 100644 --- a/vendor/github.com/openshift/library-go/pkg/config/serving/server.go +++ b/vendor/github.com/openshift/library-go/pkg/config/serving/server.go @@ -1,17 +1,23 @@ package serving import ( + "context" + "time" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer" + "k8s.io/apimachinery/pkg/util/wait" genericapiserver "k8s.io/apiserver/pkg/server" genericapiserveroptions "k8s.io/apiserver/pkg/server/options" + "k8s.io/klog" configv1 "github.com/openshift/api/config/v1" operatorv1alpha1 "github.com/openshift/api/operator/v1alpha1" ) -func ToServerConfig(servingInfo configv1.HTTPServingInfo, authenticationConfig operatorv1alpha1.DelegatedAuthentication, authorizationConfig operatorv1alpha1.DelegatedAuthorization, kubeConfigFile string) (*genericapiserver.Config, error) { +func ToServerConfig(ctx context.Context, servingInfo configv1.HTTPServingInfo, authenticationConfig operatorv1alpha1.DelegatedAuthentication, authorizationConfig operatorv1alpha1.DelegatedAuthorization, + kubeConfigFile string) (*genericapiserver.Config, error) { scheme := runtime.NewScheme() metav1.AddToGroupVersion(scheme, metav1.SchemeGroupVersion) config := genericapiserver.NewConfig(serializer.NewCodecFactory(scheme)) @@ -20,23 +26,51 @@ func ToServerConfig(servingInfo configv1.HTTPServingInfo, authenticationConfig o if err != nil { return nil, err } + if err := servingOptions.ApplyTo(&config.SecureServing, &config.LoopbackClientConfig); err != nil { return nil, err } + var lastApplyErr error + + pollCtx, cancel := context.WithTimeout(ctx, 30*time.Second) + defer cancel() + if !authenticationConfig.Disabled { authenticationOptions := genericapiserveroptions.NewDelegatingAuthenticationOptions() authenticationOptions.RemoteKubeConfigFile = kubeConfigFile - if err := authenticationOptions.ApplyTo(&config.Authentication, config.SecureServing, config.OpenAPIConfig); err != nil { - return nil, err + + // In some cases the API server can return connection refused when getting the "extension-apiserver-authentication" + // config map. + err := wait.PollImmediateUntil(1*time.Second, func() (done bool, err error) { + lastApplyErr = authenticationOptions.ApplyTo(&config.Authentication, config.SecureServing, config.OpenAPIConfig) + if lastApplyErr != nil { + klog.V(4).Infof("Error initializing delegating authentication (will retry): %v", err) + return false, nil + } + return true, nil + }, pollCtx.Done()) + if err != nil { + return nil, lastApplyErr } } if !authorizationConfig.Disabled { authorizationOptions := genericapiserveroptions.NewDelegatingAuthorizationOptions() authorizationOptions.RemoteKubeConfigFile = kubeConfigFile - if err := authorizationOptions.ApplyTo(&config.Authorization); err != nil { - return nil, err + + // In some cases the API server can return connection refused when getting the "extension-apiserver-authentication" + // config map. + err := wait.PollImmediateUntil(1*time.Second, func() (done bool, err error) { + lastApplyErr = authorizationOptions.ApplyTo(&config.Authorization) + if lastApplyErr != nil { + klog.V(4).Infof("Error initializing delegating authorization (will retry): %v", err) + return false, nil + } + return true, nil + }, pollCtx.Done()) + if err != nil { + return nil, lastApplyErr } } diff --git a/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/builder.go b/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/builder.go index afaad37f64..01ed53da63 100644 --- a/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/builder.go +++ b/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/builder.go @@ -199,7 +199,7 @@ func (b *ControllerBuilder) Run(config *unstructured.Unstructured, ctx context.C if b.kubeAPIServerConfigFile != nil { kubeConfig = *b.kubeAPIServerConfigFile } - serverConfig, err := serving.ToServerConfig(*b.servingInfo, *b.authenticationConfig, *b.authorizationConfig, kubeConfig) + serverConfig, err := serving.ToServerConfig(ctx, *b.servingInfo, *b.authenticationConfig, *b.authorizationConfig, kubeConfig) if err != nil { return err } diff --git a/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/cmd.go b/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/cmd.go index 099b42a87c..b072c41dfd 100644 --- a/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/cmd.go +++ b/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/cmd.go @@ -11,15 +11,17 @@ import ( "time" "github.com/spf13/cobra" - "k8s.io/klog" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/version" + "k8s.io/apiserver/pkg/server" "k8s.io/apiserver/pkg/util/logs" + "k8s.io/klog" operatorv1alpha1 "github.com/openshift/api/operator/v1alpha1" + "github.com/openshift/library-go/pkg/config/configdefaults" "github.com/openshift/library-go/pkg/crypto" "github.com/openshift/library-go/pkg/serviceability" @@ -51,22 +53,42 @@ func NewControllerCommandConfig(componentName string, version version.Info, star // NewCommand returns a new command that a caller must set the Use and Descriptions on. It wires default log, profiling, // leader election and other "normal" behaviors. +// Deprecated: Use the NewCommandWithContext instead, this is here to be less disturbing for existing usages. func (c *ControllerCommandConfig) NewCommand() *cobra.Command { + return c.NewCommandWithContext(context.TODO()) + +} + +// NewCommandWithContext returns a new command that a caller must set the Use and Descriptions on. It wires default log, profiling, +// leader election and other "normal" behaviors. +// The context passed will be passed down to controller loops and observers and cancelled on SIGTERM and SIGINT signals. +func (c *ControllerCommandConfig) NewCommandWithContext(ctx context.Context) *cobra.Command { cmd := &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { // boiler plate for the "normal" command rand.Seed(time.Now().UTC().UnixNano()) logs.InitLogs() + + // handle SIGTERM and SIGINT by cancelling the context. + shutdownCtx, cancel := context.WithCancel(ctx) + shutdownHandler := server.SetupSignalHandler() + go func() { + defer cancel() + <-shutdownHandler + klog.Infof("Received SIGTERM or SIGINT signal, shutting down controller.") + }() + defer logs.FlushLogs() defer serviceability.BehaviorOnPanic(os.Getenv("OPENSHIFT_ON_PANIC"), c.version)() defer serviceability.Profile(os.Getenv("OPENSHIFT_PROFILE")).Stop() + serviceability.StartProfiler() if err := c.basicFlags.Validate(); err != nil { klog.Fatal(err) } - if err := c.StartController(context.Background()); err != nil { + if err := c.StartController(shutdownCtx); err != nil { klog.Fatal(err) } }, diff --git a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/client_cert_rotation_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/client_cert_rotation_controller.go index 44e46ccfbf..ab9830505d 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/client_cert_rotation_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/client_cert_rotation_controller.go @@ -43,10 +43,8 @@ type CertRotationController struct { TargetRotation TargetRotation OperatorClient v1helpers.StaticPodOperatorClient - cachesSynced []cache.InformerSynced - - // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface + cachesToSync []cache.InformerSynced + queue workqueue.RateLimitingInterface } func NewCertRotationController( @@ -56,7 +54,7 @@ func NewCertRotationController( targetRotation TargetRotation, operatorClient v1helpers.StaticPodOperatorClient, ) (*CertRotationController, error) { - ret := &CertRotationController{ + c := &CertRotationController{ name: name, SigningRotation: signingRotation, @@ -64,20 +62,18 @@ func NewCertRotationController( TargetRotation: targetRotation, OperatorClient: operatorClient, - cachesSynced: []cache.InformerSynced{ - signingRotation.Informer.Informer().HasSynced, - caBundleRotation.Informer.Informer().HasSynced, - targetRotation.Informer.Informer().HasSynced, - }, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), name), } - signingRotation.Informer.Informer().AddEventHandler(ret.eventHandler()) - caBundleRotation.Informer.Informer().AddEventHandler(ret.eventHandler()) - targetRotation.Informer.Informer().AddEventHandler(ret.eventHandler()) + signingRotation.Informer.Informer().AddEventHandler(c.eventHandler()) + caBundleRotation.Informer.Informer().AddEventHandler(c.eventHandler()) + targetRotation.Informer.Informer().AddEventHandler(c.eventHandler()) - return ret, nil + c.cachesToSync = append(c.cachesToSync, signingRotation.Informer.Informer().HasSynced) + c.cachesToSync = append(c.cachesToSync, caBundleRotation.Informer.Informer().HasSynced) + c.cachesToSync = append(c.cachesToSync, targetRotation.Informer.Informer().HasSynced) + + return c, nil } func (c CertRotationController) sync() error { @@ -117,17 +113,29 @@ func (c CertRotationController) syncWorker() error { return nil } +func (c *CertRotationController) WaitForReady(stopCh <-chan struct{}) { + klog.Infof("Waiting for CertRotationController - %q", c.name) + defer klog.Infof("Finished waiting for CertRotationController - %q", c.name) + + if !cache.WaitForCacheSync(stopCh, c.cachesToSync...) { + utilruntime.HandleError(fmt.Errorf("caches did not sync")) + return + } +} + +// RunOnce will run the cert rotation logic, but will not try to update the static pod status. +// This eliminates the need to pass an OperatorClient and avoids dubious writes and status. +func (c *CertRotationController) RunOnce() error { + return c.syncWorker() +} + func (c *CertRotationController) Run(workers int, stopCh <-chan struct{}) { defer utilruntime.HandleCrash() defer c.queue.ShutDown() klog.Infof("Starting CertRotationController - %q", c.name) defer klog.Infof("Shutting down CertRotationController - %q", c.name) - - if !cache.WaitForCacheSync(stopCh, c.cachesSynced...) { - utilruntime.HandleError(fmt.Errorf("caches did not sync")) - return - } + c.WaitForReady(stopCh) // doesn't matter what workers say, only start one. go wait.Until(c.runWorker, time.Second, stopCh) diff --git a/vendor/github.com/openshift/library-go/pkg/operator/configobserver/cloudprovider/observe_cloudprovider.go b/vendor/github.com/openshift/library-go/pkg/operator/configobserver/cloudprovider/observe_cloudprovider.go index 65846c975a..eb0382fefd 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/configobserver/cloudprovider/observe_cloudprovider.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/configobserver/cloudprovider/observe_cloudprovider.go @@ -6,6 +6,7 @@ import ( "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/util/sets" configv1 "github.com/openshift/api/config/v1" "github.com/openshift/library-go/pkg/operator/configobserver" @@ -92,8 +93,10 @@ func (c *cloudProviderObserver) ObserveCloudProviderNames(genericListers configo Namespace: sourceCloudConfigNamespace, Name: sourceCloudConfigMap, } - // we set cloudprovider configmap values only for vsphere. - if cloudProvider != "vsphere" { + + // we set cloudprovider configmap values only for some cloud providers. + validCloudProviders := sets.NewString("azure", "vsphere") + if !validCloudProviders.Has(cloudProvider) { sourceCloudConfigMap = "" } @@ -143,6 +146,7 @@ func getPlatformName(platformType configv1.PlatformType, recorder events.Recorde cloudProvider = "azure" case configv1.VSpherePlatformType: cloudProvider = "vsphere" + case configv1.BareMetalPlatformType: case configv1.LibvirtPlatformType: case configv1.OpenStackPlatformType: // TODO(flaper87): Enable this once we've figured out a way to write the cloud provider config in the master nodes diff --git a/vendor/github.com/openshift/library-go/pkg/operator/configobserver/cloudprovider/observe_cloudprovider_test.go b/vendor/github.com/openshift/library-go/pkg/operator/configobserver/cloudprovider/observe_cloudprovider_test.go index 1d801515ff..e5c183c413 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/configobserver/cloudprovider/observe_cloudprovider_test.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/configobserver/cloudprovider/observe_cloudprovider_test.go @@ -55,6 +55,9 @@ func TestObserveCloudProviderNames(t *testing.T) { platform: configv1.AzurePlatformType, expected: "azure", cloudProviderCount: 1, + }, { + platform: configv1.BareMetalPlatformType, + cloudProviderCount: 0, }, { platform: configv1.LibvirtPlatformType, cloudProviderCount: 0, diff --git a/vendor/github.com/openshift/library-go/pkg/operator/configobserver/config_observer_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/configobserver/config_observer_controller.go index e527f64b31..2c566647fd 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/configobserver/config_observer_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/configobserver/config_observer_controller.go @@ -41,18 +41,17 @@ type Listers interface { type ObserveConfigFunc func(listers Listers, recorder events.Recorder, existingConfig map[string]interface{}) (observedConfig map[string]interface{}, errs []error) type ConfigObserver struct { - operatorConfigClient v1helpers.OperatorClient - eventRecorder events.Recorder - - // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface // observers are called in an undefined order and their results are merged to // determine the observed configuration. observers []ObserveConfigFunc + operatorClient v1helpers.OperatorClient // listers are used by config observers to retrieve necessary resources listers Listers + + queue workqueue.RateLimitingInterface + eventRecorder events.Recorder } func NewConfigObserver( @@ -62,8 +61,8 @@ func NewConfigObserver( observers ...ObserveConfigFunc, ) *ConfigObserver { return &ConfigObserver{ - operatorConfigClient: operatorClient, - eventRecorder: eventRecorder.WithComponentSuffix("config-observer"), + operatorClient: operatorClient, + eventRecorder: eventRecorder.WithComponentSuffix("config-observer"), queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "ConfigObserver"), @@ -75,7 +74,7 @@ func NewConfigObserver( // sync reacts to a change in prereqs by finding information that is required to match another value in the cluster. This // must be information that is logically "owned" by another component. func (c ConfigObserver) sync() error { - originalSpec, _, _, err := c.operatorConfigClient.GetOperatorState() + originalSpec, _, _, err := c.operatorClient.GetOperatorState() if err != nil { return err } @@ -116,7 +115,7 @@ func (c ConfigObserver) sync() error { if !equality.Semantic.DeepEqual(existingConfig, mergedObservedConfig) { c.eventRecorder.Eventf("ObservedConfigChanged", "Writing updated observed config: %v", diff.ObjectDiff(existingConfig, mergedObservedConfig)) - if _, _, err := v1helpers.UpdateSpec(c.operatorConfigClient, v1helpers.UpdateObservedConfigFn(mergedObservedConfig)); err != nil { + if _, _, err := v1helpers.UpdateSpec(c.operatorClient, v1helpers.UpdateObservedConfigFn(mergedObservedConfig)); err != nil { // At this point we failed to write the updated config. If we are permanently broken, do not pile the errors from observers // but instead reset the errors and only report single error condition. errs = []error{fmt.Errorf("error writing updated observed config: %v", err)} @@ -135,7 +134,7 @@ func (c ConfigObserver) sync() error { cond.Reason = "Error" cond.Message = configError.Error() } - if _, _, updateError := v1helpers.UpdateStatus(c.operatorConfigClient, v1helpers.UpdateConditionFn(cond)); updateError != nil { + if _, _, updateError := v1helpers.UpdateStatus(c.operatorClient, v1helpers.UpdateConditionFn(cond)); updateError != nil { return updateError } @@ -148,7 +147,6 @@ func (c *ConfigObserver) Run(workers int, stopCh <-chan struct{}) { klog.Infof("Starting ConfigObserver") defer klog.Infof("Shutting down ConfigObserver") - if !cache.WaitForCacheSync(stopCh, c.listers.PreRunHasSynced()...) { utilruntime.HandleError(fmt.Errorf("caches did not sync")) return diff --git a/vendor/github.com/openshift/library-go/pkg/operator/configobserver/config_observer_controller_test.go b/vendor/github.com/openshift/library-go/pkg/operator/configobserver/config_observer_controller_test.go index 2a5ca93375..0b28510a86 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/configobserver/config_observer_controller_test.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/configobserver/config_observer_controller_test.go @@ -204,10 +204,10 @@ func TestSyncStatus(t *testing.T) { eventClient := fake.NewSimpleClientset() configObserver := ConfigObserver{ - listers: &fakeLister{}, - operatorConfigClient: operatorConfigClient, - observers: tc.observers, - eventRecorder: events.NewRecorder(eventClient.CoreV1().Events("test"), "test-operator", &corev1.ObjectReference{}), + listers: &fakeLister{}, + operatorClient: operatorConfigClient, + observers: tc.observers, + eventRecorder: events.NewRecorder(eventClient.CoreV1().Events("test"), "test-operator", &corev1.ObjectReference{}), } err := configObserver.sync() if tc.expectError && err == nil { diff --git a/vendor/github.com/openshift/library-go/pkg/operator/events/recorder_in_memory.go b/vendor/github.com/openshift/library-go/pkg/operator/events/recorder_in_memory.go index 40b7354e2c..b64d9f6a98 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/events/recorder_in_memory.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/events/recorder_in_memory.go @@ -38,7 +38,10 @@ func (r *inMemoryEventRecorder) ComponentName() string { } func (r *inMemoryEventRecorder) ForComponent(component string) Recorder { - return &inMemoryEventRecorder{events: []*corev1.Event{}, source: component} + r.Lock() + defer r.Unlock() + r.source = component + return r } func (r *inMemoryEventRecorder) WithComponentSuffix(suffix string) Recorder { diff --git a/vendor/github.com/openshift/library-go/pkg/operator/loglevel/logging_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/loglevel/logging_controller.go index 7f2b8f8192..0ebcd57b1a 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/loglevel/logging_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/loglevel/logging_controller.go @@ -10,6 +10,8 @@ import ( "k8s.io/client-go/util/workqueue" "k8s.io/klog" + operatorv1 "github.com/openshift/api/operator/v1" + "github.com/openshift/library-go/pkg/operator/events" operatorv1helpers "github.com/openshift/library-go/pkg/operator/v1helpers" ) @@ -18,11 +20,10 @@ var workQueueKey = "instance" type LogLevelController struct { operatorClient operatorv1helpers.OperatorClient - cachesToSync []cache.InformerSynced - eventRecorder events.Recorder - // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface + cachesToSync []cache.InformerSynced + queue workqueue.RateLimitingInterface + eventRecorder events.Recorder } // sets the klog level based on desired state @@ -31,7 +32,6 @@ func NewClusterOperatorLoggingController( recorder events.Recorder, ) *LogLevelController { c := &LogLevelController{ - cachesToSync: []cache.InformerSynced{operatorClient.Informer().HasSynced}, operatorClient: operatorClient, eventRecorder: recorder.WithComponentSuffix("loglevel-controller"), @@ -40,6 +40,8 @@ func NewClusterOperatorLoggingController( operatorClient.Informer().AddEventHandler(c.eventHandler()) + c.cachesToSync = append(c.cachesToSync, operatorClient.Informer().HasSynced) + return c } @@ -51,23 +53,25 @@ func (c LogLevelController) sync() error { return err } - logLevel := fmt.Sprintf("%d", LogLevelToKlog(detailedSpec.OperatorLogLevel)) + currentLogLevel := CurrentLogLevel() + desiredLogLevel := detailedSpec.OperatorLogLevel - var level klog.Level + if len(desiredLogLevel) == 0 { + desiredLogLevel = operatorv1.Normal + } - oldLevel, ok := level.Get().(klog.Level) - if !ok { - oldLevel = level + // When the current loglevel is the desired one, do nothing + if currentLogLevel == desiredLogLevel { + return nil } - if err := level.Set(logLevel); err != nil { - c.eventRecorder.Warningf("LoglevelChangeFailed", "Unable to set loglevel level %v", err) + // Set the new loglevel if the operator spec changed + if err := SetVerbosityValue(desiredLogLevel); err != nil { + c.eventRecorder.Warningf("OperatorLoglevelChangeFailed", "Unable to change operator log level from %q to %q: %v", currentLogLevel, desiredLogLevel, err) return err } - if oldLevel.String() != logLevel { - c.eventRecorder.Eventf("LoglevelChange", "Changed loglevel level to %q", logLevel) - } + c.eventRecorder.Eventf("OperatorLoglevelChange", "Operator log level changed from %q to %q", currentLogLevel, desiredLogLevel) return nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/loglevel/logging_controller_test.go b/vendor/github.com/openshift/library-go/pkg/operator/loglevel/logging_controller_test.go new file mode 100644 index 0000000000..ff21148d47 --- /dev/null +++ b/vendor/github.com/openshift/library-go/pkg/operator/loglevel/logging_controller_test.go @@ -0,0 +1,68 @@ +package loglevel + +import ( + "testing" + + operatorv1 "github.com/openshift/api/operator/v1" + + "github.com/openshift/library-go/pkg/operator/events" + "github.com/openshift/library-go/pkg/operator/v1helpers" +) + +func TestClusterOperatorLoggingController(t *testing.T) { + if err := SetVerbosityValue(operatorv1.Normal); err != nil { + t.Fatal(err) + } + + operatorSpec := &operatorv1.OperatorSpec{ + ManagementState: operatorv1.Managed, + } + + fakeStaticPodOperatorClient := v1helpers.NewFakeOperatorClient( + operatorSpec, + &operatorv1.OperatorStatus{}, + nil, + ) + + recorder := events.NewInMemoryRecorder("") + + controller := NewClusterOperatorLoggingController(fakeStaticPodOperatorClient, recorder) + + // no-op, desired == current + // When OperatorLogLevel is "" we assume the loglevel is Normal. + if err := controller.sync(); err != nil { + t.Fatal(err) + } + + if len(recorder.Events()) > 0 { + t.Fatalf("expected zero events, got %d", len(recorder.Events())) + } + + // change the log level to trace should 1 emit event + operatorSpec.OperatorLogLevel = operatorv1.Trace + if err := controller.sync(); err != nil { + t.Fatal(err) + } + + if operatorEvents := recorder.Events(); len(operatorEvents) == 1 { + expectedEventMessage := `Operator log level changed from "Normal" to "Trace"` + if message := operatorEvents[0].Message; message != expectedEventMessage { + t.Fatalf("expected event message %q, got %q", expectedEventMessage, message) + } + } else { + t.Fatalf("expected 1 event, got %d", len(operatorEvents)) + } + + // next sync should not produce any extra event + if err := controller.sync(); err != nil { + t.Fatal(err) + } + + if operatorEvents := recorder.Events(); len(operatorEvents) != 1 { + t.Fatalf("expected 1 event recorded, got %d", len(operatorEvents)) + } + + if current := CurrentLogLevel(); current != operatorv1.Trace { + t.Fatalf("expected log level 'Trace', got %v", current) + } +} diff --git a/vendor/github.com/openshift/library-go/pkg/operator/loglevel/util.go b/vendor/github.com/openshift/library-go/pkg/operator/loglevel/util.go index d6b9427976..91e4251f06 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/loglevel/util.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/loglevel/util.go @@ -1,7 +1,15 @@ package loglevel -import operatorv1 "github.com/openshift/api/operator/v1" +import ( + "flag" + "fmt" + "k8s.io/klog" + + operatorv1 "github.com/openshift/api/operator/v1" +) + +// LogLevelToKlog transforms operator log level to a klog numeric verbosity level. func LogLevelToKlog(logLevel operatorv1.LogLevel) int { switch logLevel { case operatorv1.Normal: @@ -16,3 +24,66 @@ func LogLevelToKlog(logLevel operatorv1.LogLevel) int { return 2 } } + +// CurrentLogLevel attempts to guess the current log level that is used by klog. +// We can use flags here as well, but this is less ugly ano more programmatically correct than flags. +func CurrentLogLevel() operatorv1.LogLevel { + switch { + case klog.V(8) == true: + return operatorv1.TraceAll + case klog.V(6) == true: + return operatorv1.Trace + case klog.V(4) == true: + return operatorv1.Debug + case klog.V(2) == true: + return operatorv1.Normal + default: + return operatorv1.Normal + } +} + +// SetVerbosityValue is a nasty hack and attempt to manipulate the global flags as klog does not expose +// a way to dynamically change the loglevel in runtime. +func SetVerbosityValue(logLevel operatorv1.LogLevel) error { + if logLevel == CurrentLogLevel() { + return nil + } + + var level *klog.Level + + // Convert operator loglevel to klog numeric string + desiredLevelValue := fmt.Sprintf("%d", LogLevelToKlog(logLevel)) + + // First, if the '-v' was specified in command line, attempt to acquire the level pointer from it. + if f := flag.CommandLine.Lookup("v"); f != nil { + if flagValue, ok := f.Value.(*klog.Level); ok { + level = flagValue + } + } + + // Second, if the '-v' was not set but is still present in flags defined for the command, attempt to acquire it + // by visiting all flags. + if level == nil { + flag.VisitAll(func(f *flag.Flag) { + if level != nil { + return + } + if levelFlag, ok := f.Value.(*klog.Level); ok { + level = levelFlag + } + }) + } + + if level != nil { + return level.Set(desiredLevelValue) + } + + // Third, if modifying the flag value (which is recommended by klog) fails, then fallback to modifying + // the internal state of klog using the empty new level. + var newLevel klog.Level + if err := newLevel.Set(desiredLevelValue); err != nil { + return fmt.Errorf("failed set klog.logging.verbosity %s: %v", desiredLevelValue, err) + } + + return nil +} diff --git a/vendor/github.com/openshift/library-go/pkg/operator/management/management_state_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/management/management_state_controller.go index 4b3ab3f57f..71e4f4cf7a 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/management/management_state_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/management/management_state_controller.go @@ -27,27 +27,28 @@ var workQueueKey = "instance" type ManagementStateController struct { operatorName string operatorClient operatorv1helpers.OperatorClient - eventRecorder events.Recorder - // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface + cachesToSync []cache.InformerSynced + queue workqueue.RateLimitingInterface + eventRecorder events.Recorder } func NewOperatorManagementStateController( name string, - operatorStatusProvider operatorv1helpers.OperatorClient, + operatorClient operatorv1helpers.OperatorClient, recorder events.Recorder, ) *ManagementStateController { c := &ManagementStateController{ operatorName: name, - operatorClient: operatorStatusProvider, + operatorClient: operatorClient, eventRecorder: recorder, queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "ManagementStateController-"+name), } - operatorStatusProvider.Informer().AddEventHandler(c.eventHandler()) - // TODO watch clusterOperator.status changes when it moves to openshift/api + operatorClient.Informer().AddEventHandler(c.eventHandler()) + + c.cachesToSync = append(c.cachesToSync, operatorClient.Informer().HasSynced) return c } @@ -97,6 +98,9 @@ func (c *ManagementStateController) Run(workers int, stopCh <-chan struct{}) { klog.Infof("Starting management-state-controller-" + c.operatorName) defer klog.Infof("Shutting down management-state-controller-" + c.operatorName) + if !cache.WaitForCacheSync(stopCh, c.cachesToSync...) { + return + } // doesn't matter what workers say, only start one. go wait.Until(c.runWorker, time.Second, stopCh) diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiregistration.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiregistration.go index 81a81a2d01..c10efe73f0 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiregistration.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiregistration.go @@ -1,22 +1,23 @@ package resourceapply import ( - "k8s.io/klog" - "k8s.io/apimachinery/pkg/api/equality" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/klog" apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" apiregistrationv1client "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/typed/apiregistration/v1" + "github.com/openshift/library-go/pkg/operator/events" "github.com/openshift/library-go/pkg/operator/resource/resourcemerge" ) // ApplyAPIService merges objectmeta and requires apiservice coordinates. It does not touch CA bundles, which should be managed via service CA controller. -func ApplyAPIService(client apiregistrationv1client.APIServicesGetter, required *apiregistrationv1.APIService) (*apiregistrationv1.APIService, bool, error) { +func ApplyAPIService(client apiregistrationv1client.APIServicesGetter, recorder events.Recorder, required *apiregistrationv1.APIService) (*apiregistrationv1.APIService, bool, error) { existing, err := client.APIServices().Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { actual, err := client.APIServices().Create(required) + reportCreateEvent(recorder, required, err) return actual, true, err } if err != nil { @@ -41,5 +42,6 @@ func ApplyAPIService(client apiregistrationv1client.APIServicesGetter, required klog.Infof("APIService %q changes: %s", existing.Name, JSONPatch(existing, existingCopy)) } actual, err := client.APIServices().Update(existingCopy) + reportUpdateEvent(recorder, required, err) return actual, true, err } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core.go index 870b7ceb64..36777d6eb4 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core.go @@ -196,6 +196,10 @@ func ApplyConfigMap(client coreclientv1.ConfigMapsGetter, recorder events.Record // ApplySecret merges objectmeta, requires data func ApplySecret(client coreclientv1.SecretsGetter, recorder events.Recorder, required *corev1.Secret) (*corev1.Secret, bool, error) { + if len(required.StringData) > 0 { + return nil, false, fmt.Errorf("Secret.stringData is not supported") + } + existing, err := client.Secrets(required.Namespace).Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { actual, err := client.Secrets(required.Namespace).Create(required) @@ -210,6 +214,7 @@ func ApplySecret(client coreclientv1.SecretsGetter, recorder events.Recorder, re existingCopy := existing.DeepCopy() resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta) + dataSame := equality.Semantic.DeepEqual(existingCopy.Data, required.Data) if dataSame && !*modified { return existingCopy, false, nil @@ -217,7 +222,23 @@ func ApplySecret(client coreclientv1.SecretsGetter, recorder events.Recorder, re existingCopy.Data = required.Data if klog.V(4) { - klog.Infof("Secret %q changes: %v", required.Namespace+"/"+required.Name, JSONPatch(existing, required)) + safeRequired := required.DeepCopy() + safeExisting := existing.DeepCopy() + + for s := range safeExisting.Data { + safeExisting.Data[s] = []byte("OLD") + } + for s := range safeRequired.Data { + if _, preexisting := existing.Data[s]; !preexisting { + safeRequired.Data[s] = []byte("NEW") + } else if !equality.Semantic.DeepEqual(existing.Data[s], safeRequired.Data[s]) { + safeRequired.Data[s] = []byte("MODIFIED") + } else { + safeRequired.Data[s] = []byte("OLD") + } + } + + klog.Infof("Secret %q changes: %v", required.Namespace+"/"+required.Name, JSONPatch(safeExisting, safeRequired)) } actual, err := client.Secrets(required.Namespace).Update(existingCopy) diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/rbac.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/rbac.go index 43f4130249..ff9388a95d 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/rbac.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/rbac.go @@ -131,7 +131,7 @@ func ApplyRole(client rbacclientv1.RolesGetter, recorder events.Recorder, requir if klog.V(4) { klog.Infof("Role %q changes: %v", required.Namespace+"/"+required.Name, JSONPatch(existing, existingCopy)) } - actual, err := client.Roles(required.Namespace).Update(existing) + actual, err := client.Roles(required.Namespace).Update(existingCopy) reportUpdateEvent(recorder, required, err) return actual, true, err } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller.go index 2e638da7fd..4d4cc4f127 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller.go @@ -45,16 +45,14 @@ type ResourceSyncController struct { // knownNamespaces is the list of namespaces we are watching. knownNamespaces sets.String - preRunCachesSynced []cache.InformerSynced - - // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface - configMapGetter corev1client.ConfigMapsGetter secretGetter corev1client.SecretsGetter kubeInformersForNamespaces v1helpers.KubeInformersForNamespaces operatorConfigClient v1helpers.OperatorClient - eventRecorder events.Recorder + + cachesToSync []cache.InformerSynced + queue workqueue.RateLimitingInterface + eventRecorder events.Recorder } var _ ResourceSyncer = &ResourceSyncController{} @@ -88,13 +86,16 @@ func NewResourceSyncController( informers := kubeInformersForNamespaces.InformersFor(namespace) informers.Core().V1().ConfigMaps().Informer().AddEventHandler(c.eventHandler()) informers.Core().V1().Secrets().Informer().AddEventHandler(c.eventHandler()) - c.preRunCachesSynced = append(c.preRunCachesSynced, informers.Core().V1().ConfigMaps().Informer().HasSynced) - c.preRunCachesSynced = append(c.preRunCachesSynced, informers.Core().V1().Secrets().Informer().HasSynced) + + c.cachesToSync = append(c.cachesToSync, informers.Core().V1().ConfigMaps().Informer().HasSynced) + c.cachesToSync = append(c.cachesToSync, informers.Core().V1().Secrets().Informer().HasSynced) } // we watch this just in case someone messes with our status operatorConfigClient.Informer().AddEventHandler(c.eventHandler()) + c.cachesToSync = append(c.cachesToSync, operatorConfigClient.Informer().HasSynced) + return c } @@ -217,7 +218,7 @@ func (c *ResourceSyncController) Run(workers int, stopCh <-chan struct{}) { klog.Infof("Starting ResourceSyncController") defer klog.Infof("Shutting down ResourceSyncController") - if !cache.WaitForCacheSync(stopCh, c.preRunCachesSynced...) { + if !cache.WaitForCacheSync(stopCh, c.cachesToSync...) { return } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller_test.go b/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller_test.go index 8ca0b60add..6a7b081f2b 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller_test.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller_test.go @@ -100,7 +100,7 @@ func TestSyncSecret(t *testing.T) { kubeClient.CoreV1(), eventRecorder, ) - c.preRunCachesSynced = []cache.InformerSynced{ + c.cachesToSync = []cache.InformerSynced{ secretInformers.Core().V1().Secrets().Informer().HasSynced, } c.configMapGetter = kubeClient.CoreV1() diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staleconditions/remove_stale_conditions.go b/vendor/github.com/openshift/library-go/pkg/operator/staleconditions/remove_stale_conditions.go new file mode 100644 index 0000000000..f9b94d8276 --- /dev/null +++ b/vendor/github.com/openshift/library-go/pkg/operator/staleconditions/remove_stale_conditions.go @@ -0,0 +1,116 @@ +package staleconditions + +import ( + "fmt" + "time" + + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/tools/cache" + "k8s.io/client-go/util/workqueue" + "k8s.io/klog" + + operatorv1 "github.com/openshift/api/operator/v1" + "github.com/openshift/library-go/pkg/operator/events" + "github.com/openshift/library-go/pkg/operator/v1helpers" +) + +const workQueueKey = "key" + +type RemoveStaleConditions struct { + conditions []string + + operatorClient v1helpers.OperatorClient + cachesToSync []cache.InformerSynced + + eventRecorder events.Recorder + // queue only ever has one item, but it has nice error handling backoff/retry semantics + queue workqueue.RateLimitingInterface +} + +func NewRemoveStaleConditions( + conditions []string, + operatorClient v1helpers.OperatorClient, + eventRecorder events.Recorder, +) *RemoveStaleConditions { + c := &RemoveStaleConditions{ + conditions: conditions, + + operatorClient: operatorClient, + eventRecorder: eventRecorder, + cachesToSync: []cache.InformerSynced{operatorClient.Informer().HasSynced}, + + queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "RemoveStaleConditions"), + } + + operatorClient.Informer().AddEventHandler(c.eventHandler()) + + return c +} + +func (c RemoveStaleConditions) sync() error { + removeStaleConditionsFn := func(status *operatorv1.OperatorStatus) error { + for _, condition := range c.conditions { + v1helpers.RemoveOperatorCondition(&status.Conditions, condition) + } + return nil + } + + if _, _, err := v1helpers.UpdateStatus(c.operatorClient, removeStaleConditionsFn); err != nil { + return err + } + + return nil +} + +// Run starts the kube-scheduler and blocks until stopCh is closed. +func (c *RemoveStaleConditions) Run(workers int, stopCh <-chan struct{}) { + defer utilruntime.HandleCrash() + defer c.queue.ShutDown() + + klog.Infof("Starting RemoveStaleConditions") + defer klog.Infof("Shutting down RemoveStaleConditions") + + if !cache.WaitForCacheSync(stopCh, c.cachesToSync...) { + utilruntime.HandleError(fmt.Errorf("caches did not sync")) + return + } + + // doesn't matter what workers say, only start one. + go wait.Until(c.runWorker, time.Second, stopCh) + + <-stopCh +} + +func (c *RemoveStaleConditions) runWorker() { + for c.processNextWorkItem() { + } +} + +func (c *RemoveStaleConditions) processNextWorkItem() bool { + dsKey, quit := c.queue.Get() + if quit { + return false + } + defer c.queue.Done(dsKey) + + err := c.sync() + if err == nil { + c.queue.Forget(dsKey) + return true + } + + utilruntime.HandleError(fmt.Errorf("%v failed with : %v", dsKey, err)) + c.queue.AddRateLimited(dsKey) + + return true +} + +// eventHandler queues the operator to check spec and status +func (c *RemoveStaleConditions) eventHandler() cache.ResourceEventHandler { + return cache.ResourceEventHandlerFuncs{ + AddFunc: func(obj interface{}) { c.queue.Add(workQueueKey) }, + UpdateFunc: func(old, new interface{}) { c.queue.Add(workQueueKey) }, + DeleteFunc: func(obj interface{}) { c.queue.Add(workQueueKey) }, + } +} diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/certsyncpod/certsync_cmd.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/certsyncpod/certsync_cmd.go index 00586222c8..e1e77dd878 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/certsyncpod/certsync_cmd.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/certsyncpod/certsync_cmd.go @@ -49,7 +49,7 @@ func NewCertSyncControllerCommand(configmaps, secrets []revision.RevisionResourc } cmd.Flags().StringVar(&o.DestinationDir, "destination-dir", o.DestinationDir, "Directory to write to") - cmd.Flags().StringVarP(&o.Namespace, "namespace", "n", o.Namespace, "Namespace to read from") + cmd.Flags().StringVarP(&o.Namespace, "namespace", "n", o.Namespace, "Namespace to read from (default to 'POD_NAMESPACE' environment variable)") cmd.Flags().StringVar(&o.KubeConfigFile, "kubeconfig", o.KubeConfigFile, "Location of the master configuration file to run from.") return cmd @@ -66,10 +66,8 @@ func (o *CertSyncControllerOptions) Run() error { observer.AddReactor(fileobserver.ExitOnChangeReactor, map[string][]byte{o.KubeConfigFile: initialContent}, o.KubeConfigFile) stopCh := make(chan struct{}) - go observer.Run(stopCh) kubeInformers := informers.NewSharedInformerFactoryWithOptions(o.kubeClient, 10*time.Minute, informers.WithNamespace(o.Namespace)) - go kubeInformers.Start(stopCh) eventRecorder := events.NewKubeRecorder(o.kubeClient.CoreV1().Events(o.Namespace), "cert-syncer", &corev1.ObjectReference{ @@ -90,7 +88,11 @@ func (o *CertSyncControllerOptions) Run() error { if err != nil { return err } + + // start everything. Informers start after they have been requested. go controller.Run(1, stopCh) + go observer.Run(stopCh) + go kubeInformers.Start(stopCh) <-stopCh klog.Infof("Shutting down certificate syncer") @@ -104,6 +106,10 @@ func (o *CertSyncControllerOptions) Complete() error { return err } + if len(o.Namespace) == 0 && len(os.Getenv("POD_NAMESPACE")) > 0 { + o.Namespace = os.Getenv("POD_NAMESPACE") + } + protoKubeConfig := rest.CopyConfig(kubeConfig) protoKubeConfig.AcceptContentTypes = "application/vnd.kubernetes.protobuf,application/json" protoKubeConfig.ContentType = "application/vnd.kubernetes.protobuf" diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/certsyncpod/certsync_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/certsyncpod/certsync_controller.go index 397adb0f63..70f68a3f43 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/certsyncpod/certsync_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/certsyncpod/certsync_controller.go @@ -161,6 +161,12 @@ func (c *CertSyncController) Run(workers int, stopCh <-chan struct{}) { klog.Infof("Starting CertSyncer") defer klog.Infof("Shutting down CertSyncer") + if !cache.WaitForCacheSync(stopCh, c.preRunCaches...) { + klog.Error("failed waiting for caches") + return + } + klog.V(2).Infof("CertSyncer caches synced") + // doesn't matter what workers say, only start one. go wait.Until(c.runWorker, time.Second, stopCh) diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/backingresource/backing_resource_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/backingresource/backing_resource_controller.go index 3094a52656..9c55363dfe 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/backingresource/backing_resource_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/backingresource/backing_resource_controller.go @@ -36,50 +36,46 @@ const ( // service accounts and RBAC rules in the target namespace according to the bindata manifests // (templated with the config) if they differ. type BackingResourceController struct { - targetNamespace string - operatorConfigClient v1helpers.OperatorClient + targetNamespace string - saListerSynced cache.InformerSynced - saLister corelisterv1.ServiceAccountLister + operatorClient v1helpers.OperatorClient + saLister corelisterv1.ServiceAccountLister + clusterRoleBindingLister rbaclisterv1.ClusterRoleBindingLister + kubeClient kubernetes.Interface - clusterRoleBindingLister rbaclisterv1.ClusterRoleBindingLister - clusterRoleBindingListerSynced cache.InformerSynced - - // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface - - kubeClient kubernetes.Interface + cachesToSync []cache.InformerSynced + queue workqueue.RateLimitingInterface eventRecorder events.Recorder } // NewBackingResourceController creates a new backing resource controller. func NewBackingResourceController( targetNamespace string, - operatorConfigClient v1helpers.OperatorClient, + operatorClient v1helpers.OperatorClient, kubeInformersForTargetNamespace informers.SharedInformerFactory, kubeClient kubernetes.Interface, eventRecorder events.Recorder, ) *BackingResourceController { c := &BackingResourceController{ - targetNamespace: targetNamespace, - operatorConfigClient: operatorConfigClient, - eventRecorder: eventRecorder.WithComponentSuffix("backing-resource-controller"), + targetNamespace: targetNamespace, + operatorClient: operatorClient, - saListerSynced: kubeInformersForTargetNamespace.Core().V1().ServiceAccounts().Informer().HasSynced, - saLister: kubeInformersForTargetNamespace.Core().V1().ServiceAccounts().Lister(), + saLister: kubeInformersForTargetNamespace.Core().V1().ServiceAccounts().Lister(), + clusterRoleBindingLister: kubeInformersForTargetNamespace.Rbac().V1().ClusterRoleBindings().Lister(), + kubeClient: kubeClient, - clusterRoleBindingListerSynced: kubeInformersForTargetNamespace.Core().V1().ServiceAccounts().Informer().HasSynced, - clusterRoleBindingLister: kubeInformersForTargetNamespace.Rbac().V1().ClusterRoleBindings().Lister(), - - queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "BackingResourceController"), - kubeClient: kubeClient, + queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "BackingResourceController"), + eventRecorder: eventRecorder.WithComponentSuffix("backing-resource-controller"), } - operatorConfigClient.Informer().AddEventHandler(c.eventHandler()) - + operatorClient.Informer().AddEventHandler(c.eventHandler()) kubeInformersForTargetNamespace.Core().V1().ServiceAccounts().Informer().AddEventHandler(c.eventHandler()) kubeInformersForTargetNamespace.Rbac().V1().ClusterRoleBindings().Informer().AddEventHandler(c.eventHandler()) + c.cachesToSync = append(c.cachesToSync, operatorClient.Informer().HasSynced) + c.cachesToSync = append(c.cachesToSync, kubeInformersForTargetNamespace.Core().V1().ServiceAccounts().Informer().HasSynced) + c.cachesToSync = append(c.cachesToSync, kubeInformersForTargetNamespace.Rbac().V1().ClusterRoleBindings().Informer().HasSynced) + return c } @@ -93,7 +89,7 @@ func (c BackingResourceController) mustTemplateAsset(name string) ([]byte, error } func (c BackingResourceController) sync() error { - operatorSpec, _, _, err := c.operatorConfigClient.GetOperatorState() + operatorSpec, _, _, err := c.operatorClient.GetOperatorState() if err != nil { return err } @@ -125,7 +121,7 @@ func (c BackingResourceController) sync() error { cond.Reason = "Error" cond.Message = err.Error() } - if _, _, updateError := v1helpers.UpdateStatus(c.operatorConfigClient, v1helpers.UpdateConditionFn(cond)); updateError != nil { + if _, _, updateError := v1helpers.UpdateStatus(c.operatorClient, v1helpers.UpdateConditionFn(cond)); updateError != nil { if err == nil { return updateError } @@ -141,10 +137,7 @@ func (c *BackingResourceController) Run(workers int, stopCh <-chan struct{}) { klog.Infof("Starting BackingResourceController") defer klog.Infof("Shutting down BackingResourceController") - if !cache.WaitForCacheSync(stopCh, c.saListerSynced) { - return - } - if !cache.WaitForCacheSync(stopCh, c.clusterRoleBindingListerSynced) { + if !cache.WaitForCacheSync(stopCh, c.cachesToSync...) { return } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installer/installer_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installer/installer_controller.go index 0858114cb2..014580de75 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installer/installer_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installer/installer_controller.go @@ -10,18 +10,20 @@ import ( "time" "github.com/davecgh/go-spew/spew" - "k8s.io/klog" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/equality" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + utilerrors "k8s.io/apimachinery/pkg/util/errors" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/informers" corev1client "k8s.io/client-go/kubernetes/typed/core/v1" "k8s.io/client-go/tools/cache" "k8s.io/client-go/util/workqueue" + "k8s.io/klog" operatorv1 "github.com/openshift/api/operator/v1" @@ -66,16 +68,16 @@ type InstallerController struct { certSecrets []revision.RevisionResource certDir string - operatorConfigClient v1helpers.StaticPodOperatorClient + operatorClient v1helpers.StaticPodOperatorClient configMapsGetter corev1client.ConfigMapsGetter + secretsGetter corev1client.SecretsGetter podsGetter corev1client.PodsGetter + cachesToSync []cache.InformerSynced + queue workqueue.RateLimitingInterface eventRecorder events.Recorder - // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface - // installerPodImageFn returns the image name for the installer pod installerPodImageFn func() string // ownerRefsFn sets the ownerrefs on the pruner pod @@ -87,16 +89,16 @@ type InstallerController struct { // InstallerPodMutationFunc is a function that has a chance at changing the installer pod before it is created type InstallerPodMutationFunc func(pod *corev1.Pod, nodeName string, operatorSpec *operatorv1.StaticPodOperatorSpec, revision int32) error -func (o *InstallerController) WithInstallerPodMutationFn(installerPodMutationFn InstallerPodMutationFunc) *InstallerController { - o.installerPodMutationFns = append(o.installerPodMutationFns, installerPodMutationFn) - return o +func (c *InstallerController) WithInstallerPodMutationFn(installerPodMutationFn InstallerPodMutationFunc) *InstallerController { + c.installerPodMutationFns = append(c.installerPodMutationFns, installerPodMutationFn) + return c } -func (o *InstallerController) WithCerts(certDir string, certConfigMaps, certSecrets []revision.RevisionResource) *InstallerController { - o.certDir = certDir - o.certConfigMaps = certConfigMaps - o.certSecrets = certSecrets - return o +func (c *InstallerController) WithCerts(certDir string, certConfigMaps, certSecrets []revision.RevisionResource) *InstallerController { + c.certDir = certDir + c.certConfigMaps = certConfigMaps + c.certSecrets = certSecrets + return c } // staticPodState is the status of a static pod that has been installed to a node. @@ -118,8 +120,9 @@ func NewInstallerController( secrets []revision.RevisionResource, command []string, kubeInformersForTargetNamespace informers.SharedInformerFactory, - operatorConfigClient v1helpers.StaticPodOperatorClient, + operatorClient v1helpers.StaticPodOperatorClient, configMapsGetter corev1client.ConfigMapsGetter, + secretsGetter corev1client.SecretsGetter, podsGetter corev1client.PodsGetter, eventRecorder events.Recorder, ) *InstallerController { @@ -130,10 +133,11 @@ func NewInstallerController( secrets: secrets, command: command, - operatorConfigClient: operatorConfigClient, - configMapsGetter: configMapsGetter, - podsGetter: podsGetter, - eventRecorder: eventRecorder.WithComponentSuffix("installer-controller"), + operatorClient: operatorClient, + configMapsGetter: configMapsGetter, + secretsGetter: secretsGetter, + podsGetter: podsGetter, + eventRecorder: eventRecorder.WithComponentSuffix("installer-controller"), queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "InstallerController"), @@ -141,9 +145,13 @@ func NewInstallerController( } c.ownerRefsFn = c.setOwnerRefs - operatorConfigClient.Informer().AddEventHandler(c.eventHandler()) + + operatorClient.Informer().AddEventHandler(c.eventHandler()) kubeInformersForTargetNamespace.Core().V1().Pods().Informer().AddEventHandler(c.eventHandler()) + c.cachesToSync = append(c.cachesToSync, operatorClient.Informer().HasSynced) + c.cachesToSync = append(c.cachesToSync, kubeInformersForTargetNamespace.Core().V1().Pods().Informer().HasSynced) + return c } @@ -190,14 +198,14 @@ func nodeToStartRevisionWith(getStaticPodState func(nodeName string) (state stat oldestNotReadyRevision := math.MaxInt32 for i := range nodes { currNodeState := &nodes[i] - state, revision, _, err := getStaticPodState(currNodeState.NodeName) + state, currentRevision, _, err := getStaticPodState(currNodeState.NodeName) if err != nil && apierrors.IsNotFound(err) { return i, nil } if err != nil { return 0, err } - revisionNum, err := strconv.Atoi(revision) + revisionNum, err := strconv.Atoi(currentRevision) if err != nil { return i, nil } @@ -215,11 +223,11 @@ func nodeToStartRevisionWith(getStaticPodState func(nodeName string) (state stat oldestPodRevision := math.MaxInt32 for i := range nodes { currNodeState := &nodes[i] - _, revision, _, err := getStaticPodState(currNodeState.NodeName) + _, currentRevision, _, err := getStaticPodState(currNodeState.NodeName) if err != nil { return 0, err } - revisionNum, err := strconv.Atoi(revision) + revisionNum, err := strconv.Atoi(currentRevision) if err != nil { return i, nil } @@ -291,7 +299,7 @@ func (c *InstallerController) manageInstallationPods(operatorSpec *operatorv1.St } pendingNewRevision := operatorStatus.LatestAvailableRevision > currNodeState.TargetRevision - newCurrNodeState, oom, err := c.newNodeStateForInstallInProgress(currNodeState, pendingNewRevision) + newCurrNodeState, installerPodFailed, err := c.newNodeStateForInstallInProgress(currNodeState, pendingNewRevision) if err != nil { return true, err } @@ -300,7 +308,7 @@ func (c *InstallerController) manageInstallationPods(operatorSpec *operatorv1.St // it's an extra write/read, but it makes the state debuggable from outside this process if !equality.Semantic.DeepEqual(newCurrNodeState, currNodeState) { klog.Infof("%q moving to %v", currNodeState.NodeName, spew.Sdump(*newCurrNodeState)) - newOperatorStatus, updated, updateError := v1helpers.UpdateStaticPodStatus(c.operatorConfigClient, setNodeStatusFn(newCurrNodeState), setAvailableProgressingNodeInstallerFailingConditions) + newOperatorStatus, updated, updateError := v1helpers.UpdateStaticPodStatus(c.operatorClient, setNodeStatusFn(newCurrNodeState), setAvailableProgressingNodeInstallerFailingConditions) if updateError != nil { return false, updateError } else if updated && currNodeState.CurrentRevision != newCurrNodeState.CurrentRevision { @@ -314,12 +322,12 @@ func (c *InstallerController) manageInstallationPods(operatorSpec *operatorv1.St } else { klog.V(2).Infof("%q is in transition to %d, but has not made progress", currNodeState.NodeName, currNodeState.TargetRevision) } - if !oom { + + // We want to retry the installer pod by deleting and then rekicking. Also we don't set LastFailedRevision. + if !installerPodFailed { break } - - // OOM is special. We want to retry the installer pod by falling through here. Also we don't set LastFailedRevision. - klog.V(2).Infof("Retrying %q for revision %d because it was OOM killed", currNodeState.NodeName, currNodeState.TargetRevision) + klog.Infof("Retrying %q for revision %d because it failed", currNodeState.NodeName, currNodeState.TargetRevision) installerPodName := getInstallerPodName(currNodeState.TargetRevision, currNodeState.NodeName) if err := c.podsGetter.Pods(c.targetNamespace).Delete(installerPodName, &metav1.DeleteOptions{}); err != nil && !apierrors.IsNotFound(err) { return true, err @@ -341,7 +349,7 @@ func (c *InstallerController) manageInstallationPods(operatorSpec *operatorv1.St // it's an extra write/read, but it makes the state debuggable from outside this process if !equality.Semantic.DeepEqual(newCurrNodeState, currNodeState) { klog.Infof("%q moving to %v", currNodeState.NodeName, spew.Sdump(*newCurrNodeState)) - if _, updated, updateError := v1helpers.UpdateStaticPodStatus(c.operatorConfigClient, setNodeStatusFn(newCurrNodeState), setAvailableProgressingNodeInstallerFailingConditions); updateError != nil { + if _, updated, updateError := v1helpers.UpdateStaticPodStatus(c.operatorClient, setNodeStatusFn(newCurrNodeState), setAvailableProgressingNodeInstallerFailingConditions); updateError != nil { return false, updateError } else if updated && currNodeState.TargetRevision != newCurrNodeState.TargetRevision && newCurrNodeState.TargetRevision != 0 { c.eventRecorder.Eventf("NodeTargetRevisionChanged", "Updating node %q from revision %d to %d", currNodeState.NodeName, @@ -416,20 +424,17 @@ func setAvailableProgressingNodeInstallerFailingConditions(newStatus *operatorv1 failingCount := map[int32]int{} failing := map[int32][]string{} for _, currNodeStatus := range newStatus.NodeStatuses { + counts[currNodeStatus.CurrentRevision] = counts[currNodeStatus.CurrentRevision] + 1 if currNodeStatus.CurrentRevision != 0 { numAvailable++ } // keep track of failures so that we can report failing status if currNodeStatus.LastFailedRevision != 0 { - existing := failingCount[currNodeStatus.CurrentRevision] - failingCount[currNodeStatus.CurrentRevision] = existing + 1 + failingCount[currNodeStatus.LastFailedRevision] = failingCount[currNodeStatus.LastFailedRevision] + 1 failing[currNodeStatus.LastFailedRevision] = append(failing[currNodeStatus.LastFailedRevision], currNodeStatus.LastFailedRevisionErrors...) } - existing := counts[currNodeStatus.CurrentRevision] - counts[currNodeStatus.CurrentRevision] = existing + 1 - if newStatus.LatestAvailableRevision == currNodeStatus.CurrentRevision { numAtLatestRevision += 1 } else { @@ -438,8 +443,13 @@ func setAvailableProgressingNodeInstallerFailingConditions(newStatus *operatorv1 } revisionStrings := []string{} - for revision, count := range counts { - revisionStrings = append(revisionStrings, fmt.Sprintf("%d nodes are at revision %d", count, revision)) + for _, currentRevision := range Int32KeySet(counts).List() { + count := counts[currentRevision] + revisionStrings = append(revisionStrings, fmt.Sprintf("%d nodes are at revision %d", count, currentRevision)) + } + // if we are progressing and no nodes have achieved that level, we should indicate + if numProgressing > 0 && counts[newStatus.LatestAvailableRevision] == 0 { + revisionStrings = append(revisionStrings, fmt.Sprintf("%d nodes have achieved new revision %d", 0, newStatus.LatestAvailableRevision)) } revisionDescription := strings.Join(revisionStrings, "; ") @@ -476,11 +486,8 @@ func setAvailableProgressingNodeInstallerFailingConditions(newStatus *operatorv1 if len(failing) > 0 { failingStrings := []string{} - for failingRevision, errorStrings := range failing { - // Do not report failing for nodes that are actually not failing. - if failingCount[failingRevision] == 0 { - continue - } + for _, failingRevision := range Int32KeySet(failing).List() { + errorStrings := failing[failingRevision] failingStrings = append(failingStrings, fmt.Sprintf("%d nodes are failing on revision %d:\n%v", failingCount[failingRevision], failingRevision, strings.Join(errorStrings, "\n"))) } failingDescription := strings.Join(failingStrings, "; ") @@ -502,7 +509,7 @@ func setAvailableProgressingNodeInstallerFailingConditions(newStatus *operatorv1 } // newNodeStateForInstallInProgress returns the new NodeState, whether it was killed by OOM or an error -func (c *InstallerController) newNodeStateForInstallInProgress(currNodeState *operatorv1.NodeStatus, newRevisionPending bool) (status *operatorv1.NodeStatus, oom bool, err error) { +func (c *InstallerController) newNodeStateForInstallInProgress(currNodeState *operatorv1.NodeStatus, newRevisionPending bool) (status *operatorv1.NodeStatus, installerPodFailed bool, err error) { ret := currNodeState.DeepCopy() installerPod, err := c.podsGetter.Pods(c.targetNamespace).Get(getInstallerPodName(currNodeState.TargetRevision, currNodeState.NodeName), metav1.GetOptions{}) if apierrors.IsNotFound(err) { @@ -527,12 +534,12 @@ func (c *InstallerController) newNodeStateForInstallInProgress(currNodeState *op break } - state, revision, failedErrors, err := c.getStaticPodState(currNodeState.NodeName) + state, currentRevision, failedErrors, err := c.getStaticPodState(currNodeState.NodeName) if err != nil { return nil, false, err } - if revision != strconv.Itoa(int(currNodeState.TargetRevision)) { + if currentRevision != strconv.Itoa(int(currNodeState.TargetRevision)) { // new updated pod to be launched break } @@ -555,10 +562,9 @@ func (c *InstallerController) newNodeStateForInstallInProgress(currNodeState *op for _, containerStatus := range installerPod.Status.ContainerStatuses { if containerStatus.State.Terminated != nil && len(containerStatus.State.Terminated.Message) > 0 { errors = append(errors, fmt.Sprintf("%s: %s", containerStatus.Name, containerStatus.State.Terminated.Message)) - if containerStatus.State.Terminated.Reason == "OOMKilled" { - // do not set LastFailedRevision - return currNodeState, true, nil - } + c.eventRecorder.Warningf("InstallerPodFailed", "installer errors: %v", strings.Join(errors, "\n")) + // do not set LastFailedRevision + return currNodeState, true, nil } } } @@ -697,8 +703,78 @@ func getInstallerPodImageFromEnv() string { return os.Getenv("OPERATOR_IMAGE") } +func (c InstallerController) ensureSecretRevisionResourcesExists(secrets []revision.RevisionResource, hasRevisionSuffix bool, latestRevisionNumber int32) error { + missing := sets.NewString() + for _, secret := range secrets { + if secret.Optional { + continue + } + name := secret.Name + if !hasRevisionSuffix { + name = fmt.Sprintf("%s-%d", name, latestRevisionNumber) + } + _, err := c.secretsGetter.Secrets(c.targetNamespace).Get(name, metav1.GetOptions{}) + if err == nil { + continue + } + if apierrors.IsNotFound(err) { + missing.Insert(name) + } + } + if missing.Len() == 0 { + return nil + } + return fmt.Errorf("secrets: %s", strings.Join(missing.List(), ",")) +} + +func (c InstallerController) ensureConfigMapRevisionResourcesExists(configs []revision.RevisionResource, hasRevisionSuffix bool, latestRevisionNumber int32) error { + missing := sets.NewString() + for _, config := range configs { + if config.Optional { + continue + } + name := config.Name + if !hasRevisionSuffix { + name = fmt.Sprintf("%s-%d", name, latestRevisionNumber) + } + _, err := c.configMapsGetter.ConfigMaps(c.targetNamespace).Get(name, metav1.GetOptions{}) + if err == nil { + continue + } + if apierrors.IsNotFound(err) { + missing.Insert(name) + } + } + if missing.Len() == 0 { + return nil + } + return fmt.Errorf("configmaps: %s", strings.Join(missing.List(), ",")) +} + +// ensureRequiredResourcesExist makes sure that all non-optional resources are ready or it will return an error to trigger a requeue so that we try again. +func (c InstallerController) ensureRequiredResourcesExist(revisionNumber int32) error { + errs := []error{} + + errs = append(errs, c.ensureConfigMapRevisionResourcesExists(c.certConfigMaps, true, revisionNumber)) + errs = append(errs, c.ensureConfigMapRevisionResourcesExists(c.configMaps, false, revisionNumber)) + errs = append(errs, c.ensureSecretRevisionResourcesExists(c.certSecrets, true, revisionNumber)) + errs = append(errs, c.ensureSecretRevisionResourcesExists(c.secrets, false, revisionNumber)) + + aggregatedErr := utilerrors.NewAggregate(errs) + if aggregatedErr == nil { + return nil + } + + eventMessages := []string{} + for _, err := range aggregatedErr.Errors() { + eventMessages = append(eventMessages, err.Error()) + } + c.eventRecorder.Warningf("RequiredInstallerResourcesMissing", strings.Join(eventMessages, ", ")) + return fmt.Errorf("missing required resources: %v", aggregatedErr) +} + func (c InstallerController) sync() error { - operatorSpec, originalOperatorStatus, resourceVersion, err := c.operatorConfigClient.GetStaticPodOperatorState() + operatorSpec, originalOperatorStatus, resourceVersion, err := c.operatorClient.GetStaticPodOperatorState() if err != nil { return err } @@ -708,13 +784,19 @@ func (c InstallerController) sync() error { return nil } - requeue, syncErr := c.manageInstallationPods(operatorSpec, operatorStatus, resourceVersion) - if requeue && syncErr == nil { - return fmt.Errorf("synthetic requeue request") + err = c.ensureRequiredResourcesExist(originalOperatorStatus.LatestAvailableRevision) + + // Only manage installation pods when all required certs are present. + if err == nil { + requeue, syncErr := c.manageInstallationPods(operatorSpec, operatorStatus, resourceVersion) + if requeue && syncErr == nil { + return fmt.Errorf("synthetic requeue request") + } + err = syncErr } - err = syncErr - // update failing condition + // Update failing condition + // If required certs are missing, this will report degraded as we can't create installer pods because of this pre-condition. cond := operatorv1.OperatorCondition{ Type: operatorStatusInstallerControllerDegraded, Status: operatorv1.ConditionFalse, @@ -724,7 +806,7 @@ func (c InstallerController) sync() error { cond.Reason = "Error" cond.Message = err.Error() } - if _, _, updateError := v1helpers.UpdateStaticPodStatus(c.operatorConfigClient, v1helpers.UpdateStaticPodConditionFn(cond), setAvailableProgressingNodeInstallerFailingConditions); updateError != nil { + if _, _, updateError := v1helpers.UpdateStaticPodStatus(c.operatorClient, v1helpers.UpdateStaticPodConditionFn(cond), setAvailableProgressingNodeInstallerFailingConditions); updateError != nil { if err == nil { return updateError } @@ -740,6 +822,9 @@ func (c *InstallerController) Run(workers int, stopCh <-chan struct{}) { klog.Infof("Starting InstallerController") defer klog.Infof("Shutting down InstallerController") + if !cache.WaitForCacheSync(stopCh, c.cachesToSync...) { + return + } // doesn't matter what workers say, only start one. go wait.Until(c.runWorker, time.Second, stopCh) diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installer/installer_controller_test.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installer/installer_controller_test.go index 0d11b23611..da90d01d50 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installer/installer_controller_test.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installer/installer_controller_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -21,20 +21,28 @@ import ( operatorv1 "github.com/openshift/api/operator/v1" "github.com/openshift/library-go/pkg/operator/events" + "github.com/openshift/library-go/pkg/operator/events/eventstesting" "github.com/openshift/library-go/pkg/operator/staticpod/controller/revision" "github.com/openshift/library-go/pkg/operator/v1helpers" ) func TestNewNodeStateForInstallInProgress(t *testing.T) { - kubeClient := fake.NewSimpleClientset() + kubeClient := fake.NewSimpleClientset( + &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Namespace: "test", Name: "test-config"}}, + &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Namespace: "test", Name: "test-secret"}}, + &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Namespace: "test", Name: fmt.Sprintf("%s-%d", "test-secret", 1)}}, + &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Namespace: "test", Name: fmt.Sprintf("%s-%d", "test-config", 1)}}, + &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Namespace: "test", Name: fmt.Sprintf("%s-%d", "test-secret", 2)}}, + &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Namespace: "test", Name: fmt.Sprintf("%s-%d", "test-config", 2)}}, + ) - var installerPod *v1.Pod + var installerPod *corev1.Pod kubeClient.PrependReactor("create", "pods", func(action ktesting.Action) (handled bool, ret runtime.Object, err error) { if installerPod != nil { return true, nil, errors.NewAlreadyExists(schema.GroupResource{Resource: "pods"}, installerPod.Name) } - installerPod = action.(ktesting.CreateAction).GetObject().(*v1.Pod) + installerPod = action.(ktesting.CreateAction).GetObject().(*corev1.Pod) kubeClient.PrependReactor("get", "pods", getPodsReactor(installerPod)) return true, installerPod, nil }) @@ -57,9 +65,10 @@ func TestNewNodeStateForInstallInProgress(t *testing.T) { }, }, nil, + nil, ) - eventRecorder := events.NewRecorder(kubeClient.CoreV1().Events("test"), "test-operator", &v1.ObjectReference{}) + eventRecorder := events.NewRecorder(kubeClient.CoreV1().Events("test"), "test-operator", &corev1.ObjectReference{}) podCommand := []string{"/bin/true", "--foo=test", "--bar"} c := NewInstallerController( "test", "test-pod", @@ -70,6 +79,7 @@ func TestNewNodeStateForInstallInProgress(t *testing.T) { fakeStaticPodOperatorClient, kubeClient.CoreV1(), kubeClient.CoreV1(), + kubeClient.CoreV1(), eventRecorder, ) c.ownerRefsFn = func(revision int32) ([]metav1.OwnerReference, error) { @@ -136,7 +146,7 @@ func TestNewNodeStateForInstallInProgress(t *testing.T) { } t.Log("installer succeeded") - installerPod.Status.Phase = v1.PodSucceeded + installerPod.Status.Phase = corev1.PodSucceeded if err := c.sync(); err != nil { t.Fatal(err) @@ -148,21 +158,21 @@ func TestNewNodeStateForInstallInProgress(t *testing.T) { } t.Log("static pod launched, but is not ready") - staticPod := &v1.Pod{ + staticPod := &corev1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: "test-pod-test-node-1", Namespace: "test", Labels: map[string]string{"revision": "1"}, }, - Spec: v1.PodSpec{}, - Status: v1.PodStatus{ - Conditions: []v1.PodCondition{ + Spec: corev1.PodSpec{}, + Status: corev1.PodStatus{ + Conditions: []corev1.PodCondition{ { - Status: v1.ConditionFalse, - Type: v1.PodReady, + Status: corev1.ConditionFalse, + Type: corev1.PodReady, }, }, - Phase: v1.PodRunning, + Phase: corev1.PodRunning, }, } kubeClient.PrependReactor("get", "pods", getPodsReactor(staticPod)) @@ -177,7 +187,7 @@ func TestNewNodeStateForInstallInProgress(t *testing.T) { } t.Log("static pod is ready") - staticPod.Status.Conditions[0].Status = v1.ConditionTrue + staticPod.Status.Conditions[0].Status = corev1.ConditionTrue if err := c.sync(); err != nil { t.Fatal(err) @@ -195,12 +205,12 @@ func TestNewNodeStateForInstallInProgress(t *testing.T) { fakeStaticPodOperatorClient.UpdateStaticPodOperatorStatus("1", currStatus) installerPod.Name = "installer-2-test-node-1" - installerPod.Status.Phase = v1.PodFailed - installerPod.Status.ContainerStatuses = []v1.ContainerStatus{ + installerPod.Status.Phase = corev1.PodFailed + installerPod.Status.ContainerStatuses = []corev1.ContainerStatus{ { Name: "installer", - State: v1.ContainerState{ - Terminated: &v1.ContainerStateTerminated{Message: "fake death"}, + State: corev1.ContainerState{ + Terminated: &corev1.ContainerStateTerminated{Message: "fake death"}, }, }, } @@ -209,16 +219,13 @@ func TestNewNodeStateForInstallInProgress(t *testing.T) { } _, currStatus, _, _ = fakeStaticPodOperatorClient.GetStaticPodOperatorState() - if generation := currStatus.NodeStatuses[0].LastFailedRevision; generation != 2 { - t.Errorf("expected last failed revision generation for node to be 2, got %d", generation) + if generation := currStatus.NodeStatuses[0].LastFailedRevision; generation != 0 { + t.Errorf("expected last failed revision generation for node to be 0, got %d", generation) } - if errors := currStatus.NodeStatuses[0].LastFailedRevisionErrors; len(errors) > 0 { - if errors[0] != "installer: fake death" { - t.Errorf("expected the error to be set to 'fake death', got %#v", errors) - } - } else { - t.Errorf("expected errors to be not empty") + // installer pod failures are suppressed + if errors := currStatus.NodeStatuses[0].LastFailedRevisionErrors; len(errors) != 0 { + t.Error(errors) } if v1helpers.FindOperatorCondition(currStatus.Conditions, operatorv1.OperatorStatusTypeProgressing) == nil { @@ -229,7 +236,7 @@ func TestNewNodeStateForInstallInProgress(t *testing.T) { } } -func getPodsReactor(pods ...*v1.Pod) ktesting.ReactionFunc { +func getPodsReactor(pods ...*corev1.Pod) ktesting.ReactionFunc { return func(action ktesting.Action) (handled bool, ret runtime.Object, err error) { podName := action.(ktesting.GetAction).GetName() for _, p := range pods { @@ -242,11 +249,16 @@ func getPodsReactor(pods ...*v1.Pod) ktesting.ReactionFunc { } func TestCreateInstallerPod(t *testing.T) { - kubeClient := fake.NewSimpleClientset() + kubeClient := fake.NewSimpleClientset( + &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Namespace: "test", Name: "test-config"}}, + &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Namespace: "test", Name: "test-secret"}}, + &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Namespace: "test", Name: fmt.Sprintf("%s-%d", "test-secret", 1)}}, + &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Namespace: "test", Name: fmt.Sprintf("%s-%d", "test-config", 1)}}, + ) - var installerPod *v1.Pod + var installerPod *corev1.Pod kubeClient.PrependReactor("create", "pods", func(action ktesting.Action) (handled bool, ret runtime.Object, err error) { - installerPod = action.(ktesting.CreateAction).GetObject().(*v1.Pod) + installerPod = action.(ktesting.CreateAction).GetObject().(*corev1.Pod) return false, nil, nil }) kubeInformers := informers.NewSharedInformerFactoryWithOptions(kubeClient, 1*time.Minute, informers.WithNamespace("test")) @@ -268,8 +280,9 @@ func TestCreateInstallerPod(t *testing.T) { }, }, nil, + nil, ) - eventRecorder := events.NewRecorder(kubeClient.CoreV1().Events("test"), "test-operator", &v1.ObjectReference{}) + eventRecorder := events.NewRecorder(kubeClient.CoreV1().Events("test"), "test-operator", &corev1.ObjectReference{}) c := NewInstallerController( "test", "test-pod", @@ -280,6 +293,7 @@ func TestCreateInstallerPod(t *testing.T) { fakeStaticPodOperatorClient, kubeClient.CoreV1(), kubeClient.CoreV1(), + kubeClient.CoreV1(), eventRecorder, ) c.ownerRefsFn = func(revision int32) ([]metav1.OwnerReference, error) { @@ -409,9 +423,9 @@ func TestEnsureInstallerPod(t *testing.T) { t.Run(tt.name, func(t *testing.T) { kubeClient := fake.NewSimpleClientset() - var installerPod *v1.Pod + var installerPod *corev1.Pod kubeClient.PrependReactor("create", "pods", func(action ktesting.Action) (handled bool, ret runtime.Object, err error) { - installerPod = action.(ktesting.CreateAction).GetObject().(*v1.Pod) + installerPod = action.(ktesting.CreateAction).GetObject().(*corev1.Pod) return false, nil, nil }) kubeInformers := informers.NewSharedInformerFactoryWithOptions(kubeClient, 1*time.Minute, informers.WithNamespace("test")) @@ -433,8 +447,9 @@ func TestEnsureInstallerPod(t *testing.T) { }, }, nil, + nil, ) - eventRecorder := events.NewRecorder(kubeClient.CoreV1().Events("test"), "test-operator", &v1.ObjectReference{}) + eventRecorder := events.NewRecorder(kubeClient.CoreV1().Events("test"), "test-operator", &corev1.ObjectReference{}) c := NewInstallerController( "test", "test-pod", @@ -445,6 +460,7 @@ func TestEnsureInstallerPod(t *testing.T) { fakeStaticPodOperatorClient, kubeClient.CoreV1(), kubeClient.CoreV1(), + kubeClient.CoreV1(), eventRecorder, ) c.ownerRefsFn = func(revision int32) ([]metav1.OwnerReference, error) { @@ -480,23 +496,23 @@ func TestEnsureInstallerPod(t *testing.T) { } func TestCreateInstallerPodMultiNode(t *testing.T) { - newStaticPod := func(name string, revision int, phase v1.PodPhase, ready bool) *v1.Pod { - condStatus := v1.ConditionTrue + newStaticPod := func(name string, revision int, phase corev1.PodPhase, ready bool) *corev1.Pod { + condStatus := corev1.ConditionTrue if !ready { - condStatus = v1.ConditionFalse + condStatus = corev1.ConditionFalse } - return &v1.Pod{ + return &corev1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: "test", Labels: map[string]string{"revision": strconv.Itoa(revision)}, }, - Spec: v1.PodSpec{}, - Status: v1.PodStatus{ - Conditions: []v1.PodCondition{ + Spec: corev1.PodSpec{}, + Status: corev1.PodStatus{ + Conditions: []corev1.PodCondition{ { Status: condStatus, - Type: v1.PodReady, + Type: corev1.PodReady, }, }, Phase: phase, @@ -507,7 +523,7 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { tests := []struct { name string nodeStatuses []operatorv1.NodeStatus - staticPods []*v1.Pod + staticPods []*corev1.Pod latestAvailableRevision int32 expectedUpgradeOrder []int expectedSyncError []bool @@ -547,10 +563,10 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { CurrentRevision: 1, }, }, - staticPods: []*v1.Pod{ - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 1, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 1, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, v1.PodRunning, true), + staticPods: []*corev1.Pod{ + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 1, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 1, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, corev1.PodRunning, true), }, expectedUpgradeOrder: []int{0, 1, 2}, }, @@ -572,10 +588,10 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { CurrentRevision: 1, }, }, - staticPods: []*v1.Pod{ - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 1, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 1, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, v1.PodRunning, true), + staticPods: []*corev1.Pod{ + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 1, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 1, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, corev1.PodRunning, true), }, expectedUpgradeOrder: []int{1, 0, 2}, }, @@ -597,10 +613,10 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { CurrentRevision: 1, }, }, - staticPods: []*v1.Pod{ - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 1, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 2, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, v1.PodRunning, true), + staticPods: []*corev1.Pod{ + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 1, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 2, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, corev1.PodRunning, true), }, expectedUpgradeOrder: []int{1, 0, 2}, }, @@ -622,10 +638,10 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { CurrentRevision: 1, }, }, - staticPods: []*v1.Pod{ - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 1, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 2, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, v1.PodRunning, true), + staticPods: []*corev1.Pod{ + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 1, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 2, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, corev1.PodRunning, true), }, expectedUpgradeOrder: []int{}, }, @@ -647,10 +663,10 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { CurrentRevision: 2, }, }, - staticPods: []*v1.Pod{ - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 2, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 2, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 2, v1.PodRunning, true), + staticPods: []*corev1.Pod{ + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 2, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 2, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 2, corev1.PodRunning, true), }, expectedUpgradeOrder: []int{0, 1, 2}, }, @@ -671,10 +687,10 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { CurrentRevision: 1, }, }, - staticPods: []*v1.Pod{ - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 1, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 1, v1.PodRunning, false), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, v1.PodRunning, true), + staticPods: []*corev1.Pod{ + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 1, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 1, corev1.PodRunning, false), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, corev1.PodRunning, true), }, expectedUpgradeOrder: []int{1, 0, 2}, }, @@ -695,10 +711,10 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { CurrentRevision: 1, }, }, - staticPods: []*v1.Pod{ - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 2, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 1, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, v1.PodRunning, true), + staticPods: []*corev1.Pod{ + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 2, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 1, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, corev1.PodRunning, true), }, // we call sync 2*3 times: // 1. notice update of node 1 @@ -727,10 +743,10 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { CurrentRevision: 1, }, }, - staticPods: []*v1.Pod{ - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 1, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 1, v1.PodRunning, false), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, v1.PodRunning, false), + staticPods: []*corev1.Pod{ + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 1, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 1, corev1.PodRunning, false), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, corev1.PodRunning, false), }, expectedUpgradeOrder: []int{1, 2, 0}, }, @@ -751,10 +767,10 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { CurrentRevision: 1, }, }, - staticPods: []*v1.Pod{ - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 1, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 2, v1.PodRunning, false), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, v1.PodRunning, true), + staticPods: []*corev1.Pod{ + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 1, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 2, corev1.PodRunning, false), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, corev1.PodRunning, true), }, expectedUpgradeOrder: []int{1, 0, 2}, }, @@ -775,10 +791,10 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { CurrentRevision: 1, }, }, - staticPods: []*v1.Pod{ - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 4, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 1, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, v1.PodRunning, true), + staticPods: []*corev1.Pod{ + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 4, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 1, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, corev1.PodRunning, true), }, expectedUpgradeOrder: []int{1, 2, 0}, }, @@ -799,10 +815,10 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { CurrentRevision: 1, }, }, - staticPods: []*v1.Pod{ - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 3, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 1, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, v1.PodSucceeded, true), + staticPods: []*corev1.Pod{ + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 3, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 1, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, corev1.PodSucceeded, true), }, expectedUpgradeOrder: []int{1, 2}, }, @@ -823,10 +839,10 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { CurrentRevision: 1, }, }, - staticPods: []*v1.Pod{ - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 3, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 2, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, v1.PodSucceeded, true), + staticPods: []*corev1.Pod{ + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 3, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 2, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 1, corev1.PodSucceeded, true), }, expectedUpgradeOrder: []int{2, 1}, }, @@ -847,10 +863,10 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { CurrentRevision: 2, }, }, - staticPods: []*v1.Pod{ - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 2, v1.PodRunning, true), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 1, v1.PodRunning, false), - newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 2, v1.PodRunning, false), + staticPods: []*corev1.Pod{ + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-1"), 2, corev1.PodRunning, true), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-2"), 1, corev1.PodRunning, false), + newStaticPod(mirrorPodNameForNode("test-pod", "test-node-3"), 2, corev1.PodRunning, false), }, expectedUpgradeOrder: []int{1, 2, 0}, }, @@ -870,9 +886,11 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { for i, test := range tests { t.Run(test.name, func(t *testing.T) { - createdInstallerPods := []*v1.Pod{} - installerPods := map[string]*v1.Pod{} - updatedStaticPods := map[string]*v1.Pod{} + createdInstallerPods := []*corev1.Pod{} + installerPods := map[string]*corev1.Pod{} + updatedStaticPods := map[string]*corev1.Pod{} + + namespace := fmt.Sprintf("test-%d", i) installerNodeAndID := func(installerName string) (string, int) { ss := strings.SplitN(strings.TrimPrefix(installerName, "installer-"), "-", 2) @@ -883,23 +901,28 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { return ss[1], id } - kubeClient := fake.NewSimpleClientset() + kubeClient := fake.NewSimpleClientset( + &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Namespace: namespace, Name: "test-secret"}}, + &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Namespace: namespace, Name: "test-config"}}, + &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Namespace: namespace, Name: fmt.Sprintf("%s-%d", "test-secret", test.latestAvailableRevision)}}, + &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Namespace: namespace, Name: fmt.Sprintf("%s-%d", "test-config", test.latestAvailableRevision)}}, + ) kubeClient.PrependReactor("create", "pods", func(action ktesting.Action) (handled bool, ret runtime.Object, err error) { - createdPod := action.(ktesting.CreateAction).GetObject().(*v1.Pod) + createdPod := action.(ktesting.CreateAction).GetObject().(*corev1.Pod) createdInstallerPods = append(createdInstallerPods, createdPod) if _, found := installerPods[createdPod.Name]; found { - return false, nil, errors.NewAlreadyExists(v1.SchemeGroupVersion.WithResource("pods").GroupResource(), createdPod.Name) + return false, nil, errors.NewAlreadyExists(corev1.SchemeGroupVersion.WithResource("pods").GroupResource(), createdPod.Name) } installerPods[createdPod.Name] = createdPod if test.numOfInstallersOOM > 0 { test.numOfInstallersOOM-- - createdPod.Status.Phase = v1.PodFailed - createdPod.Status.ContainerStatuses = []v1.ContainerStatus{ + createdPod.Status.Phase = corev1.PodFailed + createdPod.Status.ContainerStatuses = []corev1.ContainerStatus{ { Name: "container", - State: v1.ContainerState{ - Terminated: &v1.ContainerStateTerminated{ + State: corev1.ContainerState{ + Terminated: &corev1.ContainerStateTerminated{ ExitCode: 1, Reason: "OOMKilled", Message: "killed by OOM", @@ -912,12 +935,12 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { // Once the installer pod is created, set its status to succeeded. // Note that in reality, this will probably take couple sync cycles to happen, however it is useful to do this fast // to rule out timing bugs. - createdPod.Status.Phase = v1.PodSucceeded + createdPod.Status.Phase = corev1.PodSucceeded nodeName, id := installerNodeAndID(createdPod.Name) staticPodName := mirrorPodNameForNode("test-pod", nodeName) - updatedStaticPods[staticPodName] = newStaticPod(staticPodName, id, v1.PodRunning, true) + updatedStaticPods[staticPodName] = newStaticPod(staticPodName, id, corev1.PodRunning, true) } return true, nil, nil @@ -972,12 +995,13 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { NodeStatuses: test.nodeStatuses, }, statusUpdateErrorFunc, + nil, ) - eventRecorder := events.NewRecorder(kubeClient.CoreV1().Events("test"), "test-operator", &v1.ObjectReference{}) + eventRecorder := events.NewRecorder(kubeClient.CoreV1().Events("test"), "test-operator", &corev1.ObjectReference{}) c := NewInstallerController( - fmt.Sprintf("test-%d", i), "test-pod", + namespace, "test-pod", []revision.RevisionResource{{Name: "test-config"}}, []revision.RevisionResource{{Name: "test-secret"}}, []string{"/bin/true"}, @@ -985,6 +1009,7 @@ func TestCreateInstallerPodMultiNode(t *testing.T) { fakeStaticPodOperatorClient, kubeClient.CoreV1(), kubeClient.CoreV1(), + kubeClient.CoreV1(), eventRecorder, ) c.ownerRefsFn = func(revision int32) ([]metav1.OwnerReference, error) { @@ -1054,17 +1079,17 @@ func TestInstallerController_manageInstallationPods(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { c := &InstallerController{ - targetNamespace: tt.fields.targetNamespace, - staticPodName: tt.fields.staticPodName, - configMaps: tt.fields.configMaps, - secrets: tt.fields.secrets, - command: tt.fields.command, - operatorConfigClient: tt.fields.operatorConfigClient, - configMapsGetter: tt.fields.kubeClient.CoreV1(), - podsGetter: tt.fields.kubeClient.CoreV1(), - eventRecorder: tt.fields.eventRecorder, - queue: tt.fields.queue, - installerPodImageFn: tt.fields.installerPodImageFn, + targetNamespace: tt.fields.targetNamespace, + staticPodName: tt.fields.staticPodName, + configMaps: tt.fields.configMaps, + secrets: tt.fields.secrets, + command: tt.fields.command, + operatorClient: tt.fields.operatorConfigClient, + configMapsGetter: tt.fields.kubeClient.CoreV1(), + podsGetter: tt.fields.kubeClient.CoreV1(), + eventRecorder: tt.fields.eventRecorder, + queue: tt.fields.queue, + installerPodImageFn: tt.fields.installerPodImageFn, } got, err := c.manageInstallationPods(tt.args.operatorSpec, tt.args.originalOperatorStatus, tt.args.resourceVersion) if (err != nil) != tt.wantErr { @@ -1316,3 +1341,106 @@ func TestSetConditions(t *testing.T) { } } + +func TestEnsureRequiredResources(t *testing.T) { + tests := []struct { + name string + certConfigMaps []revision.RevisionResource + certSecrets []revision.RevisionResource + + revisionNumber int32 + configMaps []revision.RevisionResource + secrets []revision.RevisionResource + + startingResources []runtime.Object + expectedErr string + }{ + { + name: "none", + }, + { + name: "skip-optional", + certConfigMaps: []revision.RevisionResource{ + {Name: "foo-cm", Optional: true}, + }, + certSecrets: []revision.RevisionResource{ + {Name: "foo-s", Optional: true}, + }, + }, + { + name: "wait-required", + configMaps: []revision.RevisionResource{ + {Name: "foo-cm"}, + }, + secrets: []revision.RevisionResource{ + {Name: "foo-s"}, + }, + expectedErr: "missing required resources: [configmaps: foo-cm-0, secrets: foo-s-0]", + }, + { + name: "found-required", + configMaps: []revision.RevisionResource{ + {Name: "foo-cm"}, + }, + secrets: []revision.RevisionResource{ + {Name: "foo-s"}, + }, + startingResources: []runtime.Object{ + &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Namespace: "ns", Name: "foo-cm-0"}}, + &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Namespace: "ns", Name: "foo-s-0"}}, + }, + }, + { + name: "wait-required-certs", + certConfigMaps: []revision.RevisionResource{ + {Name: "foo-cm"}, + }, + certSecrets: []revision.RevisionResource{ + {Name: "foo-s"}, + }, + expectedErr: "missing required resources: [configmaps: foo-cm, secrets: foo-s]", + }, + { + name: "found-required-certs", + certConfigMaps: []revision.RevisionResource{ + {Name: "foo-cm"}, + }, + certSecrets: []revision.RevisionResource{ + {Name: "foo-s"}, + }, + startingResources: []runtime.Object{ + &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Namespace: "ns", Name: "foo-cm"}}, + &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Namespace: "ns", Name: "foo-s"}}, + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + client := fake.NewSimpleClientset(test.startingResources...) + c := &InstallerController{ + targetNamespace: "ns", + certConfigMaps: test.certConfigMaps, + certSecrets: test.certSecrets, + configMaps: test.configMaps, + secrets: test.secrets, + eventRecorder: eventstesting.NewTestingEventRecorder(t), + + configMapsGetter: client.CoreV1(), + secretsGetter: client.CoreV1(), + } + + actual := c.ensureRequiredResourcesExist(test.revisionNumber) + switch { + case len(test.expectedErr) == 0 && actual == nil: + case len(test.expectedErr) == 0 && actual != nil: + t.Fatal(actual) + case len(test.expectedErr) != 0 && actual == nil: + t.Fatal(actual) + case len(test.expectedErr) != 0 && actual != nil && !strings.Contains(actual.Error(), test.expectedErr): + t.Fatalf("actual error: %q does not match expected: %q", actual.Error(), test.expectedErr) + } + + }) + } +} diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installer/int32.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installer/int32.go new file mode 100644 index 0000000000..87256fe20a --- /dev/null +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installer/int32.go @@ -0,0 +1,187 @@ +package installer + +import ( + "reflect" + "sort" + + "k8s.io/apimachinery/pkg/util/sets" +) + +// sets.Int32 is a set of int32s, implemented via map[int32]struct{} for minimal memory consumption. +type Int32 map[int32]sets.Empty + +// NewInt32 creates a Int32 from a list of values. +func NewInt32(items ...int32) Int32 { + ss := Int32{} + ss.Insert(items...) + return ss +} + +// Int32KeySet creates a Int32 from a keys of a map[int32](? extends interface{}). +// If the value passed in is not actually a map, this will panic. +func Int32KeySet(theMap interface{}) Int32 { + v := reflect.ValueOf(theMap) + ret := Int32{} + + for _, keyValue := range v.MapKeys() { + ret.Insert(keyValue.Interface().(int32)) + } + return ret +} + +// Insert adds items to the set. +func (s Int32) Insert(items ...int32) { + for _, item := range items { + s[item] = sets.Empty{} + } +} + +// Delete removes all items from the set. +func (s Int32) Delete(items ...int32) { + for _, item := range items { + delete(s, item) + } +} + +// Has returns true if and only if item is contained in the set. +func (s Int32) Has(item int32) bool { + _, contained := s[item] + return contained +} + +// HasAll returns true if and only if all items are contained in the set. +func (s Int32) HasAll(items ...int32) bool { + for _, item := range items { + if !s.Has(item) { + return false + } + } + return true +} + +// HasAny returns true if any items are contained in the set. +func (s Int32) HasAny(items ...int32) bool { + for _, item := range items { + if s.Has(item) { + return true + } + } + return false +} + +// Difference returns a set of objects that are not in s2 +// For example: +// s1 = {a1, a2, a3} +// s2 = {a1, a2, a4, a5} +// s1.Difference(s2) = {a3} +// s2.Difference(s1) = {a4, a5} +func (s Int32) Difference(s2 Int32) Int32 { + result := NewInt32() + for key := range s { + if !s2.Has(key) { + result.Insert(key) + } + } + return result +} + +// Union returns a new set which includes items in either s1 or s2. +// For example: +// s1 = {a1, a2} +// s2 = {a3, a4} +// s1.Union(s2) = {a1, a2, a3, a4} +// s2.Union(s1) = {a1, a2, a3, a4} +func (s1 Int32) Union(s2 Int32) Int32 { + result := NewInt32() + for key := range s1 { + result.Insert(key) + } + for key := range s2 { + result.Insert(key) + } + return result +} + +// Intersection returns a new set which includes the item in BOTH s1 and s2 +// For example: +// s1 = {a1, a2} +// s2 = {a2, a3} +// s1.Intersection(s2) = {a2} +func (s1 Int32) Intersection(s2 Int32) Int32 { + var walk, other Int32 + result := NewInt32() + if s1.Len() < s2.Len() { + walk = s1 + other = s2 + } else { + walk = s2 + other = s1 + } + for key := range walk { + if other.Has(key) { + result.Insert(key) + } + } + return result +} + +// IsSuperset returns true if and only if s1 is a superset of s2. +func (s1 Int32) IsSuperset(s2 Int32) bool { + for item := range s2 { + if !s1.Has(item) { + return false + } + } + return true +} + +// Equal returns true if and only if s1 is equal (as a set) to s2. +// Two sets are equal if their membership is identical. +// (In practice, this means same elements, order doesn't matter) +func (s1 Int32) Equal(s2 Int32) bool { + return len(s1) == len(s2) && s1.IsSuperset(s2) +} + +type sortableSliceOfInt32 []int32 + +func (s sortableSliceOfInt32) Len() int { return len(s) } +func (s sortableSliceOfInt32) Less(i, j int) bool { return lessInt32(s[i], s[j]) } +func (s sortableSliceOfInt32) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +// List returns the contents as a sorted int32 slice. +func (s Int32) List() []int32 { + res := make(sortableSliceOfInt32, 0, len(s)) + for key := range s { + res = append(res, key) + } + sort.Sort(res) + return []int32(res) +} + +// UnsortedList returns the slice with contents in random order. +func (s Int32) UnsortedList() []int32 { + res := make([]int32, 0, len(s)) + for key := range s { + res = append(res, key) + } + return res +} + +// Returns a single element from the set. +func (s Int32) PopAny() (int32, bool) { + for key := range s { + s.Delete(key) + return key, true + } + var zeroValue int32 + return zeroValue, false +} + +// Len returns the size of the set. +func (s Int32) Len() int { + return len(s) +} + +func lessInt32(lhs, rhs int32) bool { + return lhs < rhs +} diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/monitoring/monitoring_resource_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/monitoring/monitoring_resource_controller.go index 2236776d58..fba75d541b 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/monitoring/monitoring_resource_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/monitoring/monitoring_resource_controller.go @@ -5,11 +5,9 @@ import ( "path/filepath" "time" - "github.com/openshift/library-go/pkg/operator/management" - "github.com/openshift/library-go/pkg/operator/v1helpers" - "k8s.io/klog" + "k8s.io/apimachinery/pkg/api/errors" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/dynamic" @@ -20,10 +18,13 @@ import ( "k8s.io/client-go/util/workqueue" operatorv1 "github.com/openshift/api/operator/v1" + "github.com/openshift/library-go/pkg/assets" "github.com/openshift/library-go/pkg/operator/events" + "github.com/openshift/library-go/pkg/operator/management" "github.com/openshift/library-go/pkg/operator/resource/resourceapply" "github.com/openshift/library-go/pkg/operator/staticpod/controller/monitoring/bindata" + "github.com/openshift/library-go/pkg/operator/v1helpers" ) const ( @@ -32,55 +33,56 @@ const ( manifestDir = "pkg/operator/staticpod/controller/monitoring" ) +var syntheticRequeueError = fmt.Errorf("synthetic requeue request") + type MonitoringResourceController struct { targetNamespace string serviceMonitorName string clusterRoleBindingLister rbaclisterv1.ClusterRoleBindingLister - // preRunCachesSynced are the set of caches that must be synced before the controller will start doing work. This is normally - // the full set of listers and informers you use. - preRunCachesSynced []cache.InformerSynced + kubeClient kubernetes.Interface + dynamicClient dynamic.Interface + operatorClient v1helpers.StaticPodOperatorClient - // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface - - kubeClient kubernetes.Interface - dynamicClient dynamic.Interface - operatorConfigClient v1helpers.StaticPodOperatorClient - eventRecorder events.Recorder + cachesToSync []cache.InformerSynced + queue workqueue.RateLimitingInterface + eventRecorder events.Recorder } // NewMonitoringResourceController creates a new backing resource controller. func NewMonitoringResourceController( targetNamespace string, serviceMonitorName string, - operatorConfigClient v1helpers.StaticPodOperatorClient, + operatorClient v1helpers.StaticPodOperatorClient, kubeInformersForTargetNamespace informers.SharedInformerFactory, kubeClient kubernetes.Interface, dynamicClient dynamic.Interface, eventRecorder events.Recorder, ) *MonitoringResourceController { c := &MonitoringResourceController{ - targetNamespace: targetNamespace, - operatorConfigClient: operatorConfigClient, - eventRecorder: eventRecorder.WithComponentSuffix("monitoring-resource-controller"), - serviceMonitorName: serviceMonitorName, + targetNamespace: targetNamespace, + operatorClient: operatorClient, + eventRecorder: eventRecorder.WithComponentSuffix("monitoring-resource-controller"), + serviceMonitorName: serviceMonitorName, clusterRoleBindingLister: kubeInformersForTargetNamespace.Rbac().V1().ClusterRoleBindings().Lister(), - preRunCachesSynced: []cache.InformerSynced{ + cachesToSync: []cache.InformerSynced{ kubeInformersForTargetNamespace.Core().V1().ServiceAccounts().Informer().HasSynced, - operatorConfigClient.Informer().HasSynced, + operatorClient.Informer().HasSynced, }, queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "MonitoringResourceController"), kubeClient: kubeClient, dynamicClient: dynamicClient, } - operatorConfigClient.Informer().AddEventHandler(c.eventHandler()) + operatorClient.Informer().AddEventHandler(c.eventHandler()) // TODO: We need a dynamic informer here to observe changes to ServiceMonitor resource. - kubeInformersForTargetNamespace.Rbac().V1().ClusterRoleBindings().Informer().AddEventHandler(c.eventHandler()) + + c.cachesToSync = append(c.cachesToSync, operatorClient.Informer().HasSynced) + c.cachesToSync = append(c.cachesToSync, kubeInformersForTargetNamespace.Rbac().V1().ClusterRoleBindings().Informer().HasSynced) + return c } @@ -94,7 +96,7 @@ func (c MonitoringResourceController) mustTemplateAsset(name string) ([]byte, er } func (c MonitoringResourceController) sync() error { - operatorSpec, _, _, err := c.operatorConfigClient.GetStaticPodOperatorState() + operatorSpec, _, _, err := c.operatorClient.GetStaticPodOperatorState() if err != nil { return err } @@ -120,7 +122,14 @@ func (c MonitoringResourceController) sync() error { errs = append(errs, fmt.Errorf("manifests/service-monitor.yaml: %v", err)) } else { _, serviceMonitorErr := resourceapply.ApplyServiceMonitor(c.dynamicClient, c.eventRecorder, serviceMonitorBytes) - errs = append(errs, serviceMonitorErr) + // This is to handle 'the server could not find the requested resource' which occurs when the CRD is not available + // yet (the CRD is provided by prometheus operator). This produce noise and plenty of events. + if errors.IsNotFound(serviceMonitorErr) { + klog.V(4).Infof("Unable to apply service monitor: %v", err) + return syntheticRequeueError + } else if serviceMonitorErr != nil { + errs = append(errs, serviceMonitorErr) + } } err = v1helpers.NewMultiLineAggregate(errs) @@ -137,7 +146,7 @@ func (c MonitoringResourceController) sync() error { cond.Reason = "Error" cond.Message = err.Error() } - if _, _, updateError := v1helpers.UpdateStaticPodStatus(c.operatorConfigClient, v1helpers.UpdateStaticPodConditionFn(cond)); updateError != nil { + if _, _, updateError := v1helpers.UpdateStaticPodStatus(c.operatorClient, v1helpers.UpdateStaticPodConditionFn(cond)); updateError != nil { if err == nil { return updateError } @@ -152,7 +161,7 @@ func (c *MonitoringResourceController) Run(workers int, stopCh <-chan struct{}) klog.Infof("Starting MonitoringResourceController") defer klog.Infof("Shutting down MonitoringResourceController") - if !cache.WaitForCacheSync(stopCh, c.preRunCachesSynced...) { + if !cache.WaitForCacheSync(stopCh, c.cachesToSync...) { return } @@ -180,7 +189,10 @@ func (c *MonitoringResourceController) processNextWorkItem() bool { return true } - utilruntime.HandleError(fmt.Errorf("%v failed with : %v", dsKey, err)) + if err != syntheticRequeueError { + utilruntime.HandleError(fmt.Errorf("%v failed with : %v", dsKey, err)) + } + c.queue.AddRateLimited(dsKey) return true diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/monitoring/monitoring_resource_controller_test.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/monitoring/monitoring_resource_controller_test.go index 377e22492a..7b62524ef1 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/monitoring/monitoring_resource_controller_test.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/monitoring/monitoring_resource_controller_test.go @@ -65,6 +65,7 @@ func TestNewMonitoringResourcesController(t *testing.T) { }, &operatorv1.StaticPodOperatorStatus{}, nil, + nil, ), validateActions: func(t *testing.T, actions []clienttesting.Action) { if len(actions) != 4 { @@ -97,6 +98,7 @@ func TestNewMonitoringResourcesController(t *testing.T) { }, &operatorv1.StaticPodOperatorStatus{}, nil, + nil, ), startingDynamicObjects: []runtime.Object{mustAssetServiceMonitor("target-namespace")}, validateActions: func(t *testing.T, actions []clienttesting.Action) {}, diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/node/node_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/node/node_controller.go index c3ef0ffa52..85fb82965d 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/node/node_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/node/node_controller.go @@ -26,39 +26,40 @@ const nodeControllerWorkQueueKey = "key" // NodeController watches for new master nodes and adds them to the node status list in the operator config status. type NodeController struct { - operatorConfigClient v1helpers.StaticPodOperatorClient - eventRecorder events.Recorder + operatorClient v1helpers.StaticPodOperatorClient - nodeListerSynced cache.InformerSynced - nodeLister corelisterv1.NodeLister + nodeLister corelisterv1.NodeLister - // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface + cachesToSync []cache.InformerSynced + queue workqueue.RateLimitingInterface + eventRecorder events.Recorder } // NewNodeController creates a new node controller. func NewNodeController( - operatorConfigClient v1helpers.StaticPodOperatorClient, + operatorClient v1helpers.StaticPodOperatorClient, kubeInformersClusterScoped informers.SharedInformerFactory, eventRecorder events.Recorder, ) *NodeController { c := &NodeController{ - operatorConfigClient: operatorConfigClient, - eventRecorder: eventRecorder.WithComponentSuffix("node-controller"), - nodeListerSynced: kubeInformersClusterScoped.Core().V1().Nodes().Informer().HasSynced, - nodeLister: kubeInformersClusterScoped.Core().V1().Nodes().Lister(), + operatorClient: operatorClient, + eventRecorder: eventRecorder.WithComponentSuffix("node-controller"), + nodeLister: kubeInformersClusterScoped.Core().V1().Nodes().Lister(), queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "NodeController"), } - operatorConfigClient.Informer().AddEventHandler(c.eventHandler()) + operatorClient.Informer().AddEventHandler(c.eventHandler()) kubeInformersClusterScoped.Core().V1().Nodes().Informer().AddEventHandler(c.eventHandler()) + c.cachesToSync = append(c.cachesToSync, operatorClient.Informer().HasSynced) + c.cachesToSync = append(c.cachesToSync, kubeInformersClusterScoped.Core().V1().Nodes().Informer().HasSynced) + return c } func (c NodeController) sync() error { - _, originalOperatorStatus, resourceVersion, err := c.operatorConfigClient.GetStaticPodOperatorState() + _, originalOperatorStatus, resourceVersion, err := c.operatorClient.GetStaticPodOperatorState() if err != nil { return err } @@ -107,7 +108,7 @@ func (c NodeController) sync() error { operatorStatus.NodeStatuses = newTargetNodeStates if !equality.Semantic.DeepEqual(originalOperatorStatus, operatorStatus) { - if _, updateError := c.operatorConfigClient.UpdateStaticPodOperatorStatus(resourceVersion, operatorStatus); updateError != nil { + if _, updateError := c.operatorClient.UpdateStaticPodOperatorStatus(resourceVersion, operatorStatus); updateError != nil { return updateError } } @@ -122,7 +123,7 @@ func (c *NodeController) Run(workers int, stopCh <-chan struct{}) { klog.Infof("Starting NodeController") defer klog.Infof("Shutting down NodeController") - if !cache.WaitForCacheSync(stopCh, c.nodeListerSynced) { + if !cache.WaitForCacheSync(stopCh, c.cachesToSync...) { return } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/node/node_controller_test.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/node/node_controller_test.go index 1170bc87da..37ec665f02 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/node/node_controller_test.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/node/node_controller_test.go @@ -115,6 +115,7 @@ func TestNewNodeController(t *testing.T) { NodeStatuses: test.startNodeStatus, }, nil, + nil, ) eventRecorder := events.NewRecorder(kubeClient.CoreV1().Events("test"), "test-operator", &v1.ObjectReference{}) diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/prune/prune_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/prune/prune_controller.go index 727d78b111..fb4a9c3365 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/prune/prune_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/prune/prune_controller.go @@ -34,20 +34,21 @@ type PruneController struct { targetNamespace, podResourcePrefix string // command is the string to use for the pruning pod command command []string - // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface // prunerPodImageFn returns the image name for the pruning pod prunerPodImageFn func() string // ownerRefsFn sets the ownerrefs on the pruner pod ownerRefsFn func(revision int32) ([]metav1.OwnerReference, error) - operatorConfigClient v1helpers.StaticPodOperatorClient + operatorClient v1helpers.StaticPodOperatorClient configMapGetter corev1client.ConfigMapsGetter secretGetter corev1client.SecretsGetter podGetter corev1client.PodsGetter - eventRecorder events.Recorder + + cachesToSync []cache.InformerSynced + queue workqueue.RateLimitingInterface + eventRecorder events.Recorder } const ( @@ -64,7 +65,7 @@ func NewPruneController( configMapGetter corev1client.ConfigMapsGetter, secretGetter corev1client.SecretsGetter, podGetter corev1client.PodsGetter, - operatorConfigClient v1helpers.StaticPodOperatorClient, + operatorClient v1helpers.StaticPodOperatorClient, eventRecorder events.Recorder, ) *PruneController { c := &PruneController{ @@ -72,7 +73,7 @@ func NewPruneController( podResourcePrefix: podResourcePrefix, command: command, - operatorConfigClient: operatorConfigClient, + operatorClient: operatorClient, configMapGetter: configMapGetter, secretGetter: secretGetter, @@ -84,7 +85,10 @@ func NewPruneController( } c.ownerRefsFn = c.setOwnerRefs - operatorConfigClient.Informer().AddEventHandler(c.eventHandler()) + + operatorClient.Informer().AddEventHandler(c.eventHandler()) + + c.cachesToSync = append(c.cachesToSync, operatorClient.Informer().HasSynced) return c } @@ -280,6 +284,9 @@ func (c *PruneController) Run(workers int, stopCh <-chan struct{}) { klog.Infof("Starting PruneController") defer klog.Infof("Shutting down PruneController") + if !cache.WaitForCacheSync(stopCh, c.cachesToSync...) { + return + } // doesn't matter what workers say, only start one. go wait.Until(c.runWorker, time.Second, stopCh) @@ -313,7 +320,7 @@ func (c *PruneController) processNextWorkItem() bool { func (c *PruneController) sync() error { klog.V(5).Info("Syncing revision pruner") - operatorSpec, operatorStatus, _, err := c.operatorConfigClient.GetStaticPodOperatorState() + operatorSpec, operatorStatus, _, err := c.operatorClient.GetStaticPodOperatorState() if err != nil { return err } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/prune/prune_controller_test.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/prune/prune_controller_test.go index df87fee685..58fec73ba5 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/prune/prune_controller_test.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/prune/prune_controller_test.go @@ -196,6 +196,7 @@ func TestPruneAPIResources(t *testing.T) { }, }, nil, + nil, ) eventRecorder := events.NewRecorder(kubeClient.CoreV1().Events("test"), "test-operator", &v1.ObjectReference{}) @@ -211,21 +212,21 @@ func TestPruneAPIResources(t *testing.T) { } c := &PruneController{ - targetNamespace: tc.targetNamespace, - podResourcePrefix: "test-pod", - command: []string{"/bin/true"}, - configMapGetter: kubeClient.CoreV1(), - secretGetter: kubeClient.CoreV1(), - podGetter: kubeClient.CoreV1(), - eventRecorder: eventRecorder, - operatorConfigClient: fakeStaticPodOperatorClient, + targetNamespace: tc.targetNamespace, + podResourcePrefix: "test-pod", + command: []string{"/bin/true"}, + configMapGetter: kubeClient.CoreV1(), + secretGetter: kubeClient.CoreV1(), + podGetter: kubeClient.CoreV1(), + eventRecorder: eventRecorder, + operatorClient: fakeStaticPodOperatorClient, } c.ownerRefsFn = func(revision int32) ([]metav1.OwnerReference, error) { return []metav1.OwnerReference{}, nil } c.prunerPodImageFn = func() string { return "docker.io/foo/bar" } - operatorSpec, _, _, err := c.operatorConfigClient.GetStaticPodOperatorState() + operatorSpec, _, _, err := c.operatorClient.GetStaticPodOperatorState() if err != nil { t.Fatalf("unexpected error %q", err) } @@ -408,6 +409,7 @@ func TestPruneDiskResources(t *testing.T) { }, }, nil, + nil, ) eventRecorder := events.NewRecorder(kubeClient.CoreV1().Events("test"), "test-operator", &v1.ObjectReference{}) @@ -423,21 +425,21 @@ func TestPruneDiskResources(t *testing.T) { } c := &PruneController{ - targetNamespace: "test", - podResourcePrefix: "test-pod", - command: []string{"/bin/true"}, - configMapGetter: kubeClient.CoreV1(), - secretGetter: kubeClient.CoreV1(), - podGetter: kubeClient.CoreV1(), - eventRecorder: eventRecorder, - operatorConfigClient: fakeStaticPodOperatorClient, + targetNamespace: "test", + podResourcePrefix: "test-pod", + command: []string{"/bin/true"}, + configMapGetter: kubeClient.CoreV1(), + secretGetter: kubeClient.CoreV1(), + podGetter: kubeClient.CoreV1(), + eventRecorder: eventRecorder, + operatorClient: fakeStaticPodOperatorClient, } c.ownerRefsFn = func(revision int32) ([]metav1.OwnerReference, error) { return []metav1.OwnerReference{}, nil } c.prunerPodImageFn = func() string { return "docker.io/foo/bar" } - operatorSpec, _, _, err := c.operatorConfigClient.GetStaticPodOperatorState() + operatorSpec, _, _, err := c.operatorClient.GetStaticPodOperatorState() if err != nil { t.Fatalf("unexpected error %q", err) } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/revision/revision_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/revision/revision_controller.go index ae5a04de22..d08b3667da 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/revision/revision_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/revision/revision_controller.go @@ -2,6 +2,7 @@ package revision import ( "fmt" + "strconv" "strings" "time" @@ -39,13 +40,12 @@ type RevisionController struct { // secrets is a list of secrets that are directly copied for the current values. A different actor/controller modifies these. secrets []RevisionResource - operatorConfigClient v1helpers.StaticPodOperatorClient - configMapGetter corev1client.ConfigMapsGetter - secretGetter corev1client.SecretsGetter - - // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface + operatorClient v1helpers.StaticPodOperatorClient + configMapGetter corev1client.ConfigMapsGetter + secretGetter corev1client.SecretsGetter + cachesToSync []cache.InformerSynced + queue workqueue.RateLimitingInterface eventRecorder events.Recorder } @@ -60,7 +60,7 @@ func NewRevisionController( configMaps []RevisionResource, secrets []RevisionResource, kubeInformersForTargetNamespace informers.SharedInformerFactory, - operatorConfigClient v1helpers.StaticPodOperatorClient, + operatorClient v1helpers.StaticPodOperatorClient, configMapGetter corev1client.ConfigMapsGetter, secretGetter corev1client.SecretsGetter, eventRecorder events.Recorder, @@ -70,18 +70,22 @@ func NewRevisionController( configMaps: configMaps, secrets: secrets, - operatorConfigClient: operatorConfigClient, - configMapGetter: configMapGetter, - secretGetter: secretGetter, - eventRecorder: eventRecorder.WithComponentSuffix("revision-controller"), + operatorClient: operatorClient, + configMapGetter: configMapGetter, + secretGetter: secretGetter, + eventRecorder: eventRecorder.WithComponentSuffix("revision-controller"), queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "RevisionController"), } - operatorConfigClient.Informer().AddEventHandler(c.eventHandler()) + operatorClient.Informer().AddEventHandler(c.eventHandler()) kubeInformersForTargetNamespace.Core().V1().ConfigMaps().Informer().AddEventHandler(c.eventHandler()) kubeInformersForTargetNamespace.Core().V1().Secrets().Informer().AddEventHandler(c.eventHandler()) + c.cachesToSync = append(c.cachesToSync, operatorClient.Informer().HasSynced) + c.cachesToSync = append(c.cachesToSync, kubeInformersForTargetNamespace.Core().V1().ConfigMaps().Informer().HasSynced) + c.cachesToSync = append(c.cachesToSync, kubeInformersForTargetNamespace.Core().V1().Secrets().Informer().HasSynced) + return c } @@ -107,7 +111,7 @@ func (c RevisionController) createRevisionIfNeeded(operatorSpec *operatorv1.Stat Reason: "ContentCreationError", Message: err.Error(), } - if _, _, updateError := v1helpers.UpdateStaticPodStatus(c.operatorConfigClient, v1helpers.UpdateStaticPodConditionFn(cond)); updateError != nil { + if _, _, updateError := v1helpers.UpdateStaticPodStatus(c.operatorClient, v1helpers.UpdateStaticPodConditionFn(cond)); updateError != nil { c.eventRecorder.Warningf("RevisionCreateFailed", "Failed to create revision %d: %v", nextRevision, err.Error()) return true, updateError } @@ -118,7 +122,7 @@ func (c RevisionController) createRevisionIfNeeded(operatorSpec *operatorv1.Stat Type: "RevisionControllerDegraded", Status: operatorv1.ConditionFalse, } - if _, updated, updateError := v1helpers.UpdateStaticPodStatus(c.operatorConfigClient, v1helpers.UpdateStaticPodConditionFn(cond), func(operatorStatus *operatorv1.StaticPodOperatorStatus) error { + if _, updated, updateError := v1helpers.UpdateStaticPodStatus(c.operatorClient, v1helpers.UpdateStaticPodConditionFn(cond), func(operatorStatus *operatorv1.StaticPodOperatorStatus) error { if operatorStatus.LatestAvailableRevision == nextRevision { klog.Warningf("revision %d is unexpectedly already the latest available revision. This is a possible race!", nextRevision) return fmt.Errorf("conflicting latestAvailableRevision %d", operatorStatus.LatestAvailableRevision) @@ -245,8 +249,34 @@ func (c RevisionController) createNewRevision(revision int32) error { return nil } +// getLatestAvailableRevision returns the latest known revision to the operator +// This is either the LatestAvailableRevision in the status or by checking revision status configmaps +func (c RevisionController) getLatestAvailableRevision(operatorStatus *operatorv1.StaticPodOperatorStatus) (int32, error) { + configMaps, err := c.configMapGetter.ConfigMaps(c.targetNamespace).List(metav1.ListOptions{}) + if err != nil { + return 0, err + } + var latestRevision int32 + for _, configMap := range configMaps.Items { + if !strings.HasPrefix(configMap.Name, "revision-status-") { + continue + } + if revision, ok := configMap.Data["revision"]; ok { + revisionNumber, err := strconv.Atoi(revision) + if err != nil { + return 0, err + } + if int32(revisionNumber) > latestRevision { + latestRevision = int32(revisionNumber) + } + } + } + // If there are no configmaps, then this should actually be revision 0 + return latestRevision, nil +} + func (c RevisionController) sync() error { - operatorSpec, originalOperatorStatus, resourceVersion, err := c.operatorConfigClient.GetStaticPodOperatorStateWithQuorum() + operatorSpec, originalOperatorStatus, resourceVersion, err := c.operatorClient.GetStaticPodOperatorStateWithQuorum() if err != nil { return err } @@ -256,6 +286,25 @@ func (c RevisionController) sync() error { return nil } + // If the operator status has 0 as its latest available revision, this is either the first revision + // or possibly the operator resource was deleted and reset back to 0, which is not what we want so check configmaps + if operatorStatus.LatestAvailableRevision == 0 { + // Check to see if current revision is accurate and if not, search through configmaps for latest revision + latestRevision, err := c.getLatestAvailableRevision(operatorStatus) + if err != nil { + return err + } + if latestRevision != 0 { + // Then make sure that revision number is what's in the operator status + _, _, err = v1helpers.UpdateStaticPodStatus(c.operatorClient, func(status *operatorv1.StaticPodOperatorStatus) error { + status.LatestAvailableRevision = latestRevision + return nil + }) + // If we made a change return and requeue with the correct status + return fmt.Errorf("synthetic requeue request (err: %v)", err) + } + } + requeue, syncErr := c.createRevisionIfNeeded(operatorSpec, operatorStatus, resourceVersion) if requeue && syncErr == nil { return fmt.Errorf("synthetic requeue request (err: %v)", syncErr) @@ -272,7 +321,7 @@ func (c RevisionController) sync() error { cond.Reason = "Error" cond.Message = err.Error() } - if _, _, updateError := v1helpers.UpdateStaticPodStatus(c.operatorConfigClient, v1helpers.UpdateStaticPodConditionFn(cond)); updateError != nil { + if _, _, updateError := v1helpers.UpdateStaticPodStatus(c.operatorClient, v1helpers.UpdateStaticPodConditionFn(cond)); updateError != nil { if err == nil { return updateError } @@ -288,6 +337,9 @@ func (c *RevisionController) Run(workers int, stopCh <-chan struct{}) { klog.Infof("Starting RevisionController") defer klog.Infof("Shutting down RevisionController") + if !cache.WaitForCacheSync(stopCh, c.cachesToSync...) { + return + } // doesn't matter what workers say, only start one. go wait.Until(c.runWorker, time.Second, stopCh) diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/revision/revision_controller_test.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/revision/revision_controller_test.go index 7fb928cd03..db1de11391 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/revision/revision_controller_test.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/revision/revision_controller_test.go @@ -48,6 +48,49 @@ func TestRevisionController(t *testing.T) { validateStatus func(t *testing.T, status *operatorv1.StaticPodOperatorStatus) expectSyncError string }{ + { + testName: "set-latest-revision-by-configmap", + targetNamespace: targetNamespace, + staticPodOperatorClient: v1helpers.NewFakeStaticPodOperatorClient( + &operatorv1.StaticPodOperatorSpec{ + OperatorSpec: operatorv1.OperatorSpec{ + ManagementState: operatorv1.Managed, + }, + }, + &operatorv1.StaticPodOperatorStatus{ + LatestAvailableRevision: 0, + NodeStatuses: []operatorv1.NodeStatus{ + { + NodeName: "test-node-1", + CurrentRevision: 0, + TargetRevision: 0, + }, + }, + }, + nil, + nil, + ), + testConfigs: []RevisionResource{{Name: "test-config"}}, + testSecrets: []RevisionResource{{Name: "test-secret"}}, + startingObjects: []runtime.Object{ + &v1.Secret{ObjectMeta: metav1.ObjectMeta{Name: "test-secret", Namespace: targetNamespace}}, + &v1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Name: "test-config", Namespace: targetNamespace}}, + &v1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Name: "revision-status", Namespace: targetNamespace}}, + &v1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{Name: "revision-status-1", Namespace: targetNamespace}, + Data: map[string]string{"revision": "1"}, + }, + &v1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{Name: "revision-status-2", Namespace: targetNamespace}, + Data: map[string]string{"revision": "2"}, + }, + }, + validateStatus: func(t *testing.T, status *operatorv1.StaticPodOperatorStatus) { + if status.LatestAvailableRevision != 2 { + t.Errorf("expected status LatestAvailableRevision to be 2, got %v", status.LatestAvailableRevision) + } + }, + }, { testName: "operator-unmanaged", targetNamespace: targetNamespace, @@ -59,6 +102,7 @@ func TestRevisionController(t *testing.T) { }, &operatorv1.StaticPodOperatorStatus{}, nil, + nil, ), validateActions: func(t *testing.T, actions []clienttesting.Action) { createdObjects := filterCreateActions(actions) @@ -87,6 +131,7 @@ func TestRevisionController(t *testing.T) { }, }, nil, + nil, ), testConfigs: []RevisionResource{{Name: "test-config"}}, testSecrets: []RevisionResource{{Name: "test-secret"}}, @@ -123,6 +168,7 @@ func TestRevisionController(t *testing.T) { }, }, nil, + nil, ), startingObjects: []runtime.Object{ &v1.Secret{ObjectMeta: metav1.ObjectMeta{Name: "test-secret", Namespace: targetNamespace}}, @@ -189,6 +235,7 @@ func TestRevisionController(t *testing.T) { }, }, nil, + nil, ), startingObjects: []runtime.Object{ &v1.Secret{ObjectMeta: metav1.ObjectMeta{Name: "test-secret", Namespace: targetNamespace}}, @@ -267,6 +314,7 @@ func TestRevisionController(t *testing.T) { }, }, nil, + nil, ), startingObjects: []runtime.Object{ &v1.Secret{ObjectMeta: metav1.ObjectMeta{Name: "test-secret", Namespace: targetNamespace}}, @@ -327,6 +375,7 @@ func TestRevisionController(t *testing.T) { }, }, nil, + nil, ), startingObjects: []runtime.Object{ &v1.Secret{ObjectMeta: metav1.ObjectMeta{Name: "test-secret", Namespace: targetNamespace}}, @@ -364,6 +413,7 @@ func TestRevisionController(t *testing.T) { }, }, nil, + nil, ), startingObjects: []runtime.Object{ &v1.Secret{ObjectMeta: metav1.ObjectMeta{Name: "test-secret", Namespace: targetNamespace}}, diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/staticpodstate/staticpodstate_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/staticpodstate/staticpodstate_controller.go index 3df511bb5f..1a978a0153 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/staticpodstate/staticpodstate_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/staticpodstate/staticpodstate_controller.go @@ -36,14 +36,14 @@ type StaticPodStateController struct { operandName string operatorNamespace string - operatorConfigClient v1helpers.StaticPodOperatorClient - configMapGetter corev1client.ConfigMapsGetter - podsGetter corev1client.PodsGetter - versionRecorder status.VersionGetter - eventRecorder events.Recorder - - // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface + operatorClient v1helpers.StaticPodOperatorClient + configMapGetter corev1client.ConfigMapsGetter + podsGetter corev1client.PodsGetter + versionRecorder status.VersionGetter + + cachesToSync []cache.InformerSynced + queue workqueue.RateLimitingInterface + eventRecorder events.Recorder } // NewStaticPodStateController creates a controller that watches static pods and will produce a failing status if the @@ -51,7 +51,7 @@ type StaticPodStateController struct { func NewStaticPodStateController( targetNamespace, staticPodName, operatorNamespace, operandName string, kubeInformersForTargetNamespace informers.SharedInformerFactory, - operatorConfigClient v1helpers.StaticPodOperatorClient, + operatorClient v1helpers.StaticPodOperatorClient, configMapGetter corev1client.ConfigMapsGetter, podsGetter corev1client.PodsGetter, versionRecorder status.VersionGetter, @@ -63,23 +63,26 @@ func NewStaticPodStateController( operandName: operandName, operatorNamespace: operatorNamespace, - operatorConfigClient: operatorConfigClient, - configMapGetter: configMapGetter, - podsGetter: podsGetter, - versionRecorder: versionRecorder, - eventRecorder: eventRecorder.WithComponentSuffix("static-pod-state-controller"), + operatorClient: operatorClient, + configMapGetter: configMapGetter, + podsGetter: podsGetter, + versionRecorder: versionRecorder, + eventRecorder: eventRecorder.WithComponentSuffix("static-pod-state-controller"), queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "StaticPodStateController"), } - operatorConfigClient.Informer().AddEventHandler(c.eventHandler()) + operatorClient.Informer().AddEventHandler(c.eventHandler()) kubeInformersForTargetNamespace.Core().V1().Pods().Informer().AddEventHandler(c.eventHandler()) + c.cachesToSync = append(c.cachesToSync, operatorClient.Informer().HasSynced) + c.cachesToSync = append(c.cachesToSync, kubeInformersForTargetNamespace.Core().V1().Pods().Informer().HasSynced) + return c } func (c *StaticPodStateController) sync() error { - operatorSpec, originalOperatorStatus, _, err := c.operatorConfigClient.GetStaticPodOperatorState() + operatorSpec, originalOperatorStatus, _, err := c.operatorClient.GetStaticPodOperatorState() if err != nil { return err } @@ -132,6 +135,10 @@ func (c *StaticPodStateController) sync() error { c.operandName, status.VersionForOperandFromEnv(), ) + c.versionRecorder.SetVersion( + "operator", + status.VersionForOperatorFromEnv(), + ) } // update failing condition @@ -150,7 +157,7 @@ func (c *StaticPodStateController) sync() error { cond.Reason = "Error" cond.Message = v1helpers.NewMultiLineAggregate(errs).Error() } - if _, _, updateError := v1helpers.UpdateStaticPodStatus(c.operatorConfigClient, v1helpers.UpdateStaticPodConditionFn(cond), v1helpers.UpdateStaticPodConditionFn(cond)); updateError != nil { + if _, _, updateError := v1helpers.UpdateStaticPodStatus(c.operatorClient, v1helpers.UpdateStaticPodConditionFn(cond), v1helpers.UpdateStaticPodConditionFn(cond)); updateError != nil { if err == nil { return updateError } @@ -170,6 +177,9 @@ func (c *StaticPodStateController) Run(workers int, stopCh <-chan struct{}) { klog.Infof("Starting StaticPodStateController") defer klog.Infof("Shutting down StaticPodStateController") + if !cache.WaitForCacheSync(stopCh, c.cachesToSync...) { + return + } // doesn't matter what workers say, only start one. go wait.Until(c.runWorker, time.Second, stopCh) diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controllers.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controllers.go index a2e444fe7a..f17b19871b 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controllers.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controllers.go @@ -164,6 +164,7 @@ func (b *staticPodOperatorControllerBuilder) ToControllers() (*staticPodOperator operandInformers, b.staticPodOperatorClient, configMapClient, + secretClient, podClient, eventRecorder, ).WithCerts( diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/installerpod/cmd.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/installerpod/cmd.go index 2738ba2b95..11b5216b2e 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/installerpod/cmd.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/installerpod/cmd.go @@ -215,7 +215,7 @@ func (o *InstallOptions) copySecretsAndConfigMaps(ctx context.Context, resourceD for filename, content := range secret.Data { // TODO fix permissions klog.Infof("Writing secret manifest %q ...", path.Join(contentDir, filename)) - if err := ioutil.WriteFile(path.Join(contentDir, filename), content, 0644); err != nil { + if err := ioutil.WriteFile(path.Join(contentDir, filename), content, 0600); err != nil { return err } } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/status/status_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/status/status_controller.go index 276291a1a3..2f0f6307e2 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/status/status_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/status/status_controller.go @@ -46,11 +46,10 @@ type StatusSyncer struct { operatorClient operatorv1helpers.OperatorClient clusterOperatorClient configv1client.ClusterOperatorsGetter clusterOperatorLister configv1listers.ClusterOperatorLister - clusterOperatorSynced cache.InformerSynced - eventRecorder events.Recorder - // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface + cachesToSync []cache.InformerSynced + queue workqueue.RateLimitingInterface + eventRecorder events.Recorder } func NewClusterOperatorStatusController( @@ -68,7 +67,6 @@ func NewClusterOperatorStatusController( versionGetter: versionGetter, clusterOperatorClient: clusterOperatorClient, clusterOperatorLister: clusterOperatorInformer.Lister(), - clusterOperatorSynced: clusterOperatorInformer.Informer().HasSynced, operatorClient: operatorClient, eventRecorder: recorder.WithComponentSuffix("status-controller"), @@ -78,6 +76,9 @@ func NewClusterOperatorStatusController( operatorClient.Informer().AddEventHandler(c.eventHandler()) clusterOperatorInformer.Informer().AddEventHandler(c.eventHandler()) + c.cachesToSync = append(c.cachesToSync, operatorClient.Informer().HasSynced) + c.cachesToSync = append(c.cachesToSync, clusterOperatorInformer.Informer().HasSynced) + return c } @@ -86,7 +87,7 @@ func NewClusterOperatorStatusController( func (c StatusSyncer) sync() error { detailedSpec, currentDetailedStatus, _, err := c.operatorClient.GetOperatorState() if apierrors.IsNotFound(err) { - c.eventRecorder.Warningf("StatusNotFound", "Unable to determine current operator status for %s", c.clusterOperatorName) + c.eventRecorder.Warningf("StatusNotFound", "Unable to determine current operator status for clusteroperator/%s", c.clusterOperatorName) if err := c.clusterOperatorClient.ClusterOperators().Delete(c.clusterOperatorName, nil); err != nil && !apierrors.IsNotFound(err) { return err } @@ -98,7 +99,7 @@ func (c StatusSyncer) sync() error { originalClusterOperatorObj, err := c.clusterOperatorLister.Get(c.clusterOperatorName) if err != nil && !apierrors.IsNotFound(err) { - c.eventRecorder.Warningf("StatusFailed", "Unable to get current operator status for %s: %v", c.clusterOperatorName, err) + c.eventRecorder.Warningf("StatusFailed", "Unable to get current operator status for clusteroperator/%s: %v", c.clusterOperatorName, err) return err } @@ -149,7 +150,11 @@ func (c StatusSyncer) sync() error { // TODO work out removal. We don't always know the existing value, so removing early seems like a bad idea. Perhaps a remove flag. versions := c.versionGetter.GetVersions() for operand, version := range versions { - operatorv1helpers.SetOperandVersion(&clusterOperatorObj.Status.Versions, configv1.OperandVersion{Name: operand, Version: version}) + previousVersion := operatorv1helpers.SetOperandVersion(&clusterOperatorObj.Status.Versions, configv1.OperandVersion{Name: operand, Version: version}) + if previousVersion != version { + // having this message will give us a marker in events when the operator updated compared to when the operand is updated + c.eventRecorder.Eventf("OperatorVersionChanged", "clusteroperator/%s version %q changed from %q to %q", c.clusterOperatorName, operand, previousVersion, version) + } } // if we have no diff, just return @@ -161,7 +166,7 @@ func (c StatusSyncer) sync() error { if _, updateErr := c.clusterOperatorClient.ClusterOperators().UpdateStatus(clusterOperatorObj); err != nil { return updateErr } - c.eventRecorder.Eventf("OperatorStatusChanged", "Status for operator %s changed: %s", c.clusterOperatorName, configv1helpers.GetStatusDiff(originalClusterOperatorObj.Status, clusterOperatorObj.Status)) + c.eventRecorder.Eventf("OperatorStatusChanged", "Status for clusteroperator/%s changed: %s", c.clusterOperatorName, configv1helpers.GetStatusDiff(originalClusterOperatorObj.Status, clusterOperatorObj.Status)) return nil } @@ -181,7 +186,7 @@ func (c *StatusSyncer) Run(workers int, stopCh <-chan struct{}) { klog.Infof("Starting StatusSyncer-" + c.clusterOperatorName) defer klog.Infof("Shutting down StatusSyncer-" + c.clusterOperatorName) - if !cache.WaitForCacheSync(stopCh, c.clusterOperatorSynced) { + if !cache.WaitForCacheSync(stopCh, c.cachesToSync...) { return } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/status/version.go b/vendor/github.com/openshift/library-go/pkg/operator/status/version.go index 5543a602d2..3f3fcec949 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/status/version.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/status/version.go @@ -18,7 +18,8 @@ type versionGetter struct { } const ( - operandImageVersionEnvVarName = "OPERAND_IMAGE_VERSION" + operandImageVersionEnvVarName = "OPERAND_IMAGE_VERSION" + operatorImageVersionEnvVarName = "OPERATOR_IMAGE_VERSION" ) func NewVersionGetter() VersionGetter { @@ -66,6 +67,10 @@ func VersionForOperandFromEnv() string { return os.Getenv(operandImageVersionEnvVarName) } +func VersionForOperatorFromEnv() string { + return os.Getenv(operatorImageVersionEnvVarName) +} + func VersionForOperand(namespace, imagePullSpec string, configMapGetter corev1client.ConfigMapsGetter, eventRecorder events.Recorder) string { versionMap := map[string]string{} versionMapping, err := configMapGetter.ConfigMaps(namespace).Get("version-mapping", metav1.GetOptions{}) diff --git a/vendor/github.com/openshift/library-go/pkg/operator/unsupportedconfigoverridescontroller/unsupportedconfigoverrides_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/unsupportedconfigoverridescontroller/unsupportedconfigoverrides_controller.go index f118b7a0a3..2f659617b2 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/unsupportedconfigoverridescontroller/unsupportedconfigoverrides_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/unsupportedconfigoverridescontroller/unsupportedconfigoverrides_controller.go @@ -30,13 +30,11 @@ const ( // UnsupportedConfigOverridesController is a controller that will copy source configmaps and secrets to their destinations. // It will also mirror deletions by deleting destinations. type UnsupportedConfigOverridesController struct { - preRunCachesSynced []cache.InformerSynced - - // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface - operatorClient v1helpers.OperatorClient - eventRecorder events.Recorder + + cachesToSync []cache.InformerSynced + queue workqueue.RateLimitingInterface + eventRecorder events.Recorder } // NewUnsupportedConfigOverridesController creates UnsupportedConfigOverridesController. @@ -46,16 +44,15 @@ func NewUnsupportedConfigOverridesController( ) *UnsupportedConfigOverridesController { c := &UnsupportedConfigOverridesController{ operatorClient: operatorClient, - eventRecorder: eventRecorder.WithComponentSuffix("unsupported-config-overrides-controller"), - preRunCachesSynced: []cache.InformerSynced{ - operatorClient.Informer().HasSynced, - }, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "UnsupportedConfigOverridesController"), + queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "UnsupportedConfigOverridesController"), + eventRecorder: eventRecorder.WithComponentSuffix("unsupported-config-overrides-controller"), } operatorClient.Informer().AddEventHandler(c.eventHandler()) + c.cachesToSync = append(c.cachesToSync, operatorClient.Informer().HasSynced) + return c } @@ -153,7 +150,7 @@ func (c *UnsupportedConfigOverridesController) Run(workers int, stopCh <-chan st klog.Infof("Starting UnsupportedConfigOverridesController") defer klog.Infof("Shutting down UnsupportedConfigOverridesController") - if !cache.WaitForCacheSync(stopCh, c.preRunCachesSynced...) { + if !cache.WaitForCacheSync(stopCh, c.cachesToSync...) { return } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/helpers.go b/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/helpers.go index 2755b640c0..0c0d62da0a 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/helpers.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/helpers.go @@ -1,36 +1,34 @@ package v1helpers import ( - "fmt" "strings" "time" - "github.com/ghodss/yaml" - "k8s.io/apimachinery/pkg/api/equality" - "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" utilerrors "k8s.io/apimachinery/pkg/util/errors" - "k8s.io/client-go/dynamic" "k8s.io/client-go/util/retry" configv1 "github.com/openshift/api/config/v1" operatorv1 "github.com/openshift/api/operator/v1" ) -func SetOperandVersion(versions *[]configv1.OperandVersion, operandVersion configv1.OperandVersion) { +// SetOperandVersion sets the new version and returns the previous value. +func SetOperandVersion(versions *[]configv1.OperandVersion, operandVersion configv1.OperandVersion) string { if versions == nil { versions = &[]configv1.OperandVersion{} } existingVersion := FindOperandVersion(*versions, operandVersion.Name) if existingVersion == nil { *versions = append(*versions, operandVersion) - return + return "" } + + previous := existingVersion.Version existingVersion.Version = operandVersion.Version + return previous } func FindOperandVersion(versions []configv1.OperandVersion, name string) *configv1.OperandVersion { @@ -106,33 +104,6 @@ func IsOperatorConditionPresentAndEqual(conditions []operatorv1.OperatorConditio return false } -func EnsureOperatorConfigExists(client dynamic.Interface, operatorConfigBytes []byte, gvr schema.GroupVersionResource) { - configJson, err := yaml.YAMLToJSON(operatorConfigBytes) - if err != nil { - panic(err) - } - operatorConfigObj, err := runtime.Decode(unstructured.UnstructuredJSONScheme, configJson) - if err != nil { - panic(err) - } - - requiredOperatorConfig, ok := operatorConfigObj.(*unstructured.Unstructured) - if !ok { - panic(fmt.Sprintf("unexpected object in %t", operatorConfigObj)) - } - - _, err = client.Resource(gvr).Get(requiredOperatorConfig.GetName(), metav1.GetOptions{}) - if errors.IsNotFound(err) { - if _, err := client.Resource(gvr).Create(requiredOperatorConfig, metav1.CreateOptions{}); err != nil { - panic(err) - } - return - } - if err != nil { - panic(err) - } -} - // UpdateOperatorSpecFunc is a func that mutates an operator spec. type UpdateOperatorSpecFunc func(spec *operatorv1.OperatorSpec) error @@ -194,6 +165,8 @@ func UpdateStatus(client OperatorClient, updateFuncs ...UpdateStatusFunc) (*oper } if equality.Semantic.DeepEqual(oldStatus, newStatus) { + // We return the newStatus which is a deep copy of oldStatus but with all update funcs applied. + updatedOperatorStatus = newStatus return nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/interfaces.go b/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/interfaces.go index 2bb7cc6359..4afb23a612 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/interfaces.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/interfaces.go @@ -9,9 +9,9 @@ type OperatorClient interface { Informer() cache.SharedIndexInformer // GetOperatorState returns the operator spec, status and the resource version, potentially from a lister. GetOperatorState() (spec *operatorv1.OperatorSpec, status *operatorv1.OperatorStatus, resourceVersion string, err error) - // UpdateOperatorSpec updates the spec of the operator, assuming the given resource verison. + // UpdateOperatorSpec updates the spec of the operator, assuming the given resource version. UpdateOperatorSpec(oldResourceVersion string, in *operatorv1.OperatorSpec) (out *operatorv1.OperatorSpec, newResourceVersion string, err error) - // UpdateOperatorStatus updates the status of the operator, assuming the given resource verison. + // UpdateOperatorStatus updates the status of the operator, assuming the given resource version. UpdateOperatorStatus(oldResourceVersion string, in *operatorv1.OperatorStatus) (out *operatorv1.OperatorStatus, err error) } @@ -25,4 +25,6 @@ type StaticPodOperatorClient interface { GetStaticPodOperatorStateWithQuorum() (spec *operatorv1.StaticPodOperatorSpec, status *operatorv1.StaticPodOperatorStatus, resourceVersion string, err error) // UpdateStaticPodOperatorStatus updates the status, assuming the given resource version. UpdateStaticPodOperatorStatus(resourceVersion string, in *operatorv1.StaticPodOperatorStatus) (out *operatorv1.StaticPodOperatorStatus, err error) + // UpdateStaticPodOperatorSpec updates the spec, assuming the given resource version. + UpdateStaticPodOperatorSpec(resourceVersion string, in *operatorv1.StaticPodOperatorSpec) (out *operatorv1.StaticPodOperatorSpec, newResourceVersion string, err error) } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/test_helpers.go b/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/test_helpers.go index 1669c5a18c..014585c551 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/test_helpers.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/test_helpers.go @@ -61,12 +61,14 @@ func (fakeSharedIndexInformer) GetIndexer() cache.Indexer { // NewFakeStaticPodOperatorClient returns a fake operator client suitable to use in static pod controller unit tests. func NewFakeStaticPodOperatorClient( staticPodSpec *operatorv1.StaticPodOperatorSpec, staticPodStatus *operatorv1.StaticPodOperatorStatus, - triggerErr func(rv string, status *operatorv1.StaticPodOperatorStatus) error) StaticPodOperatorClient { + triggerStatusErr func(rv string, status *operatorv1.StaticPodOperatorStatus) error, + triggerSpecErr func(rv string, spec *operatorv1.StaticPodOperatorSpec) error) StaticPodOperatorClient { return &fakeStaticPodOperatorClient{ fakeStaticPodOperatorSpec: staticPodSpec, fakeStaticPodOperatorStatus: staticPodStatus, resourceVersion: "0", - triggerStatusUpdateError: triggerErr, + triggerStatusUpdateError: triggerStatusErr, + triggerSpecUpdateError: triggerSpecErr, } } @@ -76,6 +78,7 @@ type fakeStaticPodOperatorClient struct { fakeStaticPodOperatorStatus *operatorv1.StaticPodOperatorStatus resourceVersion string triggerStatusUpdateError func(rv string, status *operatorv1.StaticPodOperatorStatus) error + triggerSpecUpdateError func(rv string, status *operatorv1.StaticPodOperatorSpec) error } func (c *fakeStaticPodOperatorClient) Informer() cache.SharedIndexInformer { @@ -108,6 +111,24 @@ func (c *fakeStaticPodOperatorClient) UpdateStaticPodOperatorStatus(resourceVers return c.fakeStaticPodOperatorStatus, nil } +func (c *fakeStaticPodOperatorClient) UpdateStaticPodOperatorSpec(resourceVersion string, spec *operatorv1.StaticPodOperatorSpec) (*operatorv1.StaticPodOperatorSpec, string, error) { + if c.resourceVersion != resourceVersion { + return nil, "", errors.NewConflict(schema.GroupResource{Group: operatorv1.GroupName, Resource: "TestOperatorConfig"}, "instance", fmt.Errorf("invalid resourceVersion")) + } + rv, err := strconv.Atoi(resourceVersion) + if err != nil { + return nil, "", err + } + c.resourceVersion = strconv.Itoa(rv + 1) + if c.triggerSpecUpdateError != nil { + if err := c.triggerSpecUpdateError(resourceVersion, spec); err != nil { + return nil, "", err + } + } + c.fakeStaticPodOperatorSpec = spec + return c.fakeStaticPodOperatorSpec, c.resourceVersion, nil +} + func (c *fakeStaticPodOperatorClient) GetOperatorState() (*operatorv1.OperatorSpec, *operatorv1.OperatorStatus, string, error) { return &c.fakeStaticPodOperatorSpec.OperatorSpec, &c.fakeStaticPodOperatorStatus.OperatorStatus, "", nil } diff --git a/vendor/github.com/spf13/cobra/.circleci/config.yml b/vendor/github.com/spf13/cobra/.circleci/config.yml index 819446439a..136e17f0ee 100644 --- a/vendor/github.com/spf13/cobra/.circleci/config.yml +++ b/vendor/github.com/spf13/cobra/.circleci/config.yml @@ -1,53 +1,38 @@ +workflows: + version: 2 + main: + jobs: + - go-current + - go-previous + - go-latest +base: &base + working_directory: /go/src/github.com/spf13/cobra + steps: + - checkout + - run: + name: "All Commands" + command: | + mkdir -p bin + curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.3/shellcheck + chmod +x bin/shellcheck + go get -t -v ./... + PATH=$PATH:$PWD/bin go test -v ./... + go build + diff -u <(echo -n) <(gofmt -d -s .) + if [ -z $NOVET ]; then + diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint'); + fi version: 2 - -references: - workspace: &workspace - /go/src/github.com/spf13/cobra - - run_tests: &run_tests - run: - name: "All Commands" - command: | - mkdir -p bin - curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.6/shellcheck - chmod +x bin/shellcheck - go get -t -v ./... - PATH=$PATH:$PWD/bin go test -v ./... - go build - if [ -z $NOVET ]; then - diff -u <(echo -n) <(go vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint'); - fi - jobs: go-current: docker: - - image: circleci/golang:1.12 - working_directory: *workspace - steps: - - checkout - - *run_tests - - run: - name: "Check formatting" - command: diff -u <(echo -n) <(gofmt -d -s .) + - image: circleci/golang:1.8.3 + <<: *base go-previous: docker: - - image: circleci/golang:1.11 - working_directory: *workspace - steps: - - checkout - - *run_tests + - image: circleci/golang:1.7.6 + <<: *base go-latest: docker: - image: circleci/golang:latest - working_directory: *workspace - steps: - - checkout - - *run_tests - -workflows: - version: 2 - main: - jobs: - - go-current - - go-previous - - go-latest + <<: *base diff --git a/vendor/github.com/spf13/cobra/.travis.yml b/vendor/github.com/spf13/cobra/.travis.yml index 38b85f499c..68efa13633 100644 --- a/vendor/github.com/spf13/cobra/.travis.yml +++ b/vendor/github.com/spf13/cobra/.travis.yml @@ -1,31 +1,21 @@ language: go -stages: - - diff - - test - -go: - - 1.10.x - - 1.11.x - - 1.12.x - - tip - matrix: + include: + - go: 1.7.6 + - go: 1.8.3 + - go: tip allow_failures: - go: tip - include: - - stage: diff - go: 1.12.x - script: diff -u <(echo -n) <(gofmt -d -s .) before_install: - mkdir -p bin - - curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.6.0/shellcheck + - curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.3/shellcheck - chmod +x bin/shellcheck - - go get -u github.com/kyoh86/richgo script: - - PATH=$PATH:$PWD/bin richgo test -v ./... + - PATH=$PATH:$PWD/bin go test -v ./... - go build + - diff -u <(echo -n) <(gofmt -d -s .) - if [ -z $NOVET ]; then - diff -u <(echo -n) <(go vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint'); + diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint'); fi diff --git a/vendor/github.com/spf13/cobra/README.md b/vendor/github.com/spf13/cobra/README.md index ff16e3f60d..851fcc087c 100644 --- a/vendor/github.com/spf13/cobra/README.md +++ b/vendor/github.com/spf13/cobra/README.md @@ -2,28 +2,25 @@ Cobra is both a library for creating powerful modern CLI applications as well as a program to generate applications and command files. -Many of the most widely used Go projects are built using Cobra, such as: -[Kubernetes](http://kubernetes.io/), -[Hugo](http://gohugo.io), -[rkt](https://github.com/coreos/rkt), -[etcd](https://github.com/coreos/etcd), -[Moby (former Docker)](https://github.com/moby/moby), -[Docker (distribution)](https://github.com/docker/distribution), -[OpenShift](https://www.openshift.com/), -[Delve](https://github.com/derekparker/delve), -[GopherJS](http://www.gopherjs.org/), -[CockroachDB](http://www.cockroachlabs.com/), -[Bleve](http://www.blevesearch.com/), -[ProjectAtomic (enterprise)](http://www.projectatomic.io/), -[Giant Swarm's gsctl](https://github.com/giantswarm/gsctl), -[Nanobox](https://github.com/nanobox-io/nanobox)/[Nanopack](https://github.com/nanopack), -[rclone](http://rclone.org/), -[nehm](https://github.com/bogem/nehm), -[Pouch](https://github.com/alibaba/pouch), -[Istio](https://istio.io), -[Prototool](https://github.com/uber/prototool), -[mattermost-server](https://github.com/mattermost/mattermost-server), -etc. +Many of the most widely used Go projects are built using Cobra including: + +* [Kubernetes](http://kubernetes.io/) +* [Hugo](http://gohugo.io) +* [rkt](https://github.com/coreos/rkt) +* [etcd](https://github.com/coreos/etcd) +* [Moby (former Docker)](https://github.com/moby/moby) +* [Docker (distribution)](https://github.com/docker/distribution) +* [OpenShift](https://www.openshift.com/) +* [Delve](https://github.com/derekparker/delve) +* [GopherJS](http://www.gopherjs.org/) +* [CockroachDB](http://www.cockroachlabs.com/) +* [Bleve](http://www.blevesearch.com/) +* [ProjectAtomic (enterprise)](http://www.projectatomic.io/) +* [GiantSwarm's swarm](https://github.com/giantswarm/cli) +* [Nanobox](https://github.com/nanobox-io/nanobox)/[Nanopack](https://github.com/nanopack) +* [rclone](http://rclone.org/) +* [nehm](https://github.com/bogem/nehm) +* [Pouch](https://github.com/alibaba/pouch) [![Build Status](https://travis-ci.org/spf13/cobra.svg "Travis CI status")](https://travis-ci.org/spf13/cobra) [![CircleCI status](https://circleci.com/gh/spf13/cobra.png?circle-token=:circle-token "CircleCI status")](https://circleci.com/gh/spf13/cobra) @@ -155,6 +152,9 @@ In a Cobra app, typically the main.go file is very bare. It serves one purpose: package main import ( + "fmt" + "os" + "{pathToYourApp}/cmd" ) @@ -265,6 +265,9 @@ In a Cobra app, typically the main.go file is very bare. It serves, one purpose, package main import ( + "fmt" + "os" + "{pathToYourApp}/cmd" ) @@ -392,7 +395,6 @@ The following validators are built in: - `MinimumNArgs(int)` - the command will report an error if there are not at least N positional args. - `MaximumNArgs(int)` - the command will report an error if there are more than N positional args. - `ExactArgs(int)` - the command will report an error if there are not exactly N positional args. -- `ExactValidArgs(int)` - the command will report an error if there are not exactly N positional args OR if there are any positional args that are not in the `ValidArgs` field of `Command` - `RangeArgs(min, max)` - the command will report an error if the number of args is not between the minimum and maximum number of expected args. An example of setting the custom validator: @@ -402,7 +404,7 @@ var cmd = &cobra.Command{ Short: "hello", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { - return errors.New("requires a color argument") + return errors.New("requires at least one arg") } if myapp.IsValidColor(args[0]) { return nil @@ -462,7 +464,7 @@ Echo works a lot like print, except it has a child command.`, } var cmdTimes = &cobra.Command{ - Use: "times [string to echo]", + Use: "times [# times] [string to echo]", Short: "Echo anything to the screen more times", Long: `echo things multiple times back to the user by providing a count and a string.`, diff --git a/vendor/github.com/spf13/cobra/args.go b/vendor/github.com/spf13/cobra/args.go index c4d820b853..a5d8a9273e 100644 --- a/vendor/github.com/spf13/cobra/args.go +++ b/vendor/github.com/spf13/cobra/args.go @@ -78,18 +78,6 @@ func ExactArgs(n int) PositionalArgs { } } -// ExactValidArgs returns an error if -// there are not exactly N positional args OR -// there are any positional args that are not in the `ValidArgs` field of `Command` -func ExactValidArgs(n int) PositionalArgs { - return func(cmd *Command, args []string) error { - if err := ExactArgs(n)(cmd, args); err != nil { - return err - } - return OnlyValidArgs(cmd, args) - } -} - // RangeArgs returns an error if the number of args is not within the expected range. func RangeArgs(min int, max int) PositionalArgs { return func(cmd *Command, args []string) error { diff --git a/vendor/github.com/spf13/cobra/args_test.go b/vendor/github.com/spf13/cobra/args_test.go index c81b212ece..d797b6f587 100644 --- a/vendor/github.com/spf13/cobra/args_test.go +++ b/vendor/github.com/spf13/cobra/args_test.go @@ -158,52 +158,6 @@ func TestExactArgsWithInvalidCount(t *testing.T) { } } -func TestExactValidArgs(t *testing.T) { - c := &Command{Use: "c", Args: ExactValidArgs(3), ValidArgs: []string{"a", "b", "c"}, Run: emptyRun} - output, err := executeCommand(c, "a", "b", "c") - if output != "" { - t.Errorf("Unexpected output: %v", output) - } - if err != nil { - t.Errorf("Unexpected error: %v", err) - } -} - -func TestExactValidArgsWithInvalidCount(t *testing.T) { - c := &Command{Use: "c", Args: ExactValidArgs(2), Run: emptyRun} - _, err := executeCommand(c, "a", "b", "c") - - if err == nil { - t.Fatal("Expected an error") - } - - got := err.Error() - expected := "accepts 2 arg(s), received 3" - if got != expected { - t.Fatalf("Expected %q, got %q", expected, got) - } -} - -func TestExactValidArgsWithInvalidArgs(t *testing.T) { - c := &Command{ - Use: "c", - Args: ExactValidArgs(1), - ValidArgs: []string{"one", "two"}, - Run: emptyRun, - } - - _, err := executeCommand(c, "three") - if err == nil { - t.Fatal("Expected an error") - } - - got := err.Error() - expected := `invalid argument "three" for "c"` - if got != expected { - t.Errorf("Expected: %q, got: %q", expected, got) - } -} - func TestRangeArgs(t *testing.T) { c := &Command{Use: "c", Args: RangeArgs(2, 4), Run: emptyRun} output, err := executeCommand(c, "a", "b", "c") diff --git a/vendor/github.com/spf13/cobra/bash_completions.go b/vendor/github.com/spf13/cobra/bash_completions.go index c3c1e50188..291eae7d8e 100644 --- a/vendor/github.com/spf13/cobra/bash_completions.go +++ b/vendor/github.com/spf13/cobra/bash_completions.go @@ -129,13 +129,7 @@ __%[1]s_handle_reply() fi if [[ ${#COMPREPLY[@]} -eq 0 ]]; then - if declare -F __%[1]s_custom_func >/dev/null; then - # try command name qualified custom func - __%[1]s_custom_func - else - # otherwise fall back to unqualified for compatibility - declare -F __custom_func >/dev/null && __custom_func - fi + declare -F __custom_func >/dev/null && __custom_func fi # available in bash-completion >= 2, not always present on macOS @@ -199,8 +193,7 @@ __%[1]s_handle_flag() fi # skip the argument to a two word flag - if [[ ${words[c]} != *"="* ]] && __%[1]s_contains_word "${words[c]}" "${two_word_flags[@]}"; then - __%[1]s_debug "${FUNCNAME[0]}: found a flag ${words[c]}, skip the next argument" + if __%[1]s_contains_word "${words[c]}" "${two_word_flags[@]}"; then c=$((c+1)) # if we are looking for a flags value, don't show commands if [[ $c -eq $cword ]]; then @@ -258,14 +251,6 @@ __%[1]s_handle_word() __%[1]s_handle_command elif [[ $c -eq 0 ]]; then __%[1]s_handle_command - elif __%[1]s_contains_word "${words[c]}" "${command_aliases[@]}"; then - # aliashash variable is an associative array which is only supported in bash > 3. - if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then - words[c]=${aliashash[${words[c]}]} - __%[1]s_handle_command - else - __%[1]s_handle_noun - fi else __%[1]s_handle_noun fi @@ -281,7 +266,6 @@ func writePostscript(buf *bytes.Buffer, name string) { buf.WriteString(fmt.Sprintf(`{ local cur prev words cword declare -A flaghash 2>/dev/null || : - declare -A aliashash 2>/dev/null || : if declare -F _init_completion >/dev/null 2>&1; then _init_completion -s || return else @@ -321,7 +305,6 @@ func writeCommands(buf *bytes.Buffer, cmd *Command) { continue } buf.WriteString(fmt.Sprintf(" commands+=(%q)\n", c.Name())) - writeCmdAliases(buf, c) } buf.WriteString("\n") } @@ -380,10 +363,6 @@ func writeFlag(buf *bytes.Buffer, flag *pflag.Flag, cmd *Command) { } format += "\")\n" buf.WriteString(fmt.Sprintf(format, name)) - if len(flag.NoOptDefVal) == 0 { - format = " two_word_flags+=(\"--%s\")\n" - buf.WriteString(fmt.Sprintf(format, name)) - } writeFlagHandler(buf, "--"+name, flag.Annotations, cmd) } @@ -464,21 +443,6 @@ func writeRequiredNouns(buf *bytes.Buffer, cmd *Command) { } } -func writeCmdAliases(buf *bytes.Buffer, cmd *Command) { - if len(cmd.Aliases) == 0 { - return - } - - sort.Sort(sort.StringSlice(cmd.Aliases)) - - buf.WriteString(fmt.Sprint(` if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then`, "\n")) - for _, value := range cmd.Aliases { - buf.WriteString(fmt.Sprintf(" command_aliases+=(%q)\n", value)) - buf.WriteString(fmt.Sprintf(" aliashash[%q]=%q\n", value, cmd.Name())) - } - buf.WriteString(` fi`) - buf.WriteString("\n") -} func writeArgAliases(buf *bytes.Buffer, cmd *Command) { buf.WriteString(" noun_aliases=()\n") sort.Sort(sort.StringSlice(cmd.ArgAliases)) @@ -505,10 +469,6 @@ func gen(buf *bytes.Buffer, cmd *Command) { } buf.WriteString(fmt.Sprintf(" last_command=%q\n", commandName)) - buf.WriteString("\n") - buf.WriteString(" command_aliases=()\n") - buf.WriteString("\n") - writeCommands(buf, cmd) writeFlags(buf, cmd) writeRequiredFlag(buf, cmd) diff --git a/vendor/github.com/spf13/cobra/bash_completions.md b/vendor/github.com/spf13/cobra/bash_completions.md index 4ac61ee132..8d01f456f8 100644 --- a/vendor/github.com/spf13/cobra/bash_completions.md +++ b/vendor/github.com/spf13/cobra/bash_completions.md @@ -1,40 +1,5 @@ # Generating Bash Completions For Your Own cobra.Command -If you are using the generator you can create a completion command by running - -```bash -cobra add completion -``` - -Update the help text show how to install the bash_completion Linux show here [Kubectl docs show mac options](https://kubernetes.io/docs/tasks/tools/install-kubectl/#enabling-shell-autocompletion) - -Writing the shell script to stdout allows the most flexible use. - -```go -// completionCmd represents the completion command -var completionCmd = &cobra.Command{ - Use: "completion", - Short: "Generates bash completion scripts", - Long: `To load completion run - -. <(bitbucket completion) - -To configure your bash shell to load completions for each session add to your bashrc - -# ~/.bashrc or ~/.profile -. <(bitbucket completion) -`, - Run: func(cmd *cobra.Command, args []string) { - rootCmd.GenBashCompletion(os.Stdout); - }, -} -``` - -**Note:** The cobra generator may include messages printed to stdout for example if the config file is loaded, this will break the auto complete script - - -## Example from kubectl - Generating bash completions from a cobra command is incredibly easy. An actual program which does so for the kubernetes kubectl binary is as follows: ```go @@ -82,7 +47,7 @@ __kubectl_get_resource() fi } -__kubectl_custom_func() { +__custom_func() { case ${last_command} in kubectl_get | kubectl_describe | kubectl_delete | kubectl_stop) __kubectl_get_resource @@ -109,7 +74,7 @@ Find more information at https://github.com/GoogleCloudPlatform/kubernetes.`, } ``` -The `BashCompletionFunction` option is really only valid/useful on the root command. Doing the above will cause `__kubectl_custom_func()` (`___custom_func()`) to be called when the built in processor was unable to find a solution. In the case of kubernetes a valid command might look something like `kubectl get pod [mypod]`. If you type `kubectl get pod [tab][tab]` the `__kubectl_customc_func()` will run because the cobra.Command only understood "kubectl" and "get." `__kubectl_custom_func()` will see that the cobra.Command is "kubectl_get" and will thus call another helper `__kubectl_get_resource()`. `__kubectl_get_resource` will look at the 'nouns' collected. In our example the only noun will be `pod`. So it will call `__kubectl_parse_get pod`. `__kubectl_parse_get` will actually call out to kubernetes and get any pods. It will then set `COMPREPLY` to valid pods! +The `BashCompletionFunction` option is really only valid/useful on the root command. Doing the above will cause `__custom_func()` to be called when the built in processor was unable to find a solution. In the case of kubernetes a valid command might look something like `kubectl get pod [mypod]`. If you type `kubectl get pod [tab][tab]` the `__customc_func()` will run because the cobra.Command only understood "kubectl" and "get." `__custom_func()` will see that the cobra.Command is "kubectl_get" and will thus call another helper `__kubectl_get_resource()`. `__kubectl_get_resource` will look at the 'nouns' collected. In our example the only noun will be `pod`. So it will call `__kubectl_parse_get pod`. `__kubectl_parse_get` will actually call out to kubernetes and get any pods. It will then set `COMPREPLY` to valid pods! ## Have the completions code complete your 'nouns' @@ -216,7 +181,7 @@ a custom flag completion function with cobra.BashCompCustom: ```go annotation := make(map[string][]string) - annotation[cobra.BashCompCustom] = []string{"__kubectl_get_namespaces"} + annotation[cobra.BashCompFilenameExt] = []string{"__kubectl_get_namespaces"} flag := &pflag.Flag{ Name: "namespace", diff --git a/vendor/github.com/spf13/cobra/bash_completions_test.go b/vendor/github.com/spf13/cobra/bash_completions_test.go index eefa3de077..02a4f15baa 100644 --- a/vendor/github.com/spf13/cobra/bash_completions_test.go +++ b/vendor/github.com/spf13/cobra/bash_completions_test.go @@ -22,13 +22,6 @@ func check(t *testing.T, found, expected string) { } } -func checkNumOccurrences(t *testing.T, found, expected string, expectedOccurrences int) { - numOccurrences := strings.Count(found, expected) - if numOccurrences != expectedOccurrences { - t.Errorf("Expecting to contain %d occurrences of: \n %q\nGot %d:\n %q\n", expectedOccurrences, expected, numOccurrences, found) - } -} - func checkRegex(t *testing.T, found, pattern string) { matched, err := regexp.MatchString(pattern, found) if err != nil { @@ -60,7 +53,7 @@ func runShellCheck(s string) error { } // World worst custom function, just keep telling you to enter hello! -const bashCompletionFunc = `__root_custom_func() { +const bashCompletionFunc = `__custom_func() { COMPREPLY=( "hello" ) } ` @@ -71,7 +64,7 @@ func TestBashCompletions(t *testing.T) { ArgAliases: []string{"pods", "nodes", "services", "replicationcontrollers", "po", "no", "svc", "rc"}, ValidArgs: []string{"pod", "node", "service", "replicationcontroller"}, BashCompletionFunction: bashCompletionFunc, - Run: emptyRun, + Run: emptyRun, } rootCmd.Flags().IntP("introot", "i", -1, "help message for flag introot") rootCmd.MarkFlagRequired("introot") @@ -95,10 +88,6 @@ func TestBashCompletions(t *testing.T) { rootCmd.Flags().String("theme", "", "theme to use (located in /themes/THEMENAME/)") rootCmd.Flags().SetAnnotation("theme", BashCompSubdirsInDir, []string{"themes"}) - // For two word flags check - rootCmd.Flags().StringP("two", "t", "", "this is two word flags") - rootCmd.Flags().BoolP("two-w-default", "T", false, "this is not two word flags") - echoCmd := &Command{ Use: "echo [string to echo]", Aliases: []string{"say"}, @@ -161,10 +150,7 @@ func TestBashCompletions(t *testing.T) { // check for required flags check(t, output, `must_have_one_flag+=("--introot=")`) check(t, output, `must_have_one_flag+=("--persistent-filename=")`) - // check for custom completion function with both qualified and unqualified name - checkNumOccurrences(t, output, `__custom_func`, 2) // 1. check existence, 2. invoke - checkNumOccurrences(t, output, `__root_custom_func`, 3) // 1. check existence, 2. invoke, 3. actual definition - // check for custom completion function body + // check for custom completion function check(t, output, `COMPREPLY=( "hello" )`) // check for required nouns check(t, output, `must_have_one_noun+=("pod")`) @@ -187,12 +173,6 @@ func TestBashCompletions(t *testing.T) { // check for subdirs_in_dir flags in a subcommand checkRegex(t, output, fmt.Sprintf(`_root_echo\(\)\n{[^}]*flags_completion\+=\("__%s_handle_subdirs_in_dir_flag config"\)`, rootCmd.Name())) - // check two word flags - check(t, output, `two_word_flags+=("--two")`) - check(t, output, `two_word_flags+=("-t")`) - checkOmit(t, output, `two_word_flags+=("--two-w-default")`) - checkOmit(t, output, `two_word_flags+=("-T")`) - checkOmit(t, output, deprecatedCmd.Name()) // If available, run shellcheck against the script. diff --git a/vendor/github.com/spf13/cobra/cobra.go b/vendor/github.com/spf13/cobra/cobra.go index 6505c070b4..7010fd15b7 100644 --- a/vendor/github.com/spf13/cobra/cobra.go +++ b/vendor/github.com/spf13/cobra/cobra.go @@ -23,7 +23,6 @@ import ( "strconv" "strings" "text/template" - "time" "unicode" ) @@ -57,12 +56,6 @@ var MousetrapHelpText string = `This is a command line tool. You need to open cmd.exe and run it from there. ` -// MousetrapDisplayDuration controls how long the MousetrapHelpText message is displayed on Windows -// if the CLI is started from explorer.exe. Set to 0 to wait for the return key to be pressed. -// To disable the mousetrap, just set MousetrapHelpText to blank string (""). -// Works only on Microsoft Windows. -var MousetrapDisplayDuration time.Duration = 5 * time.Second - // AddTemplateFunc adds a template function that's available to Usage and Help // template generation. func AddTemplateFunc(name string, tmplFunc interface{}) { diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/golden_test.go b/vendor/github.com/spf13/cobra/cobra/cmd/golden_test.go index 9010caa13a..59a5a1c9f9 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/golden_test.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/golden_test.go @@ -17,11 +17,6 @@ func init() { initCmd.SetOutput(new(bytes.Buffer)) } -// ensureLF converts any \r\n to \n -func ensureLF(content []byte) []byte { - return bytes.Replace(content, []byte("\r\n"), []byte("\n"), -1) -} - // compareFiles compares the content of files with pathA and pathB. // If contents are equal, it returns nil. // If not, it returns which files are not equal @@ -35,7 +30,7 @@ func compareFiles(pathA, pathB string) error { if err != nil { return err } - if !bytes.Equal(ensureLF(contentA), ensureLF(contentB)) { + if !bytes.Equal(contentA, contentB) { output := new(bytes.Buffer) output.WriteString(fmt.Sprintf("%q and %q are not equal!\n\n", pathA, pathB)) diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/init.go b/vendor/github.com/spf13/cobra/cobra/cmd/init.go index d65e6c8c59..2441370152 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/init.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/init.go @@ -65,7 +65,7 @@ Init will not use an existing directory with contents.`, initializeProject(project) fmt.Fprintln(cmd.OutOrStdout(), `Your Cobra application is ready at -`+project.AbsPath()+` +`+project.AbsPath()+`. Give it a try by going there and running `+"`go run main.go`."+` Add commands to it by running `+"`cobra add [cmdname]`.") diff --git a/vendor/github.com/spf13/cobra/command.go b/vendor/github.com/spf13/cobra/command.go index b257f91b6f..15b8112795 100644 --- a/vendor/github.com/spf13/cobra/command.go +++ b/vendor/github.com/spf13/cobra/command.go @@ -27,9 +27,6 @@ import ( flag "github.com/spf13/pflag" ) -// FParseErrWhitelist configures Flag parse errors to be ignored -type FParseErrWhitelist flag.ParseErrorsWhitelist - // Command is just that, a command for your application. // E.g. 'go run ...' - 'run' is the command. Cobra requires // you to define the usage and description as part of your command @@ -140,9 +137,6 @@ type Command struct { // TraverseChildren parses flags on all parents before executing child command. TraverseChildren bool - //FParseErrWhitelist flag parse errors to be ignored - FParseErrWhitelist FParseErrWhitelist - // commands is the list of commands supported by this program. commands []*Command // parent is a parent command for this command. @@ -817,11 +811,13 @@ func (c *Command) ExecuteC() (cmd *Command, err error) { // overriding c.InitDefaultHelpCmd() - args := c.args + var args []string // Workaround FAIL with "go test -v" or "cobra.test -test.v", see #155 if c.args == nil && filepath.Base(os.Args[0]) != "cobra.test" { args = os.Args[1:] + } else { + args = c.args } var flags []string @@ -1333,7 +1329,7 @@ func (c *Command) LocalFlags() *flag.FlagSet { return c.lflags } -// InheritedFlags returns all flags which were inherited from parent commands. +// InheritedFlags returns all flags which were inherited from parents commands. func (c *Command) InheritedFlags() *flag.FlagSet { c.mergePersistentFlags() @@ -1467,10 +1463,6 @@ func (c *Command) ParseFlags(args []string) error { } beforeErrorBufLen := c.flagErrorBuf.Len() c.mergePersistentFlags() - - //do it here after merging all flags and just before parse - c.Flags().ParseErrorsWhitelist = flag.ParseErrorsWhitelist(c.FParseErrWhitelist) - err := c.Flags().Parse(args) // Print warnings if they occurred (e.g. deprecated flag messages). if c.flagErrorBuf.Len()-beforeErrorBufLen > 0 && err == nil { diff --git a/vendor/github.com/spf13/cobra/command_test.go b/vendor/github.com/spf13/cobra/command_test.go index 6e483a3ec4..d874a9a515 100644 --- a/vendor/github.com/spf13/cobra/command_test.go +++ b/vendor/github.com/spf13/cobra/command_test.go @@ -1164,13 +1164,12 @@ func TestPersistentHooks(t *testing.T) { t.Errorf("Unexpected error: %v", err) } - // TODO: currently PersistenPreRun* defined in parent does not - // run if the matchin child subcommand has PersistenPreRun. - // If the behavior changes (https://github.com/spf13/cobra/issues/252) - // this test must be fixed. - if parentPersPreArgs != "" { - t.Errorf("Expected blank parentPersPreArgs, got %q", parentPersPreArgs) - } + // TODO: This test fails, but should not. + // Related to https://github.com/spf13/cobra/issues/252. + // + // if parentPersPreArgs != "one two" { + // t.Errorf("Expected parentPersPreArgs %q, got %q", "one two", parentPersPreArgs) + // } if parentPreArgs != "" { t.Errorf("Expected blank parentPreArgs, got %q", parentPreArgs) } @@ -1180,13 +1179,12 @@ func TestPersistentHooks(t *testing.T) { if parentPostArgs != "" { t.Errorf("Expected blank parentPostArgs, got %q", parentPostArgs) } - // TODO: currently PersistenPostRun* defined in parent does not - // run if the matchin child subcommand has PersistenPostRun. - // If the behavior changes (https://github.com/spf13/cobra/issues/252) - // this test must be fixed. - if parentPersPostArgs != "" { - t.Errorf("Expected blank parentPersPostArgs, got %q", parentPersPostArgs) - } + // TODO: This test fails, but should not. + // Related to https://github.com/spf13/cobra/issues/252. + // + // if parentPersPostArgs != "one two" { + // t.Errorf("Expected parentPersPostArgs %q, got %q", "one two", parentPersPostArgs) + // } if childPersPreArgs != "one two" { t.Errorf("Expected childPersPreArgs %q, got %q", "one two", childPersPreArgs) @@ -1628,108 +1626,3 @@ func TestCalledAs(t *testing.T) { t.Run(name, tc.test) } } - -func TestFParseErrWhitelistBackwardCompatibility(t *testing.T) { - c := &Command{Use: "c", Run: emptyRun} - c.Flags().BoolP("boola", "a", false, "a boolean flag") - - output, err := executeCommand(c, "c", "-a", "--unknown", "flag") - if err == nil { - t.Error("expected unknown flag error") - } - checkStringContains(t, output, "unknown flag: --unknown") -} - -func TestFParseErrWhitelistSameCommand(t *testing.T) { - c := &Command{ - Use: "c", - Run: emptyRun, - FParseErrWhitelist: FParseErrWhitelist{ - UnknownFlags: true, - }, - } - c.Flags().BoolP("boola", "a", false, "a boolean flag") - - _, err := executeCommand(c, "c", "-a", "--unknown", "flag") - if err != nil { - t.Error("unexpected error: ", err) - } -} - -func TestFParseErrWhitelistParentCommand(t *testing.T) { - root := &Command{ - Use: "root", - Run: emptyRun, - FParseErrWhitelist: FParseErrWhitelist{ - UnknownFlags: true, - }, - } - - c := &Command{ - Use: "child", - Run: emptyRun, - } - c.Flags().BoolP("boola", "a", false, "a boolean flag") - - root.AddCommand(c) - - output, err := executeCommand(root, "child", "-a", "--unknown", "flag") - if err == nil { - t.Error("expected unknown flag error") - } - checkStringContains(t, output, "unknown flag: --unknown") -} - -func TestFParseErrWhitelistChildCommand(t *testing.T) { - root := &Command{ - Use: "root", - Run: emptyRun, - } - - c := &Command{ - Use: "child", - Run: emptyRun, - FParseErrWhitelist: FParseErrWhitelist{ - UnknownFlags: true, - }, - } - c.Flags().BoolP("boola", "a", false, "a boolean flag") - - root.AddCommand(c) - - _, err := executeCommand(root, "child", "-a", "--unknown", "flag") - if err != nil { - t.Error("unexpected error: ", err.Error()) - } -} - -func TestFParseErrWhitelistSiblingCommand(t *testing.T) { - root := &Command{ - Use: "root", - Run: emptyRun, - } - - c := &Command{ - Use: "child", - Run: emptyRun, - FParseErrWhitelist: FParseErrWhitelist{ - UnknownFlags: true, - }, - } - c.Flags().BoolP("boola", "a", false, "a boolean flag") - - s := &Command{ - Use: "sibling", - Run: emptyRun, - } - s.Flags().BoolP("boolb", "b", false, "a boolean flag") - - root.AddCommand(c) - root.AddCommand(s) - - output, err := executeCommand(root, "sibling", "-b", "--unknown", "flag") - if err == nil { - t.Error("expected unknown flag error") - } - checkStringContains(t, output, "unknown flag: --unknown") -} diff --git a/vendor/github.com/spf13/cobra/command_win.go b/vendor/github.com/spf13/cobra/command_win.go index 8768b1736d..edec728e4f 100644 --- a/vendor/github.com/spf13/cobra/command_win.go +++ b/vendor/github.com/spf13/cobra/command_win.go @@ -3,7 +3,6 @@ package cobra import ( - "fmt" "os" "time" @@ -15,12 +14,7 @@ var preExecHookFn = preExecHook func preExecHook(c *Command) { if MousetrapHelpText != "" && mousetrap.StartedByExplorer() { c.Print(MousetrapHelpText) - if MousetrapDisplayDuration > 0 { - time.Sleep(MousetrapDisplayDuration) - } else { - c.Println("Press return to continue...") - fmt.Scanln() - } + time.Sleep(5 * time.Second) os.Exit(1) } } diff --git a/vendor/github.com/spf13/cobra/doc/man_docs.go b/vendor/github.com/spf13/cobra/doc/man_docs.go index 4a0623393f..ce92332dd1 100644 --- a/vendor/github.com/spf13/cobra/doc/man_docs.go +++ b/vendor/github.com/spf13/cobra/doc/man_docs.go @@ -20,7 +20,6 @@ import ( "os" "path/filepath" "sort" - "strconv" "strings" "time" @@ -88,7 +87,7 @@ type GenManTreeOptions struct { // GenManHeader is a lot like the .TH header at the start of man pages. These // include the title, section, date, source, and manual. We will use the -// current time if Date is unset and will use "Auto generated by spf13/cobra" +// current time if Date if unset and will use "Auto generated by spf13/cobra" // if the Source is unset. type GenManHeader struct { Title string @@ -105,16 +104,14 @@ func GenMan(cmd *cobra.Command, header *GenManHeader, w io.Writer) error { if header == nil { header = &GenManHeader{} } - if err := fillHeader(header, cmd.CommandPath()); err != nil { - return err - } + fillHeader(header, cmd.CommandPath()) b := genMan(cmd, header) _, err := w.Write(md2man.Render(b)) return err } -func fillHeader(header *GenManHeader, name string) error { +func fillHeader(header *GenManHeader, name string) { if header.Title == "" { header.Title = strings.ToUpper(strings.Replace(name, " ", "\\-", -1)) } @@ -123,20 +120,12 @@ func fillHeader(header *GenManHeader, name string) error { } if header.Date == nil { now := time.Now() - if epoch := os.Getenv("SOURCE_DATE_EPOCH"); epoch != "" { - unixEpoch, err := strconv.ParseInt(epoch, 10, 64) - if err != nil { - return fmt.Errorf("invalid SOURCE_DATE_EPOCH: %v", err) - } - now = time.Unix(unixEpoch, 0) - } header.Date = &now } header.date = (*header.Date).Format("Jan 2006") if header.Source == "" { header.Source = "Auto generated by spf13/cobra" } - return nil } func manPreamble(buf *bytes.Buffer, header *GenManHeader, cmd *cobra.Command, dashedName string) { @@ -187,13 +176,13 @@ func manPrintFlags(buf *bytes.Buffer, flags *pflag.FlagSet) { func manPrintOptions(buf *bytes.Buffer, command *cobra.Command) { flags := command.NonInheritedFlags() - if flags.HasAvailableFlags() { + if flags.HasFlags() { buf.WriteString("# OPTIONS\n") manPrintFlags(buf, flags) buf.WriteString("\n") } flags = command.InheritedFlags() - if flags.HasAvailableFlags() { + if flags.HasFlags() { buf.WriteString("# OPTIONS INHERITED FROM PARENT COMMANDS\n") manPrintFlags(buf, flags) buf.WriteString("\n") diff --git a/vendor/github.com/spf13/cobra/doc/man_docs_test.go b/vendor/github.com/spf13/cobra/doc/man_docs_test.go index 2c400f5df7..62f85e47f4 100644 --- a/vendor/github.com/spf13/cobra/doc/man_docs_test.go +++ b/vendor/github.com/spf13/cobra/doc/man_docs_test.go @@ -47,42 +47,6 @@ func TestGenManDoc(t *testing.T) { checkStringContains(t, output, translate("Auto generated")) } -func TestGenManNoHiddenParents(t *testing.T) { - header := &GenManHeader{ - Title: "Project", - Section: "2", - } - - // We generate on a subcommand so we have both subcommands and parents - for _, name := range []string{"rootflag", "strtwo"} { - f := rootCmd.PersistentFlags().Lookup(name) - f.Hidden = true - defer func() { f.Hidden = false }() - } - buf := new(bytes.Buffer) - if err := GenMan(echoCmd, header, buf); err != nil { - t.Fatal(err) - } - output := buf.String() - - // Make sure parent has - in CommandPath() in SEE ALSO: - parentPath := echoCmd.Parent().CommandPath() - dashParentPath := strings.Replace(parentPath, " ", "-", -1) - expected := translate(dashParentPath) - expected = expected + "(" + header.Section + ")" - checkStringContains(t, output, expected) - - checkStringContains(t, output, translate(echoCmd.Name())) - checkStringContains(t, output, translate(echoCmd.Name())) - checkStringContains(t, output, "boolone") - checkStringOmits(t, output, "rootflag") - checkStringContains(t, output, translate(rootCmd.Name())) - checkStringContains(t, output, translate(echoSubCmd.Name())) - checkStringOmits(t, output, translate(deprecatedCmd.Name())) - checkStringContains(t, output, translate("Auto generated")) - checkStringOmits(t, output, "OPTIONS INHERITED FROM PARENT COMMANDS") -} - func TestGenManNoGenTag(t *testing.T) { echoCmd.DisableAutoGenTag = true defer func() { echoCmd.DisableAutoGenTag = false }() diff --git a/vendor/github.com/spf13/cobra/doc/md_docs.go b/vendor/github.com/spf13/cobra/doc/md_docs.go index d76f6d5ecb..d7a2c2b629 100644 --- a/vendor/github.com/spf13/cobra/doc/md_docs.go +++ b/vendor/github.com/spf13/cobra/doc/md_docs.go @@ -29,7 +29,7 @@ import ( func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error { flags := cmd.NonInheritedFlags() flags.SetOutput(buf) - if flags.HasAvailableFlags() { + if flags.HasFlags() { buf.WriteString("### Options\n\n```\n") flags.PrintDefaults() buf.WriteString("```\n\n") @@ -37,7 +37,7 @@ func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error { parentFlags := cmd.InheritedFlags() parentFlags.SetOutput(buf) - if parentFlags.HasAvailableFlags() { + if parentFlags.HasFlags() { buf.WriteString("### Options inherited from parent commands\n\n```\n") parentFlags.PrintDefaults() buf.WriteString("```\n\n") diff --git a/vendor/github.com/spf13/cobra/doc/md_docs_test.go b/vendor/github.com/spf13/cobra/doc/md_docs_test.go index c060f32f78..b0fa68c0b9 100644 --- a/vendor/github.com/spf13/cobra/doc/md_docs_test.go +++ b/vendor/github.com/spf13/cobra/doc/md_docs_test.go @@ -25,30 +25,6 @@ func TestGenMdDoc(t *testing.T) { checkStringContains(t, output, rootCmd.Short) checkStringContains(t, output, echoSubCmd.Short) checkStringOmits(t, output, deprecatedCmd.Short) - checkStringContains(t, output, "Options inherited from parent commands") -} - -func TestGenMdNoHiddenParents(t *testing.T) { - // We generate on subcommand so we have both subcommands and parents. - for _, name := range []string{"rootflag", "strtwo"} { - f := rootCmd.PersistentFlags().Lookup(name) - f.Hidden = true - defer func() { f.Hidden = false }() - } - buf := new(bytes.Buffer) - if err := GenMarkdown(echoCmd, buf); err != nil { - t.Fatal(err) - } - output := buf.String() - - checkStringContains(t, output, echoCmd.Long) - checkStringContains(t, output, echoCmd.Example) - checkStringContains(t, output, "boolone") - checkStringOmits(t, output, "rootflag") - checkStringContains(t, output, rootCmd.Short) - checkStringContains(t, output, echoSubCmd.Short) - checkStringOmits(t, output, deprecatedCmd.Short) - checkStringOmits(t, output, "Options inherited from parent commands") } func TestGenMdNoTag(t *testing.T) { diff --git a/vendor/github.com/spf13/cobra/doc/rest_docs.go b/vendor/github.com/spf13/cobra/doc/rest_docs.go index 051d8dc832..4913e3ee2e 100644 --- a/vendor/github.com/spf13/cobra/doc/rest_docs.go +++ b/vendor/github.com/spf13/cobra/doc/rest_docs.go @@ -29,7 +29,7 @@ import ( func printOptionsReST(buf *bytes.Buffer, cmd *cobra.Command, name string) error { flags := cmd.NonInheritedFlags() flags.SetOutput(buf) - if flags.HasAvailableFlags() { + if flags.HasFlags() { buf.WriteString("Options\n") buf.WriteString("~~~~~~~\n\n::\n\n") flags.PrintDefaults() @@ -38,7 +38,7 @@ func printOptionsReST(buf *bytes.Buffer, cmd *cobra.Command, name string) error parentFlags := cmd.InheritedFlags() parentFlags.SetOutput(buf) - if parentFlags.HasAvailableFlags() { + if parentFlags.HasFlags() { buf.WriteString("Options inherited from parent commands\n") buf.WriteString("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n") parentFlags.PrintDefaults() diff --git a/vendor/github.com/spf13/cobra/doc/rest_docs_test.go b/vendor/github.com/spf13/cobra/doc/rest_docs_test.go index 330a2e5e70..aa3186e8f9 100644 --- a/vendor/github.com/spf13/cobra/doc/rest_docs_test.go +++ b/vendor/github.com/spf13/cobra/doc/rest_docs_test.go @@ -27,29 +27,6 @@ func TestGenRSTDoc(t *testing.T) { checkStringOmits(t, output, deprecatedCmd.Short) } -func TestGenRSTNoHiddenParents(t *testing.T) { - // We generate on a subcommand so we have both subcommands and parents - for _, name := range []string{"rootflag", "strtwo"} { - f := rootCmd.PersistentFlags().Lookup(name) - f.Hidden = true - defer func() { f.Hidden = false }() - } - buf := new(bytes.Buffer) - if err := GenReST(echoCmd, buf); err != nil { - t.Fatal(err) - } - output := buf.String() - - checkStringContains(t, output, echoCmd.Long) - checkStringContains(t, output, echoCmd.Example) - checkStringContains(t, output, "boolone") - checkStringOmits(t, output, "rootflag") - checkStringContains(t, output, rootCmd.Short) - checkStringContains(t, output, echoSubCmd.Short) - checkStringOmits(t, output, deprecatedCmd.Short) - checkStringOmits(t, output, "Options inherited from parent commands") -} - func TestGenRSTNoTag(t *testing.T) { rootCmd.DisableAutoGenTag = true defer func() { rootCmd.DisableAutoGenTag = false }() diff --git a/vendor/github.com/spf13/cobra/go.mod b/vendor/github.com/spf13/cobra/go.mod deleted file mode 100644 index 9a9eb65a37..0000000000 --- a/vendor/github.com/spf13/cobra/go.mod +++ /dev/null @@ -1,13 +0,0 @@ -module github.com/spf13/cobra - -go 1.12 - -require ( - github.com/BurntSushi/toml v0.3.1 // indirect - github.com/cpuguy83/go-md2man v1.0.10 - github.com/inconshreveable/mousetrap v1.0.0 - github.com/mitchellh/go-homedir v1.1.0 - github.com/spf13/pflag v1.0.3 - github.com/spf13/viper v1.3.2 - gopkg.in/yaml.v2 v2.2.2 -) diff --git a/vendor/github.com/spf13/cobra/go.sum b/vendor/github.com/spf13/cobra/go.sum deleted file mode 100644 index 9761f4d03f..0000000000 --- a/vendor/github.com/spf13/cobra/go.sum +++ /dev/null @@ -1,51 +0,0 @@ -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a h1:1n5lsVfiQW3yfsRGu98756EH1YthsFqr/5mxHduZW2A= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/golang.org/x/tools/CONTRIBUTING.md b/vendor/golang.org/x/tools/CONTRIBUTING.md index 88dff59bc7..d0485e887a 100644 --- a/vendor/golang.org/x/tools/CONTRIBUTING.md +++ b/vendor/golang.org/x/tools/CONTRIBUTING.md @@ -4,16 +4,15 @@ Go is an open source project. It is the work of hundreds of contributors. We appreciate your help! - ## Filing issues When [filing an issue](https://golang.org/issue/new), make sure to answer these five questions: -1. What version of Go are you using (`go version`)? -2. What operating system and processor architecture are you using? -3. What did you do? -4. What did you expect to see? -5. What did you see instead? +1. What version of Go are you using (`go version`)? +2. What operating system and processor architecture are you using? +3. What did you do? +4. What did you expect to see? +5. What did you see instead? General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker. The gophers there will answer or ask you to file an issue if you've tripped over a bug. @@ -23,9 +22,5 @@ The gophers there will answer or ask you to file an issue if you've tripped over Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html) before sending patches. -**We do not accept GitHub pull requests** -(we use [Gerrit](https://code.google.com/p/gerrit/) instead for code review). - Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file. - diff --git a/vendor/golang.org/x/tools/README b/vendor/golang.org/x/tools/README deleted file mode 100644 index d5944c6db0..0000000000 --- a/vendor/golang.org/x/tools/README +++ /dev/null @@ -1,10 +0,0 @@ -This subrepository holds the source for various packages and tools that support -the Go programming language. - -Some of the tools, godoc and vet for example, are included in binary Go distributions. -Others, including the Go guru and the test coverage tool, can be fetched with "go get". - -Packages include a type-checker for Go and an implementation of the -Static Single Assignment form (SSA) representation for Go programs. - -To submit changes to this repository, see http://golang.org/doc/contribute.html. diff --git a/vendor/golang.org/x/tools/README.md b/vendor/golang.org/x/tools/README.md new file mode 100644 index 0000000000..20be9e1abd --- /dev/null +++ b/vendor/golang.org/x/tools/README.md @@ -0,0 +1,27 @@ +# Go Tools + +This subrepository holds the source for various packages and tools that support +the Go programming language. + +Some of the tools, `godoc` and `vet` for example, are included in binary Go +distributions. + +Others, including the Go `guru` and the test coverage tool, can be fetched with +`go get`. + +Packages include a type-checker for Go and an implementation of the +Static Single Assignment form (SSA) representation for Go programs. + +## Download/Install + +The easiest way to install is to run `go get -u golang.org/x/tools/...`. You can +also manually git clone the repository to `$GOPATH/src/golang.org/x/tools`. + +## Report Issues / Send Patches + +This repository uses Gerrit for code changes. To learn how to submit changes to +this repository, see https://golang.org/doc/contribute.html. + +The main issue tracker for the tools repository is located at +https://github.com/golang/go/issues. Prefix your issue with "x/tools/(your +subdir):" in the subject line, so it is easy to find. diff --git a/vendor/golang.org/x/tools/blog/blog.go b/vendor/golang.org/x/tools/blog/blog.go index 23c8dc6d47..73c184d4b4 100644 --- a/vendor/golang.org/x/tools/blog/blog.go +++ b/vendor/golang.org/x/tools/blog/blog.go @@ -24,7 +24,14 @@ import ( "golang.org/x/tools/present" ) -var validJSONPFunc = regexp.MustCompile(`(?i)^[a-z_][a-z0-9_.]*$`) +var ( + validJSONPFunc = regexp.MustCompile(`(?i)^[a-z_][a-z0-9_.]*$`) + // used to serve relative paths when ServeLocalLinks is enabled. + golangOrgAbsLinkReplacer = strings.NewReplacer( + `href="https://golang.org/pkg`, `href="/pkg`, + `href="https://golang.org/cmd`, `href="/cmd`, + ) +) // Config specifies Server configuration values. type Config struct { @@ -40,7 +47,8 @@ type Config struct { FeedArticles int // Articles to include in Atom and JSON feeds. FeedTitle string // The title of the Atom XML feed - PlayEnabled bool + PlayEnabled bool + ServeLocalLinks bool // rewrite golang.org/{pkg,cmd} links to host-less, relative paths. } // Doc represents an article adorned with presentation data. @@ -73,10 +81,17 @@ type Server struct { func NewServer(cfg Config) (*Server, error) { present.PlayEnabled = cfg.PlayEnabled + if notExist(cfg.TemplatePath) { + return nil, fmt.Errorf("template directory not found: %s", cfg.TemplatePath) + } root := filepath.Join(cfg.TemplatePath, "root.tmpl") parse := func(name string) (*template.Template, error) { + path := filepath.Join(cfg.TemplatePath, name) + if notExist(path) { + return nil, fmt.Errorf("template %s was not found in %s", name, cfg.TemplatePath) + } t := template.New("").Funcs(funcMap) - return t.ParseFiles(root, filepath.Join(cfg.TemplatePath, name)) + return t.ParseFiles(root, path) } s := &Server{cfg: cfg} @@ -184,8 +199,8 @@ func (s *Server) loadDocs(root string) error { if err != nil { return err } - html := new(bytes.Buffer) - err = d.Render(html, s.template.doc) + var html bytes.Buffer + err = d.Render(&html, s.template.doc) if err != nil { return err } @@ -410,7 +425,18 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { d.Doc = doc t = s.template.article } - err := t.ExecuteTemplate(w, "root", d) + var err error + if s.cfg.ServeLocalLinks { + var buf bytes.Buffer + err = t.ExecuteTemplate(&buf, "root", d) + if err != nil { + log.Println(err) + return + } + _, err = golangOrgAbsLinkReplacer.WriteString(w, buf.String()) + } else { + err = t.ExecuteTemplate(w, "root", d) + } if err != nil { log.Println(err) } @@ -422,3 +448,9 @@ type docsByTime []*Doc func (s docsByTime) Len() int { return len(s) } func (s docsByTime) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s docsByTime) Less(i, j int) bool { return s[i].Time.After(s[j].Time) } + +// notExist reports whether the path exists or not. +func notExist(path string) bool { + _, err := os.Stat(path) + return os.IsNotExist(err) +} diff --git a/vendor/golang.org/x/tools/blog/blog_test.go b/vendor/golang.org/x/tools/blog/blog_test.go new file mode 100644 index 0000000000..c84be2a716 --- /dev/null +++ b/vendor/golang.org/x/tools/blog/blog_test.go @@ -0,0 +1,44 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package blog + +import ( + "bytes" + "testing" +) + +func TestLinkRewrite(t *testing.T) { + tests := []struct { + input string + output string + }{ + { + `For instance, the bytes package from the standard library exports the Buffer type.`, + `For instance, the bytes package from the standard library exports the Buffer type.`}, + { + `(The gofmt command has a -r flag that provides a syntax-aware search and replace, making large-scale refactoring easier.)`, + `(The gofmt command has a -r flag that provides a syntax-aware search and replace, making large-scale refactoring easier.)`, + }, + { + `BSD license.
Terms of Service `, + `BSD license.
Terms of Service `, + }, + { + `For instance, the websocket package from the go.net sub-repository has an import path of "golang.org/x/net/websocket".`, + `For instance, the websocket package from the go.net sub-repository has an import path of "golang.org/x/net/websocket".`, + }, + } + for _, test := range tests { + var buf bytes.Buffer + _, err := golangOrgAbsLinkReplacer.WriteString(&buf, test.input) + if err != nil { + t.Errorf("unexpected error during replacing links. Got: %#v, Want: nil.\n", err) + continue + } + if got, want := buf.String(), test.output; got != want { + t.Errorf("WriteString(%q) = %q. Expected: %q", test.input, got, want) + } + } +} diff --git a/vendor/golang.org/x/tools/cmd/auth/authtest/authtest.go b/vendor/golang.org/x/tools/cmd/auth/authtest/authtest.go new file mode 100644 index 0000000000..263eed828c --- /dev/null +++ b/vendor/golang.org/x/tools/cmd/auth/authtest/authtest.go @@ -0,0 +1,231 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// authtest is a diagnostic tool for implementations of the GOAUTH protocol +// described in https://golang.org/issue/26232. +// +// It accepts a single URL as an argument, and executes the GOAUTH protocol to +// fetch and display the headers for that URL. +// +// CAUTION: authtest logs the GOAUTH responses, which may include user +// credentials, to stderr. Do not post its output unless you are certain that +// all of the credentials involved are fake! +package main + +import ( + "bufio" + "bytes" + "flag" + "fmt" + "io" + "log" + "net/http" + "net/textproto" + "net/url" + "os" + "os/exec" + "path/filepath" + "strings" +) + +var v = flag.Bool("v", false, "if true, log GOAUTH responses to stderr") + +func main() { + log.SetFlags(log.LstdFlags | log.Lshortfile) + flag.Parse() + args := flag.Args() + if len(args) != 1 { + log.Fatalf("usage: [GOAUTH=CMD...] %s URL", filepath.Base(os.Args[0])) + } + + resp := try(args[0], nil) + if resp.StatusCode == http.StatusOK { + return + } + + resp = try(args[0], resp) + if resp.StatusCode != http.StatusOK { + os.Exit(1) + } +} + +func try(url string, prev *http.Response) *http.Response { + req := new(http.Request) + if prev != nil { + *req = *prev.Request + } else { + var err error + req, err = http.NewRequest("HEAD", os.Args[1], nil) + if err != nil { + log.Fatal(err) + } + } + +goauth: + for _, argList := range strings.Split(os.Getenv("GOAUTH"), ";") { + // TODO(golang.org/issue/26849): If we escape quoted strings in GOFLAGS, use + // the same quoting here. + args := strings.Split(argList, " ") + if len(args) == 0 || args[0] == "" { + log.Fatalf("invalid or empty command in GOAUTH") + } + + creds, err := getCreds(args, prev) + if err != nil { + log.Fatal(err) + } + for _, c := range creds { + if c.Apply(req) { + fmt.Fprintf(os.Stderr, "# request to %s\n", req.URL) + fmt.Fprintf(os.Stderr, "%s %s %s\n", req.Method, req.URL, req.Proto) + req.Header.Write(os.Stderr) + fmt.Fprintln(os.Stderr) + break goauth + } + } + } + + resp, err := http.DefaultClient.Do(req) + if err != nil { + log.Fatal(err) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK && resp.StatusCode < 400 || resp.StatusCode > 500 { + log.Fatalf("unexpected status: %v", resp.Status) + } + + fmt.Fprintf(os.Stderr, "# response from %s\n", resp.Request.URL) + formatHead(os.Stderr, resp) + return resp +} + +func formatHead(out io.Writer, resp *http.Response) { + fmt.Fprintf(out, "%s %s\n", resp.Proto, resp.Status) + if err := resp.Header.Write(out); err != nil { + log.Fatal(err) + } + fmt.Fprintln(out) +} + +type Cred struct { + URLPrefixes []*url.URL + Header http.Header +} + +func (c Cred) Apply(req *http.Request) bool { + if req.URL == nil { + return false + } + ok := false + for _, prefix := range c.URLPrefixes { + if prefix.Host == req.URL.Host && + (req.URL.Path == prefix.Path || + (strings.HasPrefix(req.URL.Path, prefix.Path) && + (strings.HasSuffix(prefix.Path, "/") || + req.URL.Path[len(prefix.Path)] == '/'))) { + ok = true + break + } + } + if !ok { + return false + } + + for k, vs := range c.Header { + req.Header.Del(k) + for _, v := range vs { + req.Header.Add(k, v) + } + } + return true +} + +func (c Cred) String() string { + var buf strings.Builder + for _, u := range c.URLPrefixes { + fmt.Fprintln(&buf, u) + } + buf.WriteString("\n") + c.Header.Write(&buf) + buf.WriteString("\n") + return buf.String() +} + +func getCreds(args []string, resp *http.Response) ([]Cred, error) { + cmd := exec.Command(args[0], args[1:]...) + cmd.Stderr = os.Stderr + + if resp != nil { + u := *resp.Request.URL + u.RawQuery = "" + cmd.Args = append(cmd.Args, u.String()) + } + + var head strings.Builder + if resp != nil { + formatHead(&head, resp) + } + cmd.Stdin = strings.NewReader(head.String()) + + fmt.Fprintf(os.Stderr, "# %s\n", strings.Join(cmd.Args, " ")) + out, err := cmd.Output() + if err != nil { + return nil, fmt.Errorf("%s: %v", strings.Join(cmd.Args, " "), err) + } + os.Stderr.Write(out) + os.Stderr.WriteString("\n") + + var creds []Cred + r := textproto.NewReader(bufio.NewReader(bytes.NewReader(out))) + line := 0 +readLoop: + for { + var prefixes []*url.URL + for { + prefix, err := r.ReadLine() + if err == io.EOF { + if len(prefixes) > 0 { + return nil, fmt.Errorf("line %d: %v", line, io.ErrUnexpectedEOF) + } + break readLoop + } + line++ + + if prefix == "" { + if len(prefixes) == 0 { + return nil, fmt.Errorf("line %d: unexpected newline", line) + } + break + } + u, err := url.Parse(prefix) + if err != nil { + return nil, fmt.Errorf("line %d: malformed URL: %v", line, err) + } + if u.Scheme != "https" { + return nil, fmt.Errorf("line %d: non-HTTPS URL %q", line, prefix) + } + if len(u.RawQuery) > 0 { + return nil, fmt.Errorf("line %d: unexpected query string in URL %q", line, prefix) + } + if len(u.Fragment) > 0 { + return nil, fmt.Errorf("line %d: unexpected fragment in URL %q", line, prefix) + } + prefixes = append(prefixes, u) + } + + header, err := r.ReadMIMEHeader() + if err != nil { + return nil, fmt.Errorf("headers at line %d: %v", line, err) + } + if len(header) > 0 { + creds = append(creds, Cred{ + URLPrefixes: prefixes, + Header: http.Header(header), + }) + } + } + + return creds, nil +} diff --git a/vendor/golang.org/x/tools/cmd/auth/cookieauth/cookieauth.go b/vendor/golang.org/x/tools/cmd/auth/cookieauth/cookieauth.go new file mode 100644 index 0000000000..37e8d6e182 --- /dev/null +++ b/vendor/golang.org/x/tools/cmd/auth/cookieauth/cookieauth.go @@ -0,0 +1,166 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// cookieauth uses a “Netscape cookie file” to implement the GOAUTH protocol +// described in https://golang.org/issue/26232. +// It expects the location of the file as the first command-line argument. +// +// Example GOAUTH usage: +// export GOAUTH="cookieauth $(git config --get http.cookieFile)" +// +// See http://www.cookiecentral.com/faq/#3.5 for a description of the Netscape +// cookie file format. +package main + +import ( + "bufio" + "fmt" + "io" + "log" + "net/http" + "net/http/cookiejar" + "net/url" + "os" + "strconv" + "strings" + "time" + "unicode" +) + +func main() { + if len(os.Args) < 2 { + fmt.Fprintf(os.Stderr, "usage: %s COOKIEFILE [URL]\n", os.Args[0]) + os.Exit(2) + } + + log.SetPrefix("cookieauth: ") + + f, err := os.Open(os.Args[1]) + if err != nil { + log.Fatalf("failed to read cookie file: %v\n", os.Args[1]) + os.Exit(1) + } + defer f.Close() + + var ( + targetURL *url.URL + targetURLs = map[string]*url.URL{} + ) + if len(os.Args) == 3 { + targetURL, err = url.ParseRequestURI(os.Args[2]) + if err != nil { + log.Fatalf("invalid request URI (%v): %q\n", err, os.Args[2]) + } + targetURLs[targetURL.String()] = targetURL + } else if len(os.Args) > 3 { + // Extra arguments were passed: maybe the protocol was expanded? + // We don't know how to interpret the request, so ignore it. + return + } + + entries, err := parseCookieFile(f.Name(), f) + if err != nil { + log.Fatalf("error reading cookie file: %v\n", f.Name()) + } + + jar, err := cookiejar.New(nil) + if err != nil { + log.Fatalf("failed to initialize cookie jar: %v\n", err) + } + + for _, e := range entries { + u := &url.URL{ + Scheme: "https", + Host: e.Host, + Path: e.Cookie.Path, + } + + if targetURL == nil { + targetURLs[u.String()] = u + } + + jar.SetCookies(u, []*http.Cookie{&e.Cookie}) + } + + for _, u := range targetURLs { + req := &http.Request{URL: u, Header: make(http.Header)} + for _, c := range jar.Cookies(req.URL) { + req.AddCookie(c) + } + fmt.Printf("%s\n\n", u) + req.Header.Write(os.Stdout) + fmt.Println() + } +} + +type Entry struct { + Host string + Cookie http.Cookie +} + +// parseCookieFile parses a Netscape cookie file as described in +// http://www.cookiecentral.com/faq/#3.5. +func parseCookieFile(name string, r io.Reader) ([]*Entry, error) { + var entries []*Entry + s := bufio.NewScanner(r) + line := 0 + for s.Scan() { + line++ + text := strings.TrimSpace(s.Text()) + if len(text) < 2 || (text[0] == '#' && unicode.IsSpace(rune(text[1]))) { + continue + } + + e, err := parseCookieLine(text) + if err != nil { + log.Printf("%s:%d: %v\n", name, line, err) + continue + } + entries = append(entries, e) + } + return entries, s.Err() +} + +func parseCookieLine(line string) (*Entry, error) { + f := strings.Fields(line) + if len(f) < 7 { + return nil, fmt.Errorf("found %d columns; want 7", len(f)) + } + + e := new(Entry) + c := &e.Cookie + + if domain := f[0]; strings.HasPrefix(domain, "#HttpOnly_") { + c.HttpOnly = true + e.Host = strings.TrimPrefix(domain[10:], ".") + } else { + e.Host = strings.TrimPrefix(domain, ".") + } + + isDomain, err := strconv.ParseBool(f[1]) + if err != nil { + return nil, fmt.Errorf("non-boolean domain flag: %v", err) + } + if isDomain { + c.Domain = e.Host + } + + c.Path = f[2] + + c.Secure, err = strconv.ParseBool(f[3]) + if err != nil { + return nil, fmt.Errorf("non-boolean secure flag: %v", err) + } + + expiration, err := strconv.ParseInt(f[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("malformed expiration: %v", err) + } + c.Expires = time.Unix(expiration, 0) + + c.Name = f[5] + c.Value = f[6] + + return e, nil +} diff --git a/vendor/golang.org/x/tools/cmd/auth/gitauth/gitauth.go b/vendor/golang.org/x/tools/cmd/auth/gitauth/gitauth.go new file mode 100644 index 0000000000..b481fe6b99 --- /dev/null +++ b/vendor/golang.org/x/tools/cmd/auth/gitauth/gitauth.go @@ -0,0 +1,149 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// gitauth uses 'git credential' to implement the GOAUTH protocol described in +// https://golang.org/issue/26232. It expects an absolute path to the working +// directory for the 'git' command as the first command-line argument. +// +// Example GOAUTH usage: +// export GOAUTH="gitauth $HOME" +// +// See https://git-scm.com/docs/gitcredentials or run 'man gitcredentials' for +// information on how to configure 'git credential'. +package main + +import ( + "bytes" + "fmt" + "log" + "net/http" + "net/url" + "os" + "os/exec" + "path/filepath" + "strings" +) + +func main() { + if len(os.Args) < 2 || !filepath.IsAbs(os.Args[1]) { + fmt.Fprintf(os.Stderr, "usage: %s WORKDIR [URL]", os.Args[0]) + os.Exit(2) + } + + log.SetPrefix("gitauth: ") + + if len(os.Args) != 3 { + // No explicit URL was passed on the command line, but 'git credential' + // provides no way to enumerate existing credentials. + // Wait for a request for a specific URL. + return + } + + u, err := url.ParseRequestURI(os.Args[2]) + if err != nil { + log.Fatalf("invalid request URI (%v): %q\n", err, os.Args[1]) + } + + var ( + prefix *url.URL + lastHeader http.Header + lastStatus = http.StatusUnauthorized + ) + for lastStatus == http.StatusUnauthorized { + cmd := exec.Command("git", "credential", "fill") + + // We don't want to execute a 'git' command in an arbitrary directory, since + // that opens up a number of config-injection attacks (for example, + // https://golang.org/issue/29230). Instead, we have the user configure a + // directory explicitly on the command line. + cmd.Dir = os.Args[1] + + cmd.Stdin = strings.NewReader(fmt.Sprintf("url=%s\n", u)) + cmd.Stderr = os.Stderr + out, err := cmd.Output() + if err != nil { + log.Fatalf("'git credential fill' failed: %v\n", err) + } + + prefix = new(url.URL) + var username, password string + lines := strings.Split(string(out), "\n") + for _, line := range lines { + frags := strings.SplitN(line, "=", 2) + if len(frags) != 2 { + continue // Ignore unrecognized response lines. + } + switch strings.TrimSpace(frags[0]) { + case "protocol": + prefix.Scheme = frags[1] + case "host": + prefix.Host = frags[1] + case "path": + prefix.Path = frags[1] + case "username": + username = frags[1] + case "password": + password = frags[1] + case "url": + // Write to a local variable instead of updating prefix directly: + // if the url field is malformed, we don't want to invalidate + // information parsed from the protocol, host, and path fields. + u, err := url.ParseRequestURI(frags[1]) + if err == nil { + prefix = u + } else { + log.Printf("malformed URL from 'git credential fill' (%v): %q\n", err, frags[1]) + // Proceed anyway: we might be able to parse the prefix from other fields of the response. + } + } + } + + // Double-check that the URL Git gave us is a prefix of the one we requested. + if !strings.HasPrefix(u.String(), prefix.String()) { + log.Fatalf("requested a credential for %q, but 'git credential fill' provided one for %q\n", u, prefix) + } + + // Send a HEAD request to try to detect whether the credential is valid. + // If the user just typed in a correct password and has caching enabled, + // we don't want to nag them for it again the next time they run a 'go' command. + req, err := http.NewRequest("HEAD", u.String(), nil) + if err != nil { + log.Fatalf("internal error constructing HTTP HEAD request: %v\n", err) + } + req.SetBasicAuth(username, password) + lastHeader = req.Header + resp, err := http.DefaultClient.Do(req) + if err != nil { + log.Printf("HTTPS HEAD request failed to connect: %v\n", err) + // Couldn't verify the credential, but we have no evidence that it is invalid either. + // Proceed, but don't update git's credential cache. + break + } + lastStatus = resp.StatusCode + + if resp.StatusCode != http.StatusOK { + log.Printf("%s: %v %s\n", u, resp.StatusCode, http.StatusText(resp.StatusCode)) + } + + if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusUnauthorized { + // We learned something about the credential: it either worked or it was invalid. + // Approve or reject the credential (on a best-effort basis) + // so that the git credential helper can update its cache as appropriate. + action := "approve" + if resp.StatusCode != http.StatusOK { + action = "reject" + } + cmd = exec.Command("git", "credential", action) + cmd.Stderr = os.Stderr + cmd.Stdout = os.Stderr + cmd.Stdin = bytes.NewReader(out) + _ = cmd.Run() + } + } + + // Write out the credential in the format expected by the 'go' command. + fmt.Printf("%s\n\n", prefix) + lastHeader.Write(os.Stdout) + fmt.Println() +} diff --git a/vendor/golang.org/x/tools/cmd/auth/netrcauth/netrcauth.go b/vendor/golang.org/x/tools/cmd/auth/netrcauth/netrcauth.go new file mode 100644 index 0000000000..1855cfa24b --- /dev/null +++ b/vendor/golang.org/x/tools/cmd/auth/netrcauth/netrcauth.go @@ -0,0 +1,123 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// netrcauth uses a .netrc file (or _netrc file on Windows) to implement the +// GOAUTH protocol described in https://golang.org/issue/26232. +// It expects the location of the file as the first command-line argument. +// +// Example GOAUTH usage: +// export GOAUTH="netrcauth $HOME/.netrc" +// +// See https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html +// or run 'man 5 netrc' for a description of the .netrc file format. +package main + +import ( + "fmt" + "io/ioutil" + "log" + "net/http" + "net/url" + "os" + "strings" +) + +func main() { + if len(os.Args) < 2 { + fmt.Fprintf(os.Stderr, "usage: %s NETRCFILE [URL]", os.Args[0]) + os.Exit(2) + } + + log.SetPrefix("netrcauth: ") + + if len(os.Args) != 2 { + // An explicit URL was passed on the command line, but netrcauth does not + // have any URL-specific output: it dumps the entire .netrc file at the + // first call. + return + } + + path := os.Args[1] + + data, err := ioutil.ReadFile(path) + if err != nil { + if os.IsNotExist(err) { + return + } + log.Fatalf("failed to read %s: %v\n", path, err) + } + + u := &url.URL{Scheme: "https"} + lines := parseNetrc(string(data)) + for _, l := range lines { + u.Host = l.machine + fmt.Printf("%s\n\n", u) + + req := &http.Request{Header: make(http.Header)} + req.SetBasicAuth(l.login, l.password) + req.Header.Write(os.Stdout) + fmt.Println() + } +} + +// The following functions were extracted from src/cmd/go/internal/web2/web.go +// as of https://golang.org/cl/161698. + +type netrcLine struct { + machine string + login string + password string +} + +func parseNetrc(data string) []netrcLine { + // See https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html + // for documentation on the .netrc format. + var nrc []netrcLine + var l netrcLine + inMacro := false + for _, line := range strings.Split(data, "\n") { + if inMacro { + if line == "" { + inMacro = false + } + continue + } + + f := strings.Fields(line) + i := 0 + for ; i < len(f)-1; i += 2 { + // Reset at each "machine" token. + // “The auto-login process searches the .netrc file for a machine token + // that matches […]. Once a match is made, the subsequent .netrc tokens + // are processed, stopping when the end of file is reached or another + // machine or a default token is encountered.” + switch f[i] { + case "machine": + l = netrcLine{machine: f[i+1]} + case "default": + break + case "login": + l.login = f[i+1] + case "password": + l.password = f[i+1] + case "macdef": + // “A macro is defined with the specified name; its contents begin with + // the next .netrc line and continue until a null line (consecutive + // new-line characters) is encountered.” + inMacro = true + } + if l.machine != "" && l.login != "" && l.password != "" { + nrc = append(nrc, l) + l = netrcLine{} + } + } + + if i < len(f) && f[i] == "default" { + // “There can be only one default token, and it must be after all machine tokens.” + break + } + } + + return nrc +} diff --git a/vendor/golang.org/x/tools/cmd/bundle/.gitignore b/vendor/golang.org/x/tools/cmd/bundle/.gitignore new file mode 100644 index 0000000000..caaeb09d8c --- /dev/null +++ b/vendor/golang.org/x/tools/cmd/bundle/.gitignore @@ -0,0 +1 @@ +testdata/out.got diff --git a/vendor/golang.org/x/tools/cmd/bundle/main.go b/vendor/golang.org/x/tools/cmd/bundle/main.go index e4b261faab..7e95d583f6 100644 --- a/vendor/golang.org/x/tools/cmd/bundle/main.go +++ b/vendor/golang.org/x/tools/cmd/bundle/main.go @@ -88,6 +88,7 @@ import ( "go/build" "go/format" "go/parser" + "go/printer" "go/token" "go/types" "io/ioutil" @@ -104,8 +105,8 @@ var ( outputFile = flag.String("o", "", "write output to `file` (default standard output)") dstPath = flag.String("dst", "", "set destination import `path` (default taken from current directory)") pkgName = flag.String("pkg", "", "set destination package `name` (default taken from current directory)") - prefix = flag.String("prefix", "", "set bundled identifier prefix to `p` (default source package name + \"_\")") - underscore = flag.Bool("underscore", false, "rewrite golang.org to golang_org in imports; temporary workaround for golang.org/issue/16333") + prefix = flag.String("prefix", "&_", "set bundled identifier prefix to `p` (default is \"&_\", where & stands for the original name)") + underscore = flag.Bool("underscore", false, "rewrite golang.org/x/* to internal/x/* imports; temporary workaround for golang.org/issue/16333") importMap = map[string]string{} ) @@ -199,10 +200,11 @@ func bundle(src, dst, dstpkg, prefix string) ([]byte, error) { return nil, err } - info := lprog.Package(src) - if prefix == "" { - pkgName := info.Files[0].Name.Name - prefix = pkgName + "_" + // Because there was a single Import call and Load succeeded, + // InitialPackages is guaranteed to hold the sole requested package. + info := lprog.InitialPackages()[0] + if strings.Contains(prefix, "&") { + prefix = strings.Replace(prefix, "&", info.Files[0].Name.Name, -1) } objsToUpdate := make(map[types.Object]bool) @@ -296,7 +298,7 @@ func bundle(src, dst, dstpkg, prefix string) ([]byte, error) { pkgStd[spec] = true } else { if *underscore { - spec = strings.Replace(spec, "golang.org/", "golang_org/", 1) + spec = strings.Replace(spec, "golang.org/x/", "internal/x/", 1) } pkgExt[spec] = true } @@ -346,25 +348,41 @@ func bundle(src, dst, dstpkg, prefix string) ([]byte, error) { return true }) + last := f.Package + if len(f.Imports) > 0 { + imp := f.Imports[len(f.Imports)-1] + last = imp.End() + if imp.Comment != nil { + if e := imp.Comment.End(); e > last { + last = e + } + } + } + // Pretty-print package-level declarations. // but no package or import declarations. - // - // TODO(adonovan): this may cause loss of comments - // preceding or associated with the package or import - // declarations or not associated with any declaration. - // Check. var buf bytes.Buffer for _, decl := range f.Decls { if decl, ok := decl.(*ast.GenDecl); ok && decl.Tok == token.IMPORT { continue } + + beg, end := sourceRange(decl) + + printComments(&out, f.Comments, last, beg) + buf.Reset() - format.Node(&buf, lprog.Fset, decl) + format.Node(&buf, lprog.Fset, &printer.CommentedNode{Node: decl, Comments: f.Comments}) // Remove each "@@@." in the output. // TODO(adonovan): not hygienic. out.Write(bytes.Replace(buf.Bytes(), []byte("@@@."), nil, -1)) + + last = printSameLineComment(&out, f.Comments, lprog.Fset, end) + out.WriteString("\n\n") } + + printLastComments(&out, f.Comments, last) } // Now format the entire thing. @@ -376,6 +394,69 @@ func bundle(src, dst, dstpkg, prefix string) ([]byte, error) { return result, nil } +// sourceRange returns the [beg, end) interval of source code +// belonging to decl (incl. associated comments). +func sourceRange(decl ast.Decl) (beg, end token.Pos) { + beg = decl.Pos() + end = decl.End() + + var doc, com *ast.CommentGroup + + switch d := decl.(type) { + case *ast.GenDecl: + doc = d.Doc + if len(d.Specs) > 0 { + switch spec := d.Specs[len(d.Specs)-1].(type) { + case *ast.ValueSpec: + com = spec.Comment + case *ast.TypeSpec: + com = spec.Comment + } + } + case *ast.FuncDecl: + doc = d.Doc + } + + if doc != nil { + beg = doc.Pos() + } + if com != nil && com.End() > end { + end = com.End() + } + + return beg, end +} + +func printComments(out *bytes.Buffer, comments []*ast.CommentGroup, pos, end token.Pos) { + for _, cg := range comments { + if pos <= cg.Pos() && cg.Pos() < end { + for _, c := range cg.List { + fmt.Fprintln(out, c.Text) + } + fmt.Fprintln(out) + } + } +} + +const infinity = 1 << 30 + +func printLastComments(out *bytes.Buffer, comments []*ast.CommentGroup, pos token.Pos) { + printComments(out, comments, pos, infinity) +} + +func printSameLineComment(out *bytes.Buffer, comments []*ast.CommentGroup, fset *token.FileSet, pos token.Pos) token.Pos { + tf := fset.File(pos) + for _, cg := range comments { + if pos <= cg.Pos() && tf.Line(cg.Pos()) == tf.Line(pos) { + for _, c := range cg.List { + fmt.Fprintln(out, c.Text) + } + return cg.End() + } + } + return pos +} + type flagFunc func(string) func (f flagFunc) Set(s string) error { diff --git a/vendor/golang.org/x/tools/cmd/bundle/main_test.go b/vendor/golang.org/x/tools/cmd/bundle/main_test.go index 4db8aa7776..b96f7d9dc0 100644 --- a/vendor/golang.org/x/tools/cmd/bundle/main_test.go +++ b/vendor/golang.org/x/tools/cmd/bundle/main_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build go1.9 + package main import ( diff --git a/vendor/golang.org/x/tools/cmd/bundle/testdata/out.golden b/vendor/golang.org/x/tools/cmd/bundle/testdata/out.golden index 9374b2e9f7..5260fdd145 100644 --- a/vendor/golang.org/x/tools/cmd/bundle/testdata/out.golden +++ b/vendor/golang.org/x/tools/cmd/bundle/testdata/out.golden @@ -23,19 +23,38 @@ func init() { prefixfoo() } type prefixS struct { prefixt u int -} +} /* multi-line +comment +*/ + +// non-associated comment + +/* + non-associated comment2 +*/ // Function bar. -func prefixbar(s *prefixS) { fmt.Println(s.prefixt, s.u) } +func prefixbar(s *prefixS) { + fmt.Println(s.prefixt, s.u) // comment inside function +} + +// file-end comment -type prefixt int +type prefixt int // type1 -const prefixc = 1 +// const1 +const prefixc = 1 // const2 func prefixfoo() { fmt.Println(importdecl.F()) } +// zinit +const ( + prefixz1 = iota // z1 + prefixz2 // z2 +) // zend + func prefixbaz() { renamedfmt.Println() renamedfmt2.Println() diff --git a/vendor/golang.org/x/tools/cmd/bundle/testdata/src/initial/a.go b/vendor/golang.org/x/tools/cmd/bundle/testdata/src/initial/a.go index 99cd145abc..ded6c64c88 100644 --- a/vendor/golang.org/x/tools/cmd/bundle/testdata/src/initial/a.go +++ b/vendor/golang.org/x/tools/cmd/bundle/testdata/src/initial/a.go @@ -1,6 +1,6 @@ package initial -import "fmt" +import "fmt" // this comment should not be visible // init functions are not renamed func init() { foo() } @@ -9,7 +9,19 @@ func init() { foo() } type S struct { t u int -} +} /* multi-line +comment +*/ + +// non-associated comment + +/* + non-associated comment2 +*/ // Function bar. -func bar(s *S) { fmt.Println(s.t, s.u) } +func bar(s *S) { + fmt.Println(s.t, s.u) // comment inside function +} + +// file-end comment diff --git a/vendor/golang.org/x/tools/cmd/bundle/testdata/src/initial/b.go b/vendor/golang.org/x/tools/cmd/bundle/testdata/src/initial/b.go index 5ec45ad4ba..31d5cabe73 100644 --- a/vendor/golang.org/x/tools/cmd/bundle/testdata/src/initial/b.go +++ b/vendor/golang.org/x/tools/cmd/bundle/testdata/src/initial/b.go @@ -7,10 +7,17 @@ import ( "domain.name/importdecl" ) -type t int +type t int // type1 -const c = 1 +// const1 +const c = 1 // const2 func foo() { fmt.Println(importdecl.F()) } + +// zinit +const ( + z1 = iota // z1 + z2 // z2 +) // zend diff --git a/vendor/golang.org/x/tools/cmd/callgraph/main.go b/vendor/golang.org/x/tools/cmd/callgraph/main.go index bff39c2395..2e09bc446b 100644 --- a/vendor/golang.org/x/tools/cmd/callgraph/main.go +++ b/vendor/golang.org/x/tools/cmd/callgraph/main.go @@ -37,7 +37,7 @@ import ( "golang.org/x/tools/go/callgraph/cha" "golang.org/x/tools/go/callgraph/rta" "golang.org/x/tools/go/callgraph/static" - "golang.org/x/tools/go/loader" + "golang.org/x/tools/go/packages" "golang.org/x/tools/go/pointer" "golang.org/x/tools/go/ssa" "golang.org/x/tools/go/ssa/ssautil" @@ -67,7 +67,7 @@ const Usage = `callgraph: display the the call graph of a Go program. Usage: - callgraph [-algo=static|cha|rta|pta] [-test] [-format=...] ... + callgraph [-algo=static|cha|rta|pta] [-test] [-format=...] package... Flags: @@ -114,12 +114,10 @@ Flags: Caller and Callee are *ssa.Function values, which print as "(*sync/atomic.Mutex).Lock", but other attributes may be - derived from them, e.g. Caller.Pkg.Object.Path yields the + derived from them, e.g. Caller.Pkg.Pkg.Path yields the import path of the enclosing package. Consult the go/ssa API documentation for details. -` + loader.FromArgsUsage + ` - Examples: Show the call graph of the trivial web server application: @@ -128,7 +126,7 @@ Examples: Same, but show only the packages of each function: - callgraph -format '{{.Caller.Pkg.Object.Path}} -> {{.Callee.Pkg.Object.Path}}' \ + callgraph -format '{{.Caller.Pkg.Pkg.Path}} -> {{.Callee.Pkg.Pkg.Path}}' \ $GOROOT/src/net/http/triv.go | sort | uniq Show functions that make dynamic calls into the 'fmt' test package, @@ -158,7 +156,7 @@ func init() { func main() { flag.Parse() - if err := doCallgraph(&build.Default, *algoFlag, *formatFlag, *testFlag, flag.Args()); err != nil { + if err := doCallgraph("", "", *algoFlag, *formatFlag, *testFlag, flag.Args()); err != nil { fmt.Fprintf(os.Stderr, "callgraph: %s\n", err) os.Exit(1) } @@ -166,28 +164,30 @@ func main() { var stdout io.Writer = os.Stdout -func doCallgraph(ctxt *build.Context, algo, format string, tests bool, args []string) error { - conf := loader.Config{Build: ctxt} - +func doCallgraph(dir, gopath, algo, format string, tests bool, args []string) error { if len(args) == 0 { fmt.Fprintln(os.Stderr, Usage) return nil } - // Use the initial packages from the command line. - _, err := conf.FromArgs(args, tests) - if err != nil { - return err + cfg := &packages.Config{ + Mode: packages.LoadAllSyntax, + Tests: tests, + Dir: dir, } - - // Load, parse and type-check the whole program. - iprog, err := conf.Load() + if gopath != "" { + cfg.Env = append(os.Environ(), "GOPATH="+gopath) // to enable testing + } + initial, err := packages.Load(cfg, args...) if err != nil { return err } + if packages.PrintErrors(initial) > 0 { + return fmt.Errorf("packages contain errors") + } // Create and build SSA-form program representation. - prog := ssautil.CreateProgram(iprog, 0) + prog, pkgs := ssautil.AllPackages(initial, 0) prog.Build() // -- call graph construction ------------------------------------------ @@ -221,7 +221,7 @@ func doCallgraph(ctxt *build.Context, algo, format string, tests bool, args []st } } - mains, err := mainPackages(prog, tests) + mains, err := mainPackages(pkgs) if err != nil { return err } @@ -237,7 +237,7 @@ func doCallgraph(ctxt *build.Context, algo, format string, tests bool, args []st cg = ptares.CallGraph case "rta": - mains, err := mainPackages(prog, tests) + mains, err := mainPackages(pkgs) if err != nil { return err } @@ -305,25 +305,13 @@ func doCallgraph(ctxt *build.Context, algo, format string, tests bool, args []st // mainPackages returns the main packages to analyze. // Each resulting package is named "main" and has a main function. -func mainPackages(prog *ssa.Program, tests bool) ([]*ssa.Package, error) { - pkgs := prog.AllPackages() // TODO(adonovan): use only initial packages - - // If tests, create a "testmain" package for each test. +func mainPackages(pkgs []*ssa.Package) ([]*ssa.Package, error) { var mains []*ssa.Package - if tests { - for _, pkg := range pkgs { - if main := prog.CreateTestMainPackage(pkg); main != nil { - mains = append(mains, main) - } + for _, p := range pkgs { + if p != nil && p.Pkg.Name() == "main" && p.Func("main") != nil { + mains = append(mains, p) } - if mains == nil { - return nil, fmt.Errorf("no tests") - } - return mains, nil } - - // Otherwise, use the main packages. - mains = append(mains, ssautil.MainPackages(pkgs)...) if len(mains) == 0 { return nil, fmt.Errorf("no main packages") } diff --git a/vendor/golang.org/x/tools/cmd/callgraph/main_test.go b/vendor/golang.org/x/tools/cmd/callgraph/main_test.go index c42f56dafe..54953c7076 100644 --- a/vendor/golang.org/x/tools/cmd/callgraph/main_test.go +++ b/vendor/golang.org/x/tools/cmd/callgraph/main_test.go @@ -5,31 +5,44 @@ // No testdata on Android. // +build !android +// +build go1.11 package main import ( "bytes" "fmt" - "go/build" - "reflect" - "sort" + "log" + "os" + "path/filepath" "strings" "testing" ) -func TestCallgraph(t *testing.T) { - ctxt := build.Default // copy - ctxt.GOPATH = "testdata" +func init() { + // This test currently requires GOPATH mode. + // Explicitly disabling module mode should suffix, but + // we'll also turn off GOPROXY just for good measure. + if err := os.Setenv("GO111MODULE", "off"); err != nil { + log.Fatal(err) + } + if err := os.Setenv("GOPROXY", "off"); err != nil { + log.Fatal(err) + } +} - const format = "{{.Caller}} --> {{.Callee}}" +func TestCallgraph(t *testing.T) { + gopath, err := filepath.Abs("testdata") + if err != nil { + t.Fatal(err) + } for _, test := range []struct { - algo, format string - tests bool - want []string + algo string + tests bool + want []string }{ - {"rta", format, false, []string{ + {"rta", false, []string{ // rta imprecisely shows cross product of {main,main2} x {C,D} `pkg.main --> (pkg.C).f`, `pkg.main --> (pkg.D).f`, @@ -37,7 +50,7 @@ func TestCallgraph(t *testing.T) { `pkg.main2 --> (pkg.C).f`, `pkg.main2 --> (pkg.D).f`, }}, - {"pta", format, false, []string{ + {"pta", false, []string{ // pta distinguishes main->C, main2->D. Also has a root node. ` --> pkg.init`, ` --> pkg.main`, @@ -45,37 +58,42 @@ func TestCallgraph(t *testing.T) { `pkg.main --> pkg.main2`, `pkg.main2 --> (pkg.D).f`, }}, - // tests: main is not called. - {"rta", format, true, []string{ - `pkg$testmain.init --> pkg.init`, + // tests: both the package's main and the test's main are called. + // The callgraph includes all the guts of the "testing" package. + {"rta", true, []string{ + `pkg.test.main --> testing.MainStart`, + `testing.runExample --> pkg.Example`, `pkg.Example --> (pkg.C).f`, + `pkg.main --> (pkg.C).f`, }}, - {"pta", format, true, []string{ - ` --> pkg$testmain.init`, - ` --> pkg.Example`, - `pkg$testmain.init --> pkg.init`, + {"pta", true, []string{ + ` --> pkg.test.main`, + ` --> pkg.main`, + `pkg.test.main --> testing.MainStart`, + `testing.runExample --> pkg.Example`, `pkg.Example --> (pkg.C).f`, + `pkg.main --> (pkg.C).f`, }}, } { + const format = "{{.Caller}} --> {{.Callee}}" stdout = new(bytes.Buffer) - if err := doCallgraph(&ctxt, test.algo, test.format, test.tests, []string{"pkg"}); err != nil { + if err := doCallgraph("testdata/src", gopath, test.algo, format, test.tests, []string{"pkg"}); err != nil { t.Error(err) continue } - got := sortedLines(fmt.Sprint(stdout)) - if !reflect.DeepEqual(got, test.want) { - t.Errorf("callgraph(%q, %q, %t):\ngot:\n%s\nwant:\n%s", - test.algo, test.format, test.tests, - strings.Join(got, "\n"), - strings.Join(test.want, "\n")) + edges := make(map[string]bool) + for _, line := range strings.Split(fmt.Sprint(stdout), "\n") { + edges[line] = true + } + for _, edge := range test.want { + if !edges[edge] { + t.Errorf("callgraph(%q, %t): missing edge: %s", + test.algo, test.tests, edge) + } + } + if t.Failed() { + t.Log("got:\n", stdout) } } } - -func sortedLines(s string) []string { - s = strings.TrimSpace(s) - lines := strings.Split(s, "\n") - sort.Strings(lines) - return lines -} diff --git a/vendor/golang.org/x/tools/cmd/callgraph/testdata/src/pkg/pkg_test.go b/vendor/golang.org/x/tools/cmd/callgraph/testdata/src/pkg/pkg_test.go index d6247577b0..0dae2c3105 100644 --- a/vendor/golang.org/x/tools/cmd/callgraph/testdata/src/pkg/pkg_test.go +++ b/vendor/golang.org/x/tools/cmd/callgraph/testdata/src/pkg/pkg_test.go @@ -1,7 +1,10 @@ package main -// Don't import "testing", it adds a lot of callgraph edges. +// An Example function must have an "Output:" comment for the go build +// system to generate a call to it from the test main package. func Example() { C(0).f() + + // Output: } diff --git a/vendor/golang.org/x/tools/cmd/compilebench/main.go b/vendor/golang.org/x/tools/cmd/compilebench/main.go index e04bd61fe5..caa7051a3c 100644 --- a/vendor/golang.org/x/tools/cmd/compilebench/main.go +++ b/vendor/golang.org/x/tools/cmd/compilebench/main.go @@ -22,12 +22,21 @@ // -compileflags 'list' // Pass the space-separated list of flags to the compilation. // +// -link exe +// Use exe as the path to the cmd/link binary. +// +// -linkflags 'list' +// Pass the space-separated list of flags to the linker. +// // -count n // Run each benchmark n times (default 1). // // -cpuprofile file // Write a CPU profile of the compiler to file. // +// -go path +// Path to "go" command (default "go"). +// // -memprofile file // Write a memory profile of the compiler to file. // @@ -37,12 +46,15 @@ // -obj // Report object file statistics. // -// -pkg +// -pkg pkg // Benchmark compiling a single package. // // -run regexp // Only run benchmarks with names matching regexp. // +// -short +// Skip long-running benchmarks. +// // Although -cpuprofile and -memprofile are intended to write a // combined profile for all the executed benchmarks to file, // today they write only the profile for the last benchmark executed. @@ -67,33 +79,36 @@ package main import ( "bytes" + "encoding/json" "flag" "fmt" - "go/build" "io/ioutil" "log" "os" "os/exec" "path/filepath" "regexp" - "runtime" "strconv" "strings" "time" ) var ( - goroot = runtime.GOROOT() + goroot string compiler string + linker string runRE *regexp.Regexp is6g bool ) var ( + flagGoCmd = flag.String("go", "go", "path to \"go\" command") flagAlloc = flag.Bool("alloc", false, "report allocations") flagObj = flag.Bool("obj", false, "report object file stats") flagCompiler = flag.String("compile", "", "use `exe` as the cmd/compile binary") flagCompilerFlags = flag.String("compileflags", "", "additional `flags` to pass to compile") + flagLinker = flag.String("link", "", "use `exe` as the cmd/link binary") + flagLinkerFlags = flag.String("linkflags", "", "additional `flags` to pass to link") flagRun = flag.String("run", "", "run benchmarks matching `regexp`") flagCount = flag.Int("count", 1, "run benchmarks `n` times") flagCpuprofile = flag.String("cpuprofile", "", "write CPU profile to `file`") @@ -103,24 +118,31 @@ var ( flagShort = flag.Bool("short", false, "skip long-running benchmarks") ) -var tests = []struct { +type test struct { name string - dir string - long bool -}{ - {"BenchmarkTemplate", "html/template", false}, - {"BenchmarkUnicode", "unicode", false}, - {"BenchmarkGoTypes", "go/types", false}, - {"BenchmarkCompiler", "cmd/compile/internal/gc", false}, - {"BenchmarkSSA", "cmd/compile/internal/ssa", false}, - {"BenchmarkFlate", "compress/flate", false}, - {"BenchmarkGoParser", "go/parser", false}, - {"BenchmarkReflect", "reflect", false}, - {"BenchmarkTar", "archive/tar", false}, - {"BenchmarkXML", "encoding/xml", false}, - {"BenchmarkStdCmd", "", true}, - {"BenchmarkHelloSize", "", false}, - {"BenchmarkCmdGoSize", "", true}, + r runner +} + +type runner interface { + long() bool + run(name string, count int) error +} + +var tests = []test{ + {"BenchmarkTemplate", compile{"html/template"}}, + {"BenchmarkUnicode", compile{"unicode"}}, + {"BenchmarkGoTypes", compile{"go/types"}}, + {"BenchmarkCompiler", compile{"cmd/compile/internal/gc"}}, + {"BenchmarkSSA", compile{"cmd/compile/internal/ssa"}}, + {"BenchmarkFlate", compile{"compress/flate"}}, + {"BenchmarkGoParser", compile{"go/parser"}}, + {"BenchmarkReflect", compile{"reflect"}}, + {"BenchmarkTar", compile{"archive/tar"}}, + {"BenchmarkXML", compile{"encoding/xml"}}, + {"BenchmarkLinkCompiler", link{"cmd/compile"}}, + {"BenchmarkStdCmd", goBuild{[]string{"std", "cmd"}}}, + {"BenchmarkHelloSize", size{"$GOROOT/test/helloworld.go", false}}, + {"BenchmarkCmdGoSize", size{"cmd/go", true}}, } func usage() { @@ -139,18 +161,32 @@ func main() { usage() } + s, err := exec.Command(*flagGoCmd, "env", "GOROOT").CombinedOutput() + if err != nil { + log.Fatalf("%s env GOROOT: %v", *flagGoCmd, err) + } + goroot = strings.TrimSpace(string(s)) + os.Setenv("GOROOT", goroot) // for any subcommands + compiler = *flagCompiler if compiler == "" { - out, err := exec.Command("go", "tool", "-n", "compile").CombinedOutput() - if err != nil { - out, err = exec.Command("go", "tool", "-n", "6g").CombinedOutput() + var foundTool string + foundTool, compiler = toolPath("compile", "6g") + if foundTool == "6g" { is6g = true - if err != nil { - out, err = exec.Command("go", "tool", "-n", "compile").CombinedOutput() - log.Fatalf("go tool -n compiler: %v\n%s", err, out) - } } - compiler = strings.TrimSpace(string(out)) + } + + linker = *flagLinker + if linker == "" && !is6g { // TODO: Support 6l + _, linker = toolPath("link") + } + + if is6g { + *flagMemprofilerate = -1 + *flagAlloc = false + *flagCpuprofile = "" + *flagMemprofile = "" } if *flagRun != "" { @@ -161,67 +197,117 @@ func main() { runRE = r } - for i := 0; i < *flagCount; i++ { - if *flagPackage != "" { - runBuild("BenchmarkPkg", *flagPackage, i) - continue + if *flagPackage != "" { + tests = []test{ + {"BenchmarkPkg", compile{*flagPackage}}, + {"BenchmarkPkgLink", link{*flagPackage}}, } + runRE = nil + } + + for i := 0; i < *flagCount; i++ { for _, tt := range tests { - if tt.long && *flagShort { + if tt.r.long() && *flagShort { continue } if runRE == nil || runRE.MatchString(tt.name) { - runBuild(tt.name, tt.dir, i) + if err := tt.r.run(tt.name, i); err != nil { + log.Printf("%s: %v", tt.name, err) + } } } } } -func runCmd(name string, cmd *exec.Cmd) { +func toolPath(names ...string) (found, path string) { + var out1 []byte + var err1 error + for i, name := range names { + out, err := exec.Command(*flagGoCmd, "tool", "-n", name).CombinedOutput() + if err == nil { + return name, strings.TrimSpace(string(out)) + } + if i == 0 { + out1, err1 = out, err + } + } + log.Fatalf("go tool -n %s: %v\n%s", names[0], err1, out1) + return "", "" +} + +type Pkg struct { + Dir string + GoFiles []string +} + +func goList(dir string) (*Pkg, error) { + var pkg Pkg + out, err := exec.Command(*flagGoCmd, "list", "-json", dir).Output() + if err != nil { + return nil, fmt.Errorf("go list -json %s: %v\n", dir, err) + } + if err := json.Unmarshal(out, &pkg); err != nil { + return nil, fmt.Errorf("go list -json %s: unmarshal: %v", dir, err) + } + return &pkg, nil +} + +func runCmd(name string, cmd *exec.Cmd) error { start := time.Now() out, err := cmd.CombinedOutput() if err != nil { - log.Printf("%v: %v\n%s", name, err, out) - return + return fmt.Errorf("%v\n%s", err, out) } fmt.Printf("%s 1 %d ns/op\n", name, time.Since(start).Nanoseconds()) + return nil } -func runStdCmd() { +type goBuild struct{ pkgs []string } + +func (goBuild) long() bool { return true } + +func (r goBuild) run(name string, count int) error { args := []string{"build", "-a"} if *flagCompilerFlags != "" { args = append(args, "-gcflags", *flagCompilerFlags) } - args = append(args, "std", "cmd") - cmd := exec.Command("go", args...) - cmd.Dir = filepath.Join(runtime.GOROOT(), "src") - runCmd("BenchmarkStdCmd", cmd) + args = append(args, r.pkgs...) + cmd := exec.Command(*flagGoCmd, args...) + cmd.Dir = filepath.Join(goroot, "src") + return runCmd(name, cmd) +} + +type size struct { + // path is either a path to a file ("$GOROOT/test/helloworld.go") or a package path ("cmd/go"). + path string + isLong bool } -// path is either a path to a file ("$GOROOT/test/helloworld.go") or a package path ("cmd/go"). -func runSize(name, path string) { - cmd := exec.Command("go", "build", "-o", "_compilebenchout_", path) +func (r size) long() bool { return r.isLong } + +func (r size) run(name string, count int) error { + if strings.HasPrefix(r.path, "$GOROOT/") { + r.path = goroot + "/" + r.path[len("$GOROOT/"):] + } + + cmd := exec.Command(*flagGoCmd, "build", "-o", "_compilebenchout_", r.path) cmd.Stdout = os.Stderr cmd.Stderr = os.Stderr if err := cmd.Run(); err != nil { - log.Print(err) - return + return err } defer os.Remove("_compilebenchout_") info, err := os.Stat("_compilebenchout_") if err != nil { - log.Print(err) - return + return err } out, err := exec.Command("size", "_compilebenchout_").CombinedOutput() if err != nil { - log.Printf("size: %v\n%s", err, out) - return + return fmt.Errorf("size: %v\n%s", err, out) } lines := strings.Split(string(out), "\n") if len(lines) < 2 { - log.Printf("not enough output from size: %s", out) - return + return fmt.Errorf("not enough output from size: %s", out) } f := strings.Fields(lines[1]) if strings.HasPrefix(lines[0], "__TEXT") && len(f) >= 2 { // OS X @@ -229,61 +315,132 @@ func runSize(name, path string) { } else if strings.Contains(lines[0], "bss") && len(f) >= 3 { fmt.Printf("%s 1 %s text-bytes %s data-bytes %s bss-bytes %v exe-bytes\n", name, f[0], f[1], f[2], info.Size()) } + return nil } -func runBuild(name, dir string, count int) { - switch name { - case "BenchmarkStdCmd": - runStdCmd() - return - case "BenchmarkCmdGoSize": - runSize("BenchmarkCmdGoSize", "cmd/go") - return - case "BenchmarkHelloSize": - runSize("BenchmarkHelloSize", filepath.Join(runtime.GOROOT(), "test/helloworld.go")) - return +type compile struct{ dir string } + +func (compile) long() bool { return false } + +func (c compile) run(name string, count int) error { + // Make sure dependencies needed by go tool compile are installed to GOROOT/pkg. + out, err := exec.Command(*flagGoCmd, "build", "-i", c.dir).CombinedOutput() + if err != nil { + return fmt.Errorf("go build -i %s: %v\n%s", c.dir, err, out) } - pkg, err := build.Import(dir, ".", 0) + // Find dir and source file list. + pkg, err := goList(c.dir) if err != nil { - log.Print(err) - return + return err } + args := []string{"-o", "_compilebench_.o"} - if is6g { - *flagMemprofilerate = -1 - *flagAlloc = false - *flagCpuprofile = "" - *flagMemprofile = "" + args = append(args, strings.Fields(*flagCompilerFlags)...) + args = append(args, pkg.GoFiles...) + if err := runBuildCmd(name, count, pkg.Dir, compiler, args); err != nil { + return err + } + + opath := pkg.Dir + "/_compilebench_.o" + if *flagObj { + // TODO(josharian): object files are big; just read enough to find what we seek. + data, err := ioutil.ReadFile(opath) + if err != nil { + log.Print(err) + } + // Find start of export data. + i := bytes.Index(data, []byte("\n$$B\n")) + len("\n$$B\n") + // Count bytes to end of export data. + nexport := bytes.Index(data[i:], []byte("\n$$\n")) + fmt.Printf(" %d object-bytes %d export-bytes", len(data), nexport) + } + fmt.Println() + + os.Remove(opath) + return nil +} + +type link struct{ dir string } + +func (link) long() bool { return false } + +func (r link) run(name string, count int) error { + if linker == "" { + // No linker. Skip the test. + return nil + } + + // Build dependencies. + out, err := exec.Command(*flagGoCmd, "build", "-i", "-o", "/dev/null", r.dir).CombinedOutput() + if err != nil { + return fmt.Errorf("go build -i %s: %v\n%s", r.dir, err, out) + } + + // Build the main package. + pkg, err := goList(r.dir) + if err != nil { + return err + } + args := []string{"-o", "_compilebench_.o"} + args = append(args, pkg.GoFiles...) + cmd := exec.Command(compiler, args...) + cmd.Dir = pkg.Dir + cmd.Stdout = os.Stderr + cmd.Stderr = os.Stderr + err = cmd.Run() + if err != nil { + return fmt.Errorf("compiling: %v", err) + } + defer os.Remove(pkg.Dir + "/_compilebench_.o") + + // Link the main package. + args = []string{"-o", "_compilebench_.exe"} + args = append(args, strings.Fields(*flagLinkerFlags)...) + args = append(args, "_compilebench_.o") + if err := runBuildCmd(name, count, pkg.Dir, linker, args); err != nil { + return err } + fmt.Println() + defer os.Remove(pkg.Dir + "/_compilebench_.exe") + + return err +} + +// runBuildCmd runs "tool args..." in dir, measures standard build +// tool metrics, and prints a benchmark line. The caller may print +// additional metrics and then must print a newline. +// +// This assumes tool accepts standard build tool flags like +// -memprofilerate, -memprofile, and -cpuprofile. +func runBuildCmd(name string, count int, dir, tool string, args []string) error { + var preArgs []string if *flagMemprofilerate >= 0 { - args = append(args, "-memprofilerate", fmt.Sprint(*flagMemprofilerate)) + preArgs = append(preArgs, "-memprofilerate", fmt.Sprint(*flagMemprofilerate)) } - args = append(args, strings.Fields(*flagCompilerFlags)...) if *flagAlloc || *flagCpuprofile != "" || *flagMemprofile != "" { if *flagAlloc || *flagMemprofile != "" { - args = append(args, "-memprofile", "_compilebench_.memprof") + preArgs = append(preArgs, "-memprofile", "_compilebench_.memprof") } if *flagCpuprofile != "" { - args = append(args, "-cpuprofile", "_compilebench_.cpuprof") + preArgs = append(preArgs, "-cpuprofile", "_compilebench_.cpuprof") } } - args = append(args, pkg.GoFiles...) - cmd := exec.Command(compiler, args...) - cmd.Dir = pkg.Dir + cmd := exec.Command(tool, append(preArgs, args...)...) + cmd.Dir = dir cmd.Stdout = os.Stderr cmd.Stderr = os.Stderr start := time.Now() - err = cmd.Run() + err := cmd.Run() if err != nil { - log.Printf("%v: %v", name, err) - return + return err } end := time.Now() + haveAllocs := false var allocs, allocbytes int64 if *flagAlloc || *flagMemprofile != "" { - out, err := ioutil.ReadFile(pkg.Dir + "/_compilebench_.memprof") + out, err := ioutil.ReadFile(dir + "/_compilebench_.memprof") if err != nil { log.Print("cannot find memory profile after compilation") } @@ -296,6 +453,7 @@ func runBuild(name, dir string, count int) { if err != nil { continue } + haveAllocs = true switch f[1] { case "TotalAlloc": allocbytes = val @@ -303,17 +461,24 @@ func runBuild(name, dir string, count int) { allocs = val } } + if !haveAllocs { + log.Println("missing stats in memprof (golang.org/issue/18641)") + } if *flagMemprofile != "" { - if err := ioutil.WriteFile(*flagMemprofile, out, 0666); err != nil { + outpath := *flagMemprofile + if *flagCount != 1 { + outpath = fmt.Sprintf("%s_%d", outpath, count) + } + if err := ioutil.WriteFile(outpath, out, 0666); err != nil { log.Print(err) } } - os.Remove(pkg.Dir + "/_compilebench_.memprof") + os.Remove(dir + "/_compilebench_.memprof") } if *flagCpuprofile != "" { - out, err := ioutil.ReadFile(pkg.Dir + "/_compilebench_.cpuprof") + out, err := ioutil.ReadFile(dir + "/_compilebench_.cpuprof") if err != nil { log.Print(err) } @@ -324,31 +489,16 @@ func runBuild(name, dir string, count int) { if err := ioutil.WriteFile(outpath, out, 0666); err != nil { log.Print(err) } - os.Remove(pkg.Dir + "/_compilebench_.cpuprof") + os.Remove(dir + "/_compilebench_.cpuprof") } wallns := end.Sub(start).Nanoseconds() userns := cmd.ProcessState.UserTime().Nanoseconds() fmt.Printf("%s 1 %d ns/op %d user-ns/op", name, wallns, userns) - if *flagAlloc { + if haveAllocs { fmt.Printf(" %d B/op %d allocs/op", allocbytes, allocs) } - opath := pkg.Dir + "/_compilebench_.o" - if *flagObj { - // TODO(josharian): object files are big; just read enough to find what we seek. - data, err := ioutil.ReadFile(opath) - if err != nil { - log.Print(err) - } - // Find start of export data. - i := bytes.Index(data, []byte("\n$$B\n")) + len("\n$$B\n") - // Count bytes to end of export data. - nexport := bytes.Index(data[i:], []byte("\n$$\n")) - fmt.Printf(" %d object-bytes %d export-bytes", len(data), nexport) - } - fmt.Println() - - os.Remove(opath) + return nil } diff --git a/vendor/golang.org/x/tools/cmd/digraph/digraph.go b/vendor/golang.org/x/tools/cmd/digraph/digraph.go index 3ad2950015..4c682c3ecb 100644 --- a/vendor/golang.org/x/tools/cmd/digraph/digraph.go +++ b/vendor/golang.org/x/tools/cmd/digraph/digraph.go @@ -1,18 +1,85 @@ -// The digraph command performs queries over unlabelled directed graphs -// represented in text form. It is intended to integrate nicely with -// typical UNIX command pipelines. -// -// Since directed graphs (import graphs, reference graphs, call graphs, -// etc) often arise during software tool development and debugging, this -// command is included in the go.tools repository. -// +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +The digraph command performs queries over unlabelled directed graphs +represented in text form. It is intended to integrate nicely with +typical UNIX command pipelines. + +Usage: + + your-application | digraph [command] + +The support commands are: + + nodes + the set of all nodes + degree + the in-degree and out-degree of each node + transpose + the reverse of the input edges + preds ... + the set of immediate predecessors of the specified nodes + succs ... + the set of immediate successors of the specified nodes + forward ... + the set of nodes transitively reachable from the specified nodes + reverse ... + the set of nodes that transitively reach the specified nodes + somepath + the list of nodes on some arbitrary path from the first node to the second + allpaths + the set of nodes on all paths from the first node to the second + sccs + all strongly connected components (one per line) + scc + the set of nodes nodes strongly connected to the specified one + +Input format: + +Each line contains zero or more words. Words are separated by unquoted +whitespace; words may contain Go-style double-quoted portions, allowing spaces +and other characters to be expressed. + +Each word declares a node, and if there are more than one, an edge from the +first to each subsequent one. The graph is provided on the standard input. + +For instance, the following (acyclic) graph specifies a partial order among the +subtasks of getting dressed: + + $ cat clothes.txt + socks shoes + "boxer shorts" pants + pants belt shoes + shirt tie sweater + sweater jacket + hat + +The line "shirt tie sweater" indicates the two edges shirt -> tie and +shirt -> sweater, not shirt -> tie -> sweater. + +Example usage: + +Using digraph with existing Go tools: + + $ go mod graph | digraph nodes # Operate on the Go module graph. + $ go list -m all | digraph nodes # Operate on the Go package graph. + +Show the transitive closure of imports of the digraph tool itself: + $ go list -f '{{.ImportPath}} {{join .Imports " "}}' ... | digraph forward golang.org/x/tools/cmd/digraph + +Show which clothes (see above) must be donned before a jacket: + $ digraph reverse jacket + +*/ +package main // import "golang.org/x/tools/cmd/digraph" + // TODO(adonovan): // - support input files other than stdin -// - suport alternative formats (AT&T GraphViz, CSV, etc), +// - support alternative formats (AT&T GraphViz, CSV, etc), // a comment syntax, etc. // - allow queries to nest, like Blaze query language. -// -package main // import "golang.org/x/tools/cmd/digraph" import ( "bufio" @@ -28,73 +95,43 @@ import ( "unicode/utf8" ) -const Usage = `digraph: queries over directed graphs in text form. - -Graph format: - - Each line contains zero or more words. Words are separated by - unquoted whitespace; words may contain Go-style double-quoted portions, - allowing spaces and other characters to be expressed. - - Each field declares a node, and if there are more than one, - an edge from the first to each subsequent one. - The graph is provided on the standard input. - - For instance, the following (acyclic) graph specifies a partial order - among the subtasks of getting dressed: - - % cat clothes.txt - socks shoes - "boxer shorts" pants - pants belt shoes - shirt tie sweater - sweater jacket - hat - - The line "shirt tie sweater" indicates the two edges shirt -> tie and - shirt -> sweater, not shirt -> tie -> sweater. - -Supported queries: - - nodes - the set of all nodes - degree - the in-degree and out-degree of each node. - preds