From 8ed2e647619263356fe73b31d513592e9bb5fc29 Mon Sep 17 00:00:00 2001 From: Evan Cordell Date: Wed, 30 Oct 2019 22:30:09 -0400 Subject: [PATCH] feat(resolver): use provided and required apis from grpc instead of calculating from the csv --- go.mod | 6 +- go.sum | 91 +++ ...e_install_strategy_deployment_interface.go | 110 +-- pkg/controller/operators/catalog/operator.go | 2 +- pkg/controller/registry/resolver/evolver.go | 5 +- .../registry/resolver/evolver_test.go | 27 +- .../resolver/fakes/fake_registry_client.go | 90 +-- pkg/controller/registry/resolver/operators.go | 43 +- .../registry/resolver/operators_test.go | 63 +- pkg/controller/registry/resolver/querier.go | 41 +- .../registry/resolver/querier_test.go | 82 +-- .../registry/resolver/resolver_test.go | 39 +- pkg/controller/registry/resolver/steps.go | 34 +- pkg/controller/registry/resolver/util_test.go | 179 +++-- pkg/fakes/fake_api_intersection_reconciler.go | 4 +- pkg/fakes/fake_reconciler.go | 6 +- pkg/fakes/fake_reconciler_factory.go | 6 +- pkg/fakes/fake_registry_store.go | 347 +++++++-- pkg/fakes/fake_resolver.go | 6 +- pkg/fakes/fake_strategy.go | 4 +- pkg/fakes/fake_strategy_installer.go | 4 +- pkg/fakes/fake_strategy_resolver.go | 12 +- .../fake_apiextensions_v1beta1lister.go | 6 +- .../fake_apiregistration_v1lister.go | 4 +- .../operatorlisterfakes/fake_apps_v1lister.go | 4 +- .../operatorlisterfakes/fake_core_v1lister.go | 4 +- .../fake_operator_lister.go | 4 +- .../fake_operators_v1alpha1lister.go | 6 +- .../fake_operators_v1lister.go | 4 +- .../operatorlisterfakes/fake_rbac_v1lister.go | 4 +- pkg/package-server/provider/registry_test.go | 11 +- .../golang-migrate/migrate/v4/LICENSE | 28 + .../migrate/v4/source/driver.go | 118 +++ .../migrate/v4/source/file/README.md | 4 + .../migrate/v4/source/file/file.go | 127 ++++ .../migrate/v4/source/migration.go | 143 ++++ .../golang-migrate/migrate/v4/source/parse.go | 39 + .../go-windows-terminal-sequences/README.md | 1 + .../sequences_dummy.go | 11 + .../pkg/api/grpc_health_v1/health.pb.go | 95 +-- .../operator-registry/pkg/api/registry.pb.go | 687 ++++++------------ .../operator-registry/pkg/api/registry.proto | 10 + .../operator-registry/pkg/client/client.go | 45 +- .../pkg/client/kubeclient.go | 35 + .../operator-registry/pkg/registry/bundle.go | 44 +- .../pkg/{api => registry}/conversion.go | 25 +- .../operator-registry/pkg/registry/csv.go | 75 ++ .../operator-registry/pkg/registry/decode.go | 43 ++ .../operator-registry/pkg/registry/empty.go | 33 +- .../pkg/registry/interface.go | 16 +- .../operator-registry/pkg/server/health.go | 2 +- .../operator-registry/pkg/server/server.go | 46 +- .../pkg/sqlite/db_options.go | 24 + .../operator-registry/pkg/sqlite/load.go | 148 ++-- .../pkg/sqlite/migrations/000_init.go | 78 ++ .../sqlite/migrations/001_related_images.go | 123 ++++ .../pkg/sqlite/migrations/002_bundle_path.go | 55 ++ .../sqlite/migrations/003_required_apis.go | 148 ++++ .../pkg/sqlite/migrations/migrations.go | 82 +++ .../operator-registry/pkg/sqlite/migrator.go | 202 +++++ .../operator-registry/pkg/sqlite/query.go | 265 ++++++- .../client_golang/prometheus/collector.go | 2 +- .../client_golang/prometheus/doc.go | 6 +- .../client_golang/prometheus/histogram.go | 4 +- .../client_golang/prometheus/http.go | 1 - .../prometheus/promhttp/delegator.go | 1 - .../client_golang/prometheus/promhttp/http.go | 1 - .../client_golang/prometheus/registry.go | 2 +- .../client_golang/prometheus/summary.go | 151 +++- .../prometheus/common/expfmt/text_create.go | 12 +- .../prometheus/procfs/MAINTAINERS.md | 3 +- .../generate_internal_groups.sh | 110 --- .../code-generator/hack/boilerplate.go.txt | 15 - vendor/modules.txt | 16 +- 74 files changed, 3011 insertions(+), 1313 deletions(-) create mode 100644 vendor/github.com/golang-migrate/migrate/v4/LICENSE create mode 100644 vendor/github.com/golang-migrate/migrate/v4/source/driver.go create mode 100644 vendor/github.com/golang-migrate/migrate/v4/source/file/README.md create mode 100644 vendor/github.com/golang-migrate/migrate/v4/source/file/file.go create mode 100644 vendor/github.com/golang-migrate/migrate/v4/source/migration.go create mode 100644 vendor/github.com/golang-migrate/migrate/v4/source/parse.go create mode 100644 vendor/github.com/konsorten/go-windows-terminal-sequences/sequences_dummy.go create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/client/kubeclient.go rename vendor/github.com/operator-framework/operator-registry/pkg/{api => registry}/conversion.go (72%) create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/registry/decode.go create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/sqlite/db_options.go create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/000_init.go create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/001_related_images.go create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/002_bundle_path.go create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/003_required_apis.go create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/migrations.go create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrator.go delete mode 100755 vendor/k8s.io/code-generator/generate_internal_groups.sh delete mode 100644 vendor/k8s.io/code-generator/hack/boilerplate.go.txt diff --git a/go.mod b/go.mod index 592ea1d0390..07822479b25 100644 --- a/go.mod +++ b/go.mod @@ -26,9 +26,7 @@ require ( github.com/openshift/client-go v0.0.0-20190923180330-3b6373338c9b github.com/operator-framework/operator-registry v1.4.0 github.com/pkg/errors v0.8.1 - github.com/prometheus/client_golang v0.9.2 - github.com/prometheus/common v0.0.0-20190104105734-b1c43a6df3ae // indirect - github.com/prometheus/procfs v0.0.0-20190104112138-b1a0a9a36d74 // indirect + github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829 github.com/sirupsen/logrus v1.4.2 github.com/soheilhy/cmux v0.1.4 // indirect github.com/spf13/cobra v0.0.5 @@ -54,6 +52,8 @@ replace ( github.com/openshift/api => github.com/openshift/api v3.9.1-0.20190924102528-32369d4db2ad+incompatible github.com/openshift/client-go => github.com/openshift/client-go v0.0.0-20190923180330-3b6373338c9b + github.com/operator-framework/operator-registry => ../operator-registry + // Pin to kube 1.16 k8s.io/api => k8s.io/api v0.0.0-20190918155943-95b840bb6a1f k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.0.0-20190918161926-8f644eb6e783 diff --git a/go.sum b/go.sum index 06cd77f4c7e..d973a1de9bc 100644 --- a/go.sum +++ b/go.sum @@ -3,6 +3,7 @@ bou.ke/monkey v1.0.1 h1:zEMLInw9xvNakzUUPjfS4Ds6jYPqCFx3m7bRmG5NH2U= bou.ke/monkey v1.0.1/go.mod h1:FgHuK96Rv2Nlf+0u1OOVDpCMdsWyOFmeeketDHE7LIg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.37.4/go.mod h1:NHPJ89PdicEuT9hdPXMROBD91xc5uRDxsMtSB16k7hw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= github.com/Azure/azure-sdk-for-go v32.5.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= @@ -28,6 +29,7 @@ github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46 h1:lsxEuwrXEAo github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/NYTimes/gziphandler v1.0.1 h1:iLrQrdwjDd52kHDA5op2UBJFjmOb9g+7scBan4RN8F0= github.com/NYTimes/gziphandler v1.0.1/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= @@ -36,9 +38,12 @@ github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdko github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Rican7/retry v0.1.0/go.mod h1:FgOROf8P5bebcC1DS0PdOQiqGUridaZvikzUmkFW6gg= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= @@ -46,14 +51,17 @@ github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4 github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/auth0/go-jwt-middleware v0.0.0-20170425171159-5493cabe49f7/go.mod h1:LWMyo4iOLWXHGdBki7NIht1kHru/0wM179h+d3g8ATM= github.com/aws/aws-sdk-go v1.16.26/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.17.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/bazelbuild/bazel-gazelle v0.0.0-20181012220611-c728ce9f663e/go.mod h1:uHBSeeATKpVazAACZBDPL/Nk/UhQDDsJWDlqYJo8/Us= github.com/bazelbuild/buildtools v0.0.0-20180226164855-80c7f0d45d7e/go.mod h1:5JP0TXzWDHXv8qvxRC4InIazwdyDseBDbzESUMKk1yU= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/bifurcation/mint v0.0.0-20180715133206-93c51c6ce115/go.mod h1:zVt7zX3K/aDCk9Tj+VM7YymsX66ERvzCJzw8rFCX2JU= +github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/caddyserver/caddy v1.0.3/go.mod h1:G+ouvOY32gENkJC+jhgl62TyhvqEsFaDiZ4uw0RzP1E= @@ -65,10 +73,13 @@ github.com/cheekybits/genny v0.0.0-20170328200008-9127e812e1e9/go.mod h1:+tQajlR github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cfssl v0.0.0-20180726162950-56268a613adf/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA= github.com/clusterhq/flocker-go v0.0.0-20160920122132-2b8b7259d313/go.mod h1:P1wt9Z3DP8O6W3rvwCt0REIlshg1InHImaLW0t3ObY0= +github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk= github.com/codegangsta/negroni v1.0.0/go.mod h1:v0y3T5G7Y1UlFfyxFn/QLRU4a2EuNau2iZY63YTKWo0= github.com/container-storage-interface/spec v1.1.0/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4= github.com/containerd/console v0.0.0-20170925154832-84eeaae905fa/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= github.com/containerd/containerd v1.0.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.2.7/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= github.com/containerd/typeurl v0.0.0-20190228175220-2a93cfde8c20/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= github.com/coredns/corefile-migration v1.0.2/go.mod h1:OFwBp/Wc9dJt5cAZzHWMNhK1r5L0p0jDwIBc6j8NC8E= @@ -93,22 +104,42 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/coreos/rkt v1.30.0/go.mod h1:O634mlH6U7qk87poQifK6M2rsFNt+FyUTWNMnP1hF1U= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= +github.com/cznic/b v0.0.0-20180115125044-35e9bbe41f07/go.mod h1:URriBxXwVq5ijiJ12C7iIZqlA69nTlI+LgI6/pwftG8= +github.com/cznic/fileutil v0.0.0-20180108211300-6a051e75936f/go.mod h1:8S58EK26zhXSxzv7NQFpnliaOQsmDUxvoQO3rt154Vg= +github.com/cznic/golex v0.0.0-20170803123110-4ab7c5e190e4/go.mod h1:+bmmJDNmKlhWNG+gwWCkaBoTy39Fs+bzRxVBzoTQbIc= +github.com/cznic/internal v0.0.0-20180608152220-f44710a21d00/go.mod h1:olo7eAdKwJdXxb55TKGLiJ6xt1H0/tiiRCWKVLmtjY4= +github.com/cznic/lldb v1.1.0/go.mod h1:FIZVUmYUVhPwRiPzL8nD/mpFcJ/G7SSXjjXYG4uRI3A= +github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= +github.com/cznic/ql v1.2.0/go.mod h1:FbpzhyZrqr0PVlK6ury+PoW3T0ODUV22OeWIxcaOrSE= +github.com/cznic/sortutil v0.0.0-20150617083342-4c7342852e65/go.mod h1:q2w6Bg5jeox1B+QkJ6Wp/+Vn0G/bo3f1uY7Fn3vivIQ= +github.com/cznic/strutil v0.0.0-20171016134553-529a34b1c186/go.mod h1:AHHPPPXTw0h6pVabbcbyGRK1DckRn7r/STdZEeIDzZc= +github.com/cznic/zappy v0.0.0-20160723133515-2533cb5b45cc/go.mod h1:Y1SNZ4dRUOKXshKUbwUapqNncRrho4mkjQebgEHZLj8= github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/daviddengcn/go-colortext v0.0.0-20160507010035-511bcaf42ccd/go.mod h1:dv4zxwHi5C/8AeI+4gX4dCWOIvNi7I6JCSX0HvlKPgE= +github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dhui/dktest v0.3.0/go.mod h1:cyzIUfGsBEbZ6BT7tnXqAShHSXCZhSNmFl70sZ7c1yc= github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= +github.com/docker/distribution v2.7.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v0.7.3-0.20190103212154-2b7e084dc98b/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v0.7.3-0.20190817195342-4760db040282/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.3.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/libnetwork v0.0.0-20180830151422-a9cd636e3789/go.mod h1:93m0aTqz6z+g32wla4l4WxTrdtvBRmVzYRkYvasA5Z8= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= @@ -124,6 +155,7 @@ github.com/fatih/color v1.6.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= 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/fsouza/fake-gcs-server v1.7.0/go.mod h1:5XIRs4YvwNbNoz+1JF8j6KLAyDh7RHGAyAK3EP2EsNk= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v0.0.0-20180820084758-c7ce16629ff4/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= @@ -181,13 +213,18 @@ github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+ github.com/go-openapi/validate v0.19.2 h1:ky5l57HjyVRrsJfd2+Ro5Z9PjGuKbsmftwyMtk8H7js= github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= github.com/go-ozzo/ozzo-validation v3.5.0+incompatible/go.mod h1:gsEKFIVnabGBt6mXmxK0MoFy+cZoTJY6mu5Ll3LVLBU= +github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gocql/gocql v0.0.0-20190301043612-f6df8288f9b4/go.mod h1:4Fw1eo5iaEhDUs8XyuhSVCVy52Jq3L+/3GJgYkwc+/0= github.com/godbus/dbus v4.1.0+incompatible/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d h1:3PaI8p3seN09VjbTYC/QWlUZdZ1qS1zGjy7LH2Wt07I= github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/golang-migrate/migrate/v4 v4.6.2 h1:LDDOHo/q1W5UDj6PbkxdCv7lv9yunyZHXvxuwDkGo3k= +github.com/golang-migrate/migrate/v4 v4.6.2/go.mod h1:JYi6reN3+Z734VZ0akNuyOJNcrg45ZL7LDBMW3WGJL0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903 h1:LbsanbbD6LieFkXbj9YNNBupiGHJgFeLpO0j0Fza1h8= @@ -204,6 +241,9 @@ github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangplus/bytes v0.0.0-20160111154220-45c989fe5450/go.mod h1:Bk6SMAONeMXrxql8uvOKuAZSu8aM5RUGv+1C6IJaEho= github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995/go.mod h1:lJgMEyOkYFkPcDKwRXegd+iM6E7matEszMG5HhwytU8= github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk= @@ -215,6 +255,8 @@ github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -232,7 +274,9 @@ github.com/googleapis/gnostic v0.3.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTV github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.1/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gregjones/httpcache v0.0.0-20170728041850-787624de3eb7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= @@ -245,6 +289,9 @@ github.com/grpc-ecosystem/grpc-gateway v1.3.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpg github.com/grpc-ecosystem/grpc-gateway v1.9.4 h1:5xLhQjsk4zqPf9EHCrja2qFZMx+yBqkO3XgJ14bNnU0= github.com/grpc-ecosystem/grpc-gateway v1.9.4/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-health-probe v0.2.1-0.20181220223928-2bf0a5b182db/go.mod h1:uBKkC2RbarFsvS5jMJHpVhTLvGlGQj9JJwkaePE3FWI= +github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= @@ -263,6 +310,8 @@ github.com/imdario/mergo v0.3.7 h1:Y+UAYTZ7gDEuOfhxKWy+dvb5dRQ6rJjFSdX2HZY1/gI= github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jackc/fake v0.0.0-20150926172116-812a484cc733/go.mod h1:WrMFNQdiFJ80sQsxDoMokWK1W5TQtxBFNpzWTD84ibQ= +github.com/jackc/pgx v3.2.0+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= github.com/jimstudt/http-authentication v0.0.0-20140401203705-3eca13d6893a/go.mod h1:wK6yTYYcgjHE1Z1QtXACPDjcFJyBskHEdagmnq3vsP8= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/joefitzgerald/rainbow-reporter v0.1.0 h1:AuMG652zjdzI0YCCnXAqATtRBpGXMcAnrajcaTrSeuo= @@ -277,6 +326,7 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/karrick/godirwalk v1.7.5/go.mod h1:2c9FRhkDxdIbgkOnCEvnSWs71Bhugbl46shStcFDJ34= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= @@ -284,6 +334,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -291,7 +343,9 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kshvakov/clickhouse v1.3.5/go.mod h1:DMzX7FxRymoNkVgizH0DWAL8Cur7wHLgx3MUnGwJqpE= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/libopenstorage/openstorage v1.0.0/go.mod h1:Sp1sIObHjat1BeXhfMqLZ14wnOzEhNx2YQedreMcUyc= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= @@ -346,10 +400,12 @@ github.com/munnerz/goautoneg v0.0.0-20190414153302-2ae31c8b6b30/go.mod h1:+n7T8m github.com/mvdan/xurls v1.1.0/go.mod h1:tQlNn3BED8bE/15hnSL2HLkDeLWpNPAwtw7wkEq44oU= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8/go.mod h1:86wM1zFnC6/uDBfZGNwB65O+pR2OFi5q/YQaEUid1qA= github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= github.com/naoina/toml v0.1.1/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= @@ -367,6 +423,7 @@ github.com/openshift/api v3.9.1-0.20190924102528-32369d4db2ad+incompatible/go.mo github.com/openshift/client-go v0.0.0-20190923180330-3b6373338c9b h1:E++qQ7W1/EdvuMo+YGVbMPn4HihEp7YT5Rghh0VmA9A= github.com/openshift/client-go v0.0.0-20190923180330-3b6373338c9b/go.mod h1:6rzn+JTr7+WYS2E1TExP4gByoABxMznR6y2SnUIkmxk= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/operator-framework/operator-registry v1.4.0 h1:yhI7ZeF6d7G588i2egoFjgGi1eXhaU1aL0GMEMDuS/4= github.com/operator-framework/operator-registry v1.4.0/go.mod h1:3nJcOSX6TKPpAbmGOAVvDxakZWgccyF0WgiJsKjPAzQ= github.com/otiai10/copy v1.0.1 h1:gtBjD8aq4nychvRZ2CyJvFWAw0aja+VHazDdruZKGZA= @@ -382,6 +439,7 @@ github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtP github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -393,18 +451,27 @@ github.com/pquerna/ffjson v0.0.0-20180717144149-af8b230fcd20/go.mod h1:YARuvh7BU github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.2 h1:awm861/B8OKDd2I/6o1dy3ra4BamzKhYOiGItCeZ740= github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829 h1:D+CiwcpGTW6pL6bv6KI3KbyEyCKyS+1JWS2h8PNDnGA= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f h1:BVwpUVJDADN2ufcGik7W992pyps0wZ888b/y9GXcLTU= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/common v0.0.0-20181126121408-4724e9255275 h1:PnBWHBf+6L0jOqq0gIVUe6Yk0/QMZ640k6NvkxcBf+8= github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20190104105734-b1c43a6df3ae h1:iq3e1tH4dCzdqscIkWimcnzYt6Pkz0zOzHSgV9cb5DE= github.com/prometheus/common v0.0.0-20190104105734-b1c43a6df3ae/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.2.0 h1:kUZDBDTdBVBYBj5Tmh2NZLlF60mfjA27rM34b+cVwNU= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190104112138-b1a0a9a36d74 h1:d1Xoc24yp/pXmWl2leBiBA+Tptce6cQsA+MMx/nOOcY= github.com/prometheus/procfs v0.0.0-20190104112138-b1a0a9a36d74/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1 h1:/K3IL0Z1quvmJ7X0A1AwNEK7CRkVK3YwfOU/QAL4WGg= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/quobyte/api v0.1.2/go.mod h1:jL7lIHrmqQ7yh05OJ+eEEdHr0u/kmT1Ff9iHd+4H6VI= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= github.com/robfig/cron v1.1.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= @@ -416,8 +483,10 @@ github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdh github.com/sclevine/spec v1.2.0 h1:1Jwdf9jSfDl9NVmt8ndHqbTZ7XCCPbh1jI3hkDBHVYA= github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U= github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= +github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -450,6 +519,7 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/syndtr/gocapability v0.0.0-20160928074757-e7cb7fa329f4/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/thecodeteam/goscaleio v0.1.0/go.mod h1:68sdkZAsK8bvEwBlbQnlLS+xU+hvLYM/iQ8KXej1AwM= +github.com/tidwall/pretty v0.0.0-20180105212114-65a9db5fad51/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8 h1:ndzgwNDnKIqyCvHTXaCqh9KlOWKvBry6nuXMJmonVsE= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ= @@ -460,12 +530,18 @@ github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKn github.com/vishvananda/netlink v0.0.0-20171020171820-b2de5d10e38e/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= github.com/vishvananda/netns v0.0.0-20171111001504-be1fbeda1936/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI= github.com/vmware/govmomi v0.20.1/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= +github.com/xanzy/go-gitlab v0.15.0/go.mod h1:8zdQa/ri1dfn8eS3Ir1SyfvOKlw7WBJ8DVThkpGiXrs= +github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= +github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18 h1:MPPkRncZLN9Kh4MEFmbnK4h3BD7AUmskWv2+EeZJCCs= github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1/go.mod h1:QcJo0QPSfTONNIgpN5RA8prR7fF8nkF6cTWTcNerRO8= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE= +go.mongodb.org/mongo-driver v1.1.0/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.uber.org/atomic v0.0.0-20181018215023-8dc6146f7569/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= @@ -484,6 +560,8 @@ golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -506,6 +584,7 @@ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -516,6 +595,7 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190328230028-74de082e2cca/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -524,7 +604,9 @@ golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190812203447-cdfb69ac37fc h1:gkKoSkUmnU6bpS/VhkuO27bzQeSA51uaEfbOW5dNb68= golang.org/x/net v0.0.0-20190812203447-cdfb69ac37fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -539,7 +621,9 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181004145325-8469e314837c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190102155601-82a175fd1598/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -548,6 +632,7 @@ golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190426135247-a129542de9ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb h1:fgwFCsaw9buMuxNd6+DQfAuSFqbNiQZpcgJQAgJsK6k= @@ -574,6 +659,7 @@ golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190425222832-ad9eeb80039a/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= @@ -587,17 +673,22 @@ gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0 h1:OE9mWmgKkjJyEmDAAtGMPj gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e h1:jRyg0XfpwWlhEV8mDfdNGBeSJM2fuyh9Yjrnd8kF2Ts= gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmKJ7gzohV1XkqsFehRA2FbsbkopSuQ= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.3.2/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.6.1-0.20190607001116-5213b8090861/go.mod h1:btoxGiFvQNVUZQ8W08zLtrVS08CNpINPEfxXxgJL1Q4= google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0 h1:KxkO13IPW4Lslp2bz+KHP2E3gtFlrIGNThxkZQ3g+4c= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= diff --git a/pkg/api/wrappers/wrappersfakes/fake_install_strategy_deployment_interface.go b/pkg/api/wrappers/wrappersfakes/fake_install_strategy_deployment_interface.go index f760980f1a9..31bd62dc04d 100644 --- a/pkg/api/wrappers/wrappersfakes/fake_install_strategy_deployment_interface.go +++ b/pkg/api/wrappers/wrappersfakes/fake_install_strategy_deployment_interface.go @@ -2,14 +2,14 @@ package wrappersfakes import ( - "sync" + sync "sync" - "github.com/operator-framework/operator-lifecycle-manager/pkg/api/wrappers" - "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil" + wrappers "github.com/operator-framework/operator-lifecycle-manager/pkg/api/wrappers" + ownerutil "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil" v1 "k8s.io/api/apps/v1" - v1b "k8s.io/api/core/v1" - v1a "k8s.io/api/rbac/v1" - "k8s.io/apimachinery/pkg/labels" + v1a "k8s.io/api/core/v1" + v1b "k8s.io/api/rbac/v1" + labels "k8s.io/apimachinery/pkg/labels" ) type FakeInstallStrategyDeploymentInterface struct { @@ -39,30 +39,30 @@ type FakeInstallStrategyDeploymentInterface struct { result1 *v1.Deployment result2 error } - CreateRoleStub func(*v1a.Role) (*v1a.Role, error) + CreateRoleStub func(*v1b.Role) (*v1b.Role, error) createRoleMutex sync.RWMutex createRoleArgsForCall []struct { - arg1 *v1a.Role + arg1 *v1b.Role } createRoleReturns struct { - result1 *v1a.Role + result1 *v1b.Role result2 error } createRoleReturnsOnCall map[int]struct { - result1 *v1a.Role + result1 *v1b.Role result2 error } - CreateRoleBindingStub func(*v1a.RoleBinding) (*v1a.RoleBinding, error) + CreateRoleBindingStub func(*v1b.RoleBinding) (*v1b.RoleBinding, error) createRoleBindingMutex sync.RWMutex createRoleBindingArgsForCall []struct { - arg1 *v1a.RoleBinding + arg1 *v1b.RoleBinding } createRoleBindingReturns struct { - result1 *v1a.RoleBinding + result1 *v1b.RoleBinding result2 error } createRoleBindingReturnsOnCall map[int]struct { - result1 *v1a.RoleBinding + result1 *v1b.RoleBinding result2 error } DeleteDeploymentStub func(string) error @@ -76,18 +76,18 @@ type FakeInstallStrategyDeploymentInterface struct { deleteDeploymentReturnsOnCall map[int]struct { result1 error } - EnsureServiceAccountStub func(*v1b.ServiceAccount, ownerutil.Owner) (*v1b.ServiceAccount, error) + EnsureServiceAccountStub func(*v1a.ServiceAccount, ownerutil.Owner) (*v1a.ServiceAccount, error) ensureServiceAccountMutex sync.RWMutex ensureServiceAccountArgsForCall []struct { - arg1 *v1b.ServiceAccount + arg1 *v1a.ServiceAccount arg2 ownerutil.Owner } ensureServiceAccountReturns struct { - result1 *v1b.ServiceAccount + result1 *v1a.ServiceAccount result2 error } ensureServiceAccountReturnsOnCall map[int]struct { - result1 *v1b.ServiceAccount + result1 *v1a.ServiceAccount result2 error } FindAnyDeploymentsMatchingLabelsStub func(labels.Selector) ([]*v1.Deployment, error) @@ -116,17 +116,17 @@ type FakeInstallStrategyDeploymentInterface struct { result1 []*v1.Deployment result2 error } - GetServiceAccountByNameStub func(string) (*v1b.ServiceAccount, error) + GetServiceAccountByNameStub func(string) (*v1a.ServiceAccount, error) getServiceAccountByNameMutex sync.RWMutex getServiceAccountByNameArgsForCall []struct { arg1 string } getServiceAccountByNameReturns struct { - result1 *v1b.ServiceAccount + result1 *v1a.ServiceAccount result2 error } getServiceAccountByNameReturnsOnCall map[int]struct { - result1 *v1b.ServiceAccount + result1 *v1a.ServiceAccount result2 error } invocations map[string][][]interface{} @@ -259,11 +259,11 @@ func (fake *FakeInstallStrategyDeploymentInterface) CreateOrUpdateDeploymentRetu }{result1, result2} } -func (fake *FakeInstallStrategyDeploymentInterface) CreateRole(arg1 *v1a.Role) (*v1a.Role, error) { +func (fake *FakeInstallStrategyDeploymentInterface) CreateRole(arg1 *v1b.Role) (*v1b.Role, error) { fake.createRoleMutex.Lock() ret, specificReturn := fake.createRoleReturnsOnCall[len(fake.createRoleArgsForCall)] fake.createRoleArgsForCall = append(fake.createRoleArgsForCall, struct { - arg1 *v1a.Role + arg1 *v1b.Role }{arg1}) fake.recordInvocation("CreateRole", []interface{}{arg1}) fake.createRoleMutex.Unlock() @@ -283,50 +283,50 @@ func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleCallCount() int { return len(fake.createRoleArgsForCall) } -func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleCalls(stub func(*v1a.Role) (*v1a.Role, error)) { +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleCalls(stub func(*v1b.Role) (*v1b.Role, error)) { fake.createRoleMutex.Lock() defer fake.createRoleMutex.Unlock() fake.CreateRoleStub = stub } -func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleArgsForCall(i int) *v1a.Role { +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleArgsForCall(i int) *v1b.Role { fake.createRoleMutex.RLock() defer fake.createRoleMutex.RUnlock() argsForCall := fake.createRoleArgsForCall[i] return argsForCall.arg1 } -func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleReturns(result1 *v1a.Role, result2 error) { +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleReturns(result1 *v1b.Role, result2 error) { fake.createRoleMutex.Lock() defer fake.createRoleMutex.Unlock() fake.CreateRoleStub = nil fake.createRoleReturns = struct { - result1 *v1a.Role + result1 *v1b.Role result2 error }{result1, result2} } -func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleReturnsOnCall(i int, result1 *v1a.Role, result2 error) { +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleReturnsOnCall(i int, result1 *v1b.Role, result2 error) { fake.createRoleMutex.Lock() defer fake.createRoleMutex.Unlock() fake.CreateRoleStub = nil if fake.createRoleReturnsOnCall == nil { fake.createRoleReturnsOnCall = make(map[int]struct { - result1 *v1a.Role + result1 *v1b.Role result2 error }) } fake.createRoleReturnsOnCall[i] = struct { - result1 *v1a.Role + result1 *v1b.Role result2 error }{result1, result2} } -func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBinding(arg1 *v1a.RoleBinding) (*v1a.RoleBinding, error) { +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBinding(arg1 *v1b.RoleBinding) (*v1b.RoleBinding, error) { fake.createRoleBindingMutex.Lock() ret, specificReturn := fake.createRoleBindingReturnsOnCall[len(fake.createRoleBindingArgsForCall)] fake.createRoleBindingArgsForCall = append(fake.createRoleBindingArgsForCall, struct { - arg1 *v1a.RoleBinding + arg1 *v1b.RoleBinding }{arg1}) fake.recordInvocation("CreateRoleBinding", []interface{}{arg1}) fake.createRoleBindingMutex.Unlock() @@ -346,41 +346,41 @@ func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingCallCount() return len(fake.createRoleBindingArgsForCall) } -func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingCalls(stub func(*v1a.RoleBinding) (*v1a.RoleBinding, error)) { +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingCalls(stub func(*v1b.RoleBinding) (*v1b.RoleBinding, error)) { fake.createRoleBindingMutex.Lock() defer fake.createRoleBindingMutex.Unlock() fake.CreateRoleBindingStub = stub } -func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingArgsForCall(i int) *v1a.RoleBinding { +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingArgsForCall(i int) *v1b.RoleBinding { fake.createRoleBindingMutex.RLock() defer fake.createRoleBindingMutex.RUnlock() argsForCall := fake.createRoleBindingArgsForCall[i] return argsForCall.arg1 } -func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingReturns(result1 *v1a.RoleBinding, result2 error) { +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingReturns(result1 *v1b.RoleBinding, result2 error) { fake.createRoleBindingMutex.Lock() defer fake.createRoleBindingMutex.Unlock() fake.CreateRoleBindingStub = nil fake.createRoleBindingReturns = struct { - result1 *v1a.RoleBinding + result1 *v1b.RoleBinding result2 error }{result1, result2} } -func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingReturnsOnCall(i int, result1 *v1a.RoleBinding, result2 error) { +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingReturnsOnCall(i int, result1 *v1b.RoleBinding, result2 error) { fake.createRoleBindingMutex.Lock() defer fake.createRoleBindingMutex.Unlock() fake.CreateRoleBindingStub = nil if fake.createRoleBindingReturnsOnCall == nil { fake.createRoleBindingReturnsOnCall = make(map[int]struct { - result1 *v1a.RoleBinding + result1 *v1b.RoleBinding result2 error }) } fake.createRoleBindingReturnsOnCall[i] = struct { - result1 *v1a.RoleBinding + result1 *v1b.RoleBinding result2 error }{result1, result2} } @@ -445,11 +445,11 @@ func (fake *FakeInstallStrategyDeploymentInterface) DeleteDeploymentReturnsOnCal }{result1} } -func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccount(arg1 *v1b.ServiceAccount, arg2 ownerutil.Owner) (*v1b.ServiceAccount, error) { +func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccount(arg1 *v1a.ServiceAccount, arg2 ownerutil.Owner) (*v1a.ServiceAccount, error) { fake.ensureServiceAccountMutex.Lock() ret, specificReturn := fake.ensureServiceAccountReturnsOnCall[len(fake.ensureServiceAccountArgsForCall)] fake.ensureServiceAccountArgsForCall = append(fake.ensureServiceAccountArgsForCall, struct { - arg1 *v1b.ServiceAccount + arg1 *v1a.ServiceAccount arg2 ownerutil.Owner }{arg1, arg2}) fake.recordInvocation("EnsureServiceAccount", []interface{}{arg1, arg2}) @@ -470,41 +470,41 @@ func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountCallCoun return len(fake.ensureServiceAccountArgsForCall) } -func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountCalls(stub func(*v1b.ServiceAccount, ownerutil.Owner) (*v1b.ServiceAccount, error)) { +func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountCalls(stub func(*v1a.ServiceAccount, ownerutil.Owner) (*v1a.ServiceAccount, error)) { fake.ensureServiceAccountMutex.Lock() defer fake.ensureServiceAccountMutex.Unlock() fake.EnsureServiceAccountStub = stub } -func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountArgsForCall(i int) (*v1b.ServiceAccount, ownerutil.Owner) { +func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountArgsForCall(i int) (*v1a.ServiceAccount, ownerutil.Owner) { fake.ensureServiceAccountMutex.RLock() defer fake.ensureServiceAccountMutex.RUnlock() argsForCall := fake.ensureServiceAccountArgsForCall[i] return argsForCall.arg1, argsForCall.arg2 } -func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountReturns(result1 *v1b.ServiceAccount, result2 error) { +func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountReturns(result1 *v1a.ServiceAccount, result2 error) { fake.ensureServiceAccountMutex.Lock() defer fake.ensureServiceAccountMutex.Unlock() fake.EnsureServiceAccountStub = nil fake.ensureServiceAccountReturns = struct { - result1 *v1b.ServiceAccount + result1 *v1a.ServiceAccount result2 error }{result1, result2} } -func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountReturnsOnCall(i int, result1 *v1b.ServiceAccount, result2 error) { +func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountReturnsOnCall(i int, result1 *v1a.ServiceAccount, result2 error) { fake.ensureServiceAccountMutex.Lock() defer fake.ensureServiceAccountMutex.Unlock() fake.EnsureServiceAccountStub = nil if fake.ensureServiceAccountReturnsOnCall == nil { fake.ensureServiceAccountReturnsOnCall = make(map[int]struct { - result1 *v1b.ServiceAccount + result1 *v1a.ServiceAccount result2 error }) } fake.ensureServiceAccountReturnsOnCall[i] = struct { - result1 *v1b.ServiceAccount + result1 *v1a.ServiceAccount result2 error }{result1, result2} } @@ -640,7 +640,7 @@ func (fake *FakeInstallStrategyDeploymentInterface) FindAnyDeploymentsMatchingNa }{result1, result2} } -func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByName(arg1 string) (*v1b.ServiceAccount, error) { +func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByName(arg1 string) (*v1a.ServiceAccount, error) { fake.getServiceAccountByNameMutex.Lock() ret, specificReturn := fake.getServiceAccountByNameReturnsOnCall[len(fake.getServiceAccountByNameArgsForCall)] fake.getServiceAccountByNameArgsForCall = append(fake.getServiceAccountByNameArgsForCall, struct { @@ -664,7 +664,7 @@ func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByNameCallC return len(fake.getServiceAccountByNameArgsForCall) } -func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByNameCalls(stub func(string) (*v1b.ServiceAccount, error)) { +func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByNameCalls(stub func(string) (*v1a.ServiceAccount, error)) { fake.getServiceAccountByNameMutex.Lock() defer fake.getServiceAccountByNameMutex.Unlock() fake.GetServiceAccountByNameStub = stub @@ -677,28 +677,28 @@ func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByNameArgsF return argsForCall.arg1 } -func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByNameReturns(result1 *v1b.ServiceAccount, result2 error) { +func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByNameReturns(result1 *v1a.ServiceAccount, result2 error) { fake.getServiceAccountByNameMutex.Lock() defer fake.getServiceAccountByNameMutex.Unlock() fake.GetServiceAccountByNameStub = nil fake.getServiceAccountByNameReturns = struct { - result1 *v1b.ServiceAccount + result1 *v1a.ServiceAccount result2 error }{result1, result2} } -func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByNameReturnsOnCall(i int, result1 *v1b.ServiceAccount, result2 error) { +func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByNameReturnsOnCall(i int, result1 *v1a.ServiceAccount, result2 error) { fake.getServiceAccountByNameMutex.Lock() defer fake.getServiceAccountByNameMutex.Unlock() fake.GetServiceAccountByNameStub = nil if fake.getServiceAccountByNameReturnsOnCall == nil { fake.getServiceAccountByNameReturnsOnCall = make(map[int]struct { - result1 *v1b.ServiceAccount + result1 *v1a.ServiceAccount result2 error }) } fake.getServiceAccountByNameReturnsOnCall[i] = struct { - result1 *v1b.ServiceAccount + result1 *v1a.ServiceAccount result2 error }{result1, result2} } diff --git a/pkg/controller/operators/catalog/operator.go b/pkg/controller/operators/catalog/operator.go index 75697f9efdf..67d72ab7d57 100644 --- a/pkg/controller/operators/catalog/operator.go +++ b/pkg/controller/operators/catalog/operator.go @@ -866,7 +866,7 @@ func (o *Operator) ensureSubscriptionCSVState(logger *logrus.Entry, sub *v1alpha } bundle, _, _ := querier.FindReplacement(&csv.Spec.Version.Version, sub.Status.CurrentCSV, sub.Spec.Package, sub.Spec.Channel, resolver.CatalogKey{Name: sub.Spec.CatalogSource, Namespace: sub.Spec.CatalogSourceNamespace}) if bundle != nil { - o.logger.Tracef("replacement %s bundle found for current bundle %s", bundle.Name, sub.Status.CurrentCSV) + o.logger.Tracef("replacement %s bundle found for current bundle %s", bundle.CsvName, sub.Status.CurrentCSV) out.Status.State = v1alpha1.SubscriptionStateUpgradeAvailable } else { out.Status.State = v1alpha1.SubscriptionStateAtLatest diff --git a/pkg/controller/registry/resolver/evolver.go b/pkg/controller/registry/resolver/evolver.go index 08a4dab8cea..f82487225b0 100644 --- a/pkg/controller/registry/resolver/evolver.go +++ b/pkg/controller/registry/resolver/evolver.go @@ -1,8 +1,9 @@ package resolver import ( - opregistry "github.com/operator-framework/operator-registry/pkg/registry" "github.com/pkg/errors" + + "github.com/operator-framework/operator-registry/pkg/api" ) // TODO: this should take a cancellable context for killing long resolution @@ -76,7 +77,7 @@ func (e *NamespaceGenerationEvolver) checkForUpdates() error { func (e *NamespaceGenerationEvolver) addNewOperators(add map[OperatorSourceInfo]struct{}) error { for s := range add { - var bundle *opregistry.Bundle + var bundle *api.Bundle var key *CatalogKey var err error if s.StartingCSV != "" { diff --git a/pkg/controller/registry/resolver/evolver_test.go b/pkg/controller/registry/resolver/evolver_test.go index d7cabf40110..ad810e3291d 100644 --- a/pkg/controller/registry/resolver/evolver_test.go +++ b/pkg/controller/registry/resolver/evolver_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/operator-framework/operator-registry/pkg/api" opregistry "github.com/operator-framework/operator-registry/pkg/registry" "github.com/stretchr/testify/require" ) @@ -36,7 +37,7 @@ func TestNamespaceGenerationEvolver(t *testing.T) { { name: "NoRequiredAPIs", fields: fields{ - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ CatalogKey{"catsrc", "catsrc-namespace"}: { bundle("csv1", "p", "c", "", EmptyAPISet(), EmptyAPISet(), EmptyAPISet(), EmptyAPISet()), }, @@ -48,7 +49,7 @@ func TestNamespaceGenerationEvolver(t *testing.T) { { name: "NoNewRequiredAPIs", fields: fields{ - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ CatalogKey{"catsrc", "catsrc-namespace"}: { bundle("csv1", "p", "c", "", EmptyAPISet(), EmptyAPISet(), EmptyAPISet(), EmptyAPISet()), bundle("nothing.v1", "nothing", "channel", "", EmptyAPISet(), EmptyAPISet(), EmptyAPISet(), EmptyAPISet()), @@ -75,7 +76,7 @@ func TestNamespaceGenerationEvolver(t *testing.T) { { name: "NoNewRequiredAPIs/StartingCSV", fields: fields{ - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ CatalogKey{"catsrc", "catsrc-namespace"}: { bundle("csv1", "p", "c", "", EmptyAPISet(), EmptyAPISet(), EmptyAPISet(), EmptyAPISet()), bundle("nothing.v1", "nothing", "channel", "", EmptyAPISet(), EmptyAPISet(), EmptyAPISet(), EmptyAPISet()), @@ -104,7 +105,7 @@ func TestNamespaceGenerationEvolver(t *testing.T) { { name: "NoNewRequiredAPIs/StartingCSV/NotFound", fields: fields{ - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ CatalogKey{"catsrc", "catsrc-namespace"}: { bundle("csv1", "p", "c", "", EmptyAPISet(), EmptyAPISet(), EmptyAPISet(), EmptyAPISet()), bundle("nothing.v2", "nothing", "channel", "", EmptyAPISet(), EmptyAPISet(), EmptyAPISet(), EmptyAPISet()), @@ -134,7 +135,7 @@ func TestNamespaceGenerationEvolver(t *testing.T) { // this should contract back to the original set name: "NewRequiredAPIs/NoProviderFound", fields: fields{ - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ CatalogKey{"catsrc", "catsrc-namespace"}: { bundle("depender.v1", "depender", "channel", "", EmptyAPISet(), APISet{opregistry.APIKey{"g", "v", "k", "ks"}: {}}, EmptyAPISet(), EmptyAPISet()), }, @@ -157,7 +158,7 @@ func TestNamespaceGenerationEvolver(t *testing.T) { // this should contract back to the original set name: "NewRequiredAPIs/NoProviderFound/NonEmptyStartingGeneration", fields: fields{ - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ CatalogKey{"catsrc", "catsrc-namespace"}: { bundle("depender.v1", "depender", "channel", "", EmptyAPISet(), APISet{opregistry.APIKey{"g2", "v2", "k2", "k2s"}: {}}, EmptyAPISet(), EmptyAPISet()), }, @@ -184,7 +185,7 @@ func TestNamespaceGenerationEvolver(t *testing.T) { // this should produce a set with the new provider name: "NewRequiredAPIs/FoundProvider", fields: fields{ - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ CatalogKey{"catsrc", "catsrc-namespace"}: { bundle("depender.v1", "depender", "channel", "", EmptyAPISet(), APISet{opregistry.APIKey{"g", "v", "k", "ks"}: {}}, EmptyAPISet(), EmptyAPISet()), bundle("provider.v1", "provider", "channel", "", APISet{opregistry.APIKey{"g", "v", "k", "ks"}: {}}, EmptyAPISet(), EmptyAPISet(), EmptyAPISet()), @@ -212,7 +213,7 @@ func TestNamespaceGenerationEvolver(t *testing.T) { // this should contract back to the original set name: "NewRequiredAPIs/FoundProvider/ProviderRequired/NoSecondaryProvider", fields: fields{ - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ CatalogKey{"catsrc", "catsrc-namespace"}: { bundle("depender.v1", "depender", "channel", "", EmptyAPISet(), APISet{opregistry.APIKey{"g", "v", "k", "ks"}: {}}, EmptyAPISet(), EmptyAPISet()), @@ -240,7 +241,7 @@ func TestNamespaceGenerationEvolver(t *testing.T) { // this should produce a set with three new providers name: "NewRequiredAPIs/FoundProvider/ProviderRequired/SecondaryProviderFound", fields: fields{ - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ CatalogKey{"catsrc", "catsrc-namespace"}: { bundle("depender.v1", "depender", "channel", "", EmptyAPISet(), APISet{opregistry.APIKey{"g", "v", "k", "ks"}: {}}, EmptyAPISet(), EmptyAPISet()), @@ -276,7 +277,7 @@ func TestNamespaceGenerationEvolver(t *testing.T) { // tests dependency between crd and apiservice provided apis as a sanity check - evolver shouldn't care name: "NewRequiredCRDAPIs/FoundCRDProvider/ProviderAPIRequired/SecondaryAPIProviderFound", fields: fields{ - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ CatalogKey{"catsrc", "catsrc-namespace"}: { bundle("depender.v1", "depender", "channel", "", EmptyAPISet(), APISet{opregistry.APIKey{"g", "v", "k", "ks"}: {}}, EmptyAPISet(), EmptyAPISet()), @@ -308,7 +309,7 @@ func TestNamespaceGenerationEvolver(t *testing.T) { { name: "NewRequiredAPIs/FoundProvider/ProviderRequired/SecondaryProviderFound/RequiresAlreadyProvidedAPIs", fields: fields{ - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ CatalogKey{"catsrc", "catsrc-namespace"}: { bundle("depender.v1", "depender", "channel", "", EmptyAPISet(), @@ -347,7 +348,7 @@ func TestNamespaceGenerationEvolver(t *testing.T) { // this should produce a set with the new provider name: "UpdateRequired/NewRequiredAPIs/FoundProvider", fields: fields{ - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ CatalogKey{"catsrc", "catsrc-namespace"}: { bundle("depender.v1", "depender", "channel", "", EmptyAPISet(), APISet{opregistry.APIKey{"g", "v", "k", "ks"}: {}}, EmptyAPISet(), EmptyAPISet()), bundle("provider.v1", "provider", "channel", "", APISet{opregistry.APIKey{"g", "v", "k", "ks"}: {}}, EmptyAPISet(), EmptyAPISet(), EmptyAPISet()), @@ -378,7 +379,7 @@ func TestNamespaceGenerationEvolver(t *testing.T) { // a single evolution should update to next, not latest name: "UpdateRequired/MultipleUpdates", fields: fields{ - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ CatalogKey{"catsrc", "catsrc-namespace"}: { bundle("updated", "o", "c", "original", nil, nil, nil, nil), bundle("updated.v2", "o", "c", "updated", nil, nil, nil, nil), diff --git a/pkg/controller/registry/resolver/fakes/fake_registry_client.go b/pkg/controller/registry/resolver/fakes/fake_registry_client.go index c0b07d63616..b056f8d0221 100644 --- a/pkg/controller/registry/resolver/fakes/fake_registry_client.go +++ b/pkg/controller/registry/resolver/fakes/fake_registry_client.go @@ -2,12 +2,12 @@ package fakes import ( - "context" - "sync" - "time" + context "context" + sync "sync" + time "time" - "github.com/operator-framework/operator-registry/pkg/client" - "github.com/operator-framework/operator-registry/pkg/registry" + api "github.com/operator-framework/operator-registry/pkg/api" + client "github.com/operator-framework/operator-registry/pkg/client" ) type FakeInterface struct { @@ -21,7 +21,7 @@ type FakeInterface struct { closeReturnsOnCall map[int]struct { result1 error } - GetBundleStub func(context.Context, string, string, string) (*registry.Bundle, error) + GetBundleStub func(context.Context, string, string, string) (*api.Bundle, error) getBundleMutex sync.RWMutex getBundleArgsForCall []struct { arg1 context.Context @@ -30,14 +30,14 @@ type FakeInterface struct { arg4 string } getBundleReturns struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error } getBundleReturnsOnCall map[int]struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error } - GetBundleInPackageChannelStub func(context.Context, string, string) (*registry.Bundle, error) + GetBundleInPackageChannelStub func(context.Context, string, string) (*api.Bundle, error) getBundleInPackageChannelMutex sync.RWMutex getBundleInPackageChannelArgsForCall []struct { arg1 context.Context @@ -45,14 +45,14 @@ type FakeInterface struct { arg3 string } getBundleInPackageChannelReturns struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error } getBundleInPackageChannelReturnsOnCall map[int]struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error } - GetBundleThatProvidesStub func(context.Context, string, string, string) (*registry.Bundle, error) + GetBundleThatProvidesStub func(context.Context, string, string, string) (*api.Bundle, error) getBundleThatProvidesMutex sync.RWMutex getBundleThatProvidesArgsForCall []struct { arg1 context.Context @@ -61,14 +61,14 @@ type FakeInterface struct { arg4 string } getBundleThatProvidesReturns struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error } getBundleThatProvidesReturnsOnCall map[int]struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error } - GetReplacementBundleInPackageChannelStub func(context.Context, string, string, string) (*registry.Bundle, error) + GetReplacementBundleInPackageChannelStub func(context.Context, string, string, string) (*api.Bundle, error) getReplacementBundleInPackageChannelMutex sync.RWMutex getReplacementBundleInPackageChannelArgsForCall []struct { arg1 context.Context @@ -77,11 +77,11 @@ type FakeInterface struct { arg4 string } getReplacementBundleInPackageChannelReturns struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error } getReplacementBundleInPackageChannelReturnsOnCall map[int]struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error } HealthCheckStub func(context.Context, time.Duration) (bool, error) @@ -154,7 +154,7 @@ func (fake *FakeInterface) CloseReturnsOnCall(i int, result1 error) { }{result1} } -func (fake *FakeInterface) GetBundle(arg1 context.Context, arg2 string, arg3 string, arg4 string) (*registry.Bundle, error) { +func (fake *FakeInterface) GetBundle(arg1 context.Context, arg2 string, arg3 string, arg4 string) (*api.Bundle, error) { fake.getBundleMutex.Lock() ret, specificReturn := fake.getBundleReturnsOnCall[len(fake.getBundleArgsForCall)] fake.getBundleArgsForCall = append(fake.getBundleArgsForCall, struct { @@ -181,7 +181,7 @@ func (fake *FakeInterface) GetBundleCallCount() int { return len(fake.getBundleArgsForCall) } -func (fake *FakeInterface) GetBundleCalls(stub func(context.Context, string, string, string) (*registry.Bundle, error)) { +func (fake *FakeInterface) GetBundleCalls(stub func(context.Context, string, string, string) (*api.Bundle, error)) { fake.getBundleMutex.Lock() defer fake.getBundleMutex.Unlock() fake.GetBundleStub = stub @@ -194,33 +194,33 @@ func (fake *FakeInterface) GetBundleArgsForCall(i int) (context.Context, string, return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 } -func (fake *FakeInterface) GetBundleReturns(result1 *registry.Bundle, result2 error) { +func (fake *FakeInterface) GetBundleReturns(result1 *api.Bundle, result2 error) { fake.getBundleMutex.Lock() defer fake.getBundleMutex.Unlock() fake.GetBundleStub = nil fake.getBundleReturns = struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error }{result1, result2} } -func (fake *FakeInterface) GetBundleReturnsOnCall(i int, result1 *registry.Bundle, result2 error) { +func (fake *FakeInterface) GetBundleReturnsOnCall(i int, result1 *api.Bundle, result2 error) { fake.getBundleMutex.Lock() defer fake.getBundleMutex.Unlock() fake.GetBundleStub = nil if fake.getBundleReturnsOnCall == nil { fake.getBundleReturnsOnCall = make(map[int]struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error }) } fake.getBundleReturnsOnCall[i] = struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error }{result1, result2} } -func (fake *FakeInterface) GetBundleInPackageChannel(arg1 context.Context, arg2 string, arg3 string) (*registry.Bundle, error) { +func (fake *FakeInterface) GetBundleInPackageChannel(arg1 context.Context, arg2 string, arg3 string) (*api.Bundle, error) { fake.getBundleInPackageChannelMutex.Lock() ret, specificReturn := fake.getBundleInPackageChannelReturnsOnCall[len(fake.getBundleInPackageChannelArgsForCall)] fake.getBundleInPackageChannelArgsForCall = append(fake.getBundleInPackageChannelArgsForCall, struct { @@ -246,7 +246,7 @@ func (fake *FakeInterface) GetBundleInPackageChannelCallCount() int { return len(fake.getBundleInPackageChannelArgsForCall) } -func (fake *FakeInterface) GetBundleInPackageChannelCalls(stub func(context.Context, string, string) (*registry.Bundle, error)) { +func (fake *FakeInterface) GetBundleInPackageChannelCalls(stub func(context.Context, string, string) (*api.Bundle, error)) { fake.getBundleInPackageChannelMutex.Lock() defer fake.getBundleInPackageChannelMutex.Unlock() fake.GetBundleInPackageChannelStub = stub @@ -259,33 +259,33 @@ func (fake *FakeInterface) GetBundleInPackageChannelArgsForCall(i int) (context. return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 } -func (fake *FakeInterface) GetBundleInPackageChannelReturns(result1 *registry.Bundle, result2 error) { +func (fake *FakeInterface) GetBundleInPackageChannelReturns(result1 *api.Bundle, result2 error) { fake.getBundleInPackageChannelMutex.Lock() defer fake.getBundleInPackageChannelMutex.Unlock() fake.GetBundleInPackageChannelStub = nil fake.getBundleInPackageChannelReturns = struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error }{result1, result2} } -func (fake *FakeInterface) GetBundleInPackageChannelReturnsOnCall(i int, result1 *registry.Bundle, result2 error) { +func (fake *FakeInterface) GetBundleInPackageChannelReturnsOnCall(i int, result1 *api.Bundle, result2 error) { fake.getBundleInPackageChannelMutex.Lock() defer fake.getBundleInPackageChannelMutex.Unlock() fake.GetBundleInPackageChannelStub = nil if fake.getBundleInPackageChannelReturnsOnCall == nil { fake.getBundleInPackageChannelReturnsOnCall = make(map[int]struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error }) } fake.getBundleInPackageChannelReturnsOnCall[i] = struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error }{result1, result2} } -func (fake *FakeInterface) GetBundleThatProvides(arg1 context.Context, arg2 string, arg3 string, arg4 string) (*registry.Bundle, error) { +func (fake *FakeInterface) GetBundleThatProvides(arg1 context.Context, arg2 string, arg3 string, arg4 string) (*api.Bundle, error) { fake.getBundleThatProvidesMutex.Lock() ret, specificReturn := fake.getBundleThatProvidesReturnsOnCall[len(fake.getBundleThatProvidesArgsForCall)] fake.getBundleThatProvidesArgsForCall = append(fake.getBundleThatProvidesArgsForCall, struct { @@ -312,7 +312,7 @@ func (fake *FakeInterface) GetBundleThatProvidesCallCount() int { return len(fake.getBundleThatProvidesArgsForCall) } -func (fake *FakeInterface) GetBundleThatProvidesCalls(stub func(context.Context, string, string, string) (*registry.Bundle, error)) { +func (fake *FakeInterface) GetBundleThatProvidesCalls(stub func(context.Context, string, string, string) (*api.Bundle, error)) { fake.getBundleThatProvidesMutex.Lock() defer fake.getBundleThatProvidesMutex.Unlock() fake.GetBundleThatProvidesStub = stub @@ -325,33 +325,33 @@ func (fake *FakeInterface) GetBundleThatProvidesArgsForCall(i int) (context.Cont return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 } -func (fake *FakeInterface) GetBundleThatProvidesReturns(result1 *registry.Bundle, result2 error) { +func (fake *FakeInterface) GetBundleThatProvidesReturns(result1 *api.Bundle, result2 error) { fake.getBundleThatProvidesMutex.Lock() defer fake.getBundleThatProvidesMutex.Unlock() fake.GetBundleThatProvidesStub = nil fake.getBundleThatProvidesReturns = struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error }{result1, result2} } -func (fake *FakeInterface) GetBundleThatProvidesReturnsOnCall(i int, result1 *registry.Bundle, result2 error) { +func (fake *FakeInterface) GetBundleThatProvidesReturnsOnCall(i int, result1 *api.Bundle, result2 error) { fake.getBundleThatProvidesMutex.Lock() defer fake.getBundleThatProvidesMutex.Unlock() fake.GetBundleThatProvidesStub = nil if fake.getBundleThatProvidesReturnsOnCall == nil { fake.getBundleThatProvidesReturnsOnCall = make(map[int]struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error }) } fake.getBundleThatProvidesReturnsOnCall[i] = struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error }{result1, result2} } -func (fake *FakeInterface) GetReplacementBundleInPackageChannel(arg1 context.Context, arg2 string, arg3 string, arg4 string) (*registry.Bundle, error) { +func (fake *FakeInterface) GetReplacementBundleInPackageChannel(arg1 context.Context, arg2 string, arg3 string, arg4 string) (*api.Bundle, error) { fake.getReplacementBundleInPackageChannelMutex.Lock() ret, specificReturn := fake.getReplacementBundleInPackageChannelReturnsOnCall[len(fake.getReplacementBundleInPackageChannelArgsForCall)] fake.getReplacementBundleInPackageChannelArgsForCall = append(fake.getReplacementBundleInPackageChannelArgsForCall, struct { @@ -378,7 +378,7 @@ func (fake *FakeInterface) GetReplacementBundleInPackageChannelCallCount() int { return len(fake.getReplacementBundleInPackageChannelArgsForCall) } -func (fake *FakeInterface) GetReplacementBundleInPackageChannelCalls(stub func(context.Context, string, string, string) (*registry.Bundle, error)) { +func (fake *FakeInterface) GetReplacementBundleInPackageChannelCalls(stub func(context.Context, string, string, string) (*api.Bundle, error)) { fake.getReplacementBundleInPackageChannelMutex.Lock() defer fake.getReplacementBundleInPackageChannelMutex.Unlock() fake.GetReplacementBundleInPackageChannelStub = stub @@ -391,28 +391,28 @@ func (fake *FakeInterface) GetReplacementBundleInPackageChannelArgsForCall(i int return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 } -func (fake *FakeInterface) GetReplacementBundleInPackageChannelReturns(result1 *registry.Bundle, result2 error) { +func (fake *FakeInterface) GetReplacementBundleInPackageChannelReturns(result1 *api.Bundle, result2 error) { fake.getReplacementBundleInPackageChannelMutex.Lock() defer fake.getReplacementBundleInPackageChannelMutex.Unlock() fake.GetReplacementBundleInPackageChannelStub = nil fake.getReplacementBundleInPackageChannelReturns = struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error }{result1, result2} } -func (fake *FakeInterface) GetReplacementBundleInPackageChannelReturnsOnCall(i int, result1 *registry.Bundle, result2 error) { +func (fake *FakeInterface) GetReplacementBundleInPackageChannelReturnsOnCall(i int, result1 *api.Bundle, result2 error) { fake.getReplacementBundleInPackageChannelMutex.Lock() defer fake.getReplacementBundleInPackageChannelMutex.Unlock() fake.GetReplacementBundleInPackageChannelStub = nil if fake.getReplacementBundleInPackageChannelReturnsOnCall == nil { fake.getReplacementBundleInPackageChannelReturnsOnCall = make(map[int]struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error }) } fake.getReplacementBundleInPackageChannelReturnsOnCall[i] = struct { - result1 *registry.Bundle + result1 *api.Bundle result2 error }{result1, result2} } diff --git a/pkg/controller/registry/resolver/operators.go b/pkg/controller/registry/resolver/operators.go index e24c5ecd409..82b0c56b466 100644 --- a/pkg/controller/registry/resolver/operators.go +++ b/pkg/controller/registry/resolver/operators.go @@ -1,6 +1,7 @@ package resolver import ( + "encoding/json" "fmt" "hash/fnv" "sort" @@ -9,6 +10,8 @@ import ( "github.com/blang/semver" "k8s.io/apimachinery/pkg/runtime/schema" + "github.com/operator-framework/operator-registry/pkg/api" + "github.com/operator-framework/operator-registry/pkg/registry" opregistry "github.com/operator-framework/operator-registry/pkg/registry" "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" @@ -220,7 +223,7 @@ type OperatorSurface interface { Replaces() string Version() *semver.Version SourceInfo() *OperatorSourceInfo - Bundle() *opregistry.Bundle + Bundle() *api.Bundle } type Operator struct { @@ -229,23 +232,18 @@ type Operator struct { providedAPIs APISet requiredAPIs APISet version *semver.Version - bundle *opregistry.Bundle + bundle *api.Bundle sourceInfo *OperatorSourceInfo } var _ OperatorSurface = &Operator{} -func NewOperatorFromBundle(bundle *opregistry.Bundle, replaces string, startingCSV string, sourceKey CatalogKey) (*Operator, error) { - csv, err := bundle.ClusterServiceVersion() - if err != nil { - return nil, err - } - providedAPIs, err := bundle.ProvidedAPIs() - if err != nil { - return nil, err +func NewOperatorFromBundle(bundle *api.Bundle, replaces string, startingCSV string, sourceKey CatalogKey) (*Operator, error) { + if bundle.CsvJson == "" { + return nil, fmt.Errorf("no csv json found") } - requiredAPIs, err := bundle.RequiredAPIs() - if err != nil { + csv := ®istry.ClusterServiceVersion{} + if err := json.Unmarshal([]byte(bundle.CsvJson), csv); err != nil { return nil, err } r := replaces @@ -260,16 +258,25 @@ func NewOperatorFromBundle(bundle *opregistry.Bundle, replaces string, startingC v = nil } + provided := APISet{} + for _, gvk := range bundle.ProvidedApis { + provided[registry.APIKey{Plural: gvk.Plural, Group: gvk.Group, Kind: gvk.Kind, Version: gvk.Version}] = struct{}{} + } + required := APISet{} + for _, gvk := range bundle.RequiredApis { + required[registry.APIKey{Plural: gvk.Plural, Group: gvk.Group, Kind: gvk.Kind, Version: gvk.Version}] = struct{}{} + } + return &Operator{ name: csv.GetName(), replaces: r, version: v, - providedAPIs: providedAPIs, - requiredAPIs: requiredAPIs, + providedAPIs: provided, + requiredAPIs: required, bundle: bundle, sourceInfo: &OperatorSourceInfo{ - Package: bundle.Package, - Channel: bundle.Channel, + Package: bundle.PackageName, + Channel: bundle.ChannelName, StartingCSV: startingCSV, Catalog: sourceKey, }, @@ -328,14 +335,14 @@ func (o *Operator) Replaces() string { } func (o *Operator) Package() string { - return o.bundle.Package + return o.bundle.PackageName } func (o *Operator) SourceInfo() *OperatorSourceInfo { return o.sourceInfo } -func (o *Operator) Bundle() *opregistry.Bundle { +func (o *Operator) Bundle() *api.Bundle { return o.bundle } diff --git a/pkg/controller/registry/resolver/operators_test.go b/pkg/controller/registry/resolver/operators_test.go index ad2db796368..b2686a3f49c 100644 --- a/pkg/controller/registry/resolver/operators_test.go +++ b/pkg/controller/registry/resolver/operators_test.go @@ -1,18 +1,18 @@ package resolver import ( + "encoding/json" "testing" "github.com/blang/semver" - opregistry "github.com/operator-framework/operator-registry/pkg/registry" "github.com/stretchr/testify/require" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime" "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" opver "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/version" + "github.com/operator-framework/operator-registry/pkg/api" + opregistry "github.com/operator-framework/operator-registry/pkg/registry" ) func TestGVKStringToProvidedAPISet(t *testing.T) { @@ -910,11 +910,16 @@ func TestNewOperatorFromBundle(t *testing.T) { Version: version, }, } - csvUnst, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&csv) - require.NoError(t, err) - bundleNoAPIs := opregistry.NewBundle("testBundle", "testPackage", "testChannel", - &unstructured.Unstructured{Object: csvUnst}) + csvJson, err := json.Marshal(csv) + require.NoError(t, err) + bundleNoAPIs := &api.Bundle{ + CsvName: "testBundle", + PackageName: "testPackage", + ChannelName: "testChannel", + CsvJson: string(csvJson), + Object: []string{string(csvJson)}, + } csv.Spec.CustomResourceDefinitions.Owned = []v1alpha1.CRDDescription{ { @@ -947,7 +952,7 @@ func TestNewOperatorFromBundle(t *testing.T) { }, } - csvUnstWithAPIs, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&csv) + csvJsonWithApis, err := json.Marshal(csv) require.NoError(t, err) crd := v1beta1.CustomResourceDefinition{ @@ -975,13 +980,47 @@ func TestNewOperatorFromBundle(t *testing.T) { }, }, } - crdUnst, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&crd) + crdJson, err := json.Marshal(crd) require.NoError(t, err) - bundleWithAPIs := opregistry.NewBundle("testBundle", "testPackage", "testChannel", - &unstructured.Unstructured{Object: csvUnstWithAPIs}, &unstructured.Unstructured{Object: crdUnst}) + + bundleWithAPIs := &api.Bundle{ + CsvName: "testBundle", + PackageName: "testPackage", + ChannelName: "testChannel", + CsvJson: string(csvJsonWithApis), + Object: []string{string(csvJsonWithApis), string(crdJson)}, + ProvidedApis: []*api.GroupVersionKind{ + { + Group: "crd.group.com", + Version: "v1", + Kind: "OwnedCRD", + Plural: "owneds", + }, + { + Plural: "ownedapis", + Group: "apis.group.com", + Version: "v1", + Kind: "OwnedAPI", + }, + }, + RequiredApis: []*api.GroupVersionKind{ + { + Group: "crd.group.com", + Version: "v1", + Kind: "RequiredCRD", + Plural: "requireds", + }, + { + Plural: "requiredapis", + Group: "apis.group.com", + Version: "v1", + Kind: "RequiredAPI", + }, + }, + } type args struct { - bundle *opregistry.Bundle + bundle *api.Bundle sourceKey CatalogKey replaces string } diff --git a/pkg/controller/registry/resolver/querier.go b/pkg/controller/registry/resolver/querier.go index 358b68ccf03..93402334ea1 100644 --- a/pkg/controller/registry/resolver/querier.go +++ b/pkg/controller/registry/resolver/querier.go @@ -4,12 +4,17 @@ package resolver import ( "context" "fmt" + "strings" "github.com/blang/semver" - "github.com/operator-framework/operator-registry/pkg/client" - opregistry "github.com/operator-framework/operator-registry/pkg/registry" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/util/errors" + "k8s.io/apimachinery/pkg/util/yaml" + + "github.com/operator-framework/operator-registry/pkg/api" + "github.com/operator-framework/operator-registry/pkg/client" + opregistry "github.com/operator-framework/operator-registry/pkg/registry" ) const SkipPackageAnnotationKey = "olm.skipRange" @@ -22,10 +27,10 @@ type SourceRef struct { } type SourceQuerier interface { - FindProvider(api opregistry.APIKey, initialSource CatalogKey) (*opregistry.Bundle, *CatalogKey, error) - FindBundle(pkgName, channelName, bundleName string, initialSource CatalogKey) (*opregistry.Bundle, *CatalogKey, error) - FindLatestBundle(pkgName, channelName string, initialSource CatalogKey) (*opregistry.Bundle, *CatalogKey, error) - FindReplacement(currentVersion *semver.Version, bundleName, pkgName, channelName string, initialSource CatalogKey) (*opregistry.Bundle, *CatalogKey, error) + FindProvider(api opregistry.APIKey, initialSource CatalogKey) (*api.Bundle, *CatalogKey, error) + FindBundle(pkgName, channelName, bundleName string, initialSource CatalogKey) (*api.Bundle, *CatalogKey, error) + FindLatestBundle(pkgName, channelName string, initialSource CatalogKey) (*api.Bundle, *CatalogKey, error) + FindReplacement(currentVersion *semver.Version, bundleName, pkgName, channelName string, initialSource CatalogKey) (*api.Bundle, *CatalogKey, error) Queryable() error } @@ -48,7 +53,7 @@ func (q *NamespaceSourceQuerier) Queryable() error { return nil } -func (q *NamespaceSourceQuerier) FindProvider(api opregistry.APIKey, initialSource CatalogKey) (*opregistry.Bundle, *CatalogKey, error) { +func (q *NamespaceSourceQuerier) FindProvider(api opregistry.APIKey, initialSource CatalogKey) (*api.Bundle, *CatalogKey, error) { if initialSource.Name != "" && initialSource.Namespace != "" { source, ok := q.sources[initialSource] if ok { @@ -71,7 +76,7 @@ func (q *NamespaceSourceQuerier) FindProvider(api opregistry.APIKey, initialSour return nil, nil, fmt.Errorf("%s not provided by a package in any CatalogSource", api) } -func (q *NamespaceSourceQuerier) FindBundle(pkgName, channelName, bundleName string, initialSource CatalogKey) (*opregistry.Bundle, *CatalogKey, error) { +func (q *NamespaceSourceQuerier) FindBundle(pkgName, channelName, bundleName string, initialSource CatalogKey) (*api.Bundle, *CatalogKey, error) { if initialSource.Name != "" && initialSource.Namespace != "" { source, ok := q.sources[initialSource] if !ok { @@ -94,7 +99,7 @@ func (q *NamespaceSourceQuerier) FindBundle(pkgName, channelName, bundleName str return nil, nil, fmt.Errorf("%s/%s/%s not found in any available CatalogSource", pkgName, channelName, bundleName) } -func (q *NamespaceSourceQuerier) FindLatestBundle(pkgName, channelName string, initialSource CatalogKey) (*opregistry.Bundle, *CatalogKey, error) { +func (q *NamespaceSourceQuerier) FindLatestBundle(pkgName, channelName string, initialSource CatalogKey) (*api.Bundle, *CatalogKey, error) { if initialSource.Name != "" && initialSource.Namespace != "" { source, ok := q.sources[initialSource] if !ok { @@ -117,7 +122,7 @@ func (q *NamespaceSourceQuerier) FindLatestBundle(pkgName, channelName string, i return nil, nil, fmt.Errorf("%s/%s not found in any available CatalogSource", pkgName, channelName) } -func (q *NamespaceSourceQuerier) FindReplacement(currentVersion *semver.Version, bundleName, pkgName, channelName string, initialSource CatalogKey) (*opregistry.Bundle, *CatalogKey, error) { +func (q *NamespaceSourceQuerier) FindReplacement(currentVersion *semver.Version, bundleName, pkgName, channelName string, initialSource CatalogKey) (*api.Bundle, *CatalogKey, error) { errs := []error{} if initialSource.Name != "" && initialSource.Namespace != "" { @@ -165,7 +170,7 @@ func (q *NamespaceSourceQuerier) FindReplacement(currentVersion *semver.Version, return nil, nil, errors.NewAggregate(errs) } -func (q *NamespaceSourceQuerier) findChannelHead(currentVersion *semver.Version, pkgName, channelName string, source client.Interface) (*opregistry.Bundle, error) { +func (q *NamespaceSourceQuerier) findChannelHead(currentVersion *semver.Version, pkgName, channelName string, source client.Interface) (*api.Bundle, error) { if currentVersion == nil { return nil, nil } @@ -175,15 +180,17 @@ func (q *NamespaceSourceQuerier) findChannelHead(currentVersion *semver.Version, return nil, err } - csv, err := latest.ClusterServiceVersion() - if err != nil { - return nil, err - } - if csv == nil { + if latest.CsvJson == "" { return nil, nil } - skipRange, ok := csv.GetAnnotations()[SkipPackageAnnotationKey] + dec := yaml.NewYAMLOrJSONDecoder(strings.NewReader(latest.CsvJson), 10) + unst := &unstructured.Unstructured{} + if err := dec.Decode(unst); err != nil { + return nil, err + } + + skipRange, ok := unst.GetAnnotations()[SkipPackageAnnotationKey] if !ok { return nil, nil } diff --git a/pkg/controller/registry/resolver/querier_test.go b/pkg/controller/registry/resolver/querier_test.go index 3f758aea1f3..201579f4f0f 100644 --- a/pkg/controller/registry/resolver/querier_test.go +++ b/pkg/controller/registry/resolver/querier_test.go @@ -2,16 +2,16 @@ package resolver import ( "context" + "encoding/json" "fmt" "testing" "github.com/blang/semver" + "github.com/operator-framework/operator-registry/pkg/api" "github.com/operator-framework/operator-registry/pkg/client" opregistry "github.com/operator-framework/operator-registry/pkg/registry" "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime" "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver/fakes" @@ -108,19 +108,19 @@ func TestNamespaceSourceQuerier_FindProvider(t *testing.T) { fakeSource := fakes.FakeInterface{} fakeSource2 := fakes.FakeInterface{} sources := map[CatalogKey]client.Interface{ - CatalogKey{"test", "ns"}: &fakeSource, + CatalogKey{"test", "ns"}: &fakeSource, CatalogKey{"test2", "ns"}: &fakeSource2, } - bundle := opregistry.NewBundle("test", "testPkg", "testChannel") - bundle2 := opregistry.NewBundle("test2", "testPkg2", "testChannel2") - fakeSource.GetBundleThatProvidesStub = func(ctx context.Context, group, version, kind string) (*opregistry.Bundle, error) { + bundle := &api.Bundle{CsvName: "test", PackageName: "testPkg", ChannelName: "testChannel"} + bundle2 := &api.Bundle{CsvName: "test2", PackageName: "testPkg2", ChannelName: "testChannel2"} + fakeSource.GetBundleThatProvidesStub = func(ctx context.Context, group, version, kind string) (*api.Bundle, error) { if group != "group" || version != "version" || kind != "kind" { return nil, fmt.Errorf("Not Found") } return bundle, nil } - fakeSource2.GetBundleThatProvidesStub = func(ctx context.Context, group, version, kind string) (*opregistry.Bundle, error) { + fakeSource2.GetBundleThatProvidesStub = func(ctx context.Context, group, version, kind string) (*api.Bundle, error) { if group != "group2" || version != "version2" || kind != "kind2" { return nil, fmt.Errorf("Not Found") } @@ -131,11 +131,11 @@ func TestNamespaceSourceQuerier_FindProvider(t *testing.T) { sources map[CatalogKey]client.Interface } type args struct { - api opregistry.APIKey + api opregistry.APIKey catalogKey CatalogKey } type out struct { - bundle *opregistry.Bundle + bundle *api.Bundle key *CatalogKey err error } @@ -150,7 +150,7 @@ func TestNamespaceSourceQuerier_FindProvider(t *testing.T) { sources: sources, }, args: args{ - api: opregistry.APIKey{"group", "version", "kind", "plural"}, + api: opregistry.APIKey{"group", "version", "kind", "plural"}, catalogKey: CatalogKey{}, }, out: out{ @@ -164,7 +164,7 @@ func TestNamespaceSourceQuerier_FindProvider(t *testing.T) { sources: nil, }, args: args{ - api: opregistry.APIKey{"group", "version", "kind", "plural"}, + api: opregistry.APIKey{"group", "version", "kind", "plural"}, catalogKey: CatalogKey{}, }, out: out{ @@ -178,7 +178,7 @@ func TestNamespaceSourceQuerier_FindProvider(t *testing.T) { sources: sources, }, args: args{ - api: opregistry.APIKey{"group2", "version2", "kind2", "plural2"}, + api: opregistry.APIKey{"group2", "version2", "kind2", "plural2"}, catalogKey: CatalogKey{Name: "test2", Namespace: "ns"}, }, out: out{ @@ -192,7 +192,7 @@ func TestNamespaceSourceQuerier_FindProvider(t *testing.T) { sources: sources, }, args: args{ - api: opregistry.APIKey{"group2", "version2", "kind2", "plural2"}, + api: opregistry.APIKey{"group2", "version2", "kind2", "plural2"}, catalogKey: CatalogKey{Name: "test3", Namespace: "ns"}, }, out: out{ @@ -218,23 +218,23 @@ func TestNamespaceSourceQuerier_FindProvider(t *testing.T) { func TestNamespaceSourceQuerier_FindPackage(t *testing.T) { initialSource := fakes.FakeInterface{} otherSource := fakes.FakeInterface{} - initalBundle := opregistry.NewBundle("test", "testPkg", "testChannel") - startingBundle := opregistry.NewBundle("starting-test", "testPkg", "testChannel") - otherBundle := opregistry.NewBundle("other", "otherPkg", "otherChannel") - initialSource.GetBundleStub = func(ctx context.Context, pkgName, channelName, csvName string) (*opregistry.Bundle, error) { - if csvName != startingBundle.Name { + initalBundle := &api.Bundle{CsvName: "test", PackageName: "testPkg", ChannelName: "testChannel"} + startingBundle := &api.Bundle{CsvName: "starting-test", PackageName: "testPkg", ChannelName: "testChannel"} + otherBundle := &api.Bundle{CsvName: "other", PackageName: "otherPkg", ChannelName: "otherChannel"} + initialSource.GetBundleStub = func(ctx context.Context, pkgName, channelName, csvName string) (*api.Bundle, error) { + if csvName != startingBundle.CsvName { return nil, fmt.Errorf("not found") } return startingBundle, nil } - initialSource.GetBundleInPackageChannelStub = func(ctx context.Context, pkgName, channelName string) (*opregistry.Bundle, error) { - if pkgName != initalBundle.Name { + initialSource.GetBundleInPackageChannelStub = func(ctx context.Context, pkgName, channelName string) (*api.Bundle, error) { + if pkgName != initalBundle.CsvName { return nil, fmt.Errorf("not found") } return initalBundle, nil } - otherSource.GetBundleInPackageChannelStub = func(ctx context.Context, pkgName, channelName string) (*opregistry.Bundle, error) { - if pkgName != otherBundle.Name { + otherSource.GetBundleInPackageChannelStub = func(ctx context.Context, pkgName, channelName string) (*api.Bundle, error) { + if pkgName != otherBundle.CsvName { return nil, fmt.Errorf("not found") } return otherBundle, nil @@ -256,7 +256,7 @@ func TestNamespaceSourceQuerier_FindPackage(t *testing.T) { initialSource CatalogKey } type out struct { - bundle *opregistry.Bundle + bundle *api.Bundle key *CatalogKey err error } @@ -308,7 +308,7 @@ func TestNamespaceSourceQuerier_FindPackage(t *testing.T) { q := &NamespaceSourceQuerier{ sources: tt.fields.sources, } - var got *opregistry.Bundle + var got *api.Bundle var key *CatalogKey var err error if tt.args.startingCSV != "" { @@ -356,45 +356,45 @@ func TestNamespaceSourceQuerier_FindReplacement(t *testing.T) { Version: version.OperatorVersion{latestVersion}, }, } - csvUnst, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&csv) + csvJson, err := json.Marshal(csv) require.NoError(t, err) - nextBundle := opregistry.NewBundle("test.v1", "testPkg", "testChannel") - latestBundle := opregistry.NewBundle("latest", "testPkg", "testChannel", &unstructured.Unstructured{Object: csvUnst}) + nextBundle := &api.Bundle{CsvName: "test.v1", PackageName: "testPkg", ChannelName: "testChannel"} + latestBundle := &api.Bundle{CsvName: "latest", PackageName: "testPkg", ChannelName: "testChannel", CsvJson: string(csvJson), Object: []string{string(csvJson)}} csv.SetAnnotations(map[string]string{}) - csvUnstNoAnnotation, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&csv) + csvUnstNoAnnotationJson, err := json.Marshal(csv) require.NoError(t, err) - latestBundleNoAnnotation := opregistry.NewBundle("latest", "testPkg", "testChannel", &unstructured.Unstructured{Object: csvUnstNoAnnotation}) + latestBundleNoAnnotation := &api.Bundle{CsvName: "latest", PackageName: "testPkg", ChannelName: "testChannel", CsvJson: string(csvUnstNoAnnotationJson), Object: []string{string(csvUnstNoAnnotationJson)}} - initialSource.GetReplacementBundleInPackageChannelStub = func(ctx context.Context, bundleName, pkgName, channelName string) (*opregistry.Bundle, error) { + initialSource.GetReplacementBundleInPackageChannelStub = func(ctx context.Context, bundleName, pkgName, channelName string) (*api.Bundle, error) { return nil, fmt.Errorf("not found") } - replacementSource.GetReplacementBundleInPackageChannelStub = func(ctx context.Context, bundleName, pkgName, channelName string) (*opregistry.Bundle, error) { + replacementSource.GetReplacementBundleInPackageChannelStub = func(ctx context.Context, bundleName, pkgName, channelName string) (*api.Bundle, error) { return nextBundle, nil } - initialSource.GetBundleInPackageChannelStub = func(ctx context.Context, pkgName, channelName string) (*opregistry.Bundle, error) { - if pkgName != latestBundle.Package { + initialSource.GetBundleInPackageChannelStub = func(ctx context.Context, pkgName, channelName string) (*api.Bundle, error) { + if pkgName != latestBundle.PackageName { return nil, fmt.Errorf("not found") } return latestBundle, nil } - otherSource.GetBundleInPackageChannelStub = func(ctx context.Context, pkgName, channelName string) (*opregistry.Bundle, error) { - if pkgName != latestBundle.Package { + otherSource.GetBundleInPackageChannelStub = func(ctx context.Context, pkgName, channelName string) (*api.Bundle, error) { + if pkgName != latestBundle.PackageName { return nil, fmt.Errorf("not found") } return latestBundle, nil } - replacementAndLatestSource.GetReplacementBundleInPackageChannelStub = func(ctx context.Context, bundleName, pkgName, channelName string) (*opregistry.Bundle, error) { + replacementAndLatestSource.GetReplacementBundleInPackageChannelStub = func(ctx context.Context, bundleName, pkgName, channelName string) (*api.Bundle, error) { return nextBundle, nil } - replacementAndLatestSource.GetBundleInPackageChannelStub = func(ctx context.Context, pkgName, channelName string) (*opregistry.Bundle, error) { + replacementAndLatestSource.GetBundleInPackageChannelStub = func(ctx context.Context, pkgName, channelName string) (*api.Bundle, error) { return latestBundle, nil } - replacementAndNoAnnotationLatestSource.GetReplacementBundleInPackageChannelStub = func(ctx context.Context, bundleName, pkgName, channelName string) (*opregistry.Bundle, error) { + replacementAndNoAnnotationLatestSource.GetReplacementBundleInPackageChannelStub = func(ctx context.Context, bundleName, pkgName, channelName string) (*api.Bundle, error) { return nextBundle, nil } - replacementAndNoAnnotationLatestSource.GetBundleInPackageChannelStub = func(ctx context.Context, pkgName, channelName string) (*opregistry.Bundle, error) { + replacementAndNoAnnotationLatestSource.GetBundleInPackageChannelStub = func(ctx context.Context, pkgName, channelName string) (*api.Bundle, error) { return latestBundleNoAnnotation, nil } @@ -426,7 +426,7 @@ func TestNamespaceSourceQuerier_FindReplacement(t *testing.T) { initialSource CatalogKey } type out struct { - bundle *opregistry.Bundle + bundle *api.Bundle key *CatalogKey err error } @@ -484,7 +484,7 @@ func TestNamespaceSourceQuerier_FindReplacement(t *testing.T) { q := &NamespaceSourceQuerier{ sources: tt.fields.sources, } - var got *opregistry.Bundle + var got *api.Bundle var key *CatalogKey var err error got, key, err = q.FindReplacement(tt.args.currentVersion, tt.args.bundleName, tt.args.pkgName, tt.args.channelName, tt.args.initialSource) diff --git a/pkg/controller/registry/resolver/resolver_test.go b/pkg/controller/registry/resolver/resolver_test.go index c19631c31b1..284fbf2da47 100644 --- a/pkg/controller/registry/resolver/resolver_test.go +++ b/pkg/controller/registry/resolver/resolver_test.go @@ -5,6 +5,7 @@ import ( "testing" "time" + "github.com/operator-framework/operator-registry/pkg/api" opregistry "github.com/operator-framework/operator-registry/pkg/registry" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" @@ -62,7 +63,7 @@ func TestNamespaceResolver(t *testing.T) { clusterState: []runtime.Object{ newSub(namespace, "a", "alpha", catalog), }, - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ catalog: { bundle("a.v1", "a", "alpha", "", nil, nil, nil, nil), }, @@ -81,7 +82,7 @@ func TestNamespaceResolver(t *testing.T) { clusterState: []runtime.Object{ newSub(namespace, "a", "alpha", catalog), }, - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ catalog: { bundle("b.v1", "b", "beta", "", Provides1, nil, nil, nil), bundle("a.v1", "a", "alpha", "", nil, Requires1, nil, nil), @@ -103,7 +104,7 @@ func TestNamespaceResolver(t *testing.T) { clusterState: []runtime.Object{ newSub(namespace, "a", "alpha", catalog), }, - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ catalog: { withBundleObject(bundle("b.v1", "b", "beta", "", Provides1, nil, nil, nil), u(&rbacv1.RoleBinding{TypeMeta: metav1.TypeMeta{Kind: "RoleBinding", APIVersion: "rbac.authorization.k8s.io/v1"}, ObjectMeta: metav1.ObjectMeta{Name: "test-rb"}})), bundle("a.v1", "a", "alpha", "", nil, Requires1, nil, nil), @@ -125,7 +126,7 @@ func TestNamespaceResolver(t *testing.T) { clusterState: []runtime.Object{ newSub(namespace, "a", "alpha", catalog), }, - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ catalog: { withBundleObject(bundle("b.v1", "b", "beta", "", Provides1, nil, nil, nil), u(&corev1.Service{TypeMeta: metav1.TypeMeta{Kind: "Service", APIVersion: ""}, ObjectMeta: metav1.ObjectMeta{Name: "test-service"}})), bundle("a.v1", "a", "alpha", "", nil, Requires1, nil, nil), @@ -147,7 +148,7 @@ func TestNamespaceResolver(t *testing.T) { clusterState: []runtime.Object{ newSub(namespace, "a", "alpha", catalog), }, - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ catalog: { bundle("a.v1", "a", "alpha", "", nil, Requires1, nil, nil), }, @@ -160,7 +161,7 @@ func TestNamespaceResolver(t *testing.T) { existingSub(namespace, "a.v1", "a", "alpha", catalog), existingOperator(namespace, "a.v1", "a", "alpha", "", Provides1, nil, nil, nil), }, - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ catalog: { bundle("a.v1", "a", "alpha", "", Provides1, nil, nil, nil), }, @@ -173,7 +174,7 @@ func TestNamespaceResolver(t *testing.T) { existingSub(namespace, "a.v1", "a", "alpha", catalog), existingOperator(namespace, "a.v1", "a", "alpha", "", Provides1, nil, nil, nil), }, - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ catalog: { bundle("a.v2", "a", "alpha", "a.v1", Provides1, nil, nil, nil), bundle("a.v1", "a", "alpha", "", Provides1, nil, nil, nil), @@ -193,7 +194,7 @@ func TestNamespaceResolver(t *testing.T) { clusterState: []runtime.Object{ existingSub(namespace, "a.v1", "a", "alpha", catalog), }, - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ catalog: { bundle("a.v1", "a", "alpha", "", Provides1, nil, nil, nil), }, @@ -212,7 +213,7 @@ func TestNamespaceResolver(t *testing.T) { existingSub(namespace, "a.v1", "a", "alpha", catalog), existingOperator(namespace, "a.v1", "a", "alpha", "", Provides1, nil, nil, nil), }, - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ catalog: { bundle("a.v1", "a", "alpha", "", nil, nil, nil, nil), bundle("a.v2", "a", "alpha", "a.v1", nil, Requires1, nil, nil), @@ -236,7 +237,7 @@ func TestNamespaceResolver(t *testing.T) { existingSub(namespace, "a.v1", "a", "alpha", catalog), existingOperator(namespace, "a.v1", "a", "alpha", "", nil, nil, Provides1, nil), }, - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ catalog: { bundle("a.v1", "a", "alpha", "", nil, nil, nil, nil), bundle("a.v2", "a", "alpha", "a.v1", nil, nil, nil, Requires1), @@ -261,7 +262,7 @@ func TestNamespaceResolver(t *testing.T) { existingOperator(namespace, "a.v1", "a", "alpha", "", Provides1, nil, nil, nil), newSub(namespace, "b", "beta", catalog), }, - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ catalog: { bundle("a.v1", "a", "alpha", "", nil, nil, nil, nil), bundle("a.v2", "a", "alpha", "a.v1", nil, nil, nil, nil), @@ -285,7 +286,7 @@ func TestNamespaceResolver(t *testing.T) { existingSub(namespace, "a.v1", "a", "alpha", catalog), newSub(namespace, "b", "beta", catalog), }, - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ catalog: { bundle("a.v1", "a", "alpha", "", Provides1, nil, nil, nil), bundle("b.v1", "b", "beta", "", nil, nil, nil, nil), @@ -307,7 +308,7 @@ func TestNamespaceResolver(t *testing.T) { existingSub(namespace, "a.v1", "a", "alpha", catalog), newSub(namespace, "b", "beta", catalog), }, - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ catalog: { bundle("a.v1", "a", "alpha", "", nil, nil, Provides1, nil), bundle("b.v1", "b", "beta", "", nil, nil, nil, nil), @@ -332,7 +333,7 @@ func TestNamespaceResolver(t *testing.T) { existingSub(namespace, "b.v1", "b", "alpha", catalog), existingOperator(namespace, "b.v1", "b", "alpha", "", Provides2, Requires1, nil, nil), }, - querier: NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{ + querier: NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{ catalog: { bundle("a.v2", "a", "alpha", "a.v1", Provides3, Requires4, nil, nil), bundle("b.v2", "b", "alpha", "b.v1", Provides4, Requires3, nil, nil), @@ -420,7 +421,7 @@ func TestNamespaceResolverRBAC(t *testing.T) { tests := []struct { name string clusterState []runtime.Object - bundlesInCatalog []*opregistry.Bundle + bundlesInCatalog []*api.Bundle out out }{ { @@ -428,7 +429,7 @@ func TestNamespaceResolverRBAC(t *testing.T) { clusterState: []runtime.Object{ newSub(namespace, "a", "alpha", catalog), }, - bundlesInCatalog: []*opregistry.Bundle{bundle}, + bundlesInCatalog: []*api.Bundle{bundle}, out: out{ steps: [][]*v1alpha1.Step{ bundleSteps(bundle, namespace, "", catalog), @@ -455,7 +456,7 @@ func TestNamespaceResolverRBAC(t *testing.T) { lister.OperatorsV1alpha1().RegisterClusterServiceVersionLister(namespace, informerFactory.Operators().V1alpha1().ClusterServiceVersions().Lister()) resolver := NewOperatorsV1alpha1Resolver(lister, clientFake) - querier := NewFakeSourceQuerier(map[CatalogKey][]*opregistry.Bundle{catalog: tt.bundlesInCatalog}) + querier := NewFakeSourceQuerier(map[CatalogKey][]*api.Bundle{catalog: tt.bundlesInCatalog}) steps, subs, err := resolver.ResolveSteps(namespace, querier) require.Equal(t, tt.out.err, err) RequireStepsEqual(t, expectedSteps, steps) @@ -549,7 +550,7 @@ func existingOperator(namespace, operatorName, pkg, channel, replaces string, pr return csv } -func bundleSteps(bundle *opregistry.Bundle, ns, replaces string, catalog CatalogKey) []*v1alpha1.Step { +func bundleSteps(bundle *api.Bundle, ns, replaces string, catalog CatalogKey) []*v1alpha1.Step { if replaces == "" { csv, _ := V1alpha1CSVFromBundle(bundle) replaces = csv.Spec.Replaces @@ -562,7 +563,7 @@ func bundleSteps(bundle *opregistry.Bundle, ns, replaces string, catalog Catalog steps := make([]*v1alpha1.Step, 0) for _, sr := range stepresources { steps = append(steps, &v1alpha1.Step{ - Resolving: bundle.Name, + Resolving: bundle.CsvName, Resource: sr, Status: v1alpha1.StepStatusUnknown, }) diff --git a/pkg/controller/registry/resolver/steps.go b/pkg/controller/registry/resolver/steps.go index cca9d408233..3cec04f01f4 100644 --- a/pkg/controller/registry/resolver/steps.go +++ b/pkg/controller/registry/resolver/steps.go @@ -2,14 +2,17 @@ package resolver import ( "bytes" + "encoding/json" "fmt" "strings" - "github.com/operator-framework/operator-registry/pkg/registry" + "github.com/operator-framework/operator-registry/pkg/api" extScheme "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" k8sjson "k8s.io/apimachinery/pkg/runtime/serializer/json" + "k8s.io/apimachinery/pkg/util/yaml" k8sscheme "k8s.io/client-go/kubernetes/scheme" "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" @@ -89,20 +92,15 @@ func NewSubscriptionStepResource(namespace string, info OperatorSourceInfo) (v1a }, info.Catalog.Name, info.Catalog.Namespace) } -func V1alpha1CSVFromBundle(bundle *registry.Bundle) (*v1alpha1.ClusterServiceVersion, error) { - for _, o := range bundle.Objects { - if o.GetObjectKind().GroupVersionKind().Kind == "ClusterServiceVersion" { - csv := &v1alpha1.ClusterServiceVersion{} - if err := runtime.DefaultUnstructuredConverter.FromUnstructured(o.UnstructuredContent(), csv); err != nil { - return nil, err - } - return csv, nil - } +func V1alpha1CSVFromBundle(bundle *api.Bundle) (*v1alpha1.ClusterServiceVersion, error) { + csv := &v1alpha1.ClusterServiceVersion{} + if err := json.Unmarshal([]byte(bundle.CsvJson), csv); err != nil { + return nil, err } - return nil, fmt.Errorf("no csv found in bundle") + return csv, nil } -func NewStepResourceFromBundle(bundle *registry.Bundle, namespace, replaces, catalogSourceName, catalogSourceNamespace string) ([]v1alpha1.StepResource, error) { +func NewStepResourceFromBundle(bundle *api.Bundle, namespace, replaces, catalogSourceName, catalogSourceNamespace string) ([]v1alpha1.StepResource, error) { csv, err := V1alpha1CSVFromBundle(bundle) if err != nil { return nil, err @@ -117,11 +115,17 @@ func NewStepResourceFromBundle(bundle *registry.Bundle, namespace, replaces, cat } steps := []v1alpha1.StepResource{step} - for _, object := range bundle.Objects { - if object.GetObjectKind().GroupVersionKind().Kind == v1alpha1.ClusterServiceVersionKind { + for _, object := range bundle.Object { + dec := yaml.NewYAMLOrJSONDecoder(strings.NewReader(object), 10) + unst := &unstructured.Unstructured{} + if err := dec.Decode(unst); err != nil { + return nil, err + } + + if unst.GetObjectKind().GroupVersionKind().Kind == v1alpha1.ClusterServiceVersionKind { continue } - step, err := NewStepResourceFromObject(object, catalogSourceName, catalogSourceNamespace) + step, err := NewStepResourceFromObject(unst, catalogSourceName, catalogSourceNamespace) if err != nil { return nil, err } diff --git a/pkg/controller/registry/resolver/util_test.go b/pkg/controller/registry/resolver/util_test.go index 8386855a3ab..aa6b3569d35 100644 --- a/pkg/controller/registry/resolver/util_test.go +++ b/pkg/controller/registry/resolver/util_test.go @@ -8,6 +8,7 @@ import ( "testing" "github.com/blang/semver" + "github.com/operator-framework/operator-registry/pkg/api" "github.com/operator-framework/operator-registry/pkg/client" opregistry "github.com/operator-framework/operator-registry/pkg/registry" "github.com/stretchr/testify/require" @@ -71,9 +72,6 @@ func NewFakeOperatorSurface(name, pkg, channel, replaces, src, startingCSV strin requiredAPISet[r] = struct{}{} } b := bundle(name, pkg, channel, replaces, providedCRDAPISet, requiredCRDAPISet, providedAPIServiceAPISet, requiredAPIServiceAPISet) - // force bundle cache to fill - _, _ = b.ClusterServiceVersion() - _, _ = b.CustomResourceDefinitions() return &Operator{ providedAPIs: providedAPISet, @@ -218,25 +216,86 @@ func u(object runtime.Object) *unstructured.Unstructured { return &unstructured.Unstructured{Object: unst} } -func bundle(name, pkg, channel, replaces string, providedCRDs, requiredCRDs, providedAPIServices, requiredAPIServices APISet) *opregistry.Bundle { - bundleObjs := []*unstructured.Unstructured{u(csv(name, replaces, providedCRDs, requiredCRDs, providedAPIServices, requiredAPIServices, nil, nil))} +func apiSetToGVk(crds, apis APISet) (out []*api.GroupVersionKind) { + out = make([]*api.GroupVersionKind, 0) + for a := range crds { + out = append(out, &api.GroupVersionKind{ + Group: a.Group, + Version: a.Version, + Kind: a.Kind, + Plural: a.Plural, + }) + } + for a := range apis { + out = append(out, &api.GroupVersionKind{ + Group: a.Group, + Version: a.Version, + Kind: a.Kind, + Plural: a.Plural, + }) + } + return +} + +func bundle(name, pkg, channel, replaces string, providedCRDs, requiredCRDs, providedAPIServices, requiredAPIServices APISet) *api.Bundle { + csvJson, err := json.Marshal(csv(name, replaces, providedCRDs, requiredCRDs, providedAPIServices, requiredAPIServices, nil, nil)) + if err != nil { + panic(err) + } + + objs := []string{string(csvJson)} for p := range providedCRDs { - bundleObjs = append(bundleObjs, u(crd(p))) + crdJson, err := json.Marshal(crd(p)) + if err != nil { + panic(err) + } + objs = append(objs, string(crdJson)) + } + + return &api.Bundle{ + CsvName: name, + PackageName: pkg, + ChannelName: channel, + CsvJson: string(csvJson), + Object: objs, + ProvidedApis: apiSetToGVk(providedCRDs, providedAPIServices), + RequiredApis: apiSetToGVk(requiredCRDs, requiredAPIServices), } - return opregistry.NewBundle(name, pkg, channel, bundleObjs...) } -func withBundleObject(bundle *opregistry.Bundle, obj *unstructured.Unstructured) *opregistry.Bundle { - bundle.Add(obj) +func withBundleObject(bundle *api.Bundle, obj *unstructured.Unstructured) *api.Bundle { + j, err := json.Marshal(obj) + if err != nil { + panic(err) + } + bundle.Object = append(bundle.Object, string(j)) return bundle } -func bundleWithPermissions(name, pkg, channel, replaces string, providedCRDs, requiredCRDs, providedAPIServices, requiredAPIServices APISet, permissions, clusterPermissions []install.StrategyDeploymentPermissions) *opregistry.Bundle { - bundleObjs := []*unstructured.Unstructured{u(csv(name, replaces, providedCRDs, requiredCRDs, providedAPIServices, requiredAPIServices, permissions, clusterPermissions))} +func bundleWithPermissions(name, pkg, channel, replaces string, providedCRDs, requiredCRDs, providedAPIServices, requiredAPIServices APISet, permissions, clusterPermissions []install.StrategyDeploymentPermissions) *api.Bundle { + csvJson, err := json.Marshal(csv(name, replaces, providedCRDs, requiredCRDs, providedAPIServices, requiredAPIServices, permissions, clusterPermissions)) + if err != nil { + panic(err) + } + + objs := []string{string(csvJson)} for p := range providedCRDs { - bundleObjs = append(bundleObjs, u(crd(p))) + crdJson, err := json.Marshal(crd(p)) + if err != nil { + panic(err) + } + objs = append(objs, string(crdJson)) + } + + return &api.Bundle{ + CsvName: name, + PackageName: pkg, + ChannelName: channel, + CsvJson: string(csvJson), + Object: objs, + ProvidedApis: apiSetToGVk(providedCRDs, providedAPIServices), + RequiredApis: apiSetToGVk(requiredCRDs, requiredAPIServices), } - return opregistry.NewBundle(name, pkg, channel, bundleObjs...) } func withReplaces(operator *Operator, replaces string) *Operator { @@ -244,72 +303,15 @@ func withReplaces(operator *Operator, replaces string) *Operator { return operator } -// TestBundle verifies that the bundle stubbing works as expected -func TestBundleStub(t *testing.T) { - tests := []struct { - name string - bundle *opregistry.Bundle - wantProvidedAPIs APISet - wantRequiredAPIs APISet - }{ - { - name: "RequiredCRDs", - bundle: bundle("depender.v1", "depender", "channel", "", EmptyAPISet(), APISet{opregistry.APIKey{"g", "v", "k", "ks"}: {}}, EmptyAPISet(), EmptyAPISet()), - wantRequiredAPIs: APISet{ - opregistry.APIKey{"g", "v", "k", "ks"}: {}, - }, - }, - { - name: "ProvidedCRDs", - bundle: bundle("provider.v1", "provider", "channel", "", APISet{opregistry.APIKey{"g", "v", "k", "ks"}: {}}, EmptyAPISet(), EmptyAPISet(), EmptyAPISet()), - wantProvidedAPIs: APISet{ - opregistry.APIKey{"g", "v", "k", "ks"}: {}, - }, - }, - { - name: "RequiredAPIs", - bundle: bundle("depender.v1", "depender", "channel", "", EmptyAPISet(), EmptyAPISet(), EmptyAPISet(), APISet{opregistry.APIKey{"g", "v", "k", "ks"}: {}}), - wantRequiredAPIs: APISet{ - opregistry.APIKey{"g", "v", "k", "ks"}: {}, - }, - }, - { - name: "ProvidedAPIs", - bundle: bundle("provider.v1", "provider", "channel", "", EmptyAPISet(), EmptyAPISet(), APISet{opregistry.APIKey{"g", "v", "k", "ks"}: {}}, EmptyAPISet()), - wantProvidedAPIs: APISet{ - opregistry.APIKey{"g", "v", "k", "ks"}: {}, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if tt.wantProvidedAPIs != nil { - provided, err := tt.bundle.ProvidedAPIs() - require.NoError(t, err) - require.EqualValues(t, tt.wantProvidedAPIs, provided) - } - if tt.wantRequiredAPIs != nil { - required, err := tt.bundle.RequiredAPIs() - require.NoError(t, err) - require.EqualValues(t, tt.wantRequiredAPIs, required) - } - }) - } - -} - // NewFakeSourceQuerier builds a querier that talks to fake registry stubs for testing -func NewFakeSourceQuerier(bundlesByCatalog map[CatalogKey][]*opregistry.Bundle) *NamespaceSourceQuerier { +func NewFakeSourceQuerier(bundlesByCatalog map[CatalogKey][]*api.Bundle) *NamespaceSourceQuerier { sources := map[CatalogKey]client.Interface{} for catKey, bundles := range bundlesByCatalog { source := &fakes.FakeInterface{} - source.GetBundleThatProvidesStub = func(ctx context.Context, groupOrName, version, kind string) (*opregistry.Bundle, error) { + source.GetBundleThatProvidesStub = func(ctx context.Context, groupOrName, version, kind string) (*api.Bundle, error) { for _, b := range bundles { - apis, err := b.ProvidedAPIs() - if err != nil { - return nil, err - } - for api := range apis { + apis := b.GetProvidedApis() + for _, api := range apis { if api.Version == version && api.Kind == kind && strings.Contains(groupOrName, api.Group) && strings.Contains(groupOrName, api.Plural) { return b, nil } @@ -318,35 +320,32 @@ func NewFakeSourceQuerier(bundlesByCatalog map[CatalogKey][]*opregistry.Bundle) return nil, fmt.Errorf("no bundle found") } // note: this only allows for one bundle per package/channel, which may be enough for tests - source.GetBundleInPackageChannelStub = func(ctx context.Context, packageName, channelName string) (*opregistry.Bundle, error) { + source.GetBundleInPackageChannelStub = func(ctx context.Context, packageName, channelName string) (*api.Bundle, error) { for _, b := range bundles { - if b.Channel == channelName && b.Package == packageName { + if b.ChannelName == channelName && b.PackageName == packageName { return b, nil } } return nil, fmt.Errorf("no bundle found") } - source.GetBundleStub = func(ctx context.Context, packageName, channelName, csvName string) (*opregistry.Bundle, error) { + source.GetBundleStub = func(ctx context.Context, packageName, channelName, csvName string) (*api.Bundle, error) { for _, b := range bundles { - if b.Channel == channelName && b.Package == packageName && b.Name == csvName { + if b.ChannelName == channelName && b.PackageName == packageName && b.CsvName == csvName { return b, nil } } return nil, fmt.Errorf("no bundle found") } - source.GetReplacementBundleInPackageChannelStub = func(ctx context.Context, bundleName, packageName, channelName string) (*opregistry.Bundle, error) { + source.GetReplacementBundleInPackageChannelStub = func(ctx context.Context, bundleName, packageName, channelName string) (*api.Bundle, error) { for _, b := range bundles { - csv, err := b.ClusterServiceVersion() - if err != nil { - panic(err) - } - replaces, err := csv.GetReplaces() + csv, err := V1alpha1CSVFromBundle(b) if err != nil { panic(err) } - if replaces == bundleName && b.Channel == channelName && b.Package == packageName { + replaces := csv.Spec.Replaces + if replaces == bundleName && b.ChannelName == channelName && b.PackageName == packageName { return b, nil } } @@ -358,19 +357,19 @@ func NewFakeSourceQuerier(bundlesByCatalog map[CatalogKey][]*opregistry.Bundle) } // NewFakeSourceQuerier builds a querier that talks to fake registry stubs for testing -func NewFakeSourceQuerierCustomReplacement(catKey CatalogKey, bundle *opregistry.Bundle) *NamespaceSourceQuerier { +func NewFakeSourceQuerierCustomReplacement(catKey CatalogKey, bundle *api.Bundle) *NamespaceSourceQuerier { sources := map[CatalogKey]client.Interface{} source := &fakes.FakeInterface{} - source.GetBundleThatProvidesStub = func(ctx context.Context, groupOrName, version, kind string) (*opregistry.Bundle, error) { + source.GetBundleThatProvidesStub = func(ctx context.Context, groupOrName, version, kind string) (*api.Bundle, error) { return nil, fmt.Errorf("no bundle found") } - source.GetBundleInPackageChannelStub = func(ctx context.Context, packageName, channelName string) (*opregistry.Bundle, error) { + source.GetBundleInPackageChannelStub = func(ctx context.Context, packageName, channelName string) (*api.Bundle, error) { return nil, fmt.Errorf("no bundle found") } - source.GetBundleStub = func(ctx context.Context, packageName, channelName, csvName string) (*opregistry.Bundle, error) { + source.GetBundleStub = func(ctx context.Context, packageName, channelName, csvName string) (*api.Bundle, error) { return nil, fmt.Errorf("no bundle found") } - source.GetReplacementBundleInPackageChannelStub = func(ctx context.Context, bundleName, packageName, channelName string) (*opregistry.Bundle, error) { + source.GetReplacementBundleInPackageChannelStub = func(ctx context.Context, bundleName, packageName, channelName string) (*api.Bundle, error) { return bundle, nil } sources[catKey] = source diff --git a/pkg/fakes/fake_api_intersection_reconciler.go b/pkg/fakes/fake_api_intersection_reconciler.go index 7ce13e21a8a..f67ba401da9 100644 --- a/pkg/fakes/fake_api_intersection_reconciler.go +++ b/pkg/fakes/fake_api_intersection_reconciler.go @@ -2,9 +2,9 @@ package fakes import ( - "sync" + sync "sync" - "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver" + resolver "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver" ) type FakeAPIIntersectionReconciler struct { diff --git a/pkg/fakes/fake_reconciler.go b/pkg/fakes/fake_reconciler.go index 86122c6478e..d5231cf3b4d 100644 --- a/pkg/fakes/fake_reconciler.go +++ b/pkg/fakes/fake_reconciler.go @@ -2,10 +2,10 @@ package fakes import ( - "sync" + sync "sync" - "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" - "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/reconciler" + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + reconciler "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/reconciler" ) type FakeRegistryReconciler struct { diff --git a/pkg/fakes/fake_reconciler_factory.go b/pkg/fakes/fake_reconciler_factory.go index 1558050f573..c28842cef12 100644 --- a/pkg/fakes/fake_reconciler_factory.go +++ b/pkg/fakes/fake_reconciler_factory.go @@ -2,10 +2,10 @@ package fakes import ( - "sync" + sync "sync" - "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" - "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/reconciler" + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + reconciler "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/reconciler" ) type FakeRegistryReconcilerFactory struct { diff --git a/pkg/fakes/fake_registry_store.go b/pkg/fakes/fake_registry_store.go index 3aa1bbd0141..a435ed4d078 100644 --- a/pkg/fakes/fake_registry_store.go +++ b/pkg/fakes/fake_registry_store.go @@ -5,11 +5,28 @@ import ( context "context" sync "sync" + api "github.com/operator-framework/operator-registry/pkg/api" registry "github.com/operator-framework/operator-registry/pkg/registry" ) type FakeQuery struct { - GetBundleStub func(context.Context, string, string, string) (string, error) + GetApisForEntryStub func(context.Context, int64) ([]*api.GroupVersionKind, []*api.GroupVersionKind, error) + getApisForEntryMutex sync.RWMutex + getApisForEntryArgsForCall []struct { + arg1 context.Context + arg2 int64 + } + getApisForEntryReturns struct { + result1 []*api.GroupVersionKind + result2 []*api.GroupVersionKind + result3 error + } + getApisForEntryReturnsOnCall map[int]struct { + result1 []*api.GroupVersionKind + result2 []*api.GroupVersionKind + result3 error + } + GetBundleStub func(context.Context, string, string, string) (*api.Bundle, error) getBundleMutex sync.RWMutex getBundleArgsForCall []struct { arg1 context.Context @@ -18,14 +35,14 @@ type FakeQuery struct { arg4 string } getBundleReturns struct { - result1 string + result1 *api.Bundle result2 error } getBundleReturnsOnCall map[int]struct { - result1 string + result1 *api.Bundle result2 error } - GetBundleForChannelStub func(context.Context, string, string) (string, error) + GetBundleForChannelStub func(context.Context, string, string) (*api.Bundle, error) getBundleForChannelMutex sync.RWMutex getBundleForChannelArgsForCall []struct { arg1 context.Context @@ -33,14 +50,14 @@ type FakeQuery struct { arg3 string } getBundleForChannelReturns struct { - result1 string + result1 *api.Bundle result2 error } getBundleForChannelReturnsOnCall map[int]struct { - result1 string + result1 *api.Bundle result2 error } - GetBundleThatProvidesStub func(context.Context, string, string, string) (string, *registry.ChannelEntry, error) + GetBundleThatProvidesStub func(context.Context, string, string, string) (*api.Bundle, error) getBundleThatProvidesMutex sync.RWMutex getBundleThatProvidesArgsForCall []struct { arg1 context.Context @@ -49,16 +66,14 @@ type FakeQuery struct { arg4 string } getBundleThatProvidesReturns struct { - result1 string - result2 *registry.ChannelEntry - result3 error + result1 *api.Bundle + result2 error } getBundleThatProvidesReturnsOnCall map[int]struct { - result1 string - result2 *registry.ChannelEntry - result3 error + result1 *api.Bundle + result2 error } - GetBundleThatReplacesStub func(context.Context, string, string, string) (string, error) + GetBundleThatReplacesStub func(context.Context, string, string, string) (*api.Bundle, error) getBundleThatReplacesMutex sync.RWMutex getBundleThatReplacesArgsForCall []struct { arg1 context.Context @@ -67,11 +82,11 @@ type FakeQuery struct { arg4 string } getBundleThatReplacesReturns struct { - result1 string + result1 *api.Bundle result2 error } getBundleThatReplacesReturnsOnCall map[int]struct { - result1 string + result1 *api.Bundle result2 error } GetChannelEntriesThatProvideStub func(context.Context, string, string, string) ([]*registry.ChannelEntry, error) @@ -104,6 +119,20 @@ type FakeQuery struct { result1 []*registry.ChannelEntry result2 error } + GetImagesForBundleStub func(context.Context, string) ([]string, error) + getImagesForBundleMutex sync.RWMutex + getImagesForBundleArgsForCall []struct { + arg1 context.Context + arg2 string + } + getImagesForBundleReturns struct { + result1 []string + result2 error + } + getImagesForBundleReturnsOnCall map[int]struct { + result1 []string + result2 error + } GetLatestChannelEntriesThatProvideStub func(context.Context, string, string, string) ([]*registry.ChannelEntry, error) getLatestChannelEntriesThatProvideMutex sync.RWMutex getLatestChannelEntriesThatProvideArgsForCall []struct { @@ -134,6 +163,19 @@ type FakeQuery struct { result1 *registry.PackageManifest result2 error } + ListImagesStub func(context.Context) ([]string, error) + listImagesMutex sync.RWMutex + listImagesArgsForCall []struct { + arg1 context.Context + } + listImagesReturns struct { + result1 []string + result2 error + } + listImagesReturnsOnCall map[int]struct { + result1 []string + result2 error + } ListPackagesStub func(context.Context) ([]string, error) listPackagesMutex sync.RWMutex listPackagesArgsForCall []struct { @@ -164,7 +206,74 @@ type FakeQuery struct { invocationsMutex sync.RWMutex } -func (fake *FakeQuery) GetBundle(arg1 context.Context, arg2 string, arg3 string, arg4 string) (string, error) { +func (fake *FakeQuery) GetApisForEntry(arg1 context.Context, arg2 int64) ([]*api.GroupVersionKind, []*api.GroupVersionKind, error) { + fake.getApisForEntryMutex.Lock() + ret, specificReturn := fake.getApisForEntryReturnsOnCall[len(fake.getApisForEntryArgsForCall)] + fake.getApisForEntryArgsForCall = append(fake.getApisForEntryArgsForCall, struct { + arg1 context.Context + arg2 int64 + }{arg1, arg2}) + fake.recordInvocation("GetApisForEntry", []interface{}{arg1, arg2}) + fake.getApisForEntryMutex.Unlock() + if fake.GetApisForEntryStub != nil { + return fake.GetApisForEntryStub(arg1, arg2) + } + if specificReturn { + return ret.result1, ret.result2, ret.result3 + } + fakeReturns := fake.getApisForEntryReturns + return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 +} + +func (fake *FakeQuery) GetApisForEntryCallCount() int { + fake.getApisForEntryMutex.RLock() + defer fake.getApisForEntryMutex.RUnlock() + return len(fake.getApisForEntryArgsForCall) +} + +func (fake *FakeQuery) GetApisForEntryCalls(stub func(context.Context, int64) ([]*api.GroupVersionKind, []*api.GroupVersionKind, error)) { + fake.getApisForEntryMutex.Lock() + defer fake.getApisForEntryMutex.Unlock() + fake.GetApisForEntryStub = stub +} + +func (fake *FakeQuery) GetApisForEntryArgsForCall(i int) (context.Context, int64) { + fake.getApisForEntryMutex.RLock() + defer fake.getApisForEntryMutex.RUnlock() + argsForCall := fake.getApisForEntryArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *FakeQuery) GetApisForEntryReturns(result1 []*api.GroupVersionKind, result2 []*api.GroupVersionKind, result3 error) { + fake.getApisForEntryMutex.Lock() + defer fake.getApisForEntryMutex.Unlock() + fake.GetApisForEntryStub = nil + fake.getApisForEntryReturns = struct { + result1 []*api.GroupVersionKind + result2 []*api.GroupVersionKind + result3 error + }{result1, result2, result3} +} + +func (fake *FakeQuery) GetApisForEntryReturnsOnCall(i int, result1 []*api.GroupVersionKind, result2 []*api.GroupVersionKind, result3 error) { + fake.getApisForEntryMutex.Lock() + defer fake.getApisForEntryMutex.Unlock() + fake.GetApisForEntryStub = nil + if fake.getApisForEntryReturnsOnCall == nil { + fake.getApisForEntryReturnsOnCall = make(map[int]struct { + result1 []*api.GroupVersionKind + result2 []*api.GroupVersionKind + result3 error + }) + } + fake.getApisForEntryReturnsOnCall[i] = struct { + result1 []*api.GroupVersionKind + result2 []*api.GroupVersionKind + result3 error + }{result1, result2, result3} +} + +func (fake *FakeQuery) GetBundle(arg1 context.Context, arg2 string, arg3 string, arg4 string) (*api.Bundle, error) { fake.getBundleMutex.Lock() ret, specificReturn := fake.getBundleReturnsOnCall[len(fake.getBundleArgsForCall)] fake.getBundleArgsForCall = append(fake.getBundleArgsForCall, struct { @@ -191,7 +300,7 @@ func (fake *FakeQuery) GetBundleCallCount() int { return len(fake.getBundleArgsForCall) } -func (fake *FakeQuery) GetBundleCalls(stub func(context.Context, string, string, string) (string, error)) { +func (fake *FakeQuery) GetBundleCalls(stub func(context.Context, string, string, string) (*api.Bundle, error)) { fake.getBundleMutex.Lock() defer fake.getBundleMutex.Unlock() fake.GetBundleStub = stub @@ -204,33 +313,33 @@ func (fake *FakeQuery) GetBundleArgsForCall(i int) (context.Context, string, str return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 } -func (fake *FakeQuery) GetBundleReturns(result1 string, result2 error) { +func (fake *FakeQuery) GetBundleReturns(result1 *api.Bundle, result2 error) { fake.getBundleMutex.Lock() defer fake.getBundleMutex.Unlock() fake.GetBundleStub = nil fake.getBundleReturns = struct { - result1 string + result1 *api.Bundle result2 error }{result1, result2} } -func (fake *FakeQuery) GetBundleReturnsOnCall(i int, result1 string, result2 error) { +func (fake *FakeQuery) GetBundleReturnsOnCall(i int, result1 *api.Bundle, result2 error) { fake.getBundleMutex.Lock() defer fake.getBundleMutex.Unlock() fake.GetBundleStub = nil if fake.getBundleReturnsOnCall == nil { fake.getBundleReturnsOnCall = make(map[int]struct { - result1 string + result1 *api.Bundle result2 error }) } fake.getBundleReturnsOnCall[i] = struct { - result1 string + result1 *api.Bundle result2 error }{result1, result2} } -func (fake *FakeQuery) GetBundleForChannel(arg1 context.Context, arg2 string, arg3 string) (string, error) { +func (fake *FakeQuery) GetBundleForChannel(arg1 context.Context, arg2 string, arg3 string) (*api.Bundle, error) { fake.getBundleForChannelMutex.Lock() ret, specificReturn := fake.getBundleForChannelReturnsOnCall[len(fake.getBundleForChannelArgsForCall)] fake.getBundleForChannelArgsForCall = append(fake.getBundleForChannelArgsForCall, struct { @@ -256,7 +365,7 @@ func (fake *FakeQuery) GetBundleForChannelCallCount() int { return len(fake.getBundleForChannelArgsForCall) } -func (fake *FakeQuery) GetBundleForChannelCalls(stub func(context.Context, string, string) (string, error)) { +func (fake *FakeQuery) GetBundleForChannelCalls(stub func(context.Context, string, string) (*api.Bundle, error)) { fake.getBundleForChannelMutex.Lock() defer fake.getBundleForChannelMutex.Unlock() fake.GetBundleForChannelStub = stub @@ -269,33 +378,33 @@ func (fake *FakeQuery) GetBundleForChannelArgsForCall(i int) (context.Context, s return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 } -func (fake *FakeQuery) GetBundleForChannelReturns(result1 string, result2 error) { +func (fake *FakeQuery) GetBundleForChannelReturns(result1 *api.Bundle, result2 error) { fake.getBundleForChannelMutex.Lock() defer fake.getBundleForChannelMutex.Unlock() fake.GetBundleForChannelStub = nil fake.getBundleForChannelReturns = struct { - result1 string + result1 *api.Bundle result2 error }{result1, result2} } -func (fake *FakeQuery) GetBundleForChannelReturnsOnCall(i int, result1 string, result2 error) { +func (fake *FakeQuery) GetBundleForChannelReturnsOnCall(i int, result1 *api.Bundle, result2 error) { fake.getBundleForChannelMutex.Lock() defer fake.getBundleForChannelMutex.Unlock() fake.GetBundleForChannelStub = nil if fake.getBundleForChannelReturnsOnCall == nil { fake.getBundleForChannelReturnsOnCall = make(map[int]struct { - result1 string + result1 *api.Bundle result2 error }) } fake.getBundleForChannelReturnsOnCall[i] = struct { - result1 string + result1 *api.Bundle result2 error }{result1, result2} } -func (fake *FakeQuery) GetBundleThatProvides(arg1 context.Context, arg2 string, arg3 string, arg4 string) (string, *registry.ChannelEntry, error) { +func (fake *FakeQuery) GetBundleThatProvides(arg1 context.Context, arg2 string, arg3 string, arg4 string) (*api.Bundle, error) { fake.getBundleThatProvidesMutex.Lock() ret, specificReturn := fake.getBundleThatProvidesReturnsOnCall[len(fake.getBundleThatProvidesArgsForCall)] fake.getBundleThatProvidesArgsForCall = append(fake.getBundleThatProvidesArgsForCall, struct { @@ -310,10 +419,10 @@ func (fake *FakeQuery) GetBundleThatProvides(arg1 context.Context, arg2 string, return fake.GetBundleThatProvidesStub(arg1, arg2, arg3, arg4) } if specificReturn { - return ret.result1, ret.result2, ret.result3 + return ret.result1, ret.result2 } fakeReturns := fake.getBundleThatProvidesReturns - return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 + return fakeReturns.result1, fakeReturns.result2 } func (fake *FakeQuery) GetBundleThatProvidesCallCount() int { @@ -322,7 +431,7 @@ func (fake *FakeQuery) GetBundleThatProvidesCallCount() int { return len(fake.getBundleThatProvidesArgsForCall) } -func (fake *FakeQuery) GetBundleThatProvidesCalls(stub func(context.Context, string, string, string) (string, *registry.ChannelEntry, error)) { +func (fake *FakeQuery) GetBundleThatProvidesCalls(stub func(context.Context, string, string, string) (*api.Bundle, error)) { fake.getBundleThatProvidesMutex.Lock() defer fake.getBundleThatProvidesMutex.Unlock() fake.GetBundleThatProvidesStub = stub @@ -335,36 +444,33 @@ func (fake *FakeQuery) GetBundleThatProvidesArgsForCall(i int) (context.Context, return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 } -func (fake *FakeQuery) GetBundleThatProvidesReturns(result1 string, result2 *registry.ChannelEntry, result3 error) { +func (fake *FakeQuery) GetBundleThatProvidesReturns(result1 *api.Bundle, result2 error) { fake.getBundleThatProvidesMutex.Lock() defer fake.getBundleThatProvidesMutex.Unlock() fake.GetBundleThatProvidesStub = nil fake.getBundleThatProvidesReturns = struct { - result1 string - result2 *registry.ChannelEntry - result3 error - }{result1, result2, result3} + result1 *api.Bundle + result2 error + }{result1, result2} } -func (fake *FakeQuery) GetBundleThatProvidesReturnsOnCall(i int, result1 string, result2 *registry.ChannelEntry, result3 error) { +func (fake *FakeQuery) GetBundleThatProvidesReturnsOnCall(i int, result1 *api.Bundle, result2 error) { fake.getBundleThatProvidesMutex.Lock() defer fake.getBundleThatProvidesMutex.Unlock() fake.GetBundleThatProvidesStub = nil if fake.getBundleThatProvidesReturnsOnCall == nil { fake.getBundleThatProvidesReturnsOnCall = make(map[int]struct { - result1 string - result2 *registry.ChannelEntry - result3 error + result1 *api.Bundle + result2 error }) } fake.getBundleThatProvidesReturnsOnCall[i] = struct { - result1 string - result2 *registry.ChannelEntry - result3 error - }{result1, result2, result3} + result1 *api.Bundle + result2 error + }{result1, result2} } -func (fake *FakeQuery) GetBundleThatReplaces(arg1 context.Context, arg2 string, arg3 string, arg4 string) (string, error) { +func (fake *FakeQuery) GetBundleThatReplaces(arg1 context.Context, arg2 string, arg3 string, arg4 string) (*api.Bundle, error) { fake.getBundleThatReplacesMutex.Lock() ret, specificReturn := fake.getBundleThatReplacesReturnsOnCall[len(fake.getBundleThatReplacesArgsForCall)] fake.getBundleThatReplacesArgsForCall = append(fake.getBundleThatReplacesArgsForCall, struct { @@ -391,7 +497,7 @@ func (fake *FakeQuery) GetBundleThatReplacesCallCount() int { return len(fake.getBundleThatReplacesArgsForCall) } -func (fake *FakeQuery) GetBundleThatReplacesCalls(stub func(context.Context, string, string, string) (string, error)) { +func (fake *FakeQuery) GetBundleThatReplacesCalls(stub func(context.Context, string, string, string) (*api.Bundle, error)) { fake.getBundleThatReplacesMutex.Lock() defer fake.getBundleThatReplacesMutex.Unlock() fake.GetBundleThatReplacesStub = stub @@ -404,28 +510,28 @@ func (fake *FakeQuery) GetBundleThatReplacesArgsForCall(i int) (context.Context, return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 } -func (fake *FakeQuery) GetBundleThatReplacesReturns(result1 string, result2 error) { +func (fake *FakeQuery) GetBundleThatReplacesReturns(result1 *api.Bundle, result2 error) { fake.getBundleThatReplacesMutex.Lock() defer fake.getBundleThatReplacesMutex.Unlock() fake.GetBundleThatReplacesStub = nil fake.getBundleThatReplacesReturns = struct { - result1 string + result1 *api.Bundle result2 error }{result1, result2} } -func (fake *FakeQuery) GetBundleThatReplacesReturnsOnCall(i int, result1 string, result2 error) { +func (fake *FakeQuery) GetBundleThatReplacesReturnsOnCall(i int, result1 *api.Bundle, result2 error) { fake.getBundleThatReplacesMutex.Lock() defer fake.getBundleThatReplacesMutex.Unlock() fake.GetBundleThatReplacesStub = nil if fake.getBundleThatReplacesReturnsOnCall == nil { fake.getBundleThatReplacesReturnsOnCall = make(map[int]struct { - result1 string + result1 *api.Bundle result2 error }) } fake.getBundleThatReplacesReturnsOnCall[i] = struct { - result1 string + result1 *api.Bundle result2 error }{result1, result2} } @@ -560,6 +666,70 @@ func (fake *FakeQuery) GetChannelEntriesThatReplaceReturnsOnCall(i int, result1 }{result1, result2} } +func (fake *FakeQuery) GetImagesForBundle(arg1 context.Context, arg2 string) ([]string, error) { + fake.getImagesForBundleMutex.Lock() + ret, specificReturn := fake.getImagesForBundleReturnsOnCall[len(fake.getImagesForBundleArgsForCall)] + fake.getImagesForBundleArgsForCall = append(fake.getImagesForBundleArgsForCall, struct { + arg1 context.Context + arg2 string + }{arg1, arg2}) + fake.recordInvocation("GetImagesForBundle", []interface{}{arg1, arg2}) + fake.getImagesForBundleMutex.Unlock() + if fake.GetImagesForBundleStub != nil { + return fake.GetImagesForBundleStub(arg1, arg2) + } + if specificReturn { + return ret.result1, ret.result2 + } + fakeReturns := fake.getImagesForBundleReturns + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *FakeQuery) GetImagesForBundleCallCount() int { + fake.getImagesForBundleMutex.RLock() + defer fake.getImagesForBundleMutex.RUnlock() + return len(fake.getImagesForBundleArgsForCall) +} + +func (fake *FakeQuery) GetImagesForBundleCalls(stub func(context.Context, string) ([]string, error)) { + fake.getImagesForBundleMutex.Lock() + defer fake.getImagesForBundleMutex.Unlock() + fake.GetImagesForBundleStub = stub +} + +func (fake *FakeQuery) GetImagesForBundleArgsForCall(i int) (context.Context, string) { + fake.getImagesForBundleMutex.RLock() + defer fake.getImagesForBundleMutex.RUnlock() + argsForCall := fake.getImagesForBundleArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *FakeQuery) GetImagesForBundleReturns(result1 []string, result2 error) { + fake.getImagesForBundleMutex.Lock() + defer fake.getImagesForBundleMutex.Unlock() + fake.GetImagesForBundleStub = nil + fake.getImagesForBundleReturns = struct { + result1 []string + result2 error + }{result1, result2} +} + +func (fake *FakeQuery) GetImagesForBundleReturnsOnCall(i int, result1 []string, result2 error) { + fake.getImagesForBundleMutex.Lock() + defer fake.getImagesForBundleMutex.Unlock() + fake.GetImagesForBundleStub = nil + if fake.getImagesForBundleReturnsOnCall == nil { + fake.getImagesForBundleReturnsOnCall = make(map[int]struct { + result1 []string + result2 error + }) + } + fake.getImagesForBundleReturnsOnCall[i] = struct { + result1 []string + result2 error + }{result1, result2} +} + func (fake *FakeQuery) GetLatestChannelEntriesThatProvide(arg1 context.Context, arg2 string, arg3 string, arg4 string) ([]*registry.ChannelEntry, error) { fake.getLatestChannelEntriesThatProvideMutex.Lock() ret, specificReturn := fake.getLatestChannelEntriesThatProvideReturnsOnCall[len(fake.getLatestChannelEntriesThatProvideArgsForCall)] @@ -690,6 +860,69 @@ func (fake *FakeQuery) GetPackageReturnsOnCall(i int, result1 *registry.PackageM }{result1, result2} } +func (fake *FakeQuery) ListImages(arg1 context.Context) ([]string, error) { + fake.listImagesMutex.Lock() + ret, specificReturn := fake.listImagesReturnsOnCall[len(fake.listImagesArgsForCall)] + fake.listImagesArgsForCall = append(fake.listImagesArgsForCall, struct { + arg1 context.Context + }{arg1}) + fake.recordInvocation("ListImages", []interface{}{arg1}) + fake.listImagesMutex.Unlock() + if fake.ListImagesStub != nil { + return fake.ListImagesStub(arg1) + } + if specificReturn { + return ret.result1, ret.result2 + } + fakeReturns := fake.listImagesReturns + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *FakeQuery) ListImagesCallCount() int { + fake.listImagesMutex.RLock() + defer fake.listImagesMutex.RUnlock() + return len(fake.listImagesArgsForCall) +} + +func (fake *FakeQuery) ListImagesCalls(stub func(context.Context) ([]string, error)) { + fake.listImagesMutex.Lock() + defer fake.listImagesMutex.Unlock() + fake.ListImagesStub = stub +} + +func (fake *FakeQuery) ListImagesArgsForCall(i int) context.Context { + fake.listImagesMutex.RLock() + defer fake.listImagesMutex.RUnlock() + argsForCall := fake.listImagesArgsForCall[i] + return argsForCall.arg1 +} + +func (fake *FakeQuery) ListImagesReturns(result1 []string, result2 error) { + fake.listImagesMutex.Lock() + defer fake.listImagesMutex.Unlock() + fake.ListImagesStub = nil + fake.listImagesReturns = struct { + result1 []string + result2 error + }{result1, result2} +} + +func (fake *FakeQuery) ListImagesReturnsOnCall(i int, result1 []string, result2 error) { + fake.listImagesMutex.Lock() + defer fake.listImagesMutex.Unlock() + fake.ListImagesStub = nil + if fake.listImagesReturnsOnCall == nil { + fake.listImagesReturnsOnCall = make(map[int]struct { + result1 []string + result2 error + }) + } + fake.listImagesReturnsOnCall[i] = struct { + result1 []string + result2 error + }{result1, result2} +} + func (fake *FakeQuery) ListPackages(arg1 context.Context) ([]string, error) { fake.listPackagesMutex.Lock() ret, specificReturn := fake.listPackagesReturnsOnCall[len(fake.listPackagesArgsForCall)] @@ -819,6 +1052,8 @@ func (fake *FakeQuery) ListTablesReturnsOnCall(i int, result1 []string, result2 func (fake *FakeQuery) Invocations() map[string][][]interface{} { fake.invocationsMutex.RLock() defer fake.invocationsMutex.RUnlock() + fake.getApisForEntryMutex.RLock() + defer fake.getApisForEntryMutex.RUnlock() fake.getBundleMutex.RLock() defer fake.getBundleMutex.RUnlock() fake.getBundleForChannelMutex.RLock() @@ -831,10 +1066,14 @@ func (fake *FakeQuery) Invocations() map[string][][]interface{} { defer fake.getChannelEntriesThatProvideMutex.RUnlock() fake.getChannelEntriesThatReplaceMutex.RLock() defer fake.getChannelEntriesThatReplaceMutex.RUnlock() + fake.getImagesForBundleMutex.RLock() + defer fake.getImagesForBundleMutex.RUnlock() fake.getLatestChannelEntriesThatProvideMutex.RLock() defer fake.getLatestChannelEntriesThatProvideMutex.RUnlock() fake.getPackageMutex.RLock() defer fake.getPackageMutex.RUnlock() + fake.listImagesMutex.RLock() + defer fake.listImagesMutex.RUnlock() fake.listPackagesMutex.RLock() defer fake.listPackagesMutex.RUnlock() fake.listTablesMutex.RLock() diff --git a/pkg/fakes/fake_resolver.go b/pkg/fakes/fake_resolver.go index 24af4b8eb1d..52e00eca27a 100644 --- a/pkg/fakes/fake_resolver.go +++ b/pkg/fakes/fake_resolver.go @@ -2,10 +2,10 @@ package fakes import ( - "sync" + sync "sync" - "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" - "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver" + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + resolver "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver" ) type FakeResolver struct { diff --git a/pkg/fakes/fake_strategy.go b/pkg/fakes/fake_strategy.go index e7653a5d0fc..e0816cd2547 100644 --- a/pkg/fakes/fake_strategy.go +++ b/pkg/fakes/fake_strategy.go @@ -2,9 +2,9 @@ package fakes import ( - "sync" + sync "sync" - "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install" + install "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install" ) type FakeStrategy struct { diff --git a/pkg/fakes/fake_strategy_installer.go b/pkg/fakes/fake_strategy_installer.go index e3e5ab65711..eacb2e27d30 100644 --- a/pkg/fakes/fake_strategy_installer.go +++ b/pkg/fakes/fake_strategy_installer.go @@ -2,9 +2,9 @@ package fakes import ( - "sync" + sync "sync" - "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install" + install "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install" ) type FakeStrategyInstaller struct { diff --git a/pkg/fakes/fake_strategy_resolver.go b/pkg/fakes/fake_strategy_resolver.go index 1315e2adbd4..17f60a9a6a1 100644 --- a/pkg/fakes/fake_strategy_resolver.go +++ b/pkg/fakes/fake_strategy_resolver.go @@ -2,13 +2,13 @@ package fakes import ( - "sync" + sync "sync" - "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" - "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install" - "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient" - "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" - "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil" + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + install "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install" + operatorclient "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient" + operatorlister "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" + ownerutil "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil" ) type FakeStrategyResolverInterface struct { diff --git a/pkg/lib/operatorlister/operatorlisterfakes/fake_apiextensions_v1beta1lister.go b/pkg/lib/operatorlister/operatorlisterfakes/fake_apiextensions_v1beta1lister.go index a691dfec846..536cd24715d 100644 --- a/pkg/lib/operatorlister/operatorlisterfakes/fake_apiextensions_v1beta1lister.go +++ b/pkg/lib/operatorlister/operatorlisterfakes/fake_apiextensions_v1beta1lister.go @@ -2,10 +2,10 @@ package operatorlisterfakes import ( - "sync" + sync "sync" - "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" - "k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1" + operatorlister "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" + v1beta1 "k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1" ) type FakeAPIExtensionsV1beta1Lister struct { diff --git a/pkg/lib/operatorlister/operatorlisterfakes/fake_apiregistration_v1lister.go b/pkg/lib/operatorlister/operatorlisterfakes/fake_apiregistration_v1lister.go index edd9834b6c6..a27e12b40fd 100644 --- a/pkg/lib/operatorlister/operatorlisterfakes/fake_apiregistration_v1lister.go +++ b/pkg/lib/operatorlister/operatorlisterfakes/fake_apiregistration_v1lister.go @@ -2,9 +2,9 @@ package operatorlisterfakes import ( - "sync" + sync "sync" - "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" + operatorlister "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" v1 "k8s.io/kube-aggregator/pkg/client/listers/apiregistration/v1" ) diff --git a/pkg/lib/operatorlister/operatorlisterfakes/fake_apps_v1lister.go b/pkg/lib/operatorlister/operatorlisterfakes/fake_apps_v1lister.go index b40fa7c1479..eb4224e2c77 100644 --- a/pkg/lib/operatorlister/operatorlisterfakes/fake_apps_v1lister.go +++ b/pkg/lib/operatorlister/operatorlisterfakes/fake_apps_v1lister.go @@ -2,9 +2,9 @@ package operatorlisterfakes import ( - "sync" + sync "sync" - "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" + operatorlister "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" v1 "k8s.io/client-go/listers/apps/v1" ) diff --git a/pkg/lib/operatorlister/operatorlisterfakes/fake_core_v1lister.go b/pkg/lib/operatorlister/operatorlisterfakes/fake_core_v1lister.go index f4ecad035c5..5c3505da572 100644 --- a/pkg/lib/operatorlister/operatorlisterfakes/fake_core_v1lister.go +++ b/pkg/lib/operatorlister/operatorlisterfakes/fake_core_v1lister.go @@ -2,9 +2,9 @@ package operatorlisterfakes import ( - "sync" + sync "sync" - "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" + operatorlister "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" v1 "k8s.io/client-go/listers/core/v1" ) diff --git a/pkg/lib/operatorlister/operatorlisterfakes/fake_operator_lister.go b/pkg/lib/operatorlister/operatorlisterfakes/fake_operator_lister.go index 9173faefbbd..9f90da69e1c 100644 --- a/pkg/lib/operatorlister/operatorlisterfakes/fake_operator_lister.go +++ b/pkg/lib/operatorlister/operatorlisterfakes/fake_operator_lister.go @@ -2,9 +2,9 @@ package operatorlisterfakes import ( - "sync" + sync "sync" - "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" + operatorlister "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" ) type FakeOperatorLister struct { diff --git a/pkg/lib/operatorlister/operatorlisterfakes/fake_operators_v1alpha1lister.go b/pkg/lib/operatorlister/operatorlisterfakes/fake_operators_v1alpha1lister.go index 4885d924b2b..81d47416de0 100644 --- a/pkg/lib/operatorlister/operatorlisterfakes/fake_operators_v1alpha1lister.go +++ b/pkg/lib/operatorlister/operatorlisterfakes/fake_operators_v1alpha1lister.go @@ -2,10 +2,10 @@ package operatorlisterfakes import ( - "sync" + sync "sync" - "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1" - "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1" + operatorlister "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" ) type FakeOperatorsV1alpha1Lister struct { diff --git a/pkg/lib/operatorlister/operatorlisterfakes/fake_operators_v1lister.go b/pkg/lib/operatorlister/operatorlisterfakes/fake_operators_v1lister.go index e6e6c91e968..4f2df0684b8 100644 --- a/pkg/lib/operatorlister/operatorlisterfakes/fake_operators_v1lister.go +++ b/pkg/lib/operatorlister/operatorlisterfakes/fake_operators_v1lister.go @@ -2,10 +2,10 @@ package operatorlisterfakes import ( - "sync" + sync "sync" v1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1" - "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" + operatorlister "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" ) type FakeOperatorsV1Lister struct { diff --git a/pkg/lib/operatorlister/operatorlisterfakes/fake_rbac_v1lister.go b/pkg/lib/operatorlister/operatorlisterfakes/fake_rbac_v1lister.go index 051aa64737c..171d5d7b9ee 100644 --- a/pkg/lib/operatorlister/operatorlisterfakes/fake_rbac_v1lister.go +++ b/pkg/lib/operatorlister/operatorlisterfakes/fake_rbac_v1lister.go @@ -2,9 +2,9 @@ package operatorlisterfakes import ( - "sync" + sync "sync" - "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" + operatorlister "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" v1 "k8s.io/client-go/listers/rbac/v1" ) diff --git a/pkg/package-server/provider/registry_test.go b/pkg/package-server/provider/registry_test.go index d2dba1950dd..d6d1dead456 100644 --- a/pkg/package-server/provider/registry_test.go +++ b/pkg/package-server/provider/registry_test.go @@ -4,6 +4,7 @@ package provider import ( "context" + "database/sql" "encoding/json" "fmt" "io" @@ -45,16 +46,22 @@ func server() { } s := grpc.NewServer() - load, err := sqlite.NewSQLLiteLoader(dbName) + db, err := sql.Open("sqlite3", dbName) + load, err := sqlite.NewSQLLiteLoader(db) if err != nil { logrus.Fatal(err) } + if err := load.Migrate(context.TODO()); err != nil { + logrus.Fatal(err) + } loader := sqlite.NewSQLLoaderForDirectory(load, "manifests") if err := loader.Populate(); err != nil { logrus.Fatal(err) } - load.Close() + if err := db.Close(); err != nil { + logrus.Fatal(err) + } store, err := sqlite.NewSQLLiteQuerier(dbName) if err != nil { diff --git a/vendor/github.com/golang-migrate/migrate/v4/LICENSE b/vendor/github.com/golang-migrate/migrate/v4/LICENSE new file mode 100644 index 00000000000..d03742c9f37 --- /dev/null +++ b/vendor/github.com/golang-migrate/migrate/v4/LICENSE @@ -0,0 +1,28 @@ +The MIT License (MIT) + +Original Work +Copyright (c) 2016 Matthias Kadenbach +https://github.com/mattes/migrate + +Modified Work +Copyright (c) 2018 Dale Hui +https://github.com/golang-migrate/migrate + + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/golang-migrate/migrate/v4/source/driver.go b/vendor/github.com/golang-migrate/migrate/v4/source/driver.go new file mode 100644 index 00000000000..05f97adabf3 --- /dev/null +++ b/vendor/github.com/golang-migrate/migrate/v4/source/driver.go @@ -0,0 +1,118 @@ +// Package source provides the Source interface. +// All source drivers must implement this interface, register themselves, +// optionally provide a `WithInstance` function and pass the tests +// in package source/testing. +package source + +import ( + "fmt" + "io" + nurl "net/url" + "sync" +) + +var driversMu sync.RWMutex +var drivers = make(map[string]Driver) + +// Driver is the interface every source driver must implement. +// +// How to implement a source driver? +// 1. Implement this interface. +// 2. Optionally, add a function named `WithInstance`. +// This function should accept an existing source instance and a Config{} struct +// and return a driver instance. +// 3. Add a test that calls source/testing.go:Test() +// 4. Add own tests for Open(), WithInstance() (when provided) and Close(). +// All other functions are tested by tests in source/testing. +// Saves you some time and makes sure all source drivers behave the same way. +// 5. Call Register in init(). +// +// Guidelines: +// * All configuration input must come from the URL string in func Open() +// or the Config{} struct in WithInstance. Don't os.Getenv(). +// * Drivers are supposed to be read only. +// * Ideally don't load any contents (into memory) in Open or WithInstance. +type Driver interface { + // Open returns a a new driver instance configured with parameters + // coming from the URL string. Migrate will call this function + // only once per instance. + Open(url string) (Driver, error) + + // Close closes the underlying source instance managed by the driver. + // Migrate will call this function only once per instance. + Close() error + + // First returns the very first migration version available to the driver. + // Migrate will call this function multiple times. + // If there is no version available, it must return os.ErrNotExist. + First() (version uint, err error) + + // Prev returns the previous version for a given version available to the driver. + // Migrate will call this function multiple times. + // If there is no previous version available, it must return os.ErrNotExist. + Prev(version uint) (prevVersion uint, err error) + + // Next returns the next version for a given version available to the driver. + // Migrate will call this function multiple times. + // If there is no next version available, it must return os.ErrNotExist. + Next(version uint) (nextVersion uint, err error) + + // ReadUp returns the UP migration body and an identifier that helps + // finding this migration in the source for a given version. + // If there is no up migration available for this version, + // it must return os.ErrNotExist. + // Do not start reading, just return the ReadCloser! + ReadUp(version uint) (r io.ReadCloser, identifier string, err error) + + // ReadDown returns the DOWN migration body and an identifier that helps + // finding this migration in the source for a given version. + // If there is no down migration available for this version, + // it must return os.ErrNotExist. + // Do not start reading, just return the ReadCloser! + ReadDown(version uint) (r io.ReadCloser, identifier string, err error) +} + +// Open returns a new driver instance. +func Open(url string) (Driver, error) { + u, err := nurl.Parse(url) + if err != nil { + return nil, err + } + + if u.Scheme == "" { + return nil, fmt.Errorf("source driver: invalid URL scheme") + } + + driversMu.RLock() + d, ok := drivers[u.Scheme] + driversMu.RUnlock() + if !ok { + return nil, fmt.Errorf("source driver: unknown driver %v (forgotten import?)", u.Scheme) + } + + return d.Open(url) +} + +// Register globally registers a driver. +func Register(name string, driver Driver) { + driversMu.Lock() + defer driversMu.Unlock() + if driver == nil { + panic("Register driver is nil") + } + if _, dup := drivers[name]; dup { + panic("Register called twice for driver " + name) + } + drivers[name] = driver +} + +// List lists the registered drivers +func List() []string { + driversMu.RLock() + defer driversMu.RUnlock() + names := make([]string, 0, len(drivers)) + for n := range drivers { + names = append(names, n) + } + return names +} diff --git a/vendor/github.com/golang-migrate/migrate/v4/source/file/README.md b/vendor/github.com/golang-migrate/migrate/v4/source/file/README.md new file mode 100644 index 00000000000..7912eff66cf --- /dev/null +++ b/vendor/github.com/golang-migrate/migrate/v4/source/file/README.md @@ -0,0 +1,4 @@ +# file + +`file:///absolute/path` +`file://relative/path` diff --git a/vendor/github.com/golang-migrate/migrate/v4/source/file/file.go b/vendor/github.com/golang-migrate/migrate/v4/source/file/file.go new file mode 100644 index 00000000000..a0c6419318d --- /dev/null +++ b/vendor/github.com/golang-migrate/migrate/v4/source/file/file.go @@ -0,0 +1,127 @@ +package file + +import ( + "fmt" + "io" + "io/ioutil" + nurl "net/url" + "os" + "path" + "path/filepath" + + "github.com/golang-migrate/migrate/v4/source" +) + +func init() { + source.Register("file", &File{}) +} + +type File struct { + url string + path string + migrations *source.Migrations +} + +func (f *File) Open(url string) (source.Driver, error) { + u, err := nurl.Parse(url) + if err != nil { + return nil, err + } + + // concat host and path to restore full path + // host might be `.` + p := u.Opaque + if len(p) == 0 { + p = u.Host + u.Path + } + + if len(p) == 0 { + // default to current directory if no path + wd, err := os.Getwd() + if err != nil { + return nil, err + } + p = wd + + } else if p[0:1] == "." || p[0:1] != "/" { + // make path absolute if relative + abs, err := filepath.Abs(p) + if err != nil { + return nil, err + } + p = abs + } + + // scan directory + files, err := ioutil.ReadDir(p) + if err != nil { + return nil, err + } + + nf := &File{ + url: url, + path: p, + migrations: source.NewMigrations(), + } + + for _, fi := range files { + if !fi.IsDir() { + m, err := source.DefaultParse(fi.Name()) + if err != nil { + continue // ignore files that we can't parse + } + if !nf.migrations.Append(m) { + return nil, fmt.Errorf("unable to parse file %v", fi.Name()) + } + } + } + return nf, nil +} + +func (f *File) Close() error { + // nothing do to here + return nil +} + +func (f *File) First() (version uint, err error) { + if v, ok := f.migrations.First(); ok { + return v, nil + } + return 0, &os.PathError{Op: "first", Path: f.path, Err: os.ErrNotExist} +} + +func (f *File) Prev(version uint) (prevVersion uint, err error) { + if v, ok := f.migrations.Prev(version); ok { + return v, nil + } + return 0, &os.PathError{Op: fmt.Sprintf("prev for version %v", version), Path: f.path, Err: os.ErrNotExist} +} + +func (f *File) Next(version uint) (nextVersion uint, err error) { + if v, ok := f.migrations.Next(version); ok { + return v, nil + } + return 0, &os.PathError{Op: fmt.Sprintf("next for version %v", version), Path: f.path, Err: os.ErrNotExist} +} + +func (f *File) ReadUp(version uint) (r io.ReadCloser, identifier string, err error) { + if m, ok := f.migrations.Up(version); ok { + r, err := os.Open(path.Join(f.path, m.Raw)) + if err != nil { + return nil, "", err + } + return r, m.Identifier, nil + } + return nil, "", &os.PathError{Op: fmt.Sprintf("read version %v", version), Path: f.path, Err: os.ErrNotExist} +} + +func (f *File) ReadDown(version uint) (r io.ReadCloser, identifier string, err error) { + if m, ok := f.migrations.Down(version); ok { + r, err := os.Open(path.Join(f.path, m.Raw)) + if err != nil { + return nil, "", err + } + return r, m.Identifier, nil + } + return nil, "", &os.PathError{Op: fmt.Sprintf("read version %v", version), Path: f.path, Err: os.ErrNotExist} +} diff --git a/vendor/github.com/golang-migrate/migrate/v4/source/migration.go b/vendor/github.com/golang-migrate/migrate/v4/source/migration.go new file mode 100644 index 00000000000..b8bb79020b7 --- /dev/null +++ b/vendor/github.com/golang-migrate/migrate/v4/source/migration.go @@ -0,0 +1,143 @@ +package source + +import ( + "sort" +) + +// Direction is either up or down. +type Direction string + +const ( + Down Direction = "down" + Up Direction = "up" +) + +// Migration is a helper struct for source drivers that need to +// build the full directory tree in memory. +// Migration is fully independent from migrate.Migration. +type Migration struct { + // Version is the version of this migration. + Version uint + + // Identifier can be any string that helps identifying + // this migration in the source. + Identifier string + + // Direction is either Up or Down. + Direction Direction + + // Raw holds the raw location path to this migration in source. + // ReadUp and ReadDown will use this. + Raw string +} + +// Migrations wraps Migration and has an internal index +// to keep track of Migration order. +type Migrations struct { + index uintSlice + migrations map[uint]map[Direction]*Migration +} + +func NewMigrations() *Migrations { + return &Migrations{ + index: make(uintSlice, 0), + migrations: make(map[uint]map[Direction]*Migration), + } +} + +func (i *Migrations) Append(m *Migration) (ok bool) { + if m == nil { + return false + } + + if i.migrations[m.Version] == nil { + i.migrations[m.Version] = make(map[Direction]*Migration) + } + + // reject duplicate versions + if _, dup := i.migrations[m.Version][m.Direction]; dup { + return false + } + + i.migrations[m.Version][m.Direction] = m + i.buildIndex() + + return true +} + +func (i *Migrations) buildIndex() { + i.index = make(uintSlice, 0) + for version := range i.migrations { + i.index = append(i.index, version) + } + sort.Sort(i.index) +} + +func (i *Migrations) First() (version uint, ok bool) { + if len(i.index) == 0 { + return 0, false + } + return i.index[0], true +} + +func (i *Migrations) Prev(version uint) (prevVersion uint, ok bool) { + pos := i.findPos(version) + if pos >= 1 && len(i.index) > pos-1 { + return i.index[pos-1], true + } + return 0, false +} + +func (i *Migrations) Next(version uint) (nextVersion uint, ok bool) { + pos := i.findPos(version) + if pos >= 0 && len(i.index) > pos+1 { + return i.index[pos+1], true + } + return 0, false +} + +func (i *Migrations) Up(version uint) (m *Migration, ok bool) { + if _, ok := i.migrations[version]; ok { + if mx, ok := i.migrations[version][Up]; ok { + return mx, true + } + } + return nil, false +} + +func (i *Migrations) Down(version uint) (m *Migration, ok bool) { + if _, ok := i.migrations[version]; ok { + if mx, ok := i.migrations[version][Down]; ok { + return mx, true + } + } + return nil, false +} + +func (i *Migrations) findPos(version uint) int { + if len(i.index) > 0 { + ix := i.index.Search(version) + if ix < len(i.index) && i.index[ix] == version { + return ix + } + } + return -1 +} + +type uintSlice []uint + +func (s uintSlice) Len() int { + return len(s) +} + +func (s uintSlice) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} + +func (s uintSlice) Less(i, j int) bool { + return s[i] < s[j] +} + +func (s uintSlice) Search(x uint) int { + return sort.Search(len(s), func(i int) bool { return s[i] >= x }) +} diff --git a/vendor/github.com/golang-migrate/migrate/v4/source/parse.go b/vendor/github.com/golang-migrate/migrate/v4/source/parse.go new file mode 100644 index 00000000000..2f888fe7537 --- /dev/null +++ b/vendor/github.com/golang-migrate/migrate/v4/source/parse.go @@ -0,0 +1,39 @@ +package source + +import ( + "fmt" + "regexp" + "strconv" +) + +var ( + ErrParse = fmt.Errorf("no match") +) + +var ( + DefaultParse = Parse + DefaultRegex = Regex +) + +// Regex matches the following pattern: +// 123_name.up.ext +// 123_name.down.ext +var Regex = regexp.MustCompile(`^([0-9]+)_(.*)\.(` + string(Down) + `|` + string(Up) + `)\.(.*)$`) + +// Parse returns Migration for matching Regex pattern. +func Parse(raw string) (*Migration, error) { + m := Regex.FindStringSubmatch(raw) + if len(m) == 5 { + versionUint64, err := strconv.ParseUint(m[1], 10, 64) + if err != nil { + return nil, err + } + return &Migration{ + Version: uint(versionUint64), + Identifier: m[2], + Direction: Direction(m[3]), + Raw: raw, + }, nil + } + return nil, ErrParse +} diff --git a/vendor/github.com/konsorten/go-windows-terminal-sequences/README.md b/vendor/github.com/konsorten/go-windows-terminal-sequences/README.md index 949b77e304e..195333e51d4 100644 --- a/vendor/github.com/konsorten/go-windows-terminal-sequences/README.md +++ b/vendor/github.com/konsorten/go-windows-terminal-sequences/README.md @@ -26,6 +26,7 @@ The tool is sponsored by the [marvin + konsorten GmbH](http://www.konsorten.de). We thank all the authors who provided code to this library: * Felix Kollmann +* Nicolas Perraut ## License diff --git a/vendor/github.com/konsorten/go-windows-terminal-sequences/sequences_dummy.go b/vendor/github.com/konsorten/go-windows-terminal-sequences/sequences_dummy.go new file mode 100644 index 00000000000..df61a6f2f6f --- /dev/null +++ b/vendor/github.com/konsorten/go-windows-terminal-sequences/sequences_dummy.go @@ -0,0 +1,11 @@ +// +build linux darwin + +package sequences + +import ( + "fmt" +) + +func EnableVirtualTerminalProcessing(stream uintptr, enable bool) error { + return fmt.Errorf("windows only package") +} diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/api/grpc_health_v1/health.pb.go b/vendor/github.com/operator-framework/operator-registry/pkg/api/grpc_health_v1/health.pb.go index 54efb944d33..b4ae7462ed9 100644 --- a/vendor/github.com/operator-framework/operator-registry/pkg/api/grpc_health_v1/health.pb.go +++ b/vendor/github.com/operator-framework/operator-registry/pkg/api/grpc_health_v1/health.pb.go @@ -1,6 +1,17 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. +// Code generated by protoc-gen-go. // source: health.proto +// DO NOT EDIT! +/* +Package grpc_health_v1 is a generated protocol buffer package. + +It is generated from these files: + health.proto + +It has these top-level messages: + HealthCheckRequest + HealthCheckResponse +*/ package grpc_health_v1 import proto "github.com/golang/protobuf/proto" @@ -46,39 +57,17 @@ func (x HealthCheckResponse_ServingStatus) String() string { return proto.EnumName(HealthCheckResponse_ServingStatus_name, int32(x)) } func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_health_a4d0607c1c56185f, []int{1, 0} + return fileDescriptor0, []int{1, 0} } type HealthCheckRequest struct { - Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HealthCheckRequest) Reset() { *m = HealthCheckRequest{} } -func (m *HealthCheckRequest) String() string { return proto.CompactTextString(m) } -func (*HealthCheckRequest) ProtoMessage() {} -func (*HealthCheckRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_health_a4d0607c1c56185f, []int{0} -} -func (m *HealthCheckRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HealthCheckRequest.Unmarshal(m, b) -} -func (m *HealthCheckRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HealthCheckRequest.Marshal(b, m, deterministic) -} -func (dst *HealthCheckRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_HealthCheckRequest.Merge(dst, src) -} -func (m *HealthCheckRequest) XXX_Size() int { - return xxx_messageInfo_HealthCheckRequest.Size(m) -} -func (m *HealthCheckRequest) XXX_DiscardUnknown() { - xxx_messageInfo_HealthCheckRequest.DiscardUnknown(m) + Service string `protobuf:"bytes,1,opt,name=service" json:"service,omitempty"` } -var xxx_messageInfo_HealthCheckRequest proto.InternalMessageInfo +func (m *HealthCheckRequest) Reset() { *m = HealthCheckRequest{} } +func (m *HealthCheckRequest) String() string { return proto.CompactTextString(m) } +func (*HealthCheckRequest) ProtoMessage() {} +func (*HealthCheckRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } func (m *HealthCheckRequest) GetService() string { if m != nil { @@ -88,35 +77,13 @@ func (m *HealthCheckRequest) GetService() string { } type HealthCheckResponse struct { - Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,proto3,enum=grpc.health.v1.HealthCheckResponse_ServingStatus" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,enum=grpc.health.v1.HealthCheckResponse_ServingStatus" json:"status,omitempty"` } -func (m *HealthCheckResponse) Reset() { *m = HealthCheckResponse{} } -func (m *HealthCheckResponse) String() string { return proto.CompactTextString(m) } -func (*HealthCheckResponse) ProtoMessage() {} -func (*HealthCheckResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_health_a4d0607c1c56185f, []int{1} -} -func (m *HealthCheckResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HealthCheckResponse.Unmarshal(m, b) -} -func (m *HealthCheckResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HealthCheckResponse.Marshal(b, m, deterministic) -} -func (dst *HealthCheckResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_HealthCheckResponse.Merge(dst, src) -} -func (m *HealthCheckResponse) XXX_Size() int { - return xxx_messageInfo_HealthCheckResponse.Size(m) -} -func (m *HealthCheckResponse) XXX_DiscardUnknown() { - xxx_messageInfo_HealthCheckResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_HealthCheckResponse proto.InternalMessageInfo +func (m *HealthCheckResponse) Reset() { *m = HealthCheckResponse{} } +func (m *HealthCheckResponse) String() string { return proto.CompactTextString(m) } +func (*HealthCheckResponse) ProtoMessage() {} +func (*HealthCheckResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } func (m *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus { if m != nil { @@ -139,9 +106,8 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// HealthClient is the client API for Health service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +// Client API for Health service + type HealthClient interface { Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) } @@ -156,14 +122,15 @@ func NewHealthClient(cc *grpc.ClientConn) HealthClient { func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) { out := new(HealthCheckResponse) - err := c.cc.Invoke(ctx, "/grpc.health.v1.Health/Check", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.health.v1.Health/Check", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -// HealthServer is the server API for Health service. +// Server API for Health service + type HealthServer interface { Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) } @@ -203,11 +170,11 @@ var _Health_serviceDesc = grpc.ServiceDesc{ Metadata: "health.proto", } -func init() { proto.RegisterFile("health.proto", fileDescriptor_health_a4d0607c1c56185f) } +func init() { proto.RegisterFile("health.proto", fileDescriptor0) } -var fileDescriptor_health_a4d0607c1c56185f = []byte{ +var fileDescriptor0 = []byte{ // 204 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xc9, 0x48, 0x4d, 0xcc, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0xc9, 0x48, 0x4d, 0xcc, 0x29, 0xc9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4b, 0x2f, 0x2a, 0x48, 0xd6, 0x83, 0x0a, 0x95, 0x19, 0x2a, 0xe9, 0x71, 0x09, 0x79, 0x80, 0x39, 0xce, 0x19, 0xa9, 0xc9, 0xd9, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x12, 0x5c, 0xec, 0xc5, 0xa9, 0x45, 0x65, 0x99, 0xc9, diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/api/registry.pb.go b/vendor/github.com/operator-framework/operator-registry/pkg/api/registry.pb.go index 9209b8cca5c..06a9a930959 100644 --- a/vendor/github.com/operator-framework/operator-registry/pkg/api/registry.pb.go +++ b/vendor/github.com/operator-framework/operator-registry/pkg/api/registry.pb.go @@ -1,6 +1,30 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. +// Code generated by protoc-gen-go. // source: registry.proto - +// DO NOT EDIT! + +/* +Package api is a generated protocol buffer package. + +It is generated from these files: + registry.proto + +It has these top-level messages: + Channel + PackageName + Package + GroupVersionKind + Bundle + ChannelEntry + ListPackageRequest + GetPackageRequest + GetBundleRequest + GetBundleInChannelRequest + GetAllReplacementsRequest + GetReplacementRequest + GetAllProvidersRequest + GetLatestProvidersRequest + GetDefaultProviderRequest +*/ package api import proto "github.com/golang/protobuf/proto" @@ -24,36 +48,14 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type Channel struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - CsvName string `protobuf:"bytes,2,opt,name=csvName,proto3" json:"csvName,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Channel) Reset() { *m = Channel{} } -func (m *Channel) String() string { return proto.CompactTextString(m) } -func (*Channel) ProtoMessage() {} -func (*Channel) Descriptor() ([]byte, []int) { - return fileDescriptor_registry_3b20cfe64d54b8f8, []int{0} -} -func (m *Channel) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Channel.Unmarshal(m, b) -} -func (m *Channel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Channel.Marshal(b, m, deterministic) -} -func (dst *Channel) XXX_Merge(src proto.Message) { - xxx_messageInfo_Channel.Merge(dst, src) -} -func (m *Channel) XXX_Size() int { - return xxx_messageInfo_Channel.Size(m) -} -func (m *Channel) XXX_DiscardUnknown() { - xxx_messageInfo_Channel.DiscardUnknown(m) + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + CsvName string `protobuf:"bytes,2,opt,name=csvName" json:"csvName,omitempty"` } -var xxx_messageInfo_Channel proto.InternalMessageInfo +func (m *Channel) Reset() { *m = Channel{} } +func (m *Channel) String() string { return proto.CompactTextString(m) } +func (*Channel) ProtoMessage() {} +func (*Channel) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } func (m *Channel) GetName() string { if m != nil { @@ -70,35 +72,13 @@ func (m *Channel) GetCsvName() string { } type PackageName struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` } -func (m *PackageName) Reset() { *m = PackageName{} } -func (m *PackageName) String() string { return proto.CompactTextString(m) } -func (*PackageName) ProtoMessage() {} -func (*PackageName) Descriptor() ([]byte, []int) { - return fileDescriptor_registry_3b20cfe64d54b8f8, []int{1} -} -func (m *PackageName) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PackageName.Unmarshal(m, b) -} -func (m *PackageName) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PackageName.Marshal(b, m, deterministic) -} -func (dst *PackageName) XXX_Merge(src proto.Message) { - xxx_messageInfo_PackageName.Merge(dst, src) -} -func (m *PackageName) XXX_Size() int { - return xxx_messageInfo_PackageName.Size(m) -} -func (m *PackageName) XXX_DiscardUnknown() { - xxx_messageInfo_PackageName.DiscardUnknown(m) -} - -var xxx_messageInfo_PackageName proto.InternalMessageInfo +func (m *PackageName) Reset() { *m = PackageName{} } +func (m *PackageName) String() string { return proto.CompactTextString(m) } +func (*PackageName) ProtoMessage() {} +func (*PackageName) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } func (m *PackageName) GetName() string { if m != nil { @@ -108,37 +88,15 @@ func (m *PackageName) GetName() string { } type Package struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Channels []*Channel `protobuf:"bytes,2,rep,name=channels,proto3" json:"channels,omitempty"` - DefaultChannelName string `protobuf:"bytes,3,opt,name=defaultChannelName,proto3" json:"defaultChannelName,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Package) Reset() { *m = Package{} } -func (m *Package) String() string { return proto.CompactTextString(m) } -func (*Package) ProtoMessage() {} -func (*Package) Descriptor() ([]byte, []int) { - return fileDescriptor_registry_3b20cfe64d54b8f8, []int{2} -} -func (m *Package) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Package.Unmarshal(m, b) -} -func (m *Package) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Package.Marshal(b, m, deterministic) -} -func (dst *Package) XXX_Merge(src proto.Message) { - xxx_messageInfo_Package.Merge(dst, src) -} -func (m *Package) XXX_Size() int { - return xxx_messageInfo_Package.Size(m) -} -func (m *Package) XXX_DiscardUnknown() { - xxx_messageInfo_Package.DiscardUnknown(m) + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Channels []*Channel `protobuf:"bytes,2,rep,name=channels" json:"channels,omitempty"` + DefaultChannelName string `protobuf:"bytes,3,opt,name=defaultChannelName" json:"defaultChannelName,omitempty"` } -var xxx_messageInfo_Package proto.InternalMessageInfo +func (m *Package) Reset() { *m = Package{} } +func (m *Package) String() string { return proto.CompactTextString(m) } +func (*Package) ProtoMessage() {} +func (*Package) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } func (m *Package) GetName() string { if m != nil { @@ -161,40 +119,61 @@ func (m *Package) GetDefaultChannelName() string { return "" } -type Bundle struct { - CsvName string `protobuf:"bytes,1,opt,name=csvName,proto3" json:"csvName,omitempty"` - PackageName string `protobuf:"bytes,2,opt,name=packageName,proto3" json:"packageName,omitempty"` - ChannelName string `protobuf:"bytes,3,opt,name=channelName,proto3" json:"channelName,omitempty"` - CsvJson string `protobuf:"bytes,4,opt,name=csvJson,proto3" json:"csvJson,omitempty"` - Object []string `protobuf:"bytes,5,rep,name=object,proto3" json:"object,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +type GroupVersionKind struct { + Group string `protobuf:"bytes,1,opt,name=group" json:"group,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"` + Kind string `protobuf:"bytes,3,opt,name=kind" json:"kind,omitempty"` + Plural string `protobuf:"bytes,4,opt,name=plural" json:"plural,omitempty"` } -func (m *Bundle) Reset() { *m = Bundle{} } -func (m *Bundle) String() string { return proto.CompactTextString(m) } -func (*Bundle) ProtoMessage() {} -func (*Bundle) Descriptor() ([]byte, []int) { - return fileDescriptor_registry_3b20cfe64d54b8f8, []int{3} -} -func (m *Bundle) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Bundle.Unmarshal(m, b) +func (m *GroupVersionKind) Reset() { *m = GroupVersionKind{} } +func (m *GroupVersionKind) String() string { return proto.CompactTextString(m) } +func (*GroupVersionKind) ProtoMessage() {} +func (*GroupVersionKind) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *GroupVersionKind) GetGroup() string { + if m != nil { + return m.Group + } + return "" } -func (m *Bundle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Bundle.Marshal(b, m, deterministic) + +func (m *GroupVersionKind) GetVersion() string { + if m != nil { + return m.Version + } + return "" } -func (dst *Bundle) XXX_Merge(src proto.Message) { - xxx_messageInfo_Bundle.Merge(dst, src) + +func (m *GroupVersionKind) GetKind() string { + if m != nil { + return m.Kind + } + return "" } -func (m *Bundle) XXX_Size() int { - return xxx_messageInfo_Bundle.Size(m) + +func (m *GroupVersionKind) GetPlural() string { + if m != nil { + return m.Plural + } + return "" } -func (m *Bundle) XXX_DiscardUnknown() { - xxx_messageInfo_Bundle.DiscardUnknown(m) + +type Bundle struct { + CsvName string `protobuf:"bytes,1,opt,name=csvName" json:"csvName,omitempty"` + PackageName string `protobuf:"bytes,2,opt,name=packageName" json:"packageName,omitempty"` + ChannelName string `protobuf:"bytes,3,opt,name=channelName" json:"channelName,omitempty"` + CsvJson string `protobuf:"bytes,4,opt,name=csvJson" json:"csvJson,omitempty"` + Object []string `protobuf:"bytes,5,rep,name=object" json:"object,omitempty"` + BundlePath string `protobuf:"bytes,6,opt,name=bundlePath" json:"bundlePath,omitempty"` + ProvidedApis []*GroupVersionKind `protobuf:"bytes,7,rep,name=providedApis" json:"providedApis,omitempty"` + RequiredApis []*GroupVersionKind `protobuf:"bytes,8,rep,name=requiredApis" json:"requiredApis,omitempty"` } -var xxx_messageInfo_Bundle proto.InternalMessageInfo +func (m *Bundle) Reset() { *m = Bundle{} } +func (m *Bundle) String() string { return proto.CompactTextString(m) } +func (*Bundle) ProtoMessage() {} +func (*Bundle) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } func (m *Bundle) GetCsvName() string { if m != nil { @@ -231,39 +210,38 @@ func (m *Bundle) GetObject() []string { return nil } -type ChannelEntry struct { - PackageName string `protobuf:"bytes,1,opt,name=packageName,proto3" json:"packageName,omitempty"` - ChannelName string `protobuf:"bytes,2,opt,name=channelName,proto3" json:"channelName,omitempty"` - BundleName string `protobuf:"bytes,3,opt,name=bundleName,proto3" json:"bundleName,omitempty"` - Replaces string `protobuf:"bytes,4,opt,name=replaces,proto3" json:"replaces,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (m *Bundle) GetBundlePath() string { + if m != nil { + return m.BundlePath + } + return "" } -func (m *ChannelEntry) Reset() { *m = ChannelEntry{} } -func (m *ChannelEntry) String() string { return proto.CompactTextString(m) } -func (*ChannelEntry) ProtoMessage() {} -func (*ChannelEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_registry_3b20cfe64d54b8f8, []int{4} -} -func (m *ChannelEntry) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ChannelEntry.Unmarshal(m, b) -} -func (m *ChannelEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ChannelEntry.Marshal(b, m, deterministic) -} -func (dst *ChannelEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_ChannelEntry.Merge(dst, src) +func (m *Bundle) GetProvidedApis() []*GroupVersionKind { + if m != nil { + return m.ProvidedApis + } + return nil } -func (m *ChannelEntry) XXX_Size() int { - return xxx_messageInfo_ChannelEntry.Size(m) + +func (m *Bundle) GetRequiredApis() []*GroupVersionKind { + if m != nil { + return m.RequiredApis + } + return nil } -func (m *ChannelEntry) XXX_DiscardUnknown() { - xxx_messageInfo_ChannelEntry.DiscardUnknown(m) + +type ChannelEntry struct { + PackageName string `protobuf:"bytes,1,opt,name=packageName" json:"packageName,omitempty"` + ChannelName string `protobuf:"bytes,2,opt,name=channelName" json:"channelName,omitempty"` + BundleName string `protobuf:"bytes,3,opt,name=bundleName" json:"bundleName,omitempty"` + Replaces string `protobuf:"bytes,4,opt,name=replaces" json:"replaces,omitempty"` } -var xxx_messageInfo_ChannelEntry proto.InternalMessageInfo +func (m *ChannelEntry) Reset() { *m = ChannelEntry{} } +func (m *ChannelEntry) String() string { return proto.CompactTextString(m) } +func (*ChannelEntry) ProtoMessage() {} +func (*ChannelEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } func (m *ChannelEntry) GetPackageName() string { if m != nil { @@ -294,65 +272,21 @@ func (m *ChannelEntry) GetReplaces() string { } type ListPackageRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` } -func (m *ListPackageRequest) Reset() { *m = ListPackageRequest{} } -func (m *ListPackageRequest) String() string { return proto.CompactTextString(m) } -func (*ListPackageRequest) ProtoMessage() {} -func (*ListPackageRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_registry_3b20cfe64d54b8f8, []int{5} -} -func (m *ListPackageRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListPackageRequest.Unmarshal(m, b) -} -func (m *ListPackageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListPackageRequest.Marshal(b, m, deterministic) -} -func (dst *ListPackageRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListPackageRequest.Merge(dst, src) -} -func (m *ListPackageRequest) XXX_Size() int { - return xxx_messageInfo_ListPackageRequest.Size(m) -} -func (m *ListPackageRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ListPackageRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ListPackageRequest proto.InternalMessageInfo +func (m *ListPackageRequest) Reset() { *m = ListPackageRequest{} } +func (m *ListPackageRequest) String() string { return proto.CompactTextString(m) } +func (*ListPackageRequest) ProtoMessage() {} +func (*ListPackageRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } type GetPackageRequest struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetPackageRequest) Reset() { *m = GetPackageRequest{} } -func (m *GetPackageRequest) String() string { return proto.CompactTextString(m) } -func (*GetPackageRequest) ProtoMessage() {} -func (*GetPackageRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_registry_3b20cfe64d54b8f8, []int{6} -} -func (m *GetPackageRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetPackageRequest.Unmarshal(m, b) -} -func (m *GetPackageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetPackageRequest.Marshal(b, m, deterministic) -} -func (dst *GetPackageRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetPackageRequest.Merge(dst, src) -} -func (m *GetPackageRequest) XXX_Size() int { - return xxx_messageInfo_GetPackageRequest.Size(m) -} -func (m *GetPackageRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetPackageRequest.DiscardUnknown(m) + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` } -var xxx_messageInfo_GetPackageRequest proto.InternalMessageInfo +func (m *GetPackageRequest) Reset() { *m = GetPackageRequest{} } +func (m *GetPackageRequest) String() string { return proto.CompactTextString(m) } +func (*GetPackageRequest) ProtoMessage() {} +func (*GetPackageRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } func (m *GetPackageRequest) GetName() string { if m != nil { @@ -362,37 +296,15 @@ func (m *GetPackageRequest) GetName() string { } type GetBundleRequest struct { - PkgName string `protobuf:"bytes,1,opt,name=pkgName,proto3" json:"pkgName,omitempty"` - ChannelName string `protobuf:"bytes,2,opt,name=channelName,proto3" json:"channelName,omitempty"` - CsvName string `protobuf:"bytes,3,opt,name=csvName,proto3" json:"csvName,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetBundleRequest) Reset() { *m = GetBundleRequest{} } -func (m *GetBundleRequest) String() string { return proto.CompactTextString(m) } -func (*GetBundleRequest) ProtoMessage() {} -func (*GetBundleRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_registry_3b20cfe64d54b8f8, []int{7} -} -func (m *GetBundleRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetBundleRequest.Unmarshal(m, b) -} -func (m *GetBundleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetBundleRequest.Marshal(b, m, deterministic) -} -func (dst *GetBundleRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetBundleRequest.Merge(dst, src) -} -func (m *GetBundleRequest) XXX_Size() int { - return xxx_messageInfo_GetBundleRequest.Size(m) -} -func (m *GetBundleRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetBundleRequest.DiscardUnknown(m) + PkgName string `protobuf:"bytes,1,opt,name=pkgName" json:"pkgName,omitempty"` + ChannelName string `protobuf:"bytes,2,opt,name=channelName" json:"channelName,omitempty"` + CsvName string `protobuf:"bytes,3,opt,name=csvName" json:"csvName,omitempty"` } -var xxx_messageInfo_GetBundleRequest proto.InternalMessageInfo +func (m *GetBundleRequest) Reset() { *m = GetBundleRequest{} } +func (m *GetBundleRequest) String() string { return proto.CompactTextString(m) } +func (*GetBundleRequest) ProtoMessage() {} +func (*GetBundleRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } func (m *GetBundleRequest) GetPkgName() string { if m != nil { @@ -416,36 +328,14 @@ func (m *GetBundleRequest) GetCsvName() string { } type GetBundleInChannelRequest struct { - PkgName string `protobuf:"bytes,1,opt,name=pkgName,proto3" json:"pkgName,omitempty"` - ChannelName string `protobuf:"bytes,2,opt,name=channelName,proto3" json:"channelName,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetBundleInChannelRequest) Reset() { *m = GetBundleInChannelRequest{} } -func (m *GetBundleInChannelRequest) String() string { return proto.CompactTextString(m) } -func (*GetBundleInChannelRequest) ProtoMessage() {} -func (*GetBundleInChannelRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_registry_3b20cfe64d54b8f8, []int{8} -} -func (m *GetBundleInChannelRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetBundleInChannelRequest.Unmarshal(m, b) -} -func (m *GetBundleInChannelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetBundleInChannelRequest.Marshal(b, m, deterministic) -} -func (dst *GetBundleInChannelRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetBundleInChannelRequest.Merge(dst, src) -} -func (m *GetBundleInChannelRequest) XXX_Size() int { - return xxx_messageInfo_GetBundleInChannelRequest.Size(m) -} -func (m *GetBundleInChannelRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetBundleInChannelRequest.DiscardUnknown(m) + PkgName string `protobuf:"bytes,1,opt,name=pkgName" json:"pkgName,omitempty"` + ChannelName string `protobuf:"bytes,2,opt,name=channelName" json:"channelName,omitempty"` } -var xxx_messageInfo_GetBundleInChannelRequest proto.InternalMessageInfo +func (m *GetBundleInChannelRequest) Reset() { *m = GetBundleInChannelRequest{} } +func (m *GetBundleInChannelRequest) String() string { return proto.CompactTextString(m) } +func (*GetBundleInChannelRequest) ProtoMessage() {} +func (*GetBundleInChannelRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } func (m *GetBundleInChannelRequest) GetPkgName() string { if m != nil { @@ -462,35 +352,13 @@ func (m *GetBundleInChannelRequest) GetChannelName() string { } type GetAllReplacementsRequest struct { - CsvName string `protobuf:"bytes,1,opt,name=csvName,proto3" json:"csvName,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CsvName string `protobuf:"bytes,1,opt,name=csvName" json:"csvName,omitempty"` } -func (m *GetAllReplacementsRequest) Reset() { *m = GetAllReplacementsRequest{} } -func (m *GetAllReplacementsRequest) String() string { return proto.CompactTextString(m) } -func (*GetAllReplacementsRequest) ProtoMessage() {} -func (*GetAllReplacementsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_registry_3b20cfe64d54b8f8, []int{9} -} -func (m *GetAllReplacementsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAllReplacementsRequest.Unmarshal(m, b) -} -func (m *GetAllReplacementsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAllReplacementsRequest.Marshal(b, m, deterministic) -} -func (dst *GetAllReplacementsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllReplacementsRequest.Merge(dst, src) -} -func (m *GetAllReplacementsRequest) XXX_Size() int { - return xxx_messageInfo_GetAllReplacementsRequest.Size(m) -} -func (m *GetAllReplacementsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllReplacementsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetAllReplacementsRequest proto.InternalMessageInfo +func (m *GetAllReplacementsRequest) Reset() { *m = GetAllReplacementsRequest{} } +func (m *GetAllReplacementsRequest) String() string { return proto.CompactTextString(m) } +func (*GetAllReplacementsRequest) ProtoMessage() {} +func (*GetAllReplacementsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } func (m *GetAllReplacementsRequest) GetCsvName() string { if m != nil { @@ -500,37 +368,15 @@ func (m *GetAllReplacementsRequest) GetCsvName() string { } type GetReplacementRequest struct { - CsvName string `protobuf:"bytes,1,opt,name=csvName,proto3" json:"csvName,omitempty"` - PkgName string `protobuf:"bytes,2,opt,name=pkgName,proto3" json:"pkgName,omitempty"` - ChannelName string `protobuf:"bytes,3,opt,name=channelName,proto3" json:"channelName,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetReplacementRequest) Reset() { *m = GetReplacementRequest{} } -func (m *GetReplacementRequest) String() string { return proto.CompactTextString(m) } -func (*GetReplacementRequest) ProtoMessage() {} -func (*GetReplacementRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_registry_3b20cfe64d54b8f8, []int{10} -} -func (m *GetReplacementRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetReplacementRequest.Unmarshal(m, b) -} -func (m *GetReplacementRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetReplacementRequest.Marshal(b, m, deterministic) -} -func (dst *GetReplacementRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetReplacementRequest.Merge(dst, src) -} -func (m *GetReplacementRequest) XXX_Size() int { - return xxx_messageInfo_GetReplacementRequest.Size(m) -} -func (m *GetReplacementRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetReplacementRequest.DiscardUnknown(m) + CsvName string `protobuf:"bytes,1,opt,name=csvName" json:"csvName,omitempty"` + PkgName string `protobuf:"bytes,2,opt,name=pkgName" json:"pkgName,omitempty"` + ChannelName string `protobuf:"bytes,3,opt,name=channelName" json:"channelName,omitempty"` } -var xxx_messageInfo_GetReplacementRequest proto.InternalMessageInfo +func (m *GetReplacementRequest) Reset() { *m = GetReplacementRequest{} } +func (m *GetReplacementRequest) String() string { return proto.CompactTextString(m) } +func (*GetReplacementRequest) ProtoMessage() {} +func (*GetReplacementRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } func (m *GetReplacementRequest) GetCsvName() string { if m != nil { @@ -554,38 +400,16 @@ func (m *GetReplacementRequest) GetChannelName() string { } type GetAllProvidersRequest struct { - Group string `protobuf:"bytes,1,opt,name=group,proto3" json:"group,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - Kind string `protobuf:"bytes,3,opt,name=kind,proto3" json:"kind,omitempty"` - Plural string `protobuf:"bytes,4,opt,name=plural,proto3" json:"plural,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Group string `protobuf:"bytes,1,opt,name=group" json:"group,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"` + Kind string `protobuf:"bytes,3,opt,name=kind" json:"kind,omitempty"` + Plural string `protobuf:"bytes,4,opt,name=plural" json:"plural,omitempty"` } -func (m *GetAllProvidersRequest) Reset() { *m = GetAllProvidersRequest{} } -func (m *GetAllProvidersRequest) String() string { return proto.CompactTextString(m) } -func (*GetAllProvidersRequest) ProtoMessage() {} -func (*GetAllProvidersRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_registry_3b20cfe64d54b8f8, []int{11} -} -func (m *GetAllProvidersRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAllProvidersRequest.Unmarshal(m, b) -} -func (m *GetAllProvidersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAllProvidersRequest.Marshal(b, m, deterministic) -} -func (dst *GetAllProvidersRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllProvidersRequest.Merge(dst, src) -} -func (m *GetAllProvidersRequest) XXX_Size() int { - return xxx_messageInfo_GetAllProvidersRequest.Size(m) -} -func (m *GetAllProvidersRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllProvidersRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetAllProvidersRequest proto.InternalMessageInfo +func (m *GetAllProvidersRequest) Reset() { *m = GetAllProvidersRequest{} } +func (m *GetAllProvidersRequest) String() string { return proto.CompactTextString(m) } +func (*GetAllProvidersRequest) ProtoMessage() {} +func (*GetAllProvidersRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } func (m *GetAllProvidersRequest) GetGroup() string { if m != nil { @@ -616,38 +440,16 @@ func (m *GetAllProvidersRequest) GetPlural() string { } type GetLatestProvidersRequest struct { - Group string `protobuf:"bytes,1,opt,name=group,proto3" json:"group,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - Kind string `protobuf:"bytes,3,opt,name=kind,proto3" json:"kind,omitempty"` - Plural string `protobuf:"bytes,4,opt,name=plural,proto3" json:"plural,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Group string `protobuf:"bytes,1,opt,name=group" json:"group,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"` + Kind string `protobuf:"bytes,3,opt,name=kind" json:"kind,omitempty"` + Plural string `protobuf:"bytes,4,opt,name=plural" json:"plural,omitempty"` } -func (m *GetLatestProvidersRequest) Reset() { *m = GetLatestProvidersRequest{} } -func (m *GetLatestProvidersRequest) String() string { return proto.CompactTextString(m) } -func (*GetLatestProvidersRequest) ProtoMessage() {} -func (*GetLatestProvidersRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_registry_3b20cfe64d54b8f8, []int{12} -} -func (m *GetLatestProvidersRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetLatestProvidersRequest.Unmarshal(m, b) -} -func (m *GetLatestProvidersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetLatestProvidersRequest.Marshal(b, m, deterministic) -} -func (dst *GetLatestProvidersRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetLatestProvidersRequest.Merge(dst, src) -} -func (m *GetLatestProvidersRequest) XXX_Size() int { - return xxx_messageInfo_GetLatestProvidersRequest.Size(m) -} -func (m *GetLatestProvidersRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetLatestProvidersRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetLatestProvidersRequest proto.InternalMessageInfo +func (m *GetLatestProvidersRequest) Reset() { *m = GetLatestProvidersRequest{} } +func (m *GetLatestProvidersRequest) String() string { return proto.CompactTextString(m) } +func (*GetLatestProvidersRequest) ProtoMessage() {} +func (*GetLatestProvidersRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } func (m *GetLatestProvidersRequest) GetGroup() string { if m != nil { @@ -678,38 +480,16 @@ func (m *GetLatestProvidersRequest) GetPlural() string { } type GetDefaultProviderRequest struct { - Group string `protobuf:"bytes,1,opt,name=group,proto3" json:"group,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - Kind string `protobuf:"bytes,3,opt,name=kind,proto3" json:"kind,omitempty"` - Plural string `protobuf:"bytes,4,opt,name=plural,proto3" json:"plural,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Group string `protobuf:"bytes,1,opt,name=group" json:"group,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"` + Kind string `protobuf:"bytes,3,opt,name=kind" json:"kind,omitempty"` + Plural string `protobuf:"bytes,4,opt,name=plural" json:"plural,omitempty"` } -func (m *GetDefaultProviderRequest) Reset() { *m = GetDefaultProviderRequest{} } -func (m *GetDefaultProviderRequest) String() string { return proto.CompactTextString(m) } -func (*GetDefaultProviderRequest) ProtoMessage() {} -func (*GetDefaultProviderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_registry_3b20cfe64d54b8f8, []int{13} -} -func (m *GetDefaultProviderRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetDefaultProviderRequest.Unmarshal(m, b) -} -func (m *GetDefaultProviderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetDefaultProviderRequest.Marshal(b, m, deterministic) -} -func (dst *GetDefaultProviderRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetDefaultProviderRequest.Merge(dst, src) -} -func (m *GetDefaultProviderRequest) XXX_Size() int { - return xxx_messageInfo_GetDefaultProviderRequest.Size(m) -} -func (m *GetDefaultProviderRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetDefaultProviderRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetDefaultProviderRequest proto.InternalMessageInfo +func (m *GetDefaultProviderRequest) Reset() { *m = GetDefaultProviderRequest{} } +func (m *GetDefaultProviderRequest) String() string { return proto.CompactTextString(m) } +func (*GetDefaultProviderRequest) ProtoMessage() {} +func (*GetDefaultProviderRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } func (m *GetDefaultProviderRequest) GetGroup() string { if m != nil { @@ -743,6 +523,7 @@ func init() { proto.RegisterType((*Channel)(nil), "api.Channel") proto.RegisterType((*PackageName)(nil), "api.PackageName") proto.RegisterType((*Package)(nil), "api.Package") + proto.RegisterType((*GroupVersionKind)(nil), "api.GroupVersionKind") proto.RegisterType((*Bundle)(nil), "api.Bundle") proto.RegisterType((*ChannelEntry)(nil), "api.ChannelEntry") proto.RegisterType((*ListPackageRequest)(nil), "api.ListPackageRequest") @@ -764,9 +545,8 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// RegistryClient is the client API for Registry service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +// Client API for Registry service + type RegistryClient interface { ListPackages(ctx context.Context, in *ListPackageRequest, opts ...grpc.CallOption) (Registry_ListPackagesClient, error) GetPackage(ctx context.Context, in *GetPackageRequest, opts ...grpc.CallOption) (*Package, error) @@ -788,7 +568,7 @@ func NewRegistryClient(cc *grpc.ClientConn) RegistryClient { } func (c *registryClient) ListPackages(ctx context.Context, in *ListPackageRequest, opts ...grpc.CallOption) (Registry_ListPackagesClient, error) { - stream, err := c.cc.NewStream(ctx, &_Registry_serviceDesc.Streams[0], "/api.Registry/ListPackages", opts...) + stream, err := grpc.NewClientStream(ctx, &_Registry_serviceDesc.Streams[0], c.cc, "/api.Registry/ListPackages", opts...) if err != nil { return nil, err } @@ -821,7 +601,7 @@ func (x *registryListPackagesClient) Recv() (*PackageName, error) { func (c *registryClient) GetPackage(ctx context.Context, in *GetPackageRequest, opts ...grpc.CallOption) (*Package, error) { out := new(Package) - err := c.cc.Invoke(ctx, "/api.Registry/GetPackage", in, out, opts...) + err := grpc.Invoke(ctx, "/api.Registry/GetPackage", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -830,7 +610,7 @@ func (c *registryClient) GetPackage(ctx context.Context, in *GetPackageRequest, func (c *registryClient) GetBundle(ctx context.Context, in *GetBundleRequest, opts ...grpc.CallOption) (*Bundle, error) { out := new(Bundle) - err := c.cc.Invoke(ctx, "/api.Registry/GetBundle", in, out, opts...) + err := grpc.Invoke(ctx, "/api.Registry/GetBundle", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -839,7 +619,7 @@ func (c *registryClient) GetBundle(ctx context.Context, in *GetBundleRequest, op func (c *registryClient) GetBundleForChannel(ctx context.Context, in *GetBundleInChannelRequest, opts ...grpc.CallOption) (*Bundle, error) { out := new(Bundle) - err := c.cc.Invoke(ctx, "/api.Registry/GetBundleForChannel", in, out, opts...) + err := grpc.Invoke(ctx, "/api.Registry/GetBundleForChannel", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -847,7 +627,7 @@ func (c *registryClient) GetBundleForChannel(ctx context.Context, in *GetBundleI } func (c *registryClient) GetChannelEntriesThatReplace(ctx context.Context, in *GetAllReplacementsRequest, opts ...grpc.CallOption) (Registry_GetChannelEntriesThatReplaceClient, error) { - stream, err := c.cc.NewStream(ctx, &_Registry_serviceDesc.Streams[1], "/api.Registry/GetChannelEntriesThatReplace", opts...) + stream, err := grpc.NewClientStream(ctx, &_Registry_serviceDesc.Streams[1], c.cc, "/api.Registry/GetChannelEntriesThatReplace", opts...) if err != nil { return nil, err } @@ -880,7 +660,7 @@ func (x *registryGetChannelEntriesThatReplaceClient) Recv() (*ChannelEntry, erro func (c *registryClient) GetBundleThatReplaces(ctx context.Context, in *GetReplacementRequest, opts ...grpc.CallOption) (*Bundle, error) { out := new(Bundle) - err := c.cc.Invoke(ctx, "/api.Registry/GetBundleThatReplaces", in, out, opts...) + err := grpc.Invoke(ctx, "/api.Registry/GetBundleThatReplaces", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -888,7 +668,7 @@ func (c *registryClient) GetBundleThatReplaces(ctx context.Context, in *GetRepla } func (c *registryClient) GetChannelEntriesThatProvide(ctx context.Context, in *GetAllProvidersRequest, opts ...grpc.CallOption) (Registry_GetChannelEntriesThatProvideClient, error) { - stream, err := c.cc.NewStream(ctx, &_Registry_serviceDesc.Streams[2], "/api.Registry/GetChannelEntriesThatProvide", opts...) + stream, err := grpc.NewClientStream(ctx, &_Registry_serviceDesc.Streams[2], c.cc, "/api.Registry/GetChannelEntriesThatProvide", opts...) if err != nil { return nil, err } @@ -920,7 +700,7 @@ func (x *registryGetChannelEntriesThatProvideClient) Recv() (*ChannelEntry, erro } func (c *registryClient) GetLatestChannelEntriesThatProvide(ctx context.Context, in *GetLatestProvidersRequest, opts ...grpc.CallOption) (Registry_GetLatestChannelEntriesThatProvideClient, error) { - stream, err := c.cc.NewStream(ctx, &_Registry_serviceDesc.Streams[3], "/api.Registry/GetLatestChannelEntriesThatProvide", opts...) + stream, err := grpc.NewClientStream(ctx, &_Registry_serviceDesc.Streams[3], c.cc, "/api.Registry/GetLatestChannelEntriesThatProvide", opts...) if err != nil { return nil, err } @@ -953,14 +733,15 @@ func (x *registryGetLatestChannelEntriesThatProvideClient) Recv() (*ChannelEntry func (c *registryClient) GetDefaultBundleThatProvides(ctx context.Context, in *GetDefaultProviderRequest, opts ...grpc.CallOption) (*Bundle, error) { out := new(Bundle) - err := c.cc.Invoke(ctx, "/api.Registry/GetDefaultBundleThatProvides", in, out, opts...) + err := grpc.Invoke(ctx, "/api.Registry/GetDefaultBundleThatProvides", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -// RegistryServer is the server API for Registry service. +// Server API for Registry service + type RegistryServer interface { ListPackages(*ListPackageRequest, Registry_ListPackagesServer) error GetPackage(context.Context, *GetPackageRequest) (*Package, error) @@ -1201,47 +982,51 @@ var _Registry_serviceDesc = grpc.ServiceDesc{ Metadata: "registry.proto", } -func init() { proto.RegisterFile("registry.proto", fileDescriptor_registry_3b20cfe64d54b8f8) } - -var fileDescriptor_registry_3b20cfe64d54b8f8 = []byte{ - // 615 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x8d, 0x93, 0xe6, 0x6b, 0x12, 0xa1, 0x76, 0x69, 0x83, 0x31, 0xa8, 0x0a, 0x7b, 0x21, 0xa7, - 0x08, 0x0a, 0x88, 0x13, 0x07, 0x4a, 0x21, 0x02, 0x15, 0x54, 0x59, 0x20, 0x0e, 0x9c, 0x36, 0xce, - 0x92, 0x98, 0x38, 0x6b, 0xb3, 0xbb, 0x49, 0xd5, 0x3f, 0xc1, 0x85, 0x0b, 0x3f, 0x17, 0x79, 0xbd, - 0x76, 0xd6, 0x1f, 0xa1, 0x48, 0x48, 0xf4, 0x96, 0x19, 0xef, 0xbc, 0xf7, 0x66, 0xf7, 0xcd, 0x04, - 0x6e, 0x71, 0x3a, 0xf7, 0x85, 0xe4, 0x57, 0xe3, 0x88, 0x87, 0x32, 0x44, 0x0d, 0x12, 0xf9, 0xf8, - 0x39, 0xb4, 0x5f, 0x2d, 0x08, 0x63, 0x34, 0x40, 0x08, 0xf6, 0x18, 0x59, 0x51, 0xdb, 0x1a, 0x5a, - 0xa3, 0xae, 0xab, 0x7e, 0x23, 0x1b, 0xda, 0x9e, 0xd8, 0x7c, 0x88, 0xd3, 0x75, 0x95, 0x4e, 0x43, - 0xfc, 0x00, 0x7a, 0x17, 0xc4, 0x5b, 0x92, 0x39, 0x8d, 0xc3, 0xaa, 0x62, 0x7c, 0x09, 0x6d, 0x7d, - 0xa4, 0x12, 0x7b, 0x04, 0x1d, 0x2f, 0xa1, 0x16, 0x76, 0x7d, 0xd8, 0x18, 0xf5, 0x4e, 0xfa, 0x63, - 0x12, 0xf9, 0x63, 0xad, 0xc7, 0xcd, 0xbe, 0xa2, 0x31, 0xa0, 0x19, 0xfd, 0x4a, 0xd6, 0x81, 0xd4, - 0xdf, 0x94, 0xa0, 0x86, 0xc2, 0xaa, 0xf8, 0x82, 0x7f, 0x59, 0xd0, 0x3a, 0x5d, 0xb3, 0x59, 0x90, - 0x6b, 0xc0, 0xca, 0x35, 0x80, 0x86, 0xd0, 0x8b, 0xb6, 0x0d, 0xe8, 0xf6, 0xcc, 0x54, 0x7c, 0xc2, - 0x2b, 0xf1, 0x99, 0x29, 0x8d, 0xfe, 0x4e, 0x84, 0xcc, 0xde, 0xcb, 0xd0, 0xe3, 0x10, 0x0d, 0xa0, - 0x15, 0x4e, 0xbf, 0x51, 0x4f, 0xda, 0xcd, 0x61, 0x63, 0xd4, 0x75, 0x75, 0x84, 0x7f, 0x58, 0xd0, - 0xd7, 0x52, 0x5f, 0x33, 0xc9, 0xaf, 0x8a, 0x32, 0xac, 0x6b, 0x65, 0xd4, 0xcb, 0x32, 0x8e, 0x01, - 0xa6, 0xaa, 0x5d, 0x43, 0xa7, 0x91, 0x41, 0x0e, 0x74, 0x38, 0x8d, 0x02, 0xe2, 0x51, 0xa1, 0x75, - 0x66, 0x31, 0x3e, 0x04, 0x74, 0xee, 0x0b, 0xa9, 0x1f, 0xca, 0xa5, 0xdf, 0xd7, 0x54, 0x48, 0xfc, - 0x10, 0x0e, 0x26, 0xb4, 0x90, 0xac, 0x7c, 0xe3, 0x05, 0xec, 0x4f, 0xa8, 0x4c, 0x2e, 0x3b, 0x3d, - 0x67, 0x43, 0x3b, 0x5a, 0xce, 0xcd, 0x3b, 0xd7, 0xe1, 0x5f, 0xb4, 0x62, 0xbc, 0x57, 0x23, 0x6f, - 0xb8, 0xcf, 0x70, 0x37, 0x63, 0x7a, 0xcb, 0x52, 0x93, 0xfc, 0x3b, 0x25, 0x7e, 0xa6, 0x80, 0x5f, - 0x06, 0x81, 0x9b, 0xdc, 0xc9, 0x8a, 0x32, 0x29, 0x0c, 0xe0, 0x6a, 0xff, 0xe0, 0x15, 0x1c, 0x4d, - 0xa8, 0x34, 0x6a, 0xae, 0x2d, 0x31, 0x55, 0xd6, 0xff, 0xa8, 0xb2, 0x6c, 0x35, 0x2c, 0x61, 0x90, - 0xa8, 0xbc, 0xe0, 0xe1, 0xc6, 0x9f, 0x51, 0x9e, 0x49, 0x3c, 0x84, 0xe6, 0x9c, 0x87, 0xeb, 0x48, - 0xb3, 0x25, 0x41, 0xcc, 0xb5, 0xa1, 0x5c, 0xf8, 0x21, 0x4b, 0xb9, 0x74, 0x18, 0x3f, 0xe3, 0xd2, - 0x67, 0x33, 0x4d, 0xa2, 0x7e, 0xc7, 0x76, 0x8d, 0x82, 0x35, 0x27, 0x81, 0xf6, 0x87, 0x8e, 0xf0, - 0xa5, 0xba, 0x9b, 0x73, 0x22, 0xa9, 0x90, 0x37, 0x40, 0x7c, 0x96, 0xcc, 0x76, 0xca, 0xfc, 0x1f, - 0x88, 0x4f, 0x7e, 0x36, 0xa1, 0xe3, 0xea, 0x45, 0x89, 0x5e, 0x40, 0xdf, 0x18, 0x0e, 0x81, 0xee, - 0xa8, 0x05, 0x55, 0x9e, 0x17, 0x67, 0x5f, 0x7d, 0x30, 0x16, 0x22, 0xae, 0x3d, 0xb2, 0xd0, 0x53, - 0x80, 0xed, 0x14, 0xa1, 0x81, 0x3a, 0x53, 0x1a, 0x2b, 0xa7, 0x6f, 0xd6, 0xe2, 0x1a, 0x7a, 0x0c, - 0xdd, 0xcc, 0xe8, 0xe8, 0x28, 0x2d, 0xca, 0x8d, 0x98, 0xd3, 0x53, 0xe9, 0x24, 0x87, 0x6b, 0xe8, - 0x0c, 0x6e, 0x67, 0x47, 0xde, 0x84, 0x3c, 0xdd, 0xe8, 0xc7, 0xf9, 0xe2, 0xe2, 0xd4, 0x14, 0x51, - 0x3e, 0xc1, 0xfd, 0x09, 0x95, 0xc6, 0x76, 0xf2, 0xa9, 0xf8, 0xb8, 0x20, 0xa9, 0xc7, 0xb7, 0x70, - 0xd5, 0xb3, 0xe2, 0x1c, 0x98, 0xeb, 0x5b, 0x6d, 0x37, 0x75, 0x0b, 0xa7, 0x6a, 0x50, 0x12, 0x16, - 0x03, 0x4e, 0x20, 0x27, 0xc5, 0x2b, 0x0f, 0x51, 0x51, 0x9a, 0xbb, 0x43, 0x9a, 0x76, 0x06, 0xba, - 0x67, 0x48, 0x2b, 0xfa, 0x74, 0x97, 0xae, 0x2f, 0x80, 0x33, 0x6f, 0xef, 0x46, 0xce, 0x9a, 0xae, - 0x1e, 0x82, 0x5d, 0xe0, 0xef, 0x95, 0x60, 0xed, 0xdf, 0x6d, 0xef, 0xba, 0x5c, 0x6c, 0x61, 0xab, - 0x2d, 0x5e, 0xe8, 0x7f, 0xda, 0x52, 0x7f, 0xd9, 0x4f, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0x11, - 0x0c, 0xe5, 0xa0, 0xc4, 0x07, 0x00, 0x00, +func init() { proto.RegisterFile("registry.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 680 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x56, 0x4f, 0x6f, 0xd3, 0x30, + 0x14, 0x5f, 0xda, 0xad, 0xed, 0x5e, 0x2b, 0xb4, 0x99, 0x6d, 0x84, 0x80, 0xa6, 0xe2, 0x0b, 0x3b, + 0x55, 0x30, 0x40, 0x88, 0x03, 0x87, 0x8d, 0x41, 0x05, 0x0c, 0x34, 0x45, 0xfc, 0x39, 0x70, 0xf2, + 0x12, 0xd3, 0x86, 0x65, 0x4e, 0x66, 0x3b, 0x9b, 0xf6, 0x25, 0xb8, 0xf0, 0x3d, 0xf8, 0x8c, 0x28, + 0xb6, 0x93, 0x3a, 0x69, 0xba, 0x21, 0x21, 0xe0, 0xd6, 0xf7, 0xfc, 0xfe, 0xfc, 0xde, 0xcb, 0xef, + 0x67, 0x17, 0x6e, 0x70, 0x3a, 0x89, 0x84, 0xe4, 0x97, 0xa3, 0x94, 0x27, 0x32, 0x41, 0x6d, 0x92, + 0x46, 0xf8, 0x29, 0x74, 0x5f, 0x4c, 0x09, 0x63, 0x34, 0x46, 0x08, 0x96, 0x19, 0x39, 0xa5, 0xae, + 0x33, 0x74, 0x76, 0x56, 0x7d, 0xf5, 0x1b, 0xb9, 0xd0, 0x0d, 0xc4, 0xf9, 0xfb, 0xdc, 0xdd, 0x52, + 0xee, 0xc2, 0xc4, 0xf7, 0xa0, 0x7f, 0x44, 0x82, 0x13, 0x32, 0xa1, 0xb9, 0xd9, 0x94, 0x8c, 0x2f, + 0xa0, 0x6b, 0x42, 0x1a, 0x6b, 0xef, 0x40, 0x2f, 0xd0, 0xad, 0x85, 0xdb, 0x1a, 0xb6, 0x77, 0xfa, + 0xbb, 0x83, 0x11, 0x49, 0xa3, 0x91, 0xc1, 0xe3, 0x97, 0xa7, 0x68, 0x04, 0x28, 0xa4, 0x5f, 0x49, + 0x16, 0x4b, 0x73, 0xa6, 0x00, 0xb5, 0x55, 0xad, 0x86, 0x13, 0xcc, 0x60, 0x6d, 0xcc, 0x93, 0x2c, + 0xfd, 0x44, 0xb9, 0x88, 0x12, 0xf6, 0x36, 0x62, 0x21, 0xda, 0x80, 0x95, 0x49, 0xee, 0x33, 0x10, + 0xb4, 0x91, 0xcf, 0x77, 0xae, 0x83, 0x8a, 0xf9, 0x8c, 0x99, 0x23, 0x3e, 0x89, 0x58, 0x68, 0xba, + 0xa8, 0xdf, 0x68, 0x0b, 0x3a, 0x69, 0x9c, 0x71, 0x12, 0xbb, 0xcb, 0xca, 0x6b, 0x2c, 0xfc, 0xb3, + 0x05, 0x9d, 0xfd, 0x8c, 0x85, 0x71, 0x65, 0x61, 0x4e, 0x65, 0x61, 0x68, 0x08, 0xfd, 0x74, 0xb6, + 0x30, 0xd3, 0xce, 0x76, 0xe5, 0x11, 0xc1, 0xdc, 0x7c, 0xb6, 0xcb, 0x54, 0x7f, 0x23, 0x12, 0x66, + 0x10, 0x14, 0x66, 0x0e, 0x2d, 0x39, 0xfe, 0x46, 0x03, 0xe9, 0xae, 0x0c, 0xdb, 0x39, 0x34, 0x6d, + 0xa1, 0x6d, 0x80, 0x63, 0x85, 0xec, 0x88, 0xc8, 0xa9, 0xdb, 0x51, 0x49, 0x96, 0x07, 0x3d, 0x83, + 0x41, 0xca, 0x93, 0xf3, 0x28, 0xa4, 0xe1, 0x5e, 0x1a, 0x09, 0xb7, 0xab, 0x3e, 0xc4, 0xa6, 0xfa, + 0x10, 0xf5, 0x1d, 0xfa, 0x95, 0xd0, 0x3c, 0x95, 0xd3, 0xb3, 0x2c, 0xe2, 0x26, 0xb5, 0x77, 0x65, + 0xaa, 0x1d, 0x8a, 0xbf, 0x3b, 0x30, 0x30, 0x1f, 0xec, 0x25, 0x93, 0xfc, 0xb2, 0xbe, 0x1c, 0xe7, + 0xda, 0xe5, 0xb4, 0xe6, 0x97, 0x53, 0x8e, 0x6a, 0x6d, 0xcf, 0xf2, 0x20, 0x0f, 0x7a, 0x9c, 0xa6, + 0x31, 0x09, 0xa8, 0x30, 0xdb, 0x2b, 0x6d, 0xbc, 0x01, 0xe8, 0x30, 0x12, 0xd2, 0xd0, 0xd5, 0xa7, + 0x67, 0x19, 0x15, 0x12, 0xdf, 0x87, 0xf5, 0x31, 0xad, 0x39, 0x1b, 0x99, 0x3e, 0x85, 0xb5, 0x31, + 0x95, 0x9a, 0x02, 0x45, 0x9c, 0x0b, 0xdd, 0xf4, 0x64, 0x62, 0x33, 0xc1, 0x98, 0xbf, 0x31, 0x8a, + 0xc5, 0xa2, 0x76, 0x55, 0x76, 0x9f, 0xe1, 0x76, 0xd9, 0xe9, 0x35, 0x2b, 0xa4, 0xf2, 0xe7, 0x2d, + 0xf1, 0x13, 0x55, 0x78, 0x2f, 0x8e, 0x7d, 0xbd, 0x93, 0x53, 0xca, 0xa4, 0xb0, 0x0a, 0x37, 0xb3, + 0x1a, 0x9f, 0xc2, 0xe6, 0x98, 0x4a, 0x2b, 0xe7, 0xda, 0x14, 0x1b, 0x65, 0xeb, 0x4a, 0x94, 0xf3, + 0x02, 0xc0, 0x12, 0xb6, 0x34, 0xca, 0x23, 0xcd, 0x44, 0x5e, 0x42, 0xfc, 0x9b, 0xfa, 0xbe, 0x50, + 0xbb, 0x39, 0x24, 0x92, 0x0a, 0xf9, 0x1f, 0x1a, 0x1f, 0xe8, 0x1b, 0xae, 0xe8, 0xfc, 0x0f, 0x1a, + 0xef, 0xfe, 0x58, 0x81, 0x9e, 0x6f, 0x9e, 0x0b, 0xf4, 0x1c, 0x06, 0x96, 0x38, 0x04, 0xba, 0xa5, + 0x24, 0x3e, 0xaf, 0x17, 0x6f, 0x4d, 0x1d, 0x58, 0xcf, 0x02, 0x5e, 0x7a, 0xe0, 0xa0, 0xc7, 0x00, + 0x33, 0x15, 0xa1, 0x2d, 0x7d, 0x3f, 0xd4, 0x65, 0xe5, 0x0d, 0xec, 0x5c, 0xbc, 0x84, 0x1e, 0xc2, + 0x6a, 0x49, 0x74, 0xb4, 0x59, 0x24, 0x55, 0x24, 0xe6, 0xf5, 0x95, 0x5b, 0xfb, 0xf0, 0x12, 0x3a, + 0x80, 0x9b, 0x65, 0xc8, 0xab, 0x84, 0x17, 0xef, 0xda, 0x76, 0x35, 0xb9, 0xae, 0x9a, 0x7a, 0x95, + 0x8f, 0x70, 0x77, 0x4c, 0xa5, 0x75, 0x3b, 0x45, 0x54, 0x7c, 0x98, 0x92, 0x82, 0xe3, 0xb3, 0x72, + 0xcd, 0x5a, 0xf1, 0xd6, 0xed, 0x47, 0x4c, 0xdd, 0x6e, 0x6a, 0x0b, 0xfb, 0x4a, 0x28, 0xba, 0x8b, + 0x55, 0x4e, 0x20, 0xaf, 0xa8, 0x37, 0x2f, 0xa2, 0x3a, 0x34, 0x7f, 0x01, 0x34, 0xc3, 0x0c, 0x74, + 0xc7, 0x82, 0x56, 0xe7, 0xe9, 0x22, 0x5c, 0x5f, 0x00, 0x97, 0xdc, 0x5e, 0x5c, 0xb9, 0x1c, 0xba, + 0x59, 0x04, 0x8b, 0x8a, 0xbf, 0x53, 0x80, 0x0d, 0x7f, 0x67, 0xb3, 0x9b, 0x74, 0x31, 0x2b, 0xdb, + 0x4c, 0xf1, 0xda, 0xfc, 0xc7, 0x1d, 0xf5, 0xc7, 0xe5, 0xd1, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xf7, 0x7c, 0x82, 0x4a, 0xca, 0x08, 0x00, 0x00, } diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/api/registry.proto b/vendor/github.com/operator-framework/operator-registry/pkg/api/registry.proto index caf6b53faab..08ca7584193 100644 --- a/vendor/github.com/operator-framework/operator-registry/pkg/api/registry.proto +++ b/vendor/github.com/operator-framework/operator-registry/pkg/api/registry.proto @@ -30,12 +30,22 @@ message Package{ string defaultChannelName = 3; } +message GroupVersionKind{ + string group = 1; + string version = 2; + string kind = 3; + string plural = 4; +} + message Bundle{ string csvName = 1; string packageName = 2; string channelName = 3; string csvJson = 4; repeated string object = 5; + string bundlePath = 6; + repeated GroupVersionKind providedApis = 7; + repeated GroupVersionKind requiredApis = 8; } message ChannelEntry{ diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/client/client.go b/vendor/github.com/operator-framework/operator-registry/pkg/client/client.go index 8a319049f85..65e1d0957af 100644 --- a/vendor/github.com/operator-framework/operator-registry/pkg/client/client.go +++ b/vendor/github.com/operator-framework/operator-registry/pkg/client/client.go @@ -9,14 +9,13 @@ import ( "github.com/operator-framework/operator-registry/pkg/api" "github.com/operator-framework/operator-registry/pkg/api/grpc_health_v1" - "github.com/operator-framework/operator-registry/pkg/registry" ) type Interface interface { - GetBundle(ctx context.Context, packageName, channelName, csvName string) (*registry.Bundle, error) - GetBundleInPackageChannel(ctx context.Context, packageName, channelName string) (*registry.Bundle, error) - GetReplacementBundleInPackageChannel(ctx context.Context, currentName, packageName, channelName string) (*registry.Bundle, error) - GetBundleThatProvides(ctx context.Context, group, version, kind string) (*registry.Bundle, error) + GetBundle(ctx context.Context, packageName, channelName, csvName string) (*api.Bundle, error) + GetBundleInPackageChannel(ctx context.Context, packageName, channelName string) (*api.Bundle, error) + GetReplacementBundleInPackageChannel(ctx context.Context, currentName, packageName, channelName string) (*api.Bundle, error) + GetBundleThatProvides(ctx context.Context, group, version, kind string) (*api.Bundle, error) HealthCheck(ctx context.Context, reconnectTimeout time.Duration) (bool, error) Close() error } @@ -29,40 +28,20 @@ type Client struct { var _ Interface = &Client{} -func (c *Client) GetBundle(ctx context.Context, packageName, channelName, csvName string) (*registry.Bundle, error) { - bundle, err := c.Registry.GetBundle(ctx, &api.GetBundleRequest{PkgName: packageName, ChannelName: channelName, CsvName: csvName}) - if err != nil { - return nil, err - } - return registry.NewBundleFromStrings(bundle.CsvName, bundle.PackageName, bundle.ChannelName, bundle.Object) +func (c *Client) GetBundle(ctx context.Context, packageName, channelName, csvName string) (*api.Bundle, error) { + return c.Registry.GetBundle(ctx, &api.GetBundleRequest{PkgName: packageName, ChannelName: channelName, CsvName: csvName}) } -func (c *Client) GetBundleInPackageChannel(ctx context.Context, packageName, channelName string) (*registry.Bundle, error) { - bundle, err := c.Registry.GetBundleForChannel(ctx, &api.GetBundleInChannelRequest{PkgName: packageName, ChannelName: channelName}) - if err != nil { - return nil, err - } - return registry.NewBundleFromStrings(bundle.CsvName, packageName, channelName, bundle.Object) +func (c *Client) GetBundleInPackageChannel(ctx context.Context, packageName, channelName string) (*api.Bundle, error) { + return c.Registry.GetBundleForChannel(ctx, &api.GetBundleInChannelRequest{PkgName: packageName, ChannelName: channelName}) } -func (c *Client) GetReplacementBundleInPackageChannel(ctx context.Context, currentName, packageName, channelName string) (*registry.Bundle, error) { - bundle, err := c.Registry.GetBundleThatReplaces(ctx, &api.GetReplacementRequest{CsvName: currentName, PkgName: packageName, ChannelName: channelName}) - if err != nil { - return nil, err - } - return registry.NewBundleFromStrings(bundle.CsvName, packageName, channelName, bundle.Object) +func (c *Client) GetReplacementBundleInPackageChannel(ctx context.Context, currentName, packageName, channelName string) (*api.Bundle, error) { + return c.Registry.GetBundleThatReplaces(ctx, &api.GetReplacementRequest{CsvName: currentName, PkgName: packageName, ChannelName: channelName}) } -func (c *Client) GetBundleThatProvides(ctx context.Context, group, version, kind string) (*registry.Bundle, error) { - bundle, err := c.Registry.GetDefaultBundleThatProvides(ctx, &api.GetDefaultProviderRequest{Group: group, Version: version, Kind: kind}) - if err != nil { - return nil, err - } - parsedBundle, err := registry.NewBundleFromStrings(bundle.CsvName, bundle.PackageName, bundle.ChannelName, bundle.Object) - if err != nil { - return nil, err - } - return parsedBundle, nil +func (c *Client) GetBundleThatProvides(ctx context.Context, group, version, kind string) (*api.Bundle, error) { + return c.Registry.GetDefaultBundleThatProvides(ctx, &api.GetDefaultProviderRequest{Group: group, Version: version, Kind: kind}) } func (c *Client) Close() error { diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/client/kubeclient.go b/vendor/github.com/operator-framework/operator-registry/pkg/client/kubeclient.go new file mode 100644 index 00000000000..17a6532f883 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/client/kubeclient.go @@ -0,0 +1,35 @@ +package client + +import ( + "fmt" + "os" + + "github.com/sirupsen/logrus" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/clientcmd" +) + +func NewKubeClient(kubeconfig string, logger *logrus.Logger) (clientset *kubernetes.Clientset, err error) { + var config *rest.Config + + if overrideConfig := os.Getenv(clientcmd.RecommendedConfigPathEnvVar); overrideConfig != "" { + kubeconfig = overrideConfig + } + + if kubeconfig != "" { + logger.Infof("Loading kube client config from path %q", kubeconfig) + config, err = clientcmd.BuildConfigFromFlags("", kubeconfig) + } else { + logger.Infof("Using in-cluster kube client config") + config, err = rest.InClusterConfig() + } + + if err != nil { + err = fmt.Errorf("Cannot load config for REST client: %v", err) + return + } + + clientset, err = kubernetes.NewForConfig(config) + return +} diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/registry/bundle.go b/vendor/github.com/operator-framework/operator-registry/pkg/registry/bundle.go index d223a7359ce..b9ed042a6f4 100644 --- a/vendor/github.com/operator-framework/operator-registry/pkg/registry/bundle.go +++ b/vendor/github.com/operator-framework/operator-registry/pkg/registry/bundle.go @@ -1,11 +1,9 @@ package registry import ( - "encoding/json" "fmt" "strings" - "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" @@ -35,7 +33,7 @@ type Bundle struct { Package string Channel string csv *ClusterServiceVersion - crds []*apiextensions.CustomResourceDefinition + crds []*v1beta1.CustomResourceDefinition cacheStale bool } @@ -76,7 +74,7 @@ func (b *Bundle) ClusterServiceVersion() (*ClusterServiceVersion, error) { return b.csv, nil } -func (b *Bundle) CustomResourceDefinitions() ([]*apiextensions.CustomResourceDefinition, error) { +func (b *Bundle) CustomResourceDefinitions() ([]*v1beta1.CustomResourceDefinition, error) { if err := b.cache(); err != nil { return nil, err } @@ -104,6 +102,9 @@ func (b *Bundle) ProvidedAPIs() (map[APIKey]struct{}, error) { } ownedAPIs, _, err := csv.GetApiServiceDefinitions() + if err != nil { + return nil, err + } for _, api := range ownedAPIs { provided[APIKey{Group: api.Group, Version: api.Version, Kind: api.Kind, Plural: api.Name}] = struct{}{} } @@ -194,6 +195,28 @@ func (b *Bundle) Serialize() (csvName string, csvBytes []byte, bundleBytes []byt return csvName, csvBytes, bundleBytes, nil } +func (b *Bundle) Images() (map[string]struct{}, error) { + csv, err := b.ClusterServiceVersion() + if err != nil { + return nil, err + } + + images, err := csv.GetOperatorImages() + if err != nil { + return nil, err + } + + relatedImages, err := csv.GetRelatedImages() + if err != nil { + return nil, err + } + for img := range relatedImages { + images[img] = struct{}{} + } + + return images, nil +} + func (b *Bundle) cache() error { if !b.cacheStale { return nil @@ -210,19 +233,20 @@ func (b *Bundle) cache() error { } if b.crds == nil { - b.crds = []*apiextensions.CustomResourceDefinition{} + b.crds = []*v1beta1.CustomResourceDefinition{} } for _, o := range b.Objects { if o.GetObjectKind().GroupVersionKind().Kind == "CustomResourceDefinition" { - crd := &apiextensions.CustomResourceDefinition{} - // Marshal Unstructured and Unmarshal as CustomResourceDefinition. FromUnstructured has issues + crd := &v1beta1.CustomResourceDefinition{} + // Marshal Unstructured and Decode as CustomResourceDefinition. FromUnstructured has issues // converting JSON numbers to float64 for CRD minimum/maximum validation. - bytes, err := o.MarshalJSON() + cb, err := o.MarshalJSON() if err != nil { return err } - if err := json.Unmarshal(bytes, &crd); err != nil { - return err + dec := serializer.NewCodecFactory(Scheme).UniversalDeserializer() + if _, _, err = dec.Decode(cb, nil, crd); err != nil { + return fmt.Errorf("error decoding CRD: %v", err) } b.crds = append(b.crds, crd) } diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/api/conversion.go b/vendor/github.com/operator-framework/operator-registry/pkg/registry/conversion.go similarity index 72% rename from vendor/github.com/operator-framework/operator-registry/pkg/api/conversion.go rename to vendor/github.com/operator-framework/operator-registry/pkg/registry/conversion.go index 2000d190852..fd79b31c2fe 100644 --- a/vendor/github.com/operator-framework/operator-registry/pkg/api/conversion.go +++ b/vendor/github.com/operator-framework/operator-registry/pkg/registry/conversion.go @@ -1,36 +1,37 @@ -package api +package registry import ( "encoding/json" "fmt" "strings" - "github.com/operator-framework/operator-registry/pkg/registry" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/util/yaml" + + "github.com/operator-framework/operator-registry/pkg/api" ) -func PackageManifestToAPIPackage(manifest *registry.PackageManifest) *Package { - channels := []*Channel{} +func PackageManifestToAPIPackage(manifest *PackageManifest) *api.Package { + channels := []*api.Channel{} for _, c := range manifest.Channels { channels = append(channels, PackageChannelToAPIChannel(&c)) } - return &Package{ + return &api.Package{ Name: manifest.PackageName, DefaultChannelName: manifest.DefaultChannelName, Channels: channels, } } -func PackageChannelToAPIChannel(channel *registry.PackageChannel) *Channel { - return &Channel{ +func PackageChannelToAPIChannel(channel *PackageChannel) *api.Channel { + return &api.Channel{ Name: channel.Name, CsvName: channel.CurrentCSVName, } } -func ChannelEntryToAPIChannelEntry(entry *registry.ChannelEntry) *ChannelEntry { - return &ChannelEntry{ +func ChannelEntryToAPIChannelEntry(entry *ChannelEntry) *api.ChannelEntry { + return &api.ChannelEntry{ PackageName: entry.PackageName, ChannelName: entry.ChannelName, BundleName: entry.BundleName, @@ -55,12 +56,12 @@ func BundleStringToObjectStrings(bundleString string) ([]string, error) { return objs, nil } -func BundleStringToAPIBundle(bundleString string, entry *registry.ChannelEntry) (*Bundle, error) { +func BundleStringToAPIBundle(bundleString string) (*api.Bundle, error) { objs, err := BundleStringToObjectStrings(bundleString) if err != nil { return nil, err } - out := &Bundle{ + out := &api.Bundle{ Object: objs, } for _, o := range objs { @@ -78,7 +79,5 @@ func BundleStringToAPIBundle(bundleString string, entry *registry.ChannelEntry) if out.CsvName == "" { return nil, fmt.Errorf("no csv in bundle") } - out.ChannelName = entry.ChannelName - out.PackageName = entry.PackageName return out, nil } diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/registry/csv.go b/vendor/github.com/operator-framework/operator-registry/pkg/registry/csv.go index 5ad2240d7bd..f2b6b759d8c 100644 --- a/vendor/github.com/operator-framework/operator-registry/pkg/registry/csv.go +++ b/vendor/github.com/operator-framework/operator-registry/pkg/registry/csv.go @@ -3,6 +3,7 @@ package registry import ( "encoding/json" + v1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -28,6 +29,9 @@ const ( // The yaml attribute that specifies the version of the ClusterServiceVersion // expected to be semver and parseable by blang/semver version = "version" + + // The yaml attribute that specifies the related images of the ClusterServiceVersion + relatedImages = "relatedImages" ) // ClusterServiceVersion is a structured representation of cluster service @@ -187,3 +191,74 @@ func (csv *ClusterServiceVersion) GetApiServiceDefinitions() (owned []*Definitio required = definitions.Required return } + +// GetRelatedImage returns the list of associated images for the operator +func (csv *ClusterServiceVersion) GetRelatedImages() (imageSet map[string]struct{}, err error) { + var objmap map[string]*json.RawMessage + imageSet = make(map[string]struct{}) + + if err = json.Unmarshal(csv.Spec, &objmap); err != nil { + return + } + + rawValue, ok := objmap[relatedImages] + if !ok || rawValue == nil { + return + } + + type relatedImage struct { + Name string `json:"name"` + Ref string `json:"image"` + } + var relatedImages []relatedImage + if err = json.Unmarshal(*rawValue, &relatedImages); err != nil { + return + } + + for _, img := range relatedImages { + imageSet[img.Ref] = struct{}{} + } + + return +} + +// GetOperatorImages returns a list of any images used to run the operator. +// Currently this pulls any images in the pod specs of operator deployments. +func (csv *ClusterServiceVersion) GetOperatorImages() (map[string]struct{}, error) { + type dep struct { + Name string + Spec v1.DeploymentSpec + } + type strategySpec struct { + Deployments []dep + } + type strategy struct { + Name string `json:"strategy"` + Spec strategySpec `json:"spec"` + } + type csvSpec struct { + Install strategy + } + + var spec csvSpec + if err := json.Unmarshal(csv.Spec, &spec); err != nil { + return nil, err + } + + // this is the only install strategy we know about + if spec.Install.Name != "deployment" { + return nil, nil + } + + images := map[string]struct{}{} + for _, d := range spec.Install.Spec.Deployments { + for _, c := range d.Spec.Template.Spec.Containers { + images[c.Image] = struct{}{} + } + for _, c := range d.Spec.Template.Spec.InitContainers { + images[c.Image] = struct{}{} + } + } + + return images, nil +} diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/registry/decode.go b/vendor/github.com/operator-framework/operator-registry/pkg/registry/decode.go new file mode 100644 index 00000000000..4d418df765b --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/registry/decode.go @@ -0,0 +1,43 @@ +package registry + +import ( + "errors" + "fmt" + "io" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/util/yaml" +) + +// DecodeUnstructured decodes a raw stream into a an +// unstructured.Unstructured instance. +func DecodeUnstructured(reader io.Reader) (obj *unstructured.Unstructured, err error) { + decoder := yaml.NewYAMLOrJSONDecoder(reader, 30) + + t := &unstructured.Unstructured{} + if err = decoder.Decode(t); err != nil { + return + } + + obj = t + return +} + +// DecodePackageManifest decodes a raw stream into a a PackageManifest instance. +// If a package name is empty we consider the object invalid! +func DecodePackageManifest(reader io.Reader) (manifest *PackageManifest, err error) { + decoder := yaml.NewYAMLOrJSONDecoder(reader, 30) + + obj := &PackageManifest{} + if decodeErr := decoder.Decode(obj); decodeErr != nil { + err = fmt.Errorf("could not decode contents into package manifest - %v", decodeErr) + return + } + + if obj.PackageName == "" { + err = errors.New("name of package (packageName) is missing") + return + } + + manifest = obj + return +} diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/registry/empty.go b/vendor/github.com/operator-framework/operator-registry/pkg/registry/empty.go index 6eda1810dc7..9b33043ea95 100644 --- a/vendor/github.com/operator-framework/operator-registry/pkg/registry/empty.go +++ b/vendor/github.com/operator-framework/operator-registry/pkg/registry/empty.go @@ -3,6 +3,8 @@ package registry import ( "context" "errors" + + "github.com/operator-framework/operator-registry/pkg/api" ) // EmptyQuery acts as a "zero value" implementation of the Query interface. @@ -22,20 +24,20 @@ func (EmptyQuery) GetPackage(ctx context.Context, name string) (*PackageManifest return nil, errors.New("empty querier: cannot get package") } -func (EmptyQuery) GetBundle(ctx context.Context, pkgName, channelName, csvName string) (string, error) { - return "", errors.New("empty querier: cannot get bundle") +func (EmptyQuery) GetBundle(ctx context.Context, pkgName, channelName, csvName string) (*api.Bundle, error) { + return nil, errors.New("empty querier: cannot get bundle") } -func (EmptyQuery) GetBundleForChannel(ctx context.Context, pkgName string, channelName string) (string, error) { - return "", errors.New("empty querier: cannot get bundle for channel") +func (EmptyQuery) GetBundleForChannel(ctx context.Context, pkgName string, channelName string) (*api.Bundle, error) { + return nil, errors.New("empty querier: cannot get bundle for channel") } func (EmptyQuery) GetChannelEntriesThatReplace(ctx context.Context, name string) (entries []*ChannelEntry, err error) { return nil, errors.New("empty querier: cannot get channel entries that replace") } -func (EmptyQuery) GetBundleThatReplaces(ctx context.Context, name, pkgName, channelName string) (string, error) { - return "", errors.New("empty querier: cannot get bundle that replaces") +func (EmptyQuery) GetBundleThatReplaces(ctx context.Context, name, pkgName, channelName string) (*api.Bundle, error) { + return nil, errors.New("empty querier: cannot get bundle that replaces") } func (EmptyQuery) GetChannelEntriesThatProvide(ctx context.Context, group, version, kind string) (entries []*ChannelEntry, err error) { @@ -46,10 +48,25 @@ func (EmptyQuery) GetLatestChannelEntriesThatProvide(ctx context.Context, group, return nil, errors.New("empty querier: cannot get latest channel entries that provide") } -func (EmptyQuery) GetBundleThatProvides(ctx context.Context, group, version, kind string) (string, *ChannelEntry, error) { - return "", nil, errors.New("empty querier: cannot get bundle that provides") +func (EmptyQuery) GetBundleThatProvides(ctx context.Context, group, version, kind string) (*api.Bundle, error) { + return nil, errors.New("empty querier: cannot get bundle that provides") } +func (EmptyQuery) ListImages(ctx context.Context) ([]string, error) { + return nil, errors.New("empty querier: cannot get image list") + +} + +func (EmptyQuery) GetImagesForBundle(ctx context.Context, bundleName string) ([]string, error) { + return nil, errors.New("empty querier: cannot get image list") +} + +func (EmptyQuery) GetApisForEntry(ctx context.Context, entryId int64) (provided []*api.GroupVersionKind, required []*api.GroupVersionKind, err error) { + return nil, nil, errors.New("empty querier: cannot apis") +} + +var _ Query = &EmptyQuery{} + func NewEmptyQuerier() *EmptyQuery { return &EmptyQuery{} } diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/registry/interface.go b/vendor/github.com/operator-framework/operator-registry/pkg/registry/interface.go index a8306e6eb06..df2378088d8 100644 --- a/vendor/github.com/operator-framework/operator-registry/pkg/registry/interface.go +++ b/vendor/github.com/operator-framework/operator-registry/pkg/registry/interface.go @@ -2,6 +2,8 @@ package registry import ( "context" + + "github.com/operator-framework/operator-registry/pkg/api" ) type Load interface { @@ -13,16 +15,22 @@ type Query interface { ListTables(ctx context.Context) ([]string, error) ListPackages(ctx context.Context) ([]string, error) GetPackage(ctx context.Context, name string) (*PackageManifest, error) - GetBundle(ctx context.Context, pkgName, channelName, csvName string) (string, error) - GetBundleForChannel(ctx context.Context, pkgName string, channelName string) (string, error) + GetBundle(ctx context.Context, pkgName, channelName, csvName string) (*api.Bundle, error) + GetBundleForChannel(ctx context.Context, pkgName string, channelName string) (*api.Bundle, error) // Get all channel entries that say they replace this one GetChannelEntriesThatReplace(ctx context.Context, name string) (entries []*ChannelEntry, err error) // Get the bundle in a package/channel that replace this one - GetBundleThatReplaces(ctx context.Context, name, pkgName, channelName string) (string, error) + GetBundleThatReplaces(ctx context.Context, name, pkgName, channelName string) (*api.Bundle, error) // Get all channel entries that provide an api GetChannelEntriesThatProvide(ctx context.Context, group, version, kind string) (entries []*ChannelEntry, err error) // Get latest channel entries that provide an api GetLatestChannelEntriesThatProvide(ctx context.Context, group, version, kind string) (entries []*ChannelEntry, err error) // Get the the latest bundle that provides the API in a default channel - GetBundleThatProvides(ctx context.Context, group, version, kind string) (string, *ChannelEntry, error) + GetBundleThatProvides(ctx context.Context, group, version, kind string) (*api.Bundle, error) + // List all images in the database + ListImages(ctx context.Context) ([]string, error) + // List all images for a particular bundle + GetImagesForBundle(ctx context.Context, bundleName string) ([]string, error) + // Get Provided and Required APIs for a particular bundle + GetApisForEntry(ctx context.Context, entryId int64) (provided []*api.GroupVersionKind, required []*api.GroupVersionKind, err error) } diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/server/health.go b/vendor/github.com/operator-framework/operator-registry/pkg/server/health.go index 506937aafcd..546fbcd1b40 100644 --- a/vendor/github.com/operator-framework/operator-registry/pkg/server/health.go +++ b/vendor/github.com/operator-framework/operator-registry/pkg/server/health.go @@ -9,7 +9,7 @@ import ( type HealthServer struct { } -var _ health.HealthServer= &HealthServer{} +var _ health.HealthServer = &HealthServer{} func NewHealthServer() *HealthServer { return &HealthServer{} diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/server/server.go b/vendor/github.com/operator-framework/operator-registry/pkg/server/server.go index 2689b094885..50144d35e5a 100644 --- a/vendor/github.com/operator-framework/operator-registry/pkg/server/server.go +++ b/vendor/github.com/operator-framework/operator-registry/pkg/server/server.go @@ -3,6 +3,7 @@ package server import ( "github.com/operator-framework/operator-registry/pkg/api" "github.com/operator-framework/operator-registry/pkg/registry" + "golang.org/x/net/context" ) @@ -35,31 +36,15 @@ func (s *RegistryServer) GetPackage(ctx context.Context, req *api.GetPackageRequ if err != nil { return nil, err } - return api.PackageManifestToAPIPackage(packageManifest), nil + return registry.PackageManifestToAPIPackage(packageManifest), nil } func (s *RegistryServer) GetBundle(ctx context.Context, req *api.GetBundleRequest) (*api.Bundle, error) { - bundleString, err := s.store.GetBundle(ctx, req.GetPkgName(), req.GetChannelName(), req.GetCsvName()) - if err != nil { - return nil, err - } - entry := ®istry.ChannelEntry{ - PackageName: req.GetPkgName(), - ChannelName: req.GetChannelName(), - } - return api.BundleStringToAPIBundle(bundleString, entry) + return s.store.GetBundle(ctx, req.GetPkgName(), req.GetChannelName(), req.GetCsvName()) } func (s *RegistryServer) GetBundleForChannel(ctx context.Context, req *api.GetBundleInChannelRequest) (*api.Bundle, error) { - bundleString, err := s.store.GetBundleForChannel(ctx, req.GetPkgName(), req.GetChannelName()) - if err != nil { - return nil, err - } - entry := ®istry.ChannelEntry{ - PackageName: req.GetPkgName(), - ChannelName: req.GetChannelName(), - } - return api.BundleStringToAPIBundle(bundleString, entry) + return s.store.GetBundleForChannel(ctx, req.GetPkgName(), req.GetChannelName()) } func (s *RegistryServer) GetChannelEntriesThatReplace(req *api.GetAllReplacementsRequest, stream api.Registry_GetChannelEntriesThatReplaceServer) error { @@ -68,7 +53,7 @@ func (s *RegistryServer) GetChannelEntriesThatReplace(req *api.GetAllReplacement return err } for _, e := range channelEntries { - if err := stream.Send(api.ChannelEntryToAPIChannelEntry(e)); err != nil { + if err := stream.Send(registry.ChannelEntryToAPIChannelEntry(e)); err != nil { return err } } @@ -76,16 +61,7 @@ func (s *RegistryServer) GetChannelEntriesThatReplace(req *api.GetAllReplacement } func (s *RegistryServer) GetBundleThatReplaces(ctx context.Context, req *api.GetReplacementRequest) (*api.Bundle, error) { - bundleString, err := s.store.GetBundleThatReplaces(ctx, req.GetCsvName(), req.GetPkgName(), req.GetChannelName()) - if err != nil { - return nil, err - } - entry := ®istry.ChannelEntry{ - PackageName: req.GetPkgName(), - ChannelName: req.GetChannelName(), - Replaces: req.GetCsvName(), - } - return api.BundleStringToAPIBundle(bundleString, entry) + return s.store.GetBundleThatReplaces(ctx, req.GetCsvName(), req.GetPkgName(), req.GetChannelName()) } func (s *RegistryServer) GetChannelEntriesThatProvide(req *api.GetAllProvidersRequest, stream api.Registry_GetChannelEntriesThatProvideServer) error { @@ -94,7 +70,7 @@ func (s *RegistryServer) GetChannelEntriesThatProvide(req *api.GetAllProvidersRe return err } for _, e := range channelEntries { - if err := stream.Send(api.ChannelEntryToAPIChannelEntry(e)); err != nil { + if err := stream.Send(registry.ChannelEntryToAPIChannelEntry(e)); err != nil { return err } } @@ -107,7 +83,7 @@ func (s *RegistryServer) GetLatestChannelEntriesThatProvide(req *api.GetLatestPr return err } for _, e := range channelEntries { - if err := stream.Send(api.ChannelEntryToAPIChannelEntry(e)); err != nil { + if err := stream.Send(registry.ChannelEntryToAPIChannelEntry(e)); err != nil { return err } } @@ -115,9 +91,5 @@ func (s *RegistryServer) GetLatestChannelEntriesThatProvide(req *api.GetLatestPr } func (s *RegistryServer) GetDefaultBundleThatProvides(ctx context.Context, req *api.GetDefaultProviderRequest) (*api.Bundle, error) { - bundleString, channelEntry, err := s.store.GetBundleThatProvides(ctx, req.GetGroup(), req.GetVersion(), req.GetKind()) - if err != nil { - return nil, err - } - return api.BundleStringToAPIBundle(bundleString, channelEntry) + return s.store.GetBundleThatProvides(ctx, req.GetGroup(), req.GetVersion(), req.GetKind()) } diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/db_options.go b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/db_options.go new file mode 100644 index 00000000000..889f550e0d0 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/db_options.go @@ -0,0 +1,24 @@ +package sqlite + +import ( + "database/sql" +) + +type DbOptions struct { + // MigratorBuilder is a function that returns a migrator instance + MigratorBuilder func(*sql.DB) (Migrator, error) +} + +type DbOption func(*DbOptions) + +func defaultDBOptions() *DbOptions { + return &DbOptions{ + MigratorBuilder: NewSQLLiteMigrator, + } +} + +func WithMigratorBuilder(m func(loader *sql.DB) (Migrator, error)) DbOption { + return func(o *DbOptions) { + o.MigratorBuilder = m + } +} diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/load.go b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/load.go index 0e5139c8d7b..c3795690140 100644 --- a/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/load.go +++ b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/load.go @@ -1,6 +1,7 @@ package sqlite import ( + "context" "database/sql" "fmt" "strings" @@ -15,69 +16,35 @@ import ( ) type SQLLoader struct { - db *sql.DB + db *sql.DB + migrator Migrator } var _ registry.Load = &SQLLoader{} -func NewSQLLiteLoader(outFilename string) (*SQLLoader, error) { - db, err := sql.Open("sqlite3", outFilename) // TODO: ?immutable=true - if err != nil { +func NewSQLLiteLoader(db *sql.DB, opts ...DbOption) (*SQLLoader, error) { + options := defaultDBOptions() + for _, o := range opts { + o(options) + } + + if _, err := db.Exec("PRAGMA foreign_keys = ON", nil); err != nil { return nil, err } - createTable := ` - CREATE TABLE IF NOT EXISTS operatorbundle ( - name TEXT PRIMARY KEY, - csv TEXT UNIQUE, - bundle TEXT - ); - CREATE TABLE IF NOT EXISTS package ( - name TEXT PRIMARY KEY, - default_channel TEXT, - FOREIGN KEY(default_channel) REFERENCES channel(name) - ); - CREATE TABLE IF NOT EXISTS channel ( - name TEXT, - package_name TEXT, - head_operatorbundle_name TEXT, - PRIMARY KEY(name, package_name), - FOREIGN KEY(package_name) REFERENCES package(name), - FOREIGN KEY(head_operatorbundle_name) REFERENCES operatorbundle(name) - ); - CREATE TABLE IF NOT EXISTS channel_entry ( - entry_id INTEGER PRIMARY KEY, - channel_name TEXT, - package_name TEXT, - operatorbundle_name TEXT, - replaces INTEGER, - depth INTEGER, - FOREIGN KEY(replaces) REFERENCES channel_entry(entry_id) DEFERRABLE INITIALLY DEFERRED, - FOREIGN KEY(channel_name) REFERENCES channel(name), - FOREIGN KEY(package_name) REFERENCES channel(package_name), - FOREIGN KEY(operatorbundle_name) REFERENCES operatorbundle(name) - ); - CREATE TABLE IF NOT EXISTS api ( - group_name TEXT, - version TEXT, - kind TEXT, - plural TEXT NOT NULL, - PRIMARY KEY(group_name, version, kind) - ); - CREATE TABLE IF NOT EXISTS api_provider ( - group_name TEXT, - version TEXT, - kind TEXT, - channel_entry_id INTEGER, - FOREIGN KEY(channel_entry_id) REFERENCES channel_entry(entry_id), - FOREIGN KEY(group_name, version, kind) REFERENCES api(group_name, version, kind) - ); - ` - - if _, err = db.Exec(createTable); err != nil { + migrator, err := options.MigratorBuilder(db) + if err != nil { return nil, err } - return &SQLLoader{db}, nil + + return &SQLLoader{db: db, migrator: migrator}, nil +} + +func (s *SQLLoader) Migrate(ctx context.Context) error { + if s.migrator == nil { + return fmt.Errorf("no migrator configured") + } + return s.migrator.Migrate(ctx) } func (s *SQLLoader) AddOperatorBundle(bundle *registry.Bundle) error { @@ -89,12 +56,18 @@ func (s *SQLLoader) AddOperatorBundle(bundle *registry.Bundle) error { tx.Rollback() }() - stmt, err := tx.Prepare("insert into operatorbundle(name, csv, bundle) values(?, ?, ?)") + stmt, err := tx.Prepare("insert into operatorbundle(name, csv, bundle, bundlepath) values(?, ?, ?, ?)") if err != nil { return err } defer stmt.Close() + addImage, err := tx.Prepare("insert into related_image(image, operatorbundle_name) values(?,?)") + if err != nil { + return err + } + defer addImage.Close() + csvName, csvBytes, bundleBytes, err := bundle.Serialize() if err != nil { return err @@ -104,10 +77,21 @@ func (s *SQLLoader) AddOperatorBundle(bundle *registry.Bundle) error { return fmt.Errorf("csv name not found") } - if _, err := stmt.Exec(csvName, csvBytes, bundleBytes); err != nil { + if _, err := stmt.Exec(csvName, csvBytes, bundleBytes, nil); err != nil { return err } + imgs, err := bundle.Images() + if err != nil { + return err + } + // TODO: bulk insert + for img := range imgs { + if _, err := addImage.Exec(img, csvName); err != nil { + return err + } + } + return tx.Commit() } @@ -150,18 +134,6 @@ func (s *SQLLoader) AddPackageChannels(manifest registry.PackageManifest) error } defer addReplaces.Close() - addAPI, err := tx.Prepare("insert or replace into api(group_name, version, kind, plural) values(?, ?, ?, ?)") - if err != nil { - return err - } - defer addAPI.Close() - - addAPIProvider, err := tx.Prepare("insert into api_provider(group_name, version, kind, channel_entry_id) values(?, ?, ?, ?)") - if err != nil { - return err - } - defer addAPIProvider.Close() - if _, err := addPackage.Exec(manifest.PackageName); err != nil { // This should be terminal return err @@ -209,7 +181,7 @@ func (s *SQLLoader) AddPackageChannels(manifest registry.PackageManifest) error break } - if err := s.addProvidedAPIs(tx, channelEntryCSV, currentID); err != nil { + if err := s.addAPIs(tx, channelEntryCSV, currentID); err != nil { errs = append(errs, err) } @@ -250,7 +222,7 @@ func (s *SQLLoader) AddPackageChannels(manifest registry.PackageManifest) error continue } - if err := s.addProvidedAPIs(tx, channelEntryCSV, synthesizedID); err != nil { + if err := s.addAPIs(tx, channelEntryCSV, synthesizedID); err != nil { errs = append(errs, err) continue } @@ -302,10 +274,6 @@ func (s *SQLLoader) AddPackageChannels(manifest registry.PackageManifest) error return utilerrors.NewAggregate(errs) } -func (s *SQLLoader) Close() error { - return s.db.Close() -} - func SplitCRDName(crdName string) (plural, group string, err error) { pluralGroup := strings.SplitN(crdName, ".", 2) if len(pluralGroup) != 2 { @@ -354,7 +322,7 @@ func (s *SQLLoader) getCSV(tx *sql.Tx, csvName string) (*registry.ClusterService return csv, nil } -func (s *SQLLoader) addProvidedAPIs(tx *sql.Tx, csv *registry.ClusterServiceVersion, channelEntryId int64) error { +func (s *SQLLoader) addAPIs(tx *sql.Tx, csv *registry.ClusterServiceVersion, channelEntryId int64) error { addAPI, err := tx.Prepare("insert or replace into api(group_name, version, kind, plural) values(?, ?, ?, ?)") if err != nil { return err @@ -367,7 +335,13 @@ func (s *SQLLoader) addProvidedAPIs(tx *sql.Tx, csv *registry.ClusterServiceVers } defer addAPIProvider.Close() - ownedCRDs, _, err := csv.GetCustomResourceDefintions() + addApiRequirer, err := tx.Prepare("insert into api_requirer(group_name, version, kind, channel_entry_id) values(?, ?, ?, ?)") + if err != nil { + return err + } + defer addApiRequirer.Close() + + ownedCRDs, requiredCRDs, err := csv.GetCustomResourceDefintions() for _, crd := range ownedCRDs { plural, group, err := SplitCRDName(crd.Name) if err != nil { @@ -380,8 +354,20 @@ func (s *SQLLoader) addProvidedAPIs(tx *sql.Tx, csv *registry.ClusterServiceVers return err } } + for _, crd := range requiredCRDs { + plural, group, err := SplitCRDName(crd.Name) + if err != nil { + return err + } + if _, err := addAPI.Exec(group, crd.Version, crd.Kind, plural); err != nil { + return err + } + if _, err := addApiRequirer.Exec(group, crd.Version, crd.Kind, channelEntryId); err != nil { + return err + } + } - ownedAPIs, _, err := csv.GetApiServiceDefinitions() + ownedAPIs, requiredAPIs, err := csv.GetApiServiceDefinitions() for _, api := range ownedAPIs { if _, err := addAPI.Exec(api.Group, api.Version, api.Kind, api.Name); err != nil { return err @@ -390,5 +376,13 @@ func (s *SQLLoader) addProvidedAPIs(tx *sql.Tx, csv *registry.ClusterServiceVers return err } } + for _, api := range requiredAPIs { + if _, err := addAPI.Exec(api.Group, api.Version, api.Kind, api.Name); err != nil { + return err + } + if _, err := addAPIProvider.Exec(api.Group, api.Version, api.Kind, channelEntryId); err != nil { + return err + } + } return nil } diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/000_init.go b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/000_init.go new file mode 100644 index 00000000000..67df6476cb9 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/000_init.go @@ -0,0 +1,78 @@ +package migrations + +import ( + "context" + "database/sql" +) + +var InitMigrationKey = 0 + +var initMigration = &Migration{ + Id: InitMigrationKey, + Up: func(ctx context.Context, tx *sql.Tx) error { + sql := ` + CREATE TABLE IF NOT EXISTS operatorbundle ( + name TEXT PRIMARY KEY, + csv TEXT UNIQUE, + bundle TEXT + ); + CREATE TABLE IF NOT EXISTS package ( + name TEXT PRIMARY KEY, + default_channel TEXT, + FOREIGN KEY(name, default_channel) REFERENCES channel(package_name,name) + ); + CREATE TABLE IF NOT EXISTS channel ( + name TEXT, + package_name TEXT, + head_operatorbundle_name TEXT, + PRIMARY KEY(name, package_name), + FOREIGN KEY(package_name) REFERENCES package(name), + FOREIGN KEY(head_operatorbundle_name) REFERENCES operatorbundle(name) + ); + CREATE TABLE IF NOT EXISTS channel_entry ( + entry_id INTEGER PRIMARY KEY, + channel_name TEXT, + package_name TEXT, + operatorbundle_name TEXT, + replaces INTEGER, + depth INTEGER, + FOREIGN KEY(replaces) REFERENCES channel_entry(entry_id) DEFERRABLE INITIALLY DEFERRED, + FOREIGN KEY(channel_name, package_name) REFERENCES channel(name, package_name) + ); + CREATE TABLE IF NOT EXISTS api ( + group_name TEXT, + version TEXT, + kind TEXT, + plural TEXT NOT NULL, + PRIMARY KEY(group_name, version, kind) + ); + CREATE TABLE IF NOT EXISTS api_provider ( + group_name TEXT, + version TEXT, + kind TEXT, + channel_entry_id INTEGER, + FOREIGN KEY(channel_entry_id) REFERENCES channel_entry(entry_id), + FOREIGN KEY(group_name, version, kind) REFERENCES api(group_name, version, kind) + ); + ` + _, err := tx.ExecContext(ctx, sql) + return err + }, + Down: func(ctx context.Context, tx *sql.Tx) error { + sql := ` + DROP TABLE operatorbundle; + DROP TABLE package; + DROP TABLE channel; + DROP TABLE channel_entry; + DROP TABLE api; + DROP TABLE api_provider; + ` + _, err := tx.ExecContext(ctx, sql) + + return err + }, +} + +func init() { + migrations[InitMigrationKey] = initMigration +} diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/001_related_images.go b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/001_related_images.go new file mode 100644 index 00000000000..392f7225267 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/001_related_images.go @@ -0,0 +1,123 @@ +package migrations + +import ( + "context" + "database/sql" + "encoding/json" + "fmt" + + "github.com/sirupsen/logrus" + + "github.com/operator-framework/operator-registry/pkg/registry" +) + +const RelatedImagesMigrationKey = 1 + +func init() { + migrations[RelatedImagesMigrationKey] = relatedImagesMigration +} + +// listBundles returns a list of operatorbundles as strings +func listBundles(ctx context.Context, tx *sql.Tx) ([]string, error) { + query := "SELECT DISTINCT name FROM operatorbundle" + rows, err := tx.QueryContext(ctx, query) + if err != nil { + return nil, err + } + bundles := []string{} + for rows.Next() { + var bundleName sql.NullString + if err := rows.Scan(&bundleName); err != nil { + return nil, err + } + if bundleName.Valid { + bundles = append(bundles, bundleName.String) + } + } + return bundles, nil +} + +// getCSV pulls the csv from by name +func getCSV(ctx context.Context, tx *sql.Tx, name string) (*registry.ClusterServiceVersion, error) { + query := `SELECT csv FROM operatorbundle WHERE operatorbundle.name=?` + rows, err := tx.QueryContext(ctx, query, name) + if err != nil { + return nil, err + } + + var csvJson sql.NullString + if !rows.Next() { + return nil, fmt.Errorf("bundle %s not found", name) + } + if err := rows.Scan(&csvJson); err != nil { + return nil, err + } + if !csvJson.Valid { + return nil, fmt.Errorf("bad value for csv") + } + csv := ®istry.ClusterServiceVersion{} + if err := json.Unmarshal([]byte(csvJson.String), csv); err != nil { + return nil, err + } + return csv, nil +} + +func extractRelatedImages(ctx context.Context, tx *sql.Tx, name string) error { + addSql := `insert into related_image(image, operatorbundle_name) values(?,?)` + csv, err := getCSV(ctx, tx, name) + if err != nil { + logrus.Warnf("error backfilling related images: %v", err) + return err + } + images, err := csv.GetOperatorImages() + if err != nil { + logrus.Warnf("error backfilling related images: %v", err) + return err + } + related, err := csv.GetRelatedImages() + if err != nil { + logrus.Warnf("error backfilling related images: %v", err) + return err + } + for k := range related { + images[k] = struct{}{} + } + for img := range images { + if _, err := tx.ExecContext(ctx, addSql, img, name); err != nil { + logrus.Warnf("error backfilling related images: %v", err) + continue + } + } + return nil +} + +var relatedImagesMigration = &Migration{ + Id: RelatedImagesMigrationKey, + Up: func(ctx context.Context, tx *sql.Tx) error { + sql := ` + CREATE TABLE IF NOT EXISTS related_image ( + image TEXT, + operatorbundle_name TEXT, + FOREIGN KEY(operatorbundle_name) REFERENCES operatorbundle(name) + ); + ` + _, err := tx.ExecContext(ctx, sql) + + bundles, err := listBundles(ctx, tx) + if err != nil { + return err + } + for _, bundle := range bundles { + if err := extractRelatedImages(ctx, tx, bundle); err != nil { + logrus.Warnf("error backfilling related images: %v", err) + continue + } + } + return err + }, + Down: func(ctx context.Context, tx *sql.Tx) error { + sql := `DROP TABLE related_image;` + _, err := tx.ExecContext(ctx, sql) + return err + }, +} diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/002_bundle_path.go b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/002_bundle_path.go new file mode 100644 index 00000000000..0ba0f09f069 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/002_bundle_path.go @@ -0,0 +1,55 @@ +package migrations + +import ( + "context" + "database/sql" +) + +const BundlePathMigrationKey = 2 + +// Register this migration +func init() { + migrations[BundlePathMigrationKey] = bundlePathMigration +} + +var bundlePathMigration = &Migration{ + Id: BundlePathMigrationKey, + Up: func(ctx context.Context, tx *sql.Tx) error { + sql := ` + ALTER TABLE operatorbundle + ADD COLUMN bundlepath TEXT; + ` + _, err := tx.ExecContext(ctx, sql) + return err + }, + Down: func(ctx context.Context, tx *sql.Tx) error { + foreingKeyOff := `PRAGMA foreign_keys = 0` + createTempTable := `CREATE TABLE operatorbundle_backup (name TEXT,csv TEXT,bundle TEXT)` + backupTargetTable := `INSERT INTO operatorbundle_backup SELECT name,csv,bundle FROM operatorbundle` + dropTargetTable := `DROP TABLE operatorbundle` + renameBackUpTable := `ALTER TABLE operatorbundle_backup RENAME TO operatorbundle;` + foreingKeyOn := `PRAGMA foreign_keys = 1` + _, err := tx.ExecContext(ctx, foreingKeyOff) + if err != nil { + return err + } + _, err = tx.ExecContext(ctx, createTempTable) + if err != nil { + return err + } + _, err = tx.ExecContext(ctx, backupTargetTable) + if err != nil { + return err + } + _, err = tx.ExecContext(ctx, dropTargetTable) + if err != nil { + return err + } + _, err = tx.ExecContext(ctx, renameBackUpTable) + if err != nil { + return err + } + _, err = tx.ExecContext(ctx, foreingKeyOn) + return err + }, +} diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/003_required_apis.go b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/003_required_apis.go new file mode 100644 index 00000000000..dc1b451d74a --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/003_required_apis.go @@ -0,0 +1,148 @@ +package migrations + +import ( + "context" + "database/sql" + "fmt" + "strings" + + "github.com/sirupsen/logrus" +) + +const RequiredApiMigrationKey = 3 + +// Register this migration +func init() { + migrations[RequiredApiMigrationKey] = requiredApiMigration +} + +var requiredApiMigration = &Migration{ + Id: RequiredApiMigrationKey, + Up: func(ctx context.Context, tx *sql.Tx) error { + sql := ` + CREATE TABLE IF NOT EXISTS api_requirer ( + group_name TEXT, + version TEXT, + kind TEXT, + channel_entry_id INTEGER, + FOREIGN KEY(channel_entry_id) REFERENCES channel_entry(entry_id), + FOREIGN KEY(group_name, version, kind) REFERENCES api(group_name, version, kind) + ); + ` + _, err := tx.ExecContext(ctx, sql) + if err != nil { + return err + } + bundles, err := getChannelEntryBundles(ctx, tx) + if err != nil { + return err + } + for entryId, bundle := range bundles { + if err := extractRequiredApis(ctx, tx, entryId, bundle); err != nil { + logrus.Warnf("error backfilling required apis: %v", err) + continue + } + } + return nil + }, + Down: func(ctx context.Context, tx *sql.Tx) error { + _, err := tx.ExecContext(ctx, `DROP TABLE api_requirer`) + if err != nil { + return err + } + + return err + }, +} + +func getChannelEntryBundles(ctx context.Context, tx *sql.Tx) (map[int64]string, error) { + query := `SELECT DISTINCT channel_entry.entry_id, operatorbundle.name FROM channel_entry + INNER JOIN operatorbundle ON operatorbundle.name = channel_entry.operatorbundle_name` + + rows, err := tx.QueryContext(ctx, query) + if err != nil { + return nil, err + } + + entries := map[int64]string{} + + for rows.Next() { + var entryId sql.NullInt64 + var name sql.NullString + if err = rows.Scan(&entryId, &name); err != nil { + return nil, err + } + if !entryId.Valid || !name.Valid { + continue + } + entries[entryId.Int64] = name.String + } + return entries, nil +} + +func extractRequiredApis(ctx context.Context, tx *sql.Tx, entryId int64, name string) error { + addAPI, err := tx.Prepare("insert or replace into api(group_name, version, kind, plural) values(?, ?, ?, ?)") + if err != nil { + return err + } + defer func() { + if err := addAPI.Close();err != nil { + logrus.WithError(err).Warningf("error closing prepared statement") + } + }() + + addApiRequirer, err := tx.Prepare("insert into api_requirer(group_name, version, kind, channel_entry_id) values(?, ?, ?, ?)") + if err != nil { + return err + } + defer func() { + if err := addApiRequirer.Close(); err != nil { + logrus.WithError(err).Warningf("error closing prepared statement") + } + }() + + csv, err := getCSV(ctx, tx, name) + if err != nil { + logrus.Warnf("error backfilling required apis: %v", err) + return err + } + + _, requiredCRDs, err := csv.GetCustomResourceDefintions() + for _, crd := range requiredCRDs { + plural, group, err := SplitCRDName(crd.Name) + if err != nil { + return err + } + if _, err := addAPI.Exec(group, crd.Version, crd.Kind, plural); err != nil { + return err + } + if _, err := addApiRequirer.Exec(group, crd.Version, crd.Kind, entryId); err != nil { + return err + } + } + + _, requiredAPIs, err := csv.GetApiServiceDefinitions() + for _, api := range requiredAPIs { + if _, err := addAPI.Exec(api.Group, api.Version, api.Kind, api.Name); err != nil { + return err + } + if _, err := addApiRequirer.Exec(api.Group, api.Version, api.Kind, entryId); err != nil { + return err + } + } + + return nil +} + + +func SplitCRDName(crdName string) (plural, group string, err error) { + pluralGroup := strings.SplitN(crdName, ".", 2) + if len(pluralGroup) != 2 { + err = fmt.Errorf("can't split bad CRD name %s", crdName) + return + } + + plural = pluralGroup[0] + group = pluralGroup[1] + return +} diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/migrations.go b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/migrations.go new file mode 100644 index 00000000000..d2802c2ee0f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrations/migrations.go @@ -0,0 +1,82 @@ +package migrations + +import ( + "context" + "database/sql" + "sort" +) + +type Migration struct { + Id int + Up func(context.Context, *sql.Tx) error + Down func(context.Context, *sql.Tx) error +} + +type MigrationSet map[int]*Migration + +type Migrations []*Migration + +func (m Migrations) Len() int { return len(m) } +func (m Migrations) Swap(i, j int) { m[i], m[j] = m[j], m[i] } +func (m Migrations) Less(i, j int) bool { return m[i].Id < m[j].Id } + +var migrations MigrationSet = make(map[int]*Migration) + +// From returns a set of migrations, starting at key +func (m MigrationSet) From(key int) Migrations { + keys := make([]int, 0) + for k := range m { + keys = append(keys, k) + } + sort.Ints(keys) + sorted := []*Migration{} + for _, k := range keys { + if k < key { + continue + } + sorted = append(sorted, m[k]) + } + return sorted +} + +// To returns a set of migrations, up to and including key +func (m MigrationSet) To(key int) Migrations { + keys := make([]int, 0) + for k := range m { + keys = append(keys, k) + } + sort.Ints(keys) + sorted := []*Migration{} + for _, k := range keys { + if k > key { + continue + } + sorted = append(sorted, m[k]) + } + return sorted +} + +// Only returns a set of one migration +func (m MigrationSet) Only(key int) Migrations { + return []*Migration{m[key]} +} + +// From returns a set of migrations, starting at key +func From(key int) Migrations { + return migrations.From(key) +} + +// To returns a set of migrations, up to and including key +func To(key int) Migrations { + return migrations.To(key) +} + +// Only returns a set of one migration +func Only(key int) Migrations { + return migrations.Only(key) +} + +// All returns the full set +func All() MigrationSet { + return migrations +} diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrator.go b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrator.go new file mode 100644 index 00000000000..f1c349200b3 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/migrator.go @@ -0,0 +1,202 @@ +package sqlite + +import ( + "context" + "database/sql" + "fmt" + + _ "github.com/golang-migrate/migrate/v4/source/file" // indirect import required by golang-migrate package + "github.com/sirupsen/logrus" + + "github.com/operator-framework/operator-registry/pkg/sqlite/migrations" +) + +type Migrator interface { + Migrate(ctx context.Context) error + Up(ctx context.Context, migrations migrations.Migrations) error + Down(ctx context.Context, migrations migrations.Migrations) error +} + +type SQLLiteMigrator struct { + db *sql.DB + migrationsTable string + migrations migrations.MigrationSet +} + +var _ Migrator = &SQLLiteMigrator{} + +const ( + DefaultMigrationsTable = "schema_migrations" + NilVersion = -1 +) + +// NewSQLLiteMigrator returns a SQLLiteMigrator. +func NewSQLLiteMigrator(db *sql.DB) (Migrator, error) { + return &SQLLiteMigrator{ + db: db, + migrationsTable: DefaultMigrationsTable, + migrations: migrations.All(), + }, nil +} + +// Migrate gets the current version from the database, the latest version from the migrations, +// and migrates up the the latest +func (m *SQLLiteMigrator) Migrate(ctx context.Context) error { + tx, err := m.db.Begin() + if err != nil { + return err + } + defer func() { + if err := tx.Rollback(); err != nil { + logrus.WithError(err).Debugf("couldn't rollback - this is expected if the transaction committed") + } + }() + + version, err := m.version(ctx, tx) + if err != nil { + return err + } + + if err := tx.Commit(); err != nil { + return tx.Rollback() + } + return m.Up(ctx, m.migrations.From(version+1)) +} + +// Up runs a specific set of migrations. +func (m *SQLLiteMigrator) Up(ctx context.Context, migrations migrations.Migrations) error { + tx, err := m.db.Begin() + if err != nil { + return err + } + defer func() { + if err := tx.Rollback(); err != nil { + logrus.WithError(err).Debugf("couldn't rollback - this is expected if the transaction committed") + } + }() + + if err := m.ensureMigrationTable(ctx, tx); err != nil { + return err + } + + for _, migration := range migrations { + current_version, err := m.version(ctx, tx) + if err != nil { + return err + } + + if migration.Id != current_version+1 { + return fmt.Errorf("migration applied out of order") + } + + if err := migration.Up(ctx, tx); err != nil { + return err + } + + if err := m.setVersion(ctx, tx, migration.Id); err != nil { + return err + } + } + if err := tx.Commit(); err != nil { + return err + } + return nil +} + +func (m *SQLLiteMigrator) Down(ctx context.Context, migrations migrations.Migrations) error { + tx, err := m.db.Begin() + if err != nil { + return err + } + defer func() { + if err := tx.Rollback(); err != nil { + logrus.WithError(err).Debugf("couldn't rollback - this is expected if the transaction committed") + } + }() + if err := m.ensureMigrationTable(ctx, tx); err != nil { + return err + } + + for _, migration := range migrations { + current_version, err := m.version(ctx, tx) + if err != nil { + return err + } + + if migration.Id != current_version { + return fmt.Errorf("migration applied out of order") + } + + if err := migration.Down(ctx, tx); err != nil { + return err + } + + if err := m.setVersion(ctx, tx, migration.Id-1); err != nil { + return err + } + } + if err := tx.Commit(); err != nil { + return err + } + return nil +} + +func (m *SQLLiteMigrator) ensureMigrationTable(ctx context.Context, tx *sql.Tx) error { + sql := fmt.Sprintf(` + CREATE TABLE IF NOT EXISTS %s ( + version bigint NOT NULL, + timestamp DATETIME DEFAULT CURRENT_TIMESTAMP + ); + `, m.migrationsTable) + _, err := tx.ExecContext(ctx, sql) + return err +} + +func (m *SQLLiteMigrator) tableExists(tx *sql.Tx, table string) (bool, error) { + query := `SELECT count(*) + FROM sqlite_master + WHERE name = ?` + row := tx.QueryRow(query, table) + + var count int + err := row.Scan(&count) + if err != nil { + return false, err + } + + exists := count > 0 + return exists, nil +} + +func (m *SQLLiteMigrator) version(ctx context.Context, tx *sql.Tx) (version int, err error) { + tableExists, err := m.tableExists(tx, m.migrationsTable) + if err != nil { + return NilVersion, err + } + if !tableExists { + return NilVersion, nil + } + + query := `SELECT version FROM ` + m.migrationsTable + ` LIMIT 1` + err = tx.QueryRowContext(ctx, query).Scan(&version) + switch { + case err == sql.ErrNoRows: + return NilVersion, nil + case err != nil: + return NilVersion, err + default: + return version, nil + } +} + +func (m *SQLLiteMigrator) setVersion(ctx context.Context, tx *sql.Tx, version int) error { + if err := m.ensureMigrationTable(ctx, tx); err != nil { + return err + } + _, err := tx.ExecContext(ctx, "DELETE FROM "+m.migrationsTable) + if err != nil { + return err + } + _, err = tx.ExecContext(ctx, "INSERT INTO "+m.migrationsTable+"(version) values(?)", version) + return err +} diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/query.go b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/query.go index e7fc031682e..54d3d95e53c 100644 --- a/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/query.go +++ b/vendor/github.com/operator-framework/operator-registry/pkg/sqlite/query.go @@ -7,6 +7,7 @@ import ( _ "github.com/mattn/go-sqlite3" + "github.com/operator-framework/operator-registry/pkg/api" "github.com/operator-framework/operator-registry/pkg/registry" ) @@ -25,6 +26,10 @@ func NewSQLLiteQuerier(dbFilename string) (*SQLQuerier, error) { return &SQLQuerier{db}, nil } +func NewSQLLiteQuerierFromDb(db *sql.DB) *SQLQuerier { + return &SQLQuerier{db} +} + func (s *SQLQuerier) ListTables(ctx context.Context) ([]string, error) { query := "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;" rows, err := s.db.QueryContext(ctx, query) @@ -103,42 +108,89 @@ func (s *SQLQuerier) GetPackage(ctx context.Context, name string) (*registry.Pac return pkg, nil } -func (s *SQLQuerier) GetBundle(ctx context.Context, pkgName, channelName, csvName string) (string, error) { - query := `SELECT DISTINCT operatorbundle.bundle +func (s *SQLQuerier) GetBundle(ctx context.Context, pkgName, channelName, csvName string) (*api.Bundle, error) { + query := `SELECT DISTINCT channel_entry.entry_id, operatorbundle.name, operatorbundle.bundle, operatorbundle.bundlepath FROM operatorbundle INNER JOIN channel_entry ON operatorbundle.name=channel_entry.operatorbundle_name - WHERE channel_entry.package_name=? AND channel_entry.channel_name=? AND operatorbundle.name=? LIMIT 1` + WHERE channel_entry.package_name=? AND channel_entry.channel_name=? AND operatorbundle_name=? LIMIT 1` rows, err := s.db.QueryContext(ctx, query, pkgName, channelName, csvName) if err != nil { - return "", err + return nil, err } if !rows.Next() { - return "", fmt.Errorf("no bundle found for csv %s", csvName) + return nil, fmt.Errorf("no entry found for %s %s %s", pkgName, channelName, csvName) + } + var entryId sql.NullInt64 + var name sql.NullString + var bundle sql.NullString + var bundlePath sql.NullString + if err := rows.Scan(&entryId, &name, &bundle, &bundlePath); err != nil { + return nil, err } - var bundleStringSQL sql.NullString - if err := rows.Scan(&bundleStringSQL); err != nil { - return "", err + + out := &api.Bundle{} + if bundle.Valid && bundle.String != "" { + out, err = registry.BundleStringToAPIBundle(bundle.String) + if err != nil { + return nil, err + } } - return bundleStringSQL.String, nil + out.CsvName = name.String + out.PackageName = pkgName + out.ChannelName = channelName + out.BundlePath = bundlePath.String + + provided, required, err := s.GetApisForEntry(ctx, entryId.Int64) + if err != nil { + return nil, err + } + out.ProvidedApis = provided + out.RequiredApis = required + + return out, nil } -func (s *SQLQuerier) GetBundleForChannel(ctx context.Context, pkgName string, channelName string) (string, error) { - query := `SELECT DISTINCT operatorbundle.bundle - FROM channel INNER JOIN operatorbundle ON channel.head_operatorbundle_name=operatorbundle.name +func (s *SQLQuerier) GetBundleForChannel(ctx context.Context, pkgName string, channelName string) (*api.Bundle, error) { + query := `SELECT DISTINCT channel_entry.entry_id, operatorbundle.name, operatorbundle.bundle, operatorbundle.bundlepath FROM channel + INNER JOIN operatorbundle ON channel.head_operatorbundle_name=operatorbundle.name + INNER JOIN channel_entry ON (channel_entry.channel_name = channel.name and channel_entry.package_name=channel.package_name and channel_entry.operatorbundle_name=operatorbundle.name) WHERE channel.package_name=? AND channel.name=? LIMIT 1` rows, err := s.db.QueryContext(ctx, query, pkgName, channelName) if err != nil { - return "", err + return nil, err } if !rows.Next() { - return "", fmt.Errorf("no bundle found for %s %s", pkgName, channelName) + return nil, fmt.Errorf("no entry found for %s %s", pkgName, channelName) } + var entryId sql.NullInt64 + var name sql.NullString var bundle sql.NullString - if err := rows.Scan(&bundle); err != nil { - return "", err + var bundlePath sql.NullString + if err := rows.Scan(&entryId, &name, &bundle, &bundlePath); err != nil { + return nil, err } - return bundle.String, nil + + out := &api.Bundle{} + if bundle.Valid && bundle.String != "" { + out, err = registry.BundleStringToAPIBundle(bundle.String) + if err != nil { + return nil, err + } + } + out.CsvName = name.String + out.PackageName = pkgName + out.ChannelName = channelName + out.BundlePath = bundlePath.String + + provided, required, err := s.GetApisForEntry(ctx, entryId.Int64) + if err != nil { + return nil, err + } + out.ProvidedApis = provided + out.RequiredApis = required + + return out, nil } func (s *SQLQuerier) GetChannelEntriesThatReplace(ctx context.Context, name string) (entries []*registry.ChannelEntry, err error) { @@ -175,25 +227,48 @@ func (s *SQLQuerier) GetChannelEntriesThatReplace(ctx context.Context, name stri return } -func (s *SQLQuerier) GetBundleThatReplaces(ctx context.Context, name, pkgName, channelName string) (string, error) { - query := `SELECT DISTINCT operatorbundle.bundle +func (s *SQLQuerier) GetBundleThatReplaces(ctx context.Context, name, pkgName, channelName string) (*api.Bundle, error) { + query := `SELECT DISTINCT replaces.entry_id, operatorbundle.name, operatorbundle.bundle, operatorbundle.bundlepath FROM channel_entry LEFT OUTER JOIN channel_entry replaces ON replaces.replaces = channel_entry.entry_id INNER JOIN operatorbundle ON replaces.operatorbundle_name = operatorbundle.name WHERE channel_entry.operatorbundle_name = ? AND channel_entry.package_name = ? AND channel_entry.channel_name = ? LIMIT 1` rows, err := s.db.QueryContext(ctx, query, name, pkgName, channelName) if err != nil { - return "", err + return nil, err } if !rows.Next() { - return "", fmt.Errorf("no bundle found that replaces %s", name) + return nil, fmt.Errorf("no entry found for %s %s", pkgName, channelName) } + var entryId sql.NullInt64 + var outName sql.NullString var bundle sql.NullString - if err := rows.Scan(&bundle); err != nil { - return "", err + var bundlePath sql.NullString + if err := rows.Scan(&entryId, &outName, &bundle, &bundlePath); err != nil { + return nil, err + } + + out := &api.Bundle{} + if bundle.Valid && bundle.String != "" { + out, err = registry.BundleStringToAPIBundle(bundle.String) + if err != nil { + return nil, err + } + } + out.CsvName = outName.String + out.PackageName = pkgName + out.ChannelName = channelName + out.BundlePath = bundlePath.String + + provided, required, err := s.GetApisForEntry(ctx, entryId.Int64) + if err != nil { + return nil, err } - return bundle.String, nil + out.ProvidedApis = provided + out.RequiredApis = required + + return out, nil } func (s *SQLQuerier) GetChannelEntriesThatProvide(ctx context.Context, group, version, kind string) (entries []*registry.ChannelEntry, err error) { @@ -273,8 +348,8 @@ func (s *SQLQuerier) GetLatestChannelEntriesThatProvide(ctx context.Context, gro } // Get the the latest bundle that provides the API in a default channel, error unless there is ONLY one -func (s *SQLQuerier) GetBundleThatProvides(ctx context.Context, group, version, kind string) (string, *registry.ChannelEntry, error) { - query := `SELECT DISTINCT operatorbundle.bundle, MIN(channel_entry.depth), channel_entry.operatorbundle_name, channel_entry.package_name, channel_entry.channel_name, channel_entry.replaces +func (s *SQLQuerier) GetBundleThatProvides(ctx context.Context, group, version, kind string) (*api.Bundle, error) { + query := `SELECT DISTINCT channel_entry.entry_id, operatorbundle.bundle, operatorbundle.bundlepath, MIN(channel_entry.depth), channel_entry.operatorbundle_name, channel_entry.package_name, channel_entry.channel_name, channel_entry.replaces FROM channel_entry INNER JOIN api_provider ON channel_entry.entry_id = api_provider.channel_entry_id INNER JOIN operatorbundle ON operatorbundle.name = channel_entry.operatorbundle_name @@ -284,30 +359,146 @@ func (s *SQLQuerier) GetBundleThatProvides(ctx context.Context, group, version, rows, err := s.db.QueryContext(ctx, query, group, version, kind) if err != nil { - return "", nil, err + return nil, err } if !rows.Next() { - return "", nil, fmt.Errorf("no bundle found that provides %s %s %s", group, version, kind) + return nil, fmt.Errorf("no entry found that provides %s %s %s", group, version, kind) } - + var entryId sql.NullInt64 var bundle sql.NullString + var bundlePath sql.NullString var min_depth sql.NullInt64 var bundleName sql.NullString var pkgName sql.NullString var channelName sql.NullString var replaces sql.NullString - if err := rows.Scan(&bundle, &min_depth, &bundleName, &pkgName, &channelName, &replaces); err != nil { - return "", nil, err + if err := rows.Scan(&entryId, &bundle, &bundlePath, &min_depth, &bundleName, &pkgName, &channelName, &replaces); err != nil { + return nil, err } if !bundle.Valid { - return "", nil, fmt.Errorf("no bundle found that provides %s %s %s", group, version, kind) + return nil, fmt.Errorf("no entry found that provides %s %s %s", group, version, kind) } - entry := ®istry.ChannelEntry{ - PackageName: pkgName.String, - ChannelName: channelName.String, - BundleName: bundleName.String, + + out := &api.Bundle{} + if bundle.Valid && bundle.String != "" { + out, err = registry.BundleStringToAPIBundle(bundle.String) + if err != nil { + return nil, err + } } - return bundle.String, entry, nil + out.CsvName = bundleName.String + out.PackageName = pkgName.String + out.ChannelName = channelName.String + out.BundlePath = bundlePath.String + + provided, required, err := s.GetApisForEntry(ctx, entryId.Int64) + if err != nil { + return nil, err + } + out.ProvidedApis = provided + out.RequiredApis = required + + return out, nil +} + +func (s *SQLQuerier) ListImages(ctx context.Context) ([]string, error) { + query := "SELECT DISTINCT image FROM related_image" + rows, err := s.db.QueryContext(ctx, query) + if err != nil { + return nil, err + } + images := []string{} + for rows.Next() { + var imgName sql.NullString + if err := rows.Scan(&imgName); err != nil { + return nil, err + } + if imgName.Valid { + images = append(images, imgName.String) + } + } + return images, nil +} + +func (s *SQLQuerier) GetImagesForBundle(ctx context.Context, csvName string) ([]string, error) { + query := "SELECT DISTINCT image FROM related_image WHERE operatorbundle_name=?" + rows, err := s.db.QueryContext(ctx, query, csvName) + if err != nil { + return nil, err + } + images := []string{} + for rows.Next() { + var imgName sql.NullString + if err := rows.Scan(&imgName); err != nil { + return nil, err + } + if imgName.Valid { + images = append(images, imgName.String) + } + } + return images, nil +} + +func (s *SQLQuerier) GetApisForEntry(ctx context.Context, entryId int64) (provided []*api.GroupVersionKind, required []*api.GroupVersionKind, err error) { + providedQuery := `SELECT DISTINCT api.group_name, api.version, api.kind, api.plural FROM api + INNER JOIN api_provider ON (api.group_name=api_provider.group_name AND api.version=api_provider.version AND api.kind=api_provider.kind) + WHERE api_provider.channel_entry_id=?` + + providedRows, err := s.db.QueryContext(ctx, providedQuery, entryId) + if err != nil { + return nil,nil, err + } + provided = []*api.GroupVersionKind{} + for providedRows.Next() { + var groupName sql.NullString + var versionName sql.NullString + var kindName sql.NullString + var pluralName sql.NullString + + if err := providedRows.Scan(&groupName, &versionName, &kindName, &pluralName); err != nil { + return nil, nil, err + } + if !groupName.Valid || !versionName.Valid || !kindName.Valid || !pluralName.Valid { + return nil, nil, err + } + provided = append(provided, &api.GroupVersionKind{ + Group: groupName.String, + Version: versionName.String, + Kind: kindName.String, + Plural: pluralName.String, + }) + } + + requiredQuery := `SELECT DISTINCT api.group_name, api.version, api.kind, api.plural FROM api + INNER JOIN api_requirer ON (api.group_name=api_requirer.group_name AND api.version=api_requirer.version AND api.kind=api_requirer.kind) + WHERE api_requirer.channel_entry_id=?` + + requiredRows, err := s.db.QueryContext(ctx, requiredQuery, entryId) + if err != nil { + return nil,nil, err + } + required = []*api.GroupVersionKind{} + for requiredRows.Next() { + var groupName sql.NullString + var versionName sql.NullString + var kindName sql.NullString + var pluralName sql.NullString + + if err := requiredRows.Scan(&groupName, &versionName, &kindName, &pluralName); err != nil { + return nil, nil, err + } + if !groupName.Valid || !versionName.Valid || !kindName.Valid || !pluralName.Valid { + return nil, nil, err + } + required = append(required, &api.GroupVersionKind{ + Group: groupName.String, + Version: versionName.String, + Kind: kindName.String, + Plural: pluralName.String, + }) + } + + return } diff --git a/vendor/github.com/prometheus/client_golang/prometheus/collector.go b/vendor/github.com/prometheus/client_golang/prometheus/collector.go index c0d70b2faf1..1e839650d4d 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/collector.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/collector.go @@ -79,7 +79,7 @@ type Collector interface { // of the Describe method. If a Collector sometimes collects no metrics at all // (for example vectors like CounterVec, GaugeVec, etc., which only collect // metrics after a metric with a fully specified label set has been accessed), -// it might even get registered as an unchecked Collecter (cf. the Register +// it might even get registered as an unchecked Collector (cf. the Register // method of the Registerer interface). Hence, only use this shortcut // implementation of Describe if you are certain to fulfill the contract. // diff --git a/vendor/github.com/prometheus/client_golang/prometheus/doc.go b/vendor/github.com/prometheus/client_golang/prometheus/doc.go index 5d9525defc8..1e0d578ee7a 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/doc.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/doc.go @@ -122,13 +122,13 @@ // the Collect method. The Describe method has to return separate Desc // instances, representative of the “throw-away” metrics to be created later. // NewDesc comes in handy to create those Desc instances. Alternatively, you -// could return no Desc at all, which will marke the Collector “unchecked”. No -// checks are porformed at registration time, but metric consistency will still +// could return no Desc at all, which will mark the Collector “unchecked”. No +// checks are performed at registration time, but metric consistency will still // be ensured at scrape time, i.e. any inconsistencies will lead to scrape // errors. Thus, with unchecked Collectors, the responsibility to not collect // metrics that lead to inconsistencies in the total scrape result lies with the // implementer of the Collector. While this is not a desirable state, it is -// sometimes necessary. The typical use case is a situatios where the exact +// sometimes necessary. The typical use case is a situation where the exact // metrics to be returned by a Collector cannot be predicted at registration // time, but the implementer has sufficient knowledge of the whole system to // guarantee metric consistency. diff --git a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go b/vendor/github.com/prometheus/client_golang/prometheus/histogram.go index f88da707bc8..20ee1afb5d4 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/histogram.go @@ -204,8 +204,8 @@ func newHistogram(desc *Desc, opts HistogramOpts, labelValues ...string) Histogr } } } - // Finally we know the final length of h.upperBounds and can make counts - // for both states: + // Finally we know the final length of h.upperBounds and can make buckets + // for both counts: h.counts[0].buckets = make([]uint64, len(h.upperBounds)) h.counts[1].buckets = make([]uint64, len(h.upperBounds)) diff --git a/vendor/github.com/prometheus/client_golang/prometheus/http.go b/vendor/github.com/prometheus/client_golang/prometheus/http.go index 9f0875bfc81..0fa339aec0e 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/http.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/http.go @@ -34,7 +34,6 @@ import ( const ( contentTypeHeader = "Content-Type" - contentLengthHeader = "Content-Length" contentEncodingHeader = "Content-Encoding" acceptEncodingHeader = "Accept-Encoding" ) diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go index 67b56d37cfd..5de5bbc685a 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go @@ -38,7 +38,6 @@ type delegator interface { type responseWriterDelegator struct { http.ResponseWriter - handler, method string status int written int64 wroteHeader bool diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go index 668eb6b3c93..b137c883071 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go @@ -47,7 +47,6 @@ import ( const ( contentTypeHeader = "Content-Type" - contentLengthHeader = "Content-Length" contentEncodingHeader = "Content-Encoding" acceptEncodingHeader = "Accept-Encoding" ) diff --git a/vendor/github.com/prometheus/client_golang/prometheus/registry.go b/vendor/github.com/prometheus/client_golang/prometheus/registry.go index b5e70b93fa1..f2fb67aeebd 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/registry.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/registry.go @@ -680,7 +680,7 @@ func processMetric( // Gatherers is a slice of Gatherer instances that implements the Gatherer // interface itself. Its Gather method calls Gather on all Gatherers in the // slice in order and returns the merged results. Errors returned from the -// Gather calles are all returned in a flattened MultiError. Duplicate and +// Gather calls are all returned in a flattened MultiError. Duplicate and // inconsistent Metrics are skipped (first occurrence in slice order wins) and // reported in the returned error. // diff --git a/vendor/github.com/prometheus/client_golang/prometheus/summary.go b/vendor/github.com/prometheus/client_golang/prometheus/summary.go index 2980614dff4..e4c87145cb3 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/summary.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/summary.go @@ -16,8 +16,10 @@ package prometheus import ( "fmt" "math" + "runtime" "sort" "sync" + "sync/atomic" "time" "github.com/beorn7/perks/quantile" @@ -151,7 +153,7 @@ type SummaryOpts struct { BufCap uint32 } -// Great fuck-up with the sliding-window decay algorithm... The Merge method of +// Problem with the sliding-window decay algorithm... The Merge method of // perk/quantile is actually not working as advertised - and it might be // unfixable, as the underlying algorithm is apparently not capable of merging // summaries in the first place. To avoid using Merge, we are currently adding @@ -214,6 +216,17 @@ func newSummary(desc *Desc, opts SummaryOpts, labelValues ...string) Summary { opts.BufCap = DefBufCap } + if len(opts.Objectives) == 0 { + // Use the lock-free implementation of a Summary without objectives. + s := &noObjectivesSummary{ + desc: desc, + labelPairs: makeLabelPairs(desc, labelValues), + counts: [2]*summaryCounts{&summaryCounts{}, &summaryCounts{}}, + } + s.init(s) // Init self-collection. + return s + } + s := &summary{ desc: desc, @@ -382,6 +395,142 @@ func (s *summary) swapBufs(now time.Time) { } } +type summaryCounts struct { + // sumBits contains the bits of the float64 representing the sum of all + // observations. sumBits and count have to go first in the struct to + // guarantee alignment for atomic operations. + // http://golang.org/pkg/sync/atomic/#pkg-note-BUG + sumBits uint64 + count uint64 +} + +type noObjectivesSummary struct { + // countAndHotIdx is a complicated one. For lock-free yet atomic + // observations, we need to save the total count of observations again, + // combined with the index of the currently-hot counts struct, so that + // we can perform the operation on both values atomically. The least + // significant bit defines the hot counts struct. The remaining 63 bits + // represent the total count of observations. This happens under the + // assumption that the 63bit count will never overflow. Rationale: An + // observations takes about 30ns. Let's assume it could happen in + // 10ns. Overflowing the counter will then take at least (2^63)*10ns, + // which is about 3000 years. + // + // This has to be first in the struct for 64bit alignment. See + // http://golang.org/pkg/sync/atomic/#pkg-note-BUG + countAndHotIdx uint64 + + selfCollector + desc *Desc + writeMtx sync.Mutex // Only used in the Write method. + + // Two counts, one is "hot" for lock-free observations, the other is + // "cold" for writing out a dto.Metric. It has to be an array of + // pointers to guarantee 64bit alignment of the histogramCounts, see + // http://golang.org/pkg/sync/atomic/#pkg-note-BUG. + counts [2]*summaryCounts + hotIdx int // Index of currently-hot counts. Only used within Write. + + labelPairs []*dto.LabelPair +} + +func (s *noObjectivesSummary) Desc() *Desc { + return s.desc +} + +func (s *noObjectivesSummary) Observe(v float64) { + // We increment s.countAndHotIdx by 2 so that the counter in the upper + // 63 bits gets incremented by 1. At the same time, we get the new value + // back, which we can use to find the currently-hot counts. + n := atomic.AddUint64(&s.countAndHotIdx, 2) + hotCounts := s.counts[n%2] + + for { + oldBits := atomic.LoadUint64(&hotCounts.sumBits) + newBits := math.Float64bits(math.Float64frombits(oldBits) + v) + if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) { + break + } + } + // Increment count last as we take it as a signal that the observation + // is complete. + atomic.AddUint64(&hotCounts.count, 1) +} + +func (s *noObjectivesSummary) Write(out *dto.Metric) error { + var ( + sum = &dto.Summary{} + hotCounts, coldCounts *summaryCounts + count uint64 + ) + + // For simplicity, we mutex the rest of this method. It is not in the + // hot path, i.e. Observe is called much more often than Write. The + // complication of making Write lock-free isn't worth it. + s.writeMtx.Lock() + defer s.writeMtx.Unlock() + + // This is a bit arcane, which is why the following spells out this if + // clause in English: + // + // If the currently-hot counts struct is #0, we atomically increment + // s.countAndHotIdx by 1 so that from now on Observe will use the counts + // struct #1. Furthermore, the atomic increment gives us the new value, + // which, in its most significant 63 bits, tells us the count of + // observations done so far up to and including currently ongoing + // observations still using the counts struct just changed from hot to + // cold. To have a normal uint64 for the count, we bitshift by 1 and + // save the result in count. We also set s.hotIdx to 1 for the next + // Write call, and we will refer to counts #1 as hotCounts and to counts + // #0 as coldCounts. + // + // If the currently-hot counts struct is #1, we do the corresponding + // things the other way round. We have to _decrement_ s.countAndHotIdx + // (which is a bit arcane in itself, as we have to express -1 with an + // unsigned int...). + if s.hotIdx == 0 { + count = atomic.AddUint64(&s.countAndHotIdx, 1) >> 1 + s.hotIdx = 1 + hotCounts = s.counts[1] + coldCounts = s.counts[0] + } else { + count = atomic.AddUint64(&s.countAndHotIdx, ^uint64(0)) >> 1 // Decrement. + s.hotIdx = 0 + hotCounts = s.counts[0] + coldCounts = s.counts[1] + } + + // Now we have to wait for the now-declared-cold counts to actually cool + // down, i.e. wait for all observations still using it to finish. That's + // the case once the count in the cold counts struct is the same as the + // one atomically retrieved from the upper 63bits of s.countAndHotIdx. + for { + if count == atomic.LoadUint64(&coldCounts.count) { + break + } + runtime.Gosched() // Let observations get work done. + } + + sum.SampleCount = proto.Uint64(count) + sum.SampleSum = proto.Float64(math.Float64frombits(atomic.LoadUint64(&coldCounts.sumBits))) + + out.Summary = sum + out.Label = s.labelPairs + + // Finally add all the cold counts to the new hot counts and reset the cold counts. + atomic.AddUint64(&hotCounts.count, count) + atomic.StoreUint64(&coldCounts.count, 0) + for { + oldBits := atomic.LoadUint64(&hotCounts.sumBits) + newBits := math.Float64bits(math.Float64frombits(oldBits) + sum.GetSampleSum()) + if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) { + atomic.StoreUint64(&coldCounts.sumBits, 0) + break + } + } + return nil +} + type quantSort []*dto.Quantile func (s quantSort) Len() int { diff --git a/vendor/github.com/prometheus/common/expfmt/text_create.go b/vendor/github.com/prometheus/common/expfmt/text_create.go index 16655d417cf..8e473d0fe92 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_create.go +++ b/vendor/github.com/prometheus/common/expfmt/text_create.go @@ -436,11 +436,11 @@ func writeEscapedString(w enhancedWriter, v string, includeDoubleQuote bool) (in func writeFloat(w enhancedWriter, f float64) (int, error) { switch { case f == 1: - return w.WriteString("1.0") + return 1, w.WriteByte('1') case f == 0: - return w.WriteString("0.0") + return 1, w.WriteByte('0') case f == -1: - return w.WriteString("-1.0") + return w.WriteString("-1") case math.IsNaN(f): return w.WriteString("NaN") case math.IsInf(f, +1): @@ -450,12 +450,6 @@ func writeFloat(w enhancedWriter, f float64) (int, error) { default: bp := numBufPool.Get().(*[]byte) *bp = strconv.AppendFloat((*bp)[:0], f, 'g', -1, 64) - // Add a .0 if used fixed point and there is no decimal - // point already. This is for future proofing with OpenMetrics, - // where floats always contain either an exponent or decimal. - if !bytes.ContainsAny(*bp, "e.") { - *bp = append(*bp, '.', '0') - } written, err := w.Write(*bp) numBufPool.Put(bp) return written, err diff --git a/vendor/github.com/prometheus/procfs/MAINTAINERS.md b/vendor/github.com/prometheus/procfs/MAINTAINERS.md index 35993c41c27..f1d3b9937b7 100644 --- a/vendor/github.com/prometheus/procfs/MAINTAINERS.md +++ b/vendor/github.com/prometheus/procfs/MAINTAINERS.md @@ -1 +1,2 @@ -* Tobias Schmidt +* Tobias Schmidt @grobie +* Johannes 'fish' Ziemke @discordianfish diff --git a/vendor/k8s.io/code-generator/generate_internal_groups.sh b/vendor/k8s.io/code-generator/generate_internal_groups.sh deleted file mode 100755 index 258b53b56f8..00000000000 --- a/vendor/k8s.io/code-generator/generate_internal_groups.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2017 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -o errexit -set -o nounset -set -o pipefail - -# generate-internal-groups generates everything for a project with internal types, e.g. an -# user-provided API server based on k8s.io/apiserver. - -if [ "$#" -lt 5 ] || [ "${1}" == "--help" ]; then - cat < ... - - the generators comma separated to run (deepcopy,defaulter,conversion,client,lister,informer) or "all". - the output package name (e.g. github.com/example/project/pkg/generated). - the internal types dir (e.g. github.com/example/project/pkg/apis). - the external types dir (e.g. github.com/example/project/pkg/apis or githubcom/example/apis). - the groups and their versions in the format "groupA:v1,v2 groupB:v1 groupC:v2", relative - to . - ... arbitrary flags passed to all generator binaries. - -Examples: - $(basename "$0") all github.com/example/project/pkg/client github.com/example/project/pkg/apis github.com/example/project/pkg/apis "foo:v1 bar:v1alpha1,v1beta1" - $(basename "$0") deepcopy,defaulter,conversion github.com/example/project/pkg/client github.com/example/project/pkg/apis github.com/example/project/apis "foo:v1 bar:v1alpha1,v1beta1" -EOF - exit 0 -fi - -GENS="$1" -OUTPUT_PKG="$2" -INT_APIS_PKG="$3" -EXT_APIS_PKG="$4" -GROUPS_WITH_VERSIONS="$5" -shift 5 - -go install ./"$(dirname "${0}")"/cmd/{defaulter-gen,conversion-gen,client-gen,lister-gen,informer-gen,deepcopy-gen} -function codegen::join() { local IFS="$1"; shift; echo "$*"; } - -# enumerate group versions -ALL_FQ_APIS=() # e.g. k8s.io/kubernetes/pkg/apis/apps k8s.io/api/apps/v1 -INT_FQ_APIS=() # e.g. k8s.io/kubernetes/pkg/apis/apps -EXT_FQ_APIS=() # e.g. k8s.io/api/apps/v1 -for GVs in ${GROUPS_WITH_VERSIONS}; do - IFS=: read -r G Vs <<<"${GVs}" - - if [ -n "${INT_APIS_PKG}" ]; then - ALL_FQ_APIS+=("${INT_APIS_PKG}/${G}") - INT_FQ_APIS+=("${INT_APIS_PKG}/${G}") - fi - - # enumerate versions - for V in ${Vs//,/ }; do - ALL_FQ_APIS+=("${EXT_APIS_PKG}/${G}/${V}") - EXT_FQ_APIS+=("${EXT_APIS_PKG}/${G}/${V}") - done -done - -if [ "${GENS}" = "all" ] || grep -qw "deepcopy" <<<"${GENS}"; then - echo "Generating deepcopy funcs" - "${GOPATH}/bin/deepcopy-gen" --input-dirs "$(codegen::join , "${ALL_FQ_APIS[@]}")" -O zz_generated.deepcopy --bounding-dirs "${INT_APIS_PKG},${EXT_APIS_PKG}" "$@" -fi - -if [ "${GENS}" = "all" ] || grep -qw "defaulter" <<<"${GENS}"; then - echo "Generating defaulters" - "${GOPATH}/bin/defaulter-gen" --input-dirs "$(codegen::join , "${EXT_FQ_APIS[@]}")" -O zz_generated.defaults "$@" -fi - -if [ "${GENS}" = "all" ] || grep -qw "conversion" <<<"${GENS}"; then - echo "Generating conversions" - "${GOPATH}/bin/conversion-gen" --input-dirs "$(codegen::join , "${ALL_FQ_APIS[@]}")" -O zz_generated.conversion "$@" -fi - -if [ "${GENS}" = "all" ] || grep -qw "client" <<<"${GENS}"; then - echo "Generating clientset for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}" - if [ -n "${INT_APIS_PKG}" ]; then - IFS=" " read -r -a APIS <<< "$(printf '%s/ ' "${INT_FQ_APIS[@]}")" - "${GOPATH}/bin/client-gen" --clientset-name "${CLIENTSET_NAME_INTERNAL:-internalversion}" --input-base "" --input "$(codegen::join , "${APIS[@]}")" --output-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}" "$@" - fi - "${GOPATH}/bin/client-gen" --clientset-name "${CLIENTSET_NAME_VERSIONED:-versioned}" --input-base "" --input "$(codegen::join , "${EXT_FQ_APIS[@]}")" --output-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}" "$@" -fi - -if [ "${GENS}" = "all" ] || grep -qw "lister" <<<"${GENS}"; then - echo "Generating listers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/listers" - "${GOPATH}/bin/lister-gen" --input-dirs "$(codegen::join , "${ALL_FQ_APIS[@]}")" --output-package "${OUTPUT_PKG}/listers" "$@" -fi - -if [ "${GENS}" = "all" ] || grep -qw "informer" <<<"${GENS}"; then - echo "Generating informers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/informers" - "${GOPATH}/bin/informer-gen" \ - --input-dirs "$(codegen::join , "${ALL_FQ_APIS[@]}")" \ - --versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}/${CLIENTSET_NAME_VERSIONED:-versioned}" \ - --internal-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}/${CLIENTSET_NAME_INTERNAL:-internalversion}" \ - --listers-package "${OUTPUT_PKG}/listers" \ - --output-package "${OUTPUT_PKG}/informers" \ - "$@" -fi diff --git a/vendor/k8s.io/code-generator/hack/boilerplate.go.txt b/vendor/k8s.io/code-generator/hack/boilerplate.go.txt deleted file mode 100644 index dc48e7ab7e1..00000000000 --- a/vendor/k8s.io/code-generator/hack/boilerplate.go.txt +++ /dev/null @@ -1,15 +0,0 @@ -/* -Copyright YEAR Red Hat, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ diff --git a/vendor/modules.txt b/vendor/modules.txt index d86a82059eb..d51cbfb8a2d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -73,6 +73,9 @@ github.com/gogo/protobuf/gogoproto github.com/gogo/protobuf/proto github.com/gogo/protobuf/protoc-gen-gogo/descriptor github.com/gogo/protobuf/sortkeys +# github.com/golang-migrate/migrate/v4 v4.6.2 +github.com/golang-migrate/migrate/v4/source +github.com/golang-migrate/migrate/v4/source/file # github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/golang/glog # github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff @@ -113,7 +116,7 @@ github.com/imdario/mergo github.com/inconshreveable/mousetrap # github.com/json-iterator/go v1.1.7 github.com/json-iterator/go -# github.com/konsorten/go-windows-terminal-sequences v1.0.1 +# github.com/konsorten/go-windows-terminal-sequences v1.0.2 github.com/konsorten/go-windows-terminal-sequences # github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de github.com/liggitt/tabwriter @@ -153,30 +156,31 @@ github.com/openshift/client-go/config/informers/externalversions/config github.com/openshift/client-go/config/informers/externalversions/config/v1 github.com/openshift/client-go/config/informers/externalversions/internalinterfaces github.com/openshift/client-go/config/listers/config/v1 -# github.com/operator-framework/operator-registry v1.4.0 +# github.com/operator-framework/operator-registry v1.4.0 => ../operator-registry github.com/operator-framework/operator-registry/pkg/api github.com/operator-framework/operator-registry/pkg/api/grpc_health_v1 github.com/operator-framework/operator-registry/pkg/client github.com/operator-framework/operator-registry/pkg/registry github.com/operator-framework/operator-registry/pkg/server github.com/operator-framework/operator-registry/pkg/sqlite +github.com/operator-framework/operator-registry/pkg/sqlite/migrations # github.com/pborman/uuid v1.2.0 github.com/pborman/uuid # github.com/pkg/errors v0.8.1 github.com/pkg/errors # github.com/pmezard/go-difflib v1.0.0 github.com/pmezard/go-difflib/difflib -# github.com/prometheus/client_golang v0.9.2 +# github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829 github.com/prometheus/client_golang/prometheus github.com/prometheus/client_golang/prometheus/internal github.com/prometheus/client_golang/prometheus/promhttp -# github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 +# github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f github.com/prometheus/client_model/go -# github.com/prometheus/common v0.0.0-20190104105734-b1c43a6df3ae +# github.com/prometheus/common v0.2.0 github.com/prometheus/common/expfmt github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg github.com/prometheus/common/model -# github.com/prometheus/procfs v0.0.0-20190104112138-b1a0a9a36d74 +# github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1 github.com/prometheus/procfs github.com/prometheus/procfs/internal/util github.com/prometheus/procfs/nfs