From 67dbf8f348616a3703f297ec927b5bd3b4dd79c0 Mon Sep 17 00:00:00 2001 From: Evan Cordell Date: Wed, 12 Dec 2018 13:00:59 -0500 Subject: [PATCH] test(registry): add checks for registry pods --- go.mod | 16 +- go.sum | 48 +- .../operators/v1alpha1/catalogsource_types.go | 9 +- pkg/controller/operators/catalog/operator.go | 31 +- .../operators/catalog/operator_test.go | 7 +- .../operatorlisterfakes/fake_core_v1lister.go | 208 +++++ test/e2e/catalog_e2e_test.go | 55 +- test/e2e/csv_e2e_test.go | 29 +- test/e2e/installplan_e2e_test.go | 18 +- test/e2e/ocs_e2e_test.go | 4 +- test/e2e/setup_bare_test.go | 2 +- test/e2e/subscription_e2e_test.go | 2 +- test/e2e/util_test.go | 45 +- .../operator-registry/LICENSE | 201 ++++ .../operator-registry/pkg/api/conversion.go | 84 ++ .../operator-registry/pkg/api/health.pb.go | 205 +++++ .../operator-registry/pkg/api/health.proto | 20 + .../operator-registry/pkg/api/registry.pb.go | 859 ++++++++++++++++++ .../operator-registry/pkg/api/registry.proto | 89 ++ .../operator-registry/pkg/client/client.go | 63 ++ .../operator-registry/pkg/registry/bundle.go | 217 +++++ .../pkg/registry/interface.go | 28 + .../operator-registry/pkg/registry/types.go | 66 ++ vendor/modules.txt | 22 +- 24 files changed, 2193 insertions(+), 135 deletions(-) create mode 100644 vendor/github.com/operator-framework/operator-registry/LICENSE create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/api/conversion.go create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/api/health.pb.go create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/api/health.proto create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/api/registry.pb.go create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/api/registry.proto create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/client/client.go create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/registry/bundle.go create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/registry/interface.go create mode 100644 vendor/github.com/operator-framework/operator-registry/pkg/registry/types.go diff --git a/go.mod b/go.mod index 5c39b2cc752..a1fb2b5ee08 100644 --- a/go.mod +++ b/go.mod @@ -21,28 +21,18 @@ require ( github.com/go-openapi/spec v0.17.2 github.com/go-openapi/strfmt v0.17.2 // indirect github.com/go-openapi/validate v0.17.2 // indirect - github.com/gogo/protobuf v1.1.1 // indirect github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff // indirect github.com/golang/mock v1.1.1 - github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c // indirect - github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf // indirect - github.com/googleapis/gnostic v0.2.0 // indirect github.com/gorilla/websocket v1.4.0 // indirect - github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.5.1 // indirect github.com/hashicorp/golang-lru v0.5.0 // indirect - github.com/imdario/mergo v0.3.6 // indirect - github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jonboulle/clockwork v0.1.0 // indirect - github.com/json-iterator/go v1.1.5 // indirect - github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/maxbrunsfeld/counterfeiter v0.0.0-20181017030959-1aadac120687 - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.1 // indirect - github.com/peterbourgon/diskv v2.0.1+incompatible // indirect + github.com/operator-framework/operator-registry v1.0.1 github.com/pkg/errors v0.8.0 github.com/prometheus/client_golang v0.8.0 github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 // indirect @@ -51,14 +41,11 @@ require ( github.com/sirupsen/logrus v1.1.1 github.com/soheilhy/cmux v0.1.4 // indirect github.com/spf13/cobra v0.0.3 - github.com/spf13/pflag v1.0.3 // indirect github.com/stevvooe/resumable v0.0.0-20180830230917-22b14a53ba50 // indirect github.com/stretchr/testify v1.2.2 github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6 // indirect github.com/ugorji/go v1.1.1 // indirect github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18 // indirect - golang.org/x/crypto v0.0.0-20181015023909-0c41d7ab0a0e // indirect - golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519 // indirect golang.org/x/oauth2 v0.0.0-20181105165119-ca4130e427c7 // indirect golang.org/x/sys v0.0.0-20181023152157-44b849a8bc13 // indirect golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 // indirect @@ -66,6 +53,7 @@ require ( google.golang.org/genproto v0.0.0-20181016170114-94acd270e44e // indirect google.golang.org/grpc v1.16.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect + google.golang.org/grpc v1.16.0 gopkg.in/natefinch/lumberjack.v2 v2.0.0-20170531160350-a96e63847dc3 // indirect k8s.io/api v0.0.0-20181203235848-2dd39edadc55 k8s.io/apiextensions-apiserver v0.0.0-20181204003618-e419c5771cdc diff --git a/go.sum b/go.sum index cfbbc90cdac..1c3329b6e26 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,6 @@ bitbucket.org/ww/goautoneg v0.0.0-20120707110453-75cd24fc2f2c h1:t+Ra932MCC0eeyD/vigXqMbZTzgZjd4JOfBJWC6VSMI= bitbucket.org/ww/goautoneg v0.0.0-20120707110453-75cd24fc2f2c/go.mod h1:1vhO7Mn/FZMgOgDVGLy5X1mE6rq1HbkBdkF/yj8zkcg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/NYTimes/gziphandler v1.0.1 h1:iLrQrdwjDd52kHDA5op2UBJFjmOb9g+7scBan4RN8F0= github.com/NYTimes/gziphandler v1.0.1/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= @@ -13,10 +12,8 @@ github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf h1:eg0MeVzs github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= 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/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/bbolt v1.3.0 h1:HIgH5xUWXT914HCI671AxuTTqjj64UOFr7pHn48LUTI= github.com/coreos/bbolt v1.3.0/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.9+incompatible h1:/pWnp1yEff0z+vBEOBFLZZ22Ux5xoVozEe7X0VFyRNo= github.com/coreos/etcd v3.3.9+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -24,13 +21,10 @@ github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazu github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7 h1:u9SHYsPQNyt5tgDm3YN7+9dYrpK96E5wFilTFWIDZOM= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= 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/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/docker/distribution v2.6.2+incompatible h1:4FI6af79dfCS/CYb+RRtkSHw3q1L/bnDjG1PcPZtQhM= github.com/docker/distribution v2.6.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk= github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= @@ -40,7 +34,6 @@ github.com/emicklei/go-restful-swagger12 v0.0.0-20170926063155-7524189396c6 h1:V github.com/emicklei/go-restful-swagger12 v0.0.0-20170926063155-7524189396c6/go.mod h1:qr0VowGBT4CS4Q8vFF8BSeKz34PuqKGxs/L0IAQA9DQ= github.com/evanphx/json-patch v3.0.0+incompatible h1:l91aby7TzBXBdmF8heZqjskeH9f3g7ZOL8/sSe+vTlU= github.com/evanphx/json-patch v3.0.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -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/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -73,6 +66,7 @@ github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= 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-20180924190550-6f2cf27854a4/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff h1:kOkM9whyQYodu09SJ6W3NCsHG7crFaJILQ22Gozp3lg= github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= @@ -88,23 +82,18 @@ github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gnostic v0.2.0 h1:l6N3VoaVzTncYYW+9yOz2LJJammFZGBO13sqgEhpy9g= github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= -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-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.5.1 h1:3scN4iuXkNOyP98jF55Lv8a9j1o/IwvnDIZ0LHJK1nk= github.com/grpc-ecosystem/grpc-gateway v1.5.1/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= github.com/imdario/mergo v0.3.6/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/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.5 h1:gL2yXlmiIo4+t+y32d4WGwOjKGYcGOuyrg46vadswDE= github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -114,6 +103,7 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGi github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/maxbrunsfeld/counterfeiter v0.0.0-20181017030959-1aadac120687 h1:fJasMUaV/LYZvzK4bUOj13rNXc4fhVzU0Vu1OlcGUd4= @@ -122,14 +112,17 @@ github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQz github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.2-0.20180831124310-ae19f1b56d53 h1:W43ZAQzmBARaVM1WrnDDKjtfIkF6OyeElrMdKDQIYhY= github.com/onsi/gomega v1.4.2-0.20180831124310-ae19f1b56d53/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/operator-framework/operator-lifecycle-manager v0.0.0-20181023032605-e838f7fb2186/go.mod h1:Ma5ZXd4S1vmMyewWlF7aO8CZiokR7Sd8dhSfkGkNU4U= +github.com/operator-framework/operator-registry v1.0.1 h1:Z2155w77HzIkTrdp2qoY0QMkywxhJpuABUSGcgogXuc= +github.com/operator-framework/operator-registry v1.0.1/go.mod h1:1xEdZjjUg2hPEd52LG3YQ0jtwiwEGdm98S1TH5P4RAA= github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/petar/GoLLRB v0.0.0-20130427215148-53be0d36a84c/go.mod h1:HUpKUBZnpzkdx0kD/+Yfuft+uD3zHGtXF/XJB14TUr4= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= @@ -144,25 +137,20 @@ github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e h1:n/3MEhJQjQxrO github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273 h1:agujYaXJSxSo18YNX3jzl+4G6Bstwt+kqv47GS12uL0= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/sclevine/spec v1.0.0 h1:ILQ08A/CHCz8GGqivOvI54Hy1U40wwcpkf7WtB1MQfY= github.com/sclevine/spec v1.0.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U= github.com/sirupsen/logrus v1.1.1 h1:VzGj7lhU7KEB9e9gMpAV/v5XT2NVSvLJhJLCWbnkgXg= github.com/sirupsen/logrus v1.1.1/go.mod h1:zrgwTnHtNr00buQ1vSptGe8m1f/BbgsPukg8qsT7A+A= -github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/stevvooe/resumable v0.0.0-20180830230917-22b14a53ba50 h1:4bT0pPowCpQImewr+BjzfUKcuFW+KVyB8d1OF3b6oTI= github.com/stevvooe/resumable v0.0.0-20180830230917-22b14a53ba50/go.mod h1:1pdIZTAHUz+HDKDVZ++5xg/duPlhKAIzw9qy42CWYp4= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6 h1:lYIiVDtZnyTWlNwiAxLj0bbpTcx1BWCFhXjfsvmPdNc= github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.1 h1:gmervu+jDMvXTbcHQ0pd2wee85nEoE0BsVyEuzkfK8w= github.com/ugorji/go v1.1.1/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= -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= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181015023909-0c41d7ab0a0e h1:IzypfodbhbnViNUO/MEh0FzCUooG97cIGfdggUrUSyU= @@ -176,7 +164,6 @@ golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181105165119-ca4130e427c7 h1:g9UOdtsRWEwHYUG2bDHMxKrvfSGE5epIX2HkaMHSMBY= golang.org/x/oauth2 v0.0.0-20181105165119-ca4130e427c7/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -199,27 +186,26 @@ google.golang.org/genproto v0.0.0-20181016170114-94acd270e44e h1:I5s8aUkxqPjgAss google.golang.org/genproto v0.0.0-20181016170114-94acd270e44e/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/grpc v1.16.0 h1:dz5IJGuC2BB7qXR5AyHNwAUBhZscK2xVez7mznh72sY= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/natefinch/lumberjack.v2 v2.0.0-20170531160350-a96e63847dc3 h1:AFxeG48hTWHhDTQDk/m2gorfVHUEa9vo3tp3D7TzwjI= gopkg.in/natefinch/lumberjack.v2 v2.0.0-20170531160350-a96e63847dc3/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.0.0-20181203235848-2dd39edadc55 h1:FmAMYGd999iHkN+swot+oART9AumJiAvH0idpIZ3Ozo= -k8s.io/api v0.0.0-20181203235848-2dd39edadc55/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA= -k8s.io/apiextensions-apiserver v0.0.0-20181204003618-e419c5771cdc h1:IOukeE9HtTwpLslbujLDfRpfFU6tsjq28yO0fjnl/hk= -k8s.io/apiextensions-apiserver v0.0.0-20181204003618-e419c5771cdc/go.mod h1:IxkesAMoaCRoLrPJdZNZUQp9NfZnzqaVzLhb2VEQzXE= -k8s.io/apimachinery v0.0.0-20181203235515-3d8ee2261517 h1:p6GEgV1/cc7H0AT6XfjHwHNIypirOprIB09oKp2DQ/M= -k8s.io/apimachinery v0.0.0-20181203235515-3d8ee2261517/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0= +k8s.io/api v0.0.0-20180904230853-4e7be11eab3f h1:DLRkv8Ps4Sdx8Srj+UtGisj4whV7v/HezlHx6QqiZqE= +k8s.io/api v0.0.0-20180904230853-4e7be11eab3f/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA= +k8s.io/apiextensions-apiserver v0.0.0-20180905004947-16750353bf97 h1:s4lWWs6JN5kWVzk5bztddkr5kgO/cGIbqTDP+QttUeQ= +k8s.io/apiextensions-apiserver v0.0.0-20180905004947-16750353bf97/go.mod h1:IxkesAMoaCRoLrPJdZNZUQp9NfZnzqaVzLhb2VEQzXE= +k8s.io/apimachinery v0.0.0-20180904193909-def12e63c512/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0= +k8s.io/apimachinery v0.0.0-20181126123124-70adfbae261e h1:aoIs4wbKOxWFPPOoMSWC9V4b5+kp7c70tAD8LLByFQY= +k8s.io/apimachinery v0.0.0-20181126123124-70adfbae261e/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0= k8s.io/apiserver v0.0.0-20181026151315-13cfe3978170 h1:CqI85nZvPaV+7JFono0nAOGOx2brocqefcOhDPVhHKI= k8s.io/apiserver v0.0.0-20181026151315-13cfe3978170/go.mod h1:6bqaTSOSJavUIXUtfaR9Os9JtTCm8ZqH2SUl2S60C4w= +k8s.io/client-go v0.0.0-20180718001006-59698c7d9724/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s= k8s.io/client-go v8.0.0+incompatible h1:2pUaSg2x6iEHr8cia6zmWhoCXG1EDG9TCx9s//Aq7HY= k8s.io/client-go v8.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s= k8s.io/code-generator v0.0.0-20181203235156-f8cba74510f3 h1:f/Aa24HPnPEDWia884BCF94E1b29KYjOTVTHcBzvT2Q= @@ -232,5 +218,5 @@ k8s.io/kube-aggregator v0.0.0-20181204002017-122bac39d429 h1:wIDPKpRuwEfyt+ImBaP k8s.io/kube-aggregator v0.0.0-20181204002017-122bac39d429/go.mod h1:8sbzT4QQKDEmSCIbfqjV0sd97GpUT7A4W626sBiYJmU= k8s.io/kube-openapi v0.0.0-20181031203759-72693cb1fadd h1:ggv/Vfza0i5xuhUZyYyxcc25AmQvHY8Zi1C2m8WgBvA= k8s.io/kube-openapi v0.0.0-20181031203759-72693cb1fadd/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc= -k8s.io/kubernetes v1.11.6-beta.0.0.20181207014600-4600add36de5 h1:+oToqFCSumcTuKDfnGBfGDTufqPJK3JmI0+ItcYB2tg= -k8s.io/kubernetes v1.11.6-beta.0.0.20181207014600-4600add36de5/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= +k8s.io/kubernetes v1.11.6-beta.0.0.20181126160157-5933b9771b71 h1:HayOEaI37dSY793mGJl82RXTLCdLs9NfzGUEz7wGlnA= +k8s.io/kubernetes v1.11.6-beta.0.0.20181126160157-5933b9771b71/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= diff --git a/pkg/api/apis/operators/v1alpha1/catalogsource_types.go b/pkg/api/apis/operators/v1alpha1/catalogsource_types.go index 032add58580..9bf5bfaf9f6 100644 --- a/pkg/api/apis/operators/v1alpha1/catalogsource_types.go +++ b/pkg/api/apis/operators/v1alpha1/catalogsource_types.go @@ -1,9 +1,12 @@ package v1alpha1 import ( - "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators" + "fmt" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators" ) const ( @@ -39,6 +42,10 @@ type RegistryServiceStatus struct { CreatedAt metav1.Time `json:"createdAt,omitempty"` } +func (s *RegistryServiceStatus) Address() string { + return fmt.Sprintf("%s.%s.svc.cluster.local:%s", s.ServiceName, s.ServiceNamespace, s.Port) +} + type CatalogSourceStatus struct { ConfigMapResource *ConfigMapResourceReference `json:"configMapReference,omitempty"` RegistryServiceStatus *RegistryServiceStatus `json:"registryService,omitempty"` diff --git a/pkg/controller/operators/catalog/operator.go b/pkg/controller/operators/catalog/operator.go index 0234810964c..19424e2701c 100644 --- a/pkg/controller/operators/catalog/operator.go +++ b/pkg/controller/operators/catalog/operator.go @@ -8,19 +8,20 @@ import ( "time" "github.com/sirupsen/logrus" - "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/informers" corev1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" v1beta1ext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/client-go/informers" "k8s.io/client-go/tools/cache" "k8s.io/client-go/util/workqueue" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client" "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned" @@ -182,12 +183,12 @@ func NewOperator(kubeconfigPath string, logger *logrus.Logger, wakeupInterval ti configMapInformer := informerFactory.Core().V1().ConfigMaps() queueInformers := []*queueinformer.QueueInformer{ - queueinformer.NewInformer(roleQueue, roleInformer.Informer(), op.syncObject, handleDelete, "role", metrics.NewMetricsNil()), - queueinformer.NewInformer(roleBindingQueue, roleBindingInformer.Informer(), op.syncObject, handleDelete, "rolebinding", metrics.NewMetricsNil()), - queueinformer.NewInformer(serviceAccountQueue, serviceAccountInformer.Informer(), op.syncObject, handleDelete, "serviceaccount", metrics.NewMetricsNil()), - queueinformer.NewInformer(serviceQueue, serviceInformer.Informer(), op.syncObject, handleDelete, "service", metrics.NewMetricsNil()), - queueinformer.NewInformer(podQueue, podInformer.Informer(), op.syncObject, handleDelete, "pod", metrics.NewMetricsNil()), - queueinformer.NewInformer(configmapQueue, configMapInformer.Informer(), op.syncObject, handleDelete, "configmap", metrics.NewMetricsNil()), + queueinformer.NewInformer(roleQueue, roleInformer.Informer(), op.syncObject, handleDelete, "role", metrics.NewMetricsNil(), logger), + queueinformer.NewInformer(roleBindingQueue, roleBindingInformer.Informer(), op.syncObject, handleDelete, "rolebinding", metrics.NewMetricsNil(), logger), + queueinformer.NewInformer(serviceAccountQueue, serviceAccountInformer.Informer(), op.syncObject, handleDelete, "serviceaccount", metrics.NewMetricsNil(), logger), + queueinformer.NewInformer(serviceQueue, serviceInformer.Informer(), op.syncObject, handleDelete, "service", metrics.NewMetricsNil(), logger), + queueinformer.NewInformer(podQueue, podInformer.Informer(), op.syncObject, handleDelete, "pod", metrics.NewMetricsNil(), logger), + queueinformer.NewInformer(configmapQueue, configMapInformer.Informer(), op.syncObject, handleDelete, "configmap", metrics.NewMetricsNil(), logger), } for _, q := range queueInformers { op.RegisterQueueInformer(q) @@ -213,12 +214,12 @@ func (o *Operator) syncObject(obj interface{}) (syncError error) { runtimeObj, ok := obj.(runtime.Object) if !ok { syncError = errors.New("object sync: casting to runtime.Object failed") - log.Warn(syncError.Error()) + o.Log.Warn(syncError.Error()) return } gvk := runtimeObj.GetObjectKind().GroupVersionKind() - logger := log.WithFields(log.Fields{ + logger := o.Log.WithFields(logrus.Fields{ "group": gvk.Group, "version": gvk.Version, "kind": gvk.Kind, @@ -231,7 +232,7 @@ func (o *Operator) syncObject(obj interface{}) (syncError error) { logger.Warn(syncError.Error()) return } - logger = logger.WithFields(log.Fields{ + logger = logger.WithFields(logrus.Fields{ "name": metaObj.GetName(), "namespace": metaObj.GetNamespace(), }) @@ -276,12 +277,12 @@ func (o *Operator) syncCatalogSources(obj interface{}) (syncError error) { return fmt.Errorf("casting CatalogSource failed") } - logger := log.WithFields(log.Fields{ + logger := o.Log.WithFields(logrus.Fields{ "source": catsrc.GetName(), }) if catsrc.Spec.SourceType == v1alpha1.SourceTypeInternal || catsrc.Spec.SourceType == v1alpha1.SourceTypeConfigmap { - return o.syncConfigMapSource(logger, catsrc) + return o.syncConfigMapSource(logger.Logger, catsrc) } logger.WithField("sourceType", catsrc.Spec.SourceType).Warn("unknown source type") @@ -291,7 +292,7 @@ func (o *Operator) syncCatalogSources(obj interface{}) (syncError error) { return nil } -func (o *Operator) syncConfigMapSource(logger *log.Entry, catsrc *v1alpha1.CatalogSource) (syncError error) { +func (o *Operator) syncConfigMapSource(logger *logrus.Logger, catsrc *v1alpha1.CatalogSource) (syncError error) { // Get the catalog source's config map configMap, err := o.lister.CoreV1().ConfigMapLister().ConfigMaps(catsrc.GetNamespace()).Get(catsrc.Spec.ConfigMap) diff --git a/pkg/controller/operators/catalog/operator_test.go b/pkg/controller/operators/catalog/operator_test.go index beae71c4681..889488c67e6 100644 --- a/pkg/controller/operators/catalog/operator_test.go +++ b/pkg/controller/operators/catalog/operator_test.go @@ -6,10 +6,6 @@ import ( "testing" "time" - "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" - "k8s.io/client-go/informers" - "k8s.io/client-go/tools/cache" - "github.com/ghodss/yaml" "github.com/sirupsen/logrus" "github.com/stretchr/testify/require" @@ -19,11 +15,10 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/informers" k8sfake "k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/tools/cache" apiregistrationfake "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/fake" - "k8s.io/client-go/informers" - "k8s.io/client-go/tools/cache" "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/fake" diff --git a/pkg/lib/operatorlister/operatorlisterfakes/fake_core_v1lister.go b/pkg/lib/operatorlister/operatorlisterfakes/fake_core_v1lister.go index 9bc84916089..5c3505da572 100644 --- a/pkg/lib/operatorlister/operatorlisterfakes/fake_core_v1lister.go +++ b/pkg/lib/operatorlister/operatorlisterfakes/fake_core_v1lister.go @@ -9,6 +9,16 @@ import ( ) type FakeCoreV1Lister struct { + ConfigMapListerStub func() v1.ConfigMapLister + configMapListerMutex sync.RWMutex + configMapListerArgsForCall []struct { + } + configMapListerReturns struct { + result1 v1.ConfigMapLister + } + configMapListerReturnsOnCall map[int]struct { + result1 v1.ConfigMapLister + } NamespaceListerStub func() v1.NamespaceLister namespaceListerMutex sync.RWMutex namespaceListerArgsForCall []struct { @@ -19,11 +29,33 @@ type FakeCoreV1Lister struct { namespaceListerReturnsOnCall map[int]struct { result1 v1.NamespaceLister } + PodListerStub func() v1.PodLister + podListerMutex sync.RWMutex + podListerArgsForCall []struct { + } + podListerReturns struct { + result1 v1.PodLister + } + podListerReturnsOnCall map[int]struct { + result1 v1.PodLister + } + RegisterConfigMapListerStub func(string, v1.ConfigMapLister) + registerConfigMapListerMutex sync.RWMutex + registerConfigMapListerArgsForCall []struct { + arg1 string + arg2 v1.ConfigMapLister + } RegisterNamespaceListerStub func(v1.NamespaceLister) registerNamespaceListerMutex sync.RWMutex registerNamespaceListerArgsForCall []struct { arg1 v1.NamespaceLister } + RegisterPodListerStub func(string, v1.PodLister) + registerPodListerMutex sync.RWMutex + registerPodListerArgsForCall []struct { + arg1 string + arg2 v1.PodLister + } RegisterSecretListerStub func(string, v1.SecretLister) registerSecretListerMutex sync.RWMutex registerSecretListerArgsForCall []struct { @@ -76,6 +108,58 @@ type FakeCoreV1Lister struct { invocationsMutex sync.RWMutex } +func (fake *FakeCoreV1Lister) ConfigMapLister() v1.ConfigMapLister { + fake.configMapListerMutex.Lock() + ret, specificReturn := fake.configMapListerReturnsOnCall[len(fake.configMapListerArgsForCall)] + fake.configMapListerArgsForCall = append(fake.configMapListerArgsForCall, struct { + }{}) + fake.recordInvocation("ConfigMapLister", []interface{}{}) + fake.configMapListerMutex.Unlock() + if fake.ConfigMapListerStub != nil { + return fake.ConfigMapListerStub() + } + if specificReturn { + return ret.result1 + } + fakeReturns := fake.configMapListerReturns + return fakeReturns.result1 +} + +func (fake *FakeCoreV1Lister) ConfigMapListerCallCount() int { + fake.configMapListerMutex.RLock() + defer fake.configMapListerMutex.RUnlock() + return len(fake.configMapListerArgsForCall) +} + +func (fake *FakeCoreV1Lister) ConfigMapListerCalls(stub func() v1.ConfigMapLister) { + fake.configMapListerMutex.Lock() + defer fake.configMapListerMutex.Unlock() + fake.ConfigMapListerStub = stub +} + +func (fake *FakeCoreV1Lister) ConfigMapListerReturns(result1 v1.ConfigMapLister) { + fake.configMapListerMutex.Lock() + defer fake.configMapListerMutex.Unlock() + fake.ConfigMapListerStub = nil + fake.configMapListerReturns = struct { + result1 v1.ConfigMapLister + }{result1} +} + +func (fake *FakeCoreV1Lister) ConfigMapListerReturnsOnCall(i int, result1 v1.ConfigMapLister) { + fake.configMapListerMutex.Lock() + defer fake.configMapListerMutex.Unlock() + fake.ConfigMapListerStub = nil + if fake.configMapListerReturnsOnCall == nil { + fake.configMapListerReturnsOnCall = make(map[int]struct { + result1 v1.ConfigMapLister + }) + } + fake.configMapListerReturnsOnCall[i] = struct { + result1 v1.ConfigMapLister + }{result1} +} + func (fake *FakeCoreV1Lister) NamespaceLister() v1.NamespaceLister { fake.namespaceListerMutex.Lock() ret, specificReturn := fake.namespaceListerReturnsOnCall[len(fake.namespaceListerArgsForCall)] @@ -128,6 +212,90 @@ func (fake *FakeCoreV1Lister) NamespaceListerReturnsOnCall(i int, result1 v1.Nam }{result1} } +func (fake *FakeCoreV1Lister) PodLister() v1.PodLister { + fake.podListerMutex.Lock() + ret, specificReturn := fake.podListerReturnsOnCall[len(fake.podListerArgsForCall)] + fake.podListerArgsForCall = append(fake.podListerArgsForCall, struct { + }{}) + fake.recordInvocation("PodLister", []interface{}{}) + fake.podListerMutex.Unlock() + if fake.PodListerStub != nil { + return fake.PodListerStub() + } + if specificReturn { + return ret.result1 + } + fakeReturns := fake.podListerReturns + return fakeReturns.result1 +} + +func (fake *FakeCoreV1Lister) PodListerCallCount() int { + fake.podListerMutex.RLock() + defer fake.podListerMutex.RUnlock() + return len(fake.podListerArgsForCall) +} + +func (fake *FakeCoreV1Lister) PodListerCalls(stub func() v1.PodLister) { + fake.podListerMutex.Lock() + defer fake.podListerMutex.Unlock() + fake.PodListerStub = stub +} + +func (fake *FakeCoreV1Lister) PodListerReturns(result1 v1.PodLister) { + fake.podListerMutex.Lock() + defer fake.podListerMutex.Unlock() + fake.PodListerStub = nil + fake.podListerReturns = struct { + result1 v1.PodLister + }{result1} +} + +func (fake *FakeCoreV1Lister) PodListerReturnsOnCall(i int, result1 v1.PodLister) { + fake.podListerMutex.Lock() + defer fake.podListerMutex.Unlock() + fake.PodListerStub = nil + if fake.podListerReturnsOnCall == nil { + fake.podListerReturnsOnCall = make(map[int]struct { + result1 v1.PodLister + }) + } + fake.podListerReturnsOnCall[i] = struct { + result1 v1.PodLister + }{result1} +} + +func (fake *FakeCoreV1Lister) RegisterConfigMapLister(arg1 string, arg2 v1.ConfigMapLister) { + fake.registerConfigMapListerMutex.Lock() + fake.registerConfigMapListerArgsForCall = append(fake.registerConfigMapListerArgsForCall, struct { + arg1 string + arg2 v1.ConfigMapLister + }{arg1, arg2}) + fake.recordInvocation("RegisterConfigMapLister", []interface{}{arg1, arg2}) + fake.registerConfigMapListerMutex.Unlock() + if fake.RegisterConfigMapListerStub != nil { + fake.RegisterConfigMapListerStub(arg1, arg2) + } +} + +func (fake *FakeCoreV1Lister) RegisterConfigMapListerCallCount() int { + fake.registerConfigMapListerMutex.RLock() + defer fake.registerConfigMapListerMutex.RUnlock() + return len(fake.registerConfigMapListerArgsForCall) +} + +func (fake *FakeCoreV1Lister) RegisterConfigMapListerCalls(stub func(string, v1.ConfigMapLister)) { + fake.registerConfigMapListerMutex.Lock() + defer fake.registerConfigMapListerMutex.Unlock() + fake.RegisterConfigMapListerStub = stub +} + +func (fake *FakeCoreV1Lister) RegisterConfigMapListerArgsForCall(i int) (string, v1.ConfigMapLister) { + fake.registerConfigMapListerMutex.RLock() + defer fake.registerConfigMapListerMutex.RUnlock() + argsForCall := fake.registerConfigMapListerArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + func (fake *FakeCoreV1Lister) RegisterNamespaceLister(arg1 v1.NamespaceLister) { fake.registerNamespaceListerMutex.Lock() fake.registerNamespaceListerArgsForCall = append(fake.registerNamespaceListerArgsForCall, struct { @@ -159,6 +327,38 @@ func (fake *FakeCoreV1Lister) RegisterNamespaceListerArgsForCall(i int) v1.Names return argsForCall.arg1 } +func (fake *FakeCoreV1Lister) RegisterPodLister(arg1 string, arg2 v1.PodLister) { + fake.registerPodListerMutex.Lock() + fake.registerPodListerArgsForCall = append(fake.registerPodListerArgsForCall, struct { + arg1 string + arg2 v1.PodLister + }{arg1, arg2}) + fake.recordInvocation("RegisterPodLister", []interface{}{arg1, arg2}) + fake.registerPodListerMutex.Unlock() + if fake.RegisterPodListerStub != nil { + fake.RegisterPodListerStub(arg1, arg2) + } +} + +func (fake *FakeCoreV1Lister) RegisterPodListerCallCount() int { + fake.registerPodListerMutex.RLock() + defer fake.registerPodListerMutex.RUnlock() + return len(fake.registerPodListerArgsForCall) +} + +func (fake *FakeCoreV1Lister) RegisterPodListerCalls(stub func(string, v1.PodLister)) { + fake.registerPodListerMutex.Lock() + defer fake.registerPodListerMutex.Unlock() + fake.RegisterPodListerStub = stub +} + +func (fake *FakeCoreV1Lister) RegisterPodListerArgsForCall(i int) (string, v1.PodLister) { + fake.registerPodListerMutex.RLock() + defer fake.registerPodListerMutex.RUnlock() + argsForCall := fake.registerPodListerArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + func (fake *FakeCoreV1Lister) RegisterSecretLister(arg1 string, arg2 v1.SecretLister) { fake.registerSecretListerMutex.Lock() fake.registerSecretListerArgsForCall = append(fake.registerSecretListerArgsForCall, struct { @@ -414,10 +614,18 @@ func (fake *FakeCoreV1Lister) ServiceListerReturnsOnCall(i int, result1 v1.Servi func (fake *FakeCoreV1Lister) Invocations() map[string][][]interface{} { fake.invocationsMutex.RLock() defer fake.invocationsMutex.RUnlock() + fake.configMapListerMutex.RLock() + defer fake.configMapListerMutex.RUnlock() fake.namespaceListerMutex.RLock() defer fake.namespaceListerMutex.RUnlock() + fake.podListerMutex.RLock() + defer fake.podListerMutex.RUnlock() + fake.registerConfigMapListerMutex.RLock() + defer fake.registerConfigMapListerMutex.RUnlock() fake.registerNamespaceListerMutex.RLock() defer fake.registerNamespaceListerMutex.RUnlock() + fake.registerPodListerMutex.RLock() + defer fake.registerPodListerMutex.RUnlock() fake.registerSecretListerMutex.RLock() defer fake.registerSecretListerMutex.RUnlock() fake.registerServiceAccountListerMutex.RLock() diff --git a/test/e2e/catalog_e2e_test.go b/test/e2e/catalog_e2e_test.go index e698026838d..16a0664e9b8 100644 --- a/test/e2e/catalog_e2e_test.go +++ b/test/e2e/catalog_e2e_test.go @@ -1,13 +1,17 @@ -// +build !bare +// +build !bare package e2e import ( + "context" "fmt" "testing" "github.com/coreos/go-semver/semver" + "github.com/operator-framework/operator-registry/pkg/api" + registryclient "github.com/operator-framework/operator-registry/pkg/client" "github.com/stretchr/testify/require" + "google.golang.org/grpc" appsv1 "k8s.io/api/apps/v1" extv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" "k8s.io/apimachinery/pkg/labels" @@ -18,6 +22,37 @@ import ( "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient" ) +func waitForRegistryPodService(catalogSource *v1alpha1.CatalogSource) (*registryclient.Client, error) { + var client *registryclient.Client + var err error + + err = wait.Poll(pollInterval, pollDuration, func() (bool, error) { + conn, err := grpc.Dial(catalogSource.Status.RegistryServiceStatus.Address(), grpc.WithInsecure()) + if err != nil { + fmt.Println(err) + return false, nil + } + healthClient := api.NewHealthClient(conn) + resp, err := healthClient.Check(context.TODO(), &api.HealthCheckRequest{"Registry"}) + if err != nil { + fmt.Println(err) + return false, nil + } + if resp.Status != api.HealthCheckResponse_SERVING { + fmt.Println(resp.String()) + return false, nil + } + + client, err = registryclient.NewClient(catalogSource.Status.RegistryServiceStatus.Address()) + if err != nil { + fmt.Println(err) + return false, nil + } + return true, nil + }) + return client, err +} + func TestCatalogLoadingBetweenRestarts(t *testing.T) { defer cleaner.NotifyTestComplete(t, true) @@ -50,7 +85,15 @@ func TestCatalogLoadingBetweenRestarts(t *testing.T) { defer cleanupCatalogSource() // ensure the mock catalog exists and has been synced by the catalog operator - catalogSource, err := fetchCatalogSource(t, crc, catalogSourceName, operatorNamespace, catalogSourceSynced) + catalogSource, err := fetchCatalogSource(t, crc, catalogSourceName, operatorNamespace, catalogSourceRegistryPodSynced) + require.NoError(t, err) + + // verify that registry pod is available and usable + client, err := waitForRegistryPodService(catalogSource) + require.NoError(t, err) + bundle, err := client.GetBundleThatProvides(context.TODO(), "etcd.database.coreos.com", "v1beta2", "EtcdCluster") + require.NoError(t, err) + _, err = bundle.ClusterServiceVersion() require.NoError(t, err) // get catalog operator deployment @@ -75,6 +118,14 @@ func TestCatalogLoadingBetweenRestarts(t *testing.T) { }) require.NoError(t, err, "Catalog source never loaded into memory after catalog operator rescale") t.Logf("Catalog source sucessfully loaded after rescale") + + // verify that registry pod is available and usable + client, err = waitForRegistryPodService(catalogSource) + require.NoError(t, err) + bundle, err = client.GetBundleThatProvides(context.TODO(), "etcd.database.coreos.com", "v1beta2", "EtcdCluster") + require.NoError(t, err) + _, err = bundle.ClusterServiceVersion() + require.NoError(t, err) } func getOperatorDeployment(c operatorclient.ClientInterface, namespace string, operatorLabels labels.Set) (*appsv1.Deployment, error) { diff --git a/test/e2e/csv_e2e_test.go b/test/e2e/csv_e2e_test.go index 59940136ba5..0ef5ac4f96a 100644 --- a/test/e2e/csv_e2e_test.go +++ b/test/e2e/csv_e2e_test.go @@ -726,8 +726,33 @@ func TestCreateCSVRequirementsMetCRD(t *testing.T) { _, err = c.CreateClusterRoleBinding(&nonResourceClusterRoleBinding) require.NoError(t, err, "could not create ClusterRoleBinding") - // Wait for CSV success - _, err = fetchCSV(t, crc, csv.Name, csvSucceededChecker) + cleanupCSV, err := createCSV(t, c, crc, csv, testNamespace, true, false) + require.NoError(t, err) + defer cleanupCSV() + + fmt.Println("checking for deployment") + // Poll for deployment to be ready + err = wait.Poll(pollInterval, pollDuration, func() (bool, error) { + dep, err := c.GetDeployment(testNamespace, depName) + if k8serrors.IsNotFound(err) { + fmt.Printf("deployment %s not found\n", depName) + return false, nil + } else if err != nil { + fmt.Printf("unexpected error fetching deployment %s\n", depName) + return false, err + } + if dep.Status.UpdatedReplicas == *(dep.Spec.Replicas) && + dep.Status.Replicas == *(dep.Spec.Replicas) && + dep.Status.AvailableReplicas == *(dep.Spec.Replicas) { + fmt.Println("deployment ready") + return true, nil + } + fmt.Println("deployment not ready") + return false, nil + }) + require.NoError(t, err) + + fetchedCSV, err := fetchCSV(t, crc, csv.Name, csvSucceededChecker) require.NoError(t, err) fetchedCSV, err = fetchCSV(t, crc, csv.Name, csvSucceededChecker) diff --git a/test/e2e/installplan_e2e_test.go b/test/e2e/installplan_e2e_test.go index dd0fe5d4f68..b58acc9e537 100644 --- a/test/e2e/installplan_e2e_test.go +++ b/test/e2e/installplan_e2e_test.go @@ -221,7 +221,7 @@ func TestCreateInstallPlanManualApproval(t *testing.T) { } // Attempt to get the catalog source before creating install plan - _, err = fetchCatalogSource(t, crc, ocsConfigMap, operatorNamespace, catalogSourceSynced) + _, err = fetchCatalogSource(t, crc, ocsConfigMap, operatorNamespace, catalogSourceRegistryPodSynced) require.NoError(t, err) // Create a new InstallPlan for Vault with manual approval @@ -321,7 +321,7 @@ func TestCreateInstallPlanFromInvalidClusterServiceVersionName(t *testing.T) { } // Attempt to get the catalog source before creating install plan - _, err := fetchCatalogSource(t, crc, ocsConfigMap, operatorNamespace, catalogSourceSynced) + _, err := fetchCatalogSource(t, crc, ocsConfigMap, operatorNamespace, catalogSourceRegistryPodSynced) require.NoError(t, err) cleanup, err := decorateCommonAndCreateInstallPlan(crc, testNamespace, installPlan) @@ -395,14 +395,14 @@ func TestCreateInstallPlanWithCSVsAcrossMultipleCatalogSources(t *testing.T) { require.NoError(t, err) defer cleanupDependentCatalogSource() // Attempt to get the catalog source before creating install plan - _, err = fetchCatalogSource(t, crc, dependentCatalogName, operatorNamespace, catalogSourceSynced) + _, err = fetchCatalogSource(t, crc, dependentCatalogName, operatorNamespace, catalogSourceRegistryPodSynced) require.NoError(t, err) _, cleanupMainCatalogSource, err := createInternalCatalogSource(t, c, crc, mainCatalogName, operatorNamespace, mainManifests, nil, []v1alpha1.ClusterServiceVersion{mainCSV}) require.NoError(t, err) defer cleanupMainCatalogSource() // Attempt to get the catalog source before creating install plan - _, err = fetchCatalogSource(t, crc, mainCatalogName, operatorNamespace, catalogSourceSynced) + _, err = fetchCatalogSource(t, crc, mainCatalogName, operatorNamespace, catalogSourceRegistryPodSynced) require.NoError(t, err) // Create expected install plan step sources @@ -545,7 +545,7 @@ func TestCreateInstallPlanWithPreExistingCRDOwners(t *testing.T) { require.NoError(t, err) defer cleanupCatalogSource() // Attempt to get the catalog source before creating install plan(s) - _, err = fetchCatalogSource(t, crc, catalogSourceName, operatorNamespace, catalogSourceSynced) + _, err = fetchCatalogSource(t, crc, catalogSourceName, operatorNamespace, catalogSourceRegistryPodSynced) require.NoError(t, err) expectedSteps := map[registry.ResourceKey]struct{}{ @@ -676,7 +676,7 @@ func TestCreateInstallPlanWithPreExistingCRDOwners(t *testing.T) { require.NoError(t, err) defer cleanupCatalogSource() // Attempt to get the catalog source before creating install plan(s) - _, err = fetchCatalogSource(t, crc, catalogSourceName, operatorNamespace, catalogSourceSynced) + _, err = fetchCatalogSource(t, crc, catalogSourceName, operatorNamespace, catalogSourceRegistryPodSynced) require.NoError(t, err) secondOwnerCSV := v1alpha1.ClusterServiceVersion{ @@ -795,7 +795,7 @@ func TestCreateInstallPlanWithPreExistingCRDOwners(t *testing.T) { require.NoError(t, err) defer cleanupCatalogSource() // Attempt to get the catalog source before creating install plan(s) - _, err = fetchCatalogSource(t, crc, catalogSourceName, operatorNamespace, catalogSourceSynced) + _, err = fetchCatalogSource(t, crc, catalogSourceName, operatorNamespace, catalogSourceRegistryPodSynced) require.NoError(t, err) // Create default test installplan @@ -977,7 +977,7 @@ func TestCreateInstallPlanWithPreExistingCRDOwners(t *testing.T) { require.NoError(t, err) defer cleanupCatalogSource() // Attempt to get the catalog source before creating install plan(s) - _, err = fetchCatalogSource(t, crc, catalogSourceName, operatorNamespace, catalogSourceSynced) + _, err = fetchCatalogSource(t, crc, catalogSourceName, operatorNamespace, catalogSourceRegistryPodSynced) require.NoError(t, err) // Create a dummy installplan with a non-existent csv @@ -1136,7 +1136,7 @@ func TestCreateInstallPlanWithPermissions(t *testing.T) { defer cleanupCatalogSource() // Attempt to get CatalogSource - _, err = fetchCatalogSource(t, crc, catalogSourceName, operatorNamespace, catalogSourceSynced) + _, err = fetchCatalogSource(t, crc, catalogSourceName, operatorNamespace, catalogSourceRegistryPodSynced) require.NoError(t, err) // Create InstallPlan diff --git a/test/e2e/ocs_e2e_test.go b/test/e2e/ocs_e2e_test.go index 44d54d453f4..c7214f0c26c 100644 --- a/test/e2e/ocs_e2e_test.go +++ b/test/e2e/ocs_e2e_test.go @@ -26,7 +26,7 @@ func TestInstallEtcdOCS(t *testing.T) { c := newKubeClient(t) crc := newCRClient(t) - catalogSource, err := fetchCatalogSource(t, crc, ocsConfigMap, operatorNamespace, catalogSourceSynced) + catalogSource, err := fetchCatalogSource(t, crc, ocsConfigMap, operatorNamespace, catalogSourceRegistryPodSynced) require.NoError(t, err) require.NotNil(t, catalogSource) inMem, err := registry.NewInMemoryFromConfigMap(c, operatorNamespace, catalogSource.Spec.ConfigMap) @@ -166,7 +166,7 @@ func TestInstallPrometheusOCS(t *testing.T) { c := newKubeClient(t) crc := newCRClient(t) - catalogSource, err := fetchCatalogSource(t, crc, ocsConfigMap, operatorNamespace, catalogSourceSynced) + catalogSource, err := fetchCatalogSource(t, crc, ocsConfigMap, operatorNamespace, catalogSourceRegistryPodSynced) require.NoError(t, err) require.NotNil(t, catalogSource) inMem, err := registry.NewInMemoryFromConfigMap(c, operatorNamespace, catalogSource.Spec.ConfigMap) diff --git a/test/e2e/setup_bare_test.go b/test/e2e/setup_bare_test.go index 30a67a7bce3..a8704f6952b 100644 --- a/test/e2e/setup_bare_test.go +++ b/test/e2e/setup_bare_test.go @@ -99,7 +99,7 @@ func TestMain(m *testing.M) { logrus.WithError(err).Fatalf("error configuring olm") } olmready, _ := olmOperator.Run(olmStopCh) - catalogOperator, err := catalog.NewOperator(*kubeConfigPath, catlogger, time.Minute, *namespace, namespaces...) + catalogOperator, err := catalog.NewOperator(*kubeConfigPath, catlogger, time.Minute, "quay.io/operatorframework/configmap-operator-registry:latest", *namespace, namespaces...) if err != nil { logrus.WithError(err).Fatalf("error configuring catalog") } diff --git a/test/e2e/subscription_e2e_test.go b/test/e2e/subscription_e2e_test.go index 0c87e2ae79e..99d6dc6c766 100644 --- a/test/e2e/subscription_e2e_test.go +++ b/test/e2e/subscription_e2e_test.go @@ -223,7 +223,7 @@ func initCatalog(t *testing.T, c operatorclient.ClientInterface, crc versioned.I } // Wait for the catalog source to be created - fetched, err := fetchCatalogSource(t, crc, dummyCatalogSource.GetName(), dummyCatalogSource.GetNamespace(), catalogSourceSynced) + fetched, err := fetchCatalogSource(t, crc, dummyCatalogSource.GetName(), dummyCatalogSource.GetNamespace(), catalogSourceRegistryPodSynced) require.NoError(t, err) require.NotNil(t, fetched) diff --git a/test/e2e/util_test.go b/test/e2e/util_test.go index 94776555ab3..d6d95d5aa35 100644 --- a/test/e2e/util_test.go +++ b/test/e2e/util_test.go @@ -25,7 +25,6 @@ import ( "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned" "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry" "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient" - "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil" pmclient "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client" pmversioned "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned" ) @@ -174,44 +173,6 @@ func waitForAndFetchCustomResource(t *testing.T, c operatorclient.ClientInterfac return res, err } -/// waitForAndFetchCustomResource is same as pollForCustomResource but returns the fetched unstructured resource -func waitForAndFetchChildren(t *testing.T, c operatorclient.ClientInterface, version string, kind string, owner ownerutil.Owner, count int) ([]*unstructured.Unstructured, error) { - t.Logf("Looking for %d %s in %s\n", count, kind, testNamespace) - var res []*unstructured.Unstructured - var err error - - err = wait.Poll(pollInterval, pollDuration, func() (bool, error) { - crList, err := c.ListCustomResource(v1alpha1.GroupName, version, testNamespace, kind) - if err != nil { - t.Log(err) - return false, nil - } - - owned := 0 - for _, obj := range crList.Items { - if ownerutil.IsOwnedBy(obj, owner) { - owned += 1 - res = append(res, obj) - } - } - - // waiting for count number of objects to exist - if owned != count { - return false, nil - } - return true, nil - }) - - return res, err -} - -func cleanupCustomResource(t *testing.T, c operatorclient.ClientInterface, group, kind, name string) cleanupFunc { - return func() { - t.Logf("deleting %s %s", kind, name) - require.NoError(t, c.DeleteCustomResource(v1alpha1.GroupName, group, testNamespace, kind, name)) - } -} - // compareResources compares resource equality then prints a diff for easier debugging func compareResources(t *testing.T, expected, actual interface{}) { if eq := equality.Semantic.DeepEqual(expected, actual); !eq { @@ -240,11 +201,11 @@ func waitForDelete(checkResource checkResourceFunc) error { type catalogSourceCheckFunc func(*v1alpha1.CatalogSource) bool -func catalogSourceSynced(catalog *v1alpha1.CatalogSource) bool { - if !catalog.Status.LastSync.IsZero() { +func catalogSourceRegistryPodSynced(catalog *v1alpha1.CatalogSource) bool { + if !catalog.Status.LastSync.IsZero() && catalog.Status.RegistryServiceStatus != nil { + fmt.Printf("catalog %s pod with address %s\n", catalog.GetName(), catalog.Status.RegistryServiceStatus.Address()) return true } - return false } diff --git a/vendor/github.com/operator-framework/operator-registry/LICENSE b/vendor/github.com/operator-framework/operator-registry/LICENSE new file mode 100644 index 00000000000..261eeb9e9f8 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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/github.com/operator-framework/operator-registry/pkg/api/conversion.go b/vendor/github.com/operator-framework/operator-registry/pkg/api/conversion.go new file mode 100644 index 00000000000..1b12f484460 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/api/conversion.go @@ -0,0 +1,84 @@ +package api + +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" +) + +func PackageManifestToApiPackage(manifest *registry.PackageManifest) *Package { + channels := []*Channel{} + for _, c := range manifest.Channels { + channels = append(channels, PackageChannelToApiChannel(&c)) + } + return &Package{ + Name: manifest.PackageName, + DefaultChannelName: manifest.DefaultChannelName, + Channels: channels, + } +} + +func PackageChannelToApiChannel(channel *registry.PackageChannel) *Channel { + return &Channel{ + Name: channel.Name, + CsvName: channel.CurrentCSVName, + } +} + +func ChannelEntryToApiChannelEntry(entry *registry.ChannelEntry) *ChannelEntry { + return &ChannelEntry{ + PackageName: entry.PackageName, + ChannelName: entry.ChannelName, + BundleName: entry.BundleName, + Replaces: entry.Replaces, + } +} + +// Bundle strings are appended json objects, we need to split them apart +// e.g. {"my":"obj"}{"csv":"data"}{"crd":"too"} +func BundleStringToObjectStrings(bundleString string) ([]string, error) { + objs := []string{} + dec := json.NewDecoder(strings.NewReader(bundleString)) + + for dec.More() { + var m json.RawMessage + err := dec.Decode(&m) + if err != nil { + return nil, err + } + objs = append(objs, string(m)) + } + return objs, nil +} + +func BundleStringToApiBundle(bundleString string, entry *registry.ChannelEntry) (*Bundle, error) { + objs, err := BundleStringToObjectStrings(bundleString) + if err != nil { + return nil, err + } + out := &Bundle{ + Object: objs, + } + for _, o := range objs { + dec := yaml.NewYAMLOrJSONDecoder(strings.NewReader(o), 10) + unst := &unstructured.Unstructured{} + if err := dec.Decode(unst); err != nil { + return nil, err + } + if unst.GetKind() == "ClusterServiceVersion" { + out.CsvName = unst.GetName() + out.CsvJson = o + break + } + } + 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/api/health.pb.go b/vendor/github.com/operator-framework/operator-registry/pkg/api/health.pb.go new file mode 100644 index 00000000000..1daae3c9814 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/api/health.pb.go @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-go. +// source: health.proto +// DO NOT EDIT! + +/* +Package api is a generated protocol buffer package. + +It is generated from these files: + health.proto + registry.proto + +It has these top-level messages: + HealthCheckRequest + HealthCheckResponse + Channel + PackageName + Package + Bundle + ChannelEntry + ListPackageRequest + GetPackageRequest + GetBundleRequest + GetBundleInChannelRequest + GetAllReplacementsRequest + GetReplacementRequest + GetAllProvidersRequest + GetLatestProvidersRequest + GetDefaultProviderRequest +*/ +package api + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type HealthCheckResponse_ServingStatus int32 + +const ( + HealthCheckResponse_UNKNOWN HealthCheckResponse_ServingStatus = 0 + HealthCheckResponse_SERVING HealthCheckResponse_ServingStatus = 1 + HealthCheckResponse_NOT_SERVING HealthCheckResponse_ServingStatus = 2 +) + +var HealthCheckResponse_ServingStatus_name = map[int32]string{ + 0: "UNKNOWN", + 1: "SERVING", + 2: "NOT_SERVING", +} +var HealthCheckResponse_ServingStatus_value = map[string]int32{ + "UNKNOWN": 0, + "SERVING": 1, + "NOT_SERVING": 2, +} + +func (x HealthCheckResponse_ServingStatus) String() string { + return proto.EnumName(HealthCheckResponse_ServingStatus_name, int32(x)) +} +func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{1, 0} +} + +type HealthCheckRequest struct { + Service string `protobuf:"bytes,1,opt,name=service" json:"service,omitempty"` +} + +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 { + return m.Service + } + return "" +} + +type HealthCheckResponse struct { + Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,enum=api.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 fileDescriptor0, []int{1} } + +func (m *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus { + if m != nil { + return m.Status + } + return HealthCheckResponse_UNKNOWN +} + +func init() { + proto.RegisterType((*HealthCheckRequest)(nil), "api.HealthCheckRequest") + proto.RegisterType((*HealthCheckResponse)(nil), "api.HealthCheckResponse") + proto.RegisterEnum("api.HealthCheckResponse_ServingStatus", HealthCheckResponse_ServingStatus_name, HealthCheckResponse_ServingStatus_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Health service + +type HealthClient interface { + Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) +} + +type healthClient struct { + cc *grpc.ClientConn +} + +func NewHealthClient(cc *grpc.ClientConn) HealthClient { + return &healthClient{cc} +} + +func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) { + out := new(HealthCheckResponse) + err := grpc.Invoke(ctx, "/api.Health/Check", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Health service + +type HealthServer interface { + Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) +} + +func RegisterHealthServer(s *grpc.Server, srv HealthServer) { + s.RegisterService(&_Health_serviceDesc, srv) +} + +func _Health_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HealthCheckRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HealthServer).Check(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/api.Health/Check", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HealthServer).Check(ctx, req.(*HealthCheckRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Health_serviceDesc = grpc.ServiceDesc{ + ServiceName: "api.Health", + HandlerType: (*HealthServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Check", + Handler: _Health_Check_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "health.proto", +} + +func init() { proto.RegisterFile("health.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 199 bytes of a gzipped FileDescriptorProto + 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, 0x62, 0x4e, 0x2c, 0xc8, 0x54, 0xd2, 0xe3, + 0x12, 0xf2, 0x00, 0x0b, 0x3a, 0x67, 0xa4, 0x26, 0x67, 0x07, 0xa5, 0x16, 0x96, 0xa6, 0x16, 0x97, + 0x08, 0x49, 0x70, 0xb1, 0x17, 0xa7, 0x16, 0x95, 0x65, 0x26, 0xa7, 0x4a, 0x30, 0x2a, 0x30, 0x6a, + 0x70, 0x06, 0xc1, 0xb8, 0x4a, 0x13, 0x19, 0xb9, 0x84, 0x51, 0x34, 0x14, 0x17, 0xe4, 0xe7, 0x15, + 0xa7, 0x0a, 0xd9, 0x71, 0xb1, 0x15, 0x97, 0x24, 0x96, 0x94, 0x16, 0x83, 0x35, 0xf0, 0x19, 0xa9, + 0xe9, 0x25, 0x16, 0x64, 0xea, 0x61, 0x51, 0xa9, 0x17, 0x0c, 0x32, 0x29, 0x2f, 0x3d, 0x18, 0xac, + 0x3a, 0x08, 0xaa, 0x4b, 0xc9, 0x8a, 0x8b, 0x17, 0x45, 0x42, 0x88, 0x9b, 0x8b, 0x3d, 0xd4, 0xcf, + 0xdb, 0xcf, 0x3f, 0xdc, 0x4f, 0x80, 0x01, 0xc4, 0x09, 0x76, 0x0d, 0x0a, 0xf3, 0xf4, 0x73, 0x17, + 0x60, 0x14, 0xe2, 0xe7, 0xe2, 0xf6, 0xf3, 0x0f, 0x89, 0x87, 0x09, 0x30, 0x19, 0xb9, 0x70, 0xb1, + 0x41, 0x2c, 0x12, 0xb2, 0xe2, 0x62, 0x05, 0x5b, 0x26, 0x24, 0x8e, 0x69, 0x3d, 0xd8, 0x67, 0x52, + 0x12, 0xb8, 0xdc, 0x95, 0xc4, 0x06, 0x0e, 0x15, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc4, + 0x95, 0x3c, 0xa0, 0x25, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/api/health.proto b/vendor/github.com/operator-framework/operator-registry/pkg/api/health.proto new file mode 100644 index 00000000000..c2a15757009 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/api/health.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +package api; + +message HealthCheckRequest { + string service = 1; +} + +message HealthCheckResponse { + enum ServingStatus { + UNKNOWN = 0; + SERVING = 1; + NOT_SERVING = 2; + } + ServingStatus status = 1; +} + +service Health { + rpc Check(HealthCheckRequest) returns (HealthCheckResponse); +} 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 new file mode 100644 index 00000000000..a49343a110a --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/api/registry.pb.go @@ -0,0 +1,859 @@ +// Code generated by protoc-gen-go. +// source: registry.proto +// DO NOT EDIT! + +package api + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +type Channel struct { + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + CsvName string `protobuf:"bytes,2,opt,name=csvName" json:"csvName,omitempty"` +} + +func (m *Channel) Reset() { *m = Channel{} } +func (m *Channel) String() string { return proto.CompactTextString(m) } +func (*Channel) ProtoMessage() {} +func (*Channel) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } + +func (m *Channel) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Channel) GetCsvName() string { + if m != nil { + return m.CsvName + } + return "" +} + +type PackageName struct { + 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 fileDescriptor1, []int{1} } + +func (m *PackageName) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type Package struct { + 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"` +} + +func (m *Package) Reset() { *m = Package{} } +func (m *Package) String() string { return proto.CompactTextString(m) } +func (*Package) ProtoMessage() {} +func (*Package) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} } + +func (m *Package) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Package) GetChannels() []*Channel { + if m != nil { + return m.Channels + } + return nil +} + +func (m *Package) GetDefaultChannelName() string { + if m != nil { + return m.DefaultChannelName + } + return "" +} + +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"` +} + +func (m *Bundle) Reset() { *m = Bundle{} } +func (m *Bundle) String() string { return proto.CompactTextString(m) } +func (*Bundle) ProtoMessage() {} +func (*Bundle) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} } + +func (m *Bundle) GetCsvName() string { + if m != nil { + return m.CsvName + } + return "" +} + +func (m *Bundle) GetPackageName() string { + if m != nil { + return m.PackageName + } + return "" +} + +func (m *Bundle) GetChannelName() string { + if m != nil { + return m.ChannelName + } + return "" +} + +func (m *Bundle) GetCsvJson() string { + if m != nil { + return m.CsvJson + } + return "" +} + +func (m *Bundle) GetObject() []string { + if m != nil { + return m.Object + } + return nil +} + +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"` +} + +func (m *ChannelEntry) Reset() { *m = ChannelEntry{} } +func (m *ChannelEntry) String() string { return proto.CompactTextString(m) } +func (*ChannelEntry) ProtoMessage() {} +func (*ChannelEntry) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} } + +func (m *ChannelEntry) GetPackageName() string { + if m != nil { + return m.PackageName + } + return "" +} + +func (m *ChannelEntry) GetChannelName() string { + if m != nil { + return m.ChannelName + } + return "" +} + +func (m *ChannelEntry) GetBundleName() string { + if m != nil { + return m.BundleName + } + return "" +} + +func (m *ChannelEntry) GetReplaces() string { + if m != nil { + return m.Replaces + } + return "" +} + +type ListPackageRequest struct { +} + +func (m *ListPackageRequest) Reset() { *m = ListPackageRequest{} } +func (m *ListPackageRequest) String() string { return proto.CompactTextString(m) } +func (*ListPackageRequest) ProtoMessage() {} +func (*ListPackageRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{5} } + +type GetPackageRequest struct { + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` +} + +func (m *GetPackageRequest) Reset() { *m = GetPackageRequest{} } +func (m *GetPackageRequest) String() string { return proto.CompactTextString(m) } +func (*GetPackageRequest) ProtoMessage() {} +func (*GetPackageRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{6} } + +func (m *GetPackageRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type GetBundleRequest struct { + CsvName string `protobuf:"bytes,1,opt,name=csvName" json:"csvName,omitempty"` +} + +func (m *GetBundleRequest) Reset() { *m = GetBundleRequest{} } +func (m *GetBundleRequest) String() string { return proto.CompactTextString(m) } +func (*GetBundleRequest) ProtoMessage() {} +func (*GetBundleRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{7} } + +func (m *GetBundleRequest) GetCsvName() string { + if m != nil { + return m.CsvName + } + return "" +} + +type GetBundleInChannelRequest struct { + PkgName string `protobuf:"bytes,1,opt,name=pkgName" json:"pkgName,omitempty"` + ChannelName string `protobuf:"bytes,2,opt,name=channelName" json:"channelName,omitempty"` +} + +func (m *GetBundleInChannelRequest) Reset() { *m = GetBundleInChannelRequest{} } +func (m *GetBundleInChannelRequest) String() string { return proto.CompactTextString(m) } +func (*GetBundleInChannelRequest) ProtoMessage() {} +func (*GetBundleInChannelRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} } + +func (m *GetBundleInChannelRequest) GetPkgName() string { + if m != nil { + return m.PkgName + } + return "" +} + +func (m *GetBundleInChannelRequest) GetChannelName() string { + if m != nil { + return m.ChannelName + } + return "" +} + +type GetAllReplacementsRequest struct { + 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 fileDescriptor1, []int{9} } + +func (m *GetAllReplacementsRequest) GetCsvName() string { + if m != nil { + return m.CsvName + } + return "" +} + +type GetReplacementRequest struct { + 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"` +} + +func (m *GetReplacementRequest) Reset() { *m = GetReplacementRequest{} } +func (m *GetReplacementRequest) String() string { return proto.CompactTextString(m) } +func (*GetReplacementRequest) ProtoMessage() {} +func (*GetReplacementRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{10} } + +func (m *GetReplacementRequest) GetCsvName() string { + if m != nil { + return m.CsvName + } + return "" +} + +func (m *GetReplacementRequest) GetPkgName() string { + if m != nil { + return m.PkgName + } + return "" +} + +func (m *GetReplacementRequest) GetChannelName() string { + if m != nil { + return m.ChannelName + } + return "" +} + +type GetAllProvidersRequest struct { + GroupOrName string `protobuf:"bytes,1,opt,name=groupOrName" json:"groupOrName,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"` + Kind string `protobuf:"bytes,3,opt,name=kind" json:"kind,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 fileDescriptor1, []int{11} } + +func (m *GetAllProvidersRequest) GetGroupOrName() string { + if m != nil { + return m.GroupOrName + } + return "" +} + +func (m *GetAllProvidersRequest) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *GetAllProvidersRequest) GetKind() string { + if m != nil { + return m.Kind + } + return "" +} + +type GetLatestProvidersRequest struct { + GroupOrName string `protobuf:"bytes,1,opt,name=groupOrName" json:"groupOrName,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"` + Kind string `protobuf:"bytes,3,opt,name=kind" json:"kind,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 fileDescriptor1, []int{12} } + +func (m *GetLatestProvidersRequest) GetGroupOrName() string { + if m != nil { + return m.GroupOrName + } + return "" +} + +func (m *GetLatestProvidersRequest) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *GetLatestProvidersRequest) GetKind() string { + if m != nil { + return m.Kind + } + return "" +} + +type GetDefaultProviderRequest struct { + GroupOrName string `protobuf:"bytes,1,opt,name=groupOrName" json:"groupOrName,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"` + Kind string `protobuf:"bytes,3,opt,name=kind" json:"kind,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 fileDescriptor1, []int{13} } + +func (m *GetDefaultProviderRequest) GetGroupOrName() string { + if m != nil { + return m.GroupOrName + } + return "" +} + +func (m *GetDefaultProviderRequest) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *GetDefaultProviderRequest) GetKind() string { + if m != nil { + return m.Kind + } + return "" +} + +func init() { + proto.RegisterType((*Channel)(nil), "api.Channel") + proto.RegisterType((*PackageName)(nil), "api.PackageName") + proto.RegisterType((*Package)(nil), "api.Package") + proto.RegisterType((*Bundle)(nil), "api.Bundle") + proto.RegisterType((*ChannelEntry)(nil), "api.ChannelEntry") + proto.RegisterType((*ListPackageRequest)(nil), "api.ListPackageRequest") + proto.RegisterType((*GetPackageRequest)(nil), "api.GetPackageRequest") + proto.RegisterType((*GetBundleRequest)(nil), "api.GetBundleRequest") + proto.RegisterType((*GetBundleInChannelRequest)(nil), "api.GetBundleInChannelRequest") + proto.RegisterType((*GetAllReplacementsRequest)(nil), "api.GetAllReplacementsRequest") + proto.RegisterType((*GetReplacementRequest)(nil), "api.GetReplacementRequest") + proto.RegisterType((*GetAllProvidersRequest)(nil), "api.GetAllProvidersRequest") + proto.RegisterType((*GetLatestProvidersRequest)(nil), "api.GetLatestProvidersRequest") + proto.RegisterType((*GetDefaultProviderRequest)(nil), "api.GetDefaultProviderRequest") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// 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) + GetBundleForChannel(ctx context.Context, in *GetBundleInChannelRequest, opts ...grpc.CallOption) (*Bundle, error) + GetChannelEntriesThatReplace(ctx context.Context, in *GetAllReplacementsRequest, opts ...grpc.CallOption) (Registry_GetChannelEntriesThatReplaceClient, error) + GetBundleThatReplaces(ctx context.Context, in *GetReplacementRequest, opts ...grpc.CallOption) (*Bundle, error) + GetChannelEntriesThatProvide(ctx context.Context, in *GetAllProvidersRequest, opts ...grpc.CallOption) (Registry_GetChannelEntriesThatProvideClient, error) + GetLatestChannelEntriesThatProvide(ctx context.Context, in *GetLatestProvidersRequest, opts ...grpc.CallOption) (Registry_GetLatestChannelEntriesThatProvideClient, error) + GetDefaultBundleThatProvides(ctx context.Context, in *GetDefaultProviderRequest, opts ...grpc.CallOption) (*Bundle, error) +} + +type registryClient struct { + cc *grpc.ClientConn +} + +func NewRegistryClient(cc *grpc.ClientConn) RegistryClient { + return ®istryClient{cc} +} + +func (c *registryClient) ListPackages(ctx context.Context, in *ListPackageRequest, opts ...grpc.CallOption) (Registry_ListPackagesClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Registry_serviceDesc.Streams[0], c.cc, "/api.Registry/ListPackages", opts...) + if err != nil { + return nil, err + } + x := ®istryListPackagesClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Registry_ListPackagesClient interface { + Recv() (*PackageName, error) + grpc.ClientStream +} + +type registryListPackagesClient struct { + grpc.ClientStream +} + +func (x *registryListPackagesClient) Recv() (*PackageName, error) { + m := new(PackageName) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *registryClient) GetPackage(ctx context.Context, in *GetPackageRequest, opts ...grpc.CallOption) (*Package, error) { + out := new(Package) + err := grpc.Invoke(ctx, "/api.Registry/GetPackage", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *registryClient) GetBundleForChannel(ctx context.Context, in *GetBundleInChannelRequest, opts ...grpc.CallOption) (*Bundle, error) { + out := new(Bundle) + err := grpc.Invoke(ctx, "/api.Registry/GetBundleForChannel", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *registryClient) GetChannelEntriesThatReplace(ctx context.Context, in *GetAllReplacementsRequest, opts ...grpc.CallOption) (Registry_GetChannelEntriesThatReplaceClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Registry_serviceDesc.Streams[1], c.cc, "/api.Registry/GetChannelEntriesThatReplace", opts...) + if err != nil { + return nil, err + } + x := ®istryGetChannelEntriesThatReplaceClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Registry_GetChannelEntriesThatReplaceClient interface { + Recv() (*ChannelEntry, error) + grpc.ClientStream +} + +type registryGetChannelEntriesThatReplaceClient struct { + grpc.ClientStream +} + +func (x *registryGetChannelEntriesThatReplaceClient) Recv() (*ChannelEntry, error) { + m := new(ChannelEntry) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *registryClient) GetBundleThatReplaces(ctx context.Context, in *GetReplacementRequest, opts ...grpc.CallOption) (*Bundle, error) { + out := new(Bundle) + err := grpc.Invoke(ctx, "/api.Registry/GetBundleThatReplaces", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *registryClient) GetChannelEntriesThatProvide(ctx context.Context, in *GetAllProvidersRequest, opts ...grpc.CallOption) (Registry_GetChannelEntriesThatProvideClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Registry_serviceDesc.Streams[2], c.cc, "/api.Registry/GetChannelEntriesThatProvide", opts...) + if err != nil { + return nil, err + } + x := ®istryGetChannelEntriesThatProvideClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Registry_GetChannelEntriesThatProvideClient interface { + Recv() (*ChannelEntry, error) + grpc.ClientStream +} + +type registryGetChannelEntriesThatProvideClient struct { + grpc.ClientStream +} + +func (x *registryGetChannelEntriesThatProvideClient) Recv() (*ChannelEntry, error) { + m := new(ChannelEntry) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *registryClient) GetLatestChannelEntriesThatProvide(ctx context.Context, in *GetLatestProvidersRequest, opts ...grpc.CallOption) (Registry_GetLatestChannelEntriesThatProvideClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Registry_serviceDesc.Streams[3], c.cc, "/api.Registry/GetLatestChannelEntriesThatProvide", opts...) + if err != nil { + return nil, err + } + x := ®istryGetLatestChannelEntriesThatProvideClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Registry_GetLatestChannelEntriesThatProvideClient interface { + Recv() (*ChannelEntry, error) + grpc.ClientStream +} + +type registryGetLatestChannelEntriesThatProvideClient struct { + grpc.ClientStream +} + +func (x *registryGetLatestChannelEntriesThatProvideClient) Recv() (*ChannelEntry, error) { + m := new(ChannelEntry) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *registryClient) GetDefaultBundleThatProvides(ctx context.Context, in *GetDefaultProviderRequest, opts ...grpc.CallOption) (*Bundle, error) { + out := new(Bundle) + err := grpc.Invoke(ctx, "/api.Registry/GetDefaultBundleThatProvides", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Registry service + +type RegistryServer interface { + ListPackages(*ListPackageRequest, Registry_ListPackagesServer) error + GetPackage(context.Context, *GetPackageRequest) (*Package, error) + GetBundleForChannel(context.Context, *GetBundleInChannelRequest) (*Bundle, error) + GetChannelEntriesThatReplace(*GetAllReplacementsRequest, Registry_GetChannelEntriesThatReplaceServer) error + GetBundleThatReplaces(context.Context, *GetReplacementRequest) (*Bundle, error) + GetChannelEntriesThatProvide(*GetAllProvidersRequest, Registry_GetChannelEntriesThatProvideServer) error + GetLatestChannelEntriesThatProvide(*GetLatestProvidersRequest, Registry_GetLatestChannelEntriesThatProvideServer) error + GetDefaultBundleThatProvides(context.Context, *GetDefaultProviderRequest) (*Bundle, error) +} + +func RegisterRegistryServer(s *grpc.Server, srv RegistryServer) { + s.RegisterService(&_Registry_serviceDesc, srv) +} + +func _Registry_ListPackages_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListPackageRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(RegistryServer).ListPackages(m, ®istryListPackagesServer{stream}) +} + +type Registry_ListPackagesServer interface { + Send(*PackageName) error + grpc.ServerStream +} + +type registryListPackagesServer struct { + grpc.ServerStream +} + +func (x *registryListPackagesServer) Send(m *PackageName) error { + return x.ServerStream.SendMsg(m) +} + +func _Registry_GetPackage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPackageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RegistryServer).GetPackage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/api.Registry/GetPackage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RegistryServer).GetPackage(ctx, req.(*GetPackageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Registry_GetBundleForChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBundleInChannelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RegistryServer).GetBundleForChannel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/api.Registry/GetBundleForChannel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RegistryServer).GetBundleForChannel(ctx, req.(*GetBundleInChannelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Registry_GetChannelEntriesThatReplace_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetAllReplacementsRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(RegistryServer).GetChannelEntriesThatReplace(m, ®istryGetChannelEntriesThatReplaceServer{stream}) +} + +type Registry_GetChannelEntriesThatReplaceServer interface { + Send(*ChannelEntry) error + grpc.ServerStream +} + +type registryGetChannelEntriesThatReplaceServer struct { + grpc.ServerStream +} + +func (x *registryGetChannelEntriesThatReplaceServer) Send(m *ChannelEntry) error { + return x.ServerStream.SendMsg(m) +} + +func _Registry_GetBundleThatReplaces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetReplacementRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RegistryServer).GetBundleThatReplaces(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/api.Registry/GetBundleThatReplaces", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RegistryServer).GetBundleThatReplaces(ctx, req.(*GetReplacementRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Registry_GetChannelEntriesThatProvide_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetAllProvidersRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(RegistryServer).GetChannelEntriesThatProvide(m, ®istryGetChannelEntriesThatProvideServer{stream}) +} + +type Registry_GetChannelEntriesThatProvideServer interface { + Send(*ChannelEntry) error + grpc.ServerStream +} + +type registryGetChannelEntriesThatProvideServer struct { + grpc.ServerStream +} + +func (x *registryGetChannelEntriesThatProvideServer) Send(m *ChannelEntry) error { + return x.ServerStream.SendMsg(m) +} + +func _Registry_GetLatestChannelEntriesThatProvide_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetLatestProvidersRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(RegistryServer).GetLatestChannelEntriesThatProvide(m, ®istryGetLatestChannelEntriesThatProvideServer{stream}) +} + +type Registry_GetLatestChannelEntriesThatProvideServer interface { + Send(*ChannelEntry) error + grpc.ServerStream +} + +type registryGetLatestChannelEntriesThatProvideServer struct { + grpc.ServerStream +} + +func (x *registryGetLatestChannelEntriesThatProvideServer) Send(m *ChannelEntry) error { + return x.ServerStream.SendMsg(m) +} + +func _Registry_GetDefaultBundleThatProvides_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetDefaultProviderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RegistryServer).GetDefaultBundleThatProvides(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/api.Registry/GetDefaultBundleThatProvides", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RegistryServer).GetDefaultBundleThatProvides(ctx, req.(*GetDefaultProviderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Registry_serviceDesc = grpc.ServiceDesc{ + ServiceName: "api.Registry", + HandlerType: (*RegistryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetPackage", + Handler: _Registry_GetPackage_Handler, + }, + { + MethodName: "GetBundleForChannel", + Handler: _Registry_GetBundleForChannel_Handler, + }, + { + MethodName: "GetBundleThatReplaces", + Handler: _Registry_GetBundleThatReplaces_Handler, + }, + { + MethodName: "GetDefaultBundleThatProvides", + Handler: _Registry_GetDefaultBundleThatProvides_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ListPackages", + Handler: _Registry_ListPackages_Handler, + ServerStreams: true, + }, + { + StreamName: "GetChannelEntriesThatReplace", + Handler: _Registry_GetChannelEntriesThatReplace_Handler, + ServerStreams: true, + }, + { + StreamName: "GetChannelEntriesThatProvide", + Handler: _Registry_GetChannelEntriesThatProvide_Handler, + ServerStreams: true, + }, + { + StreamName: "GetLatestChannelEntriesThatProvide", + Handler: _Registry_GetLatestChannelEntriesThatProvide_Handler, + ServerStreams: true, + }, + }, + Metadata: "registry.proto", +} + +func init() { proto.RegisterFile("registry.proto", fileDescriptor1) } + +var fileDescriptor1 = []byte{ + // 584 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x55, 0x4d, 0x8f, 0xd3, 0x30, + 0x10, 0x6d, 0xda, 0xd2, 0x76, 0xa7, 0x15, 0xda, 0x35, 0x50, 0x42, 0x40, 0xab, 0xe0, 0x0b, 0x3d, + 0xa0, 0x0a, 0x2d, 0x20, 0x4e, 0x1c, 0x58, 0x16, 0x2a, 0xd0, 0x02, 0xab, 0x08, 0xc4, 0x81, 0x93, + 0x9b, 0x9a, 0x36, 0x34, 0x75, 0x82, 0xed, 0x16, 0xed, 0x9f, 0xe0, 0xcc, 0xcf, 0xe3, 0xa7, 0xa0, + 0x38, 0x4e, 0xe2, 0xcd, 0x07, 0x3d, 0xc1, 0x2d, 0x33, 0xe3, 0x79, 0xf3, 0x9e, 0xfd, 0x3a, 0x85, + 0xeb, 0x9c, 0x2e, 0x03, 0x21, 0xf9, 0xe5, 0x34, 0xe6, 0x91, 0x8c, 0x50, 0x87, 0xc4, 0x01, 0x7e, + 0x06, 0xfd, 0x97, 0x2b, 0xc2, 0x18, 0x0d, 0x11, 0x82, 0x2e, 0x23, 0x1b, 0x6a, 0x5b, 0xae, 0x35, + 0x39, 0xf0, 0xd4, 0x37, 0xb2, 0xa1, 0xef, 0x8b, 0xdd, 0xfb, 0x24, 0xdd, 0x56, 0xe9, 0x2c, 0xc4, + 0xf7, 0x61, 0x78, 0x41, 0xfc, 0x35, 0x59, 0xd2, 0x24, 0xac, 0x6b, 0xc6, 0x3f, 0xa0, 0xaf, 0x8f, + 0xd4, 0x62, 0x4f, 0x60, 0xe0, 0xa7, 0xa3, 0x85, 0xdd, 0x76, 0x3b, 0x93, 0xe1, 0xc9, 0x68, 0x4a, + 0xe2, 0x60, 0xaa, 0xf9, 0x78, 0x79, 0x15, 0x4d, 0x01, 0x2d, 0xe8, 0x57, 0xb2, 0x0d, 0xa5, 0xae, + 0x29, 0x42, 0x1d, 0x85, 0x55, 0x53, 0xc1, 0xbf, 0x2c, 0xe8, 0x9d, 0x6e, 0xd9, 0x22, 0xbc, 0x22, + 0xc0, 0xba, 0x22, 0x00, 0xb9, 0x30, 0x8c, 0x0b, 0x01, 0x5a, 0x9e, 0x99, 0x4a, 0x4e, 0xf8, 0x95, + 0x79, 0x66, 0x4a, 0xa3, 0xbf, 0x15, 0x11, 0xb3, 0xbb, 0x39, 0x7a, 0x12, 0xa2, 0x31, 0xf4, 0xa2, + 0xf9, 0x37, 0xea, 0x4b, 0xfb, 0x9a, 0xdb, 0x99, 0x1c, 0x78, 0x3a, 0xc2, 0x3f, 0x2d, 0x18, 0x69, + 0xaa, 0xaf, 0x98, 0xe4, 0x97, 0x65, 0x1a, 0xd6, 0x5e, 0x1a, 0xed, 0x2a, 0x8d, 0x63, 0x80, 0xb9, + 0x92, 0x6b, 0xf0, 0x34, 0x32, 0xc8, 0x81, 0x01, 0xa7, 0x71, 0x48, 0x7c, 0x2a, 0x34, 0xcf, 0x3c, + 0xc6, 0x37, 0x01, 0x9d, 0x07, 0x42, 0xea, 0x87, 0xf2, 0xe8, 0xf7, 0x2d, 0x15, 0x12, 0x3f, 0x80, + 0xa3, 0x19, 0x2d, 0x25, 0x6b, 0xdf, 0xf8, 0x21, 0x1c, 0xce, 0xa8, 0x4c, 0x2f, 0x3b, 0x3b, 0xd7, + 0x78, 0xe7, 0xf8, 0x33, 0xdc, 0xc9, 0x4f, 0xbf, 0x61, 0xd9, 0x43, 0x17, 0x6d, 0xf1, 0x7a, 0x69, + 0xb6, 0xe9, 0x70, 0xff, 0x0d, 0xe0, 0xa7, 0x0a, 0xf8, 0x45, 0x18, 0x7a, 0xa9, 0xae, 0x0d, 0x65, + 0x52, 0xec, 0xe7, 0xb3, 0x81, 0x5b, 0x33, 0x2a, 0x8d, 0x9e, 0xbd, 0x2d, 0x26, 0xcb, 0xf6, 0x5f, + 0x59, 0x56, 0xed, 0x82, 0x57, 0x30, 0x4e, 0x59, 0x5e, 0xf0, 0x68, 0x17, 0x2c, 0x28, 0xcf, 0x29, + 0xba, 0x30, 0x5c, 0xf2, 0x68, 0x1b, 0x7f, 0xe0, 0xa6, 0x0b, 0x8c, 0x54, 0x32, 0x77, 0x47, 0xb9, + 0x08, 0x22, 0x96, 0xcd, 0xd5, 0x61, 0xf2, 0x2c, 0xeb, 0x80, 0x2d, 0xf4, 0x40, 0xf5, 0x8d, 0xd7, + 0xea, 0x3e, 0xce, 0x89, 0xa4, 0x42, 0xfe, 0xa7, 0x61, 0x67, 0xe9, 0xef, 0x30, 0x9b, 0xf6, 0x8f, + 0x86, 0x9d, 0xfc, 0xee, 0xc2, 0xc0, 0xd3, 0x8b, 0x0c, 0x3d, 0x87, 0x91, 0x61, 0x5e, 0x81, 0x6e, + 0xab, 0x05, 0x52, 0xf5, 0xb3, 0x73, 0xa8, 0x0a, 0xc6, 0xc2, 0xc2, 0xad, 0x47, 0x16, 0x7a, 0x02, + 0x50, 0xb8, 0x1c, 0x8d, 0xd5, 0x99, 0x8a, 0xed, 0x9d, 0x91, 0xd9, 0x8b, 0x5b, 0xe8, 0x0c, 0x6e, + 0xe4, 0x26, 0x7e, 0x1d, 0xf1, 0x6c, 0x7d, 0x1e, 0x67, 0xed, 0xf5, 0xf6, 0x76, 0x86, 0xaa, 0x9e, + 0x16, 0x71, 0x0b, 0x7d, 0x82, 0x7b, 0x33, 0x2a, 0x8d, 0x55, 0x10, 0x50, 0xf1, 0x71, 0x45, 0x32, + 0x33, 0x16, 0x70, 0xf5, 0xa6, 0x76, 0x8e, 0xcc, 0x5d, 0xa9, 0x56, 0x89, 0x92, 0x74, 0xaa, 0x1c, + 0x9d, 0x4e, 0x31, 0xe0, 0x04, 0x72, 0x32, 0xbc, 0xaa, 0xdb, 0xcb, 0xd4, 0xbc, 0x06, 0x6a, 0xfa, + 0x69, 0xd1, 0x5d, 0x83, 0x5a, 0xd9, 0x5c, 0x4d, 0xbc, 0xbe, 0x00, 0xce, 0x0d, 0xd9, 0x8c, 0x9c, + 0x8b, 0xae, 0x77, 0x6e, 0x13, 0xf8, 0x3b, 0x45, 0x58, 0x1b, 0xb0, 0xd0, 0xae, 0xdb, 0x45, 0x01, + 0x5b, 0xef, 0xd1, 0x92, 0xfe, 0x79, 0x4f, 0xfd, 0x3f, 0x3e, 0xfe, 0x13, 0x00, 0x00, 0xff, 0xff, + 0xb5, 0x02, 0x6d, 0x3c, 0x31, 0x07, 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 new file mode 100644 index 00000000000..d00edbf5207 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/api/registry.proto @@ -0,0 +1,89 @@ +syntax = "proto3"; + +package api; + +service Registry { + rpc ListPackages(ListPackageRequest) returns (stream PackageName) {} + rpc GetPackage(GetPackageRequest) returns (Package) {} + rpc GetBundleForChannel(GetBundleInChannelRequest) returns (Bundle) {} + rpc GetChannelEntriesThatReplace(GetAllReplacementsRequest) returns (stream ChannelEntry) {} + rpc GetBundleThatReplaces(GetReplacementRequest) returns (Bundle) {} + rpc GetChannelEntriesThatProvide(GetAllProvidersRequest) returns (stream ChannelEntry) {} + rpc GetLatestChannelEntriesThatProvide(GetLatestProvidersRequest) returns (stream ChannelEntry) {} + rpc GetDefaultBundleThatProvides(GetDefaultProviderRequest) returns (Bundle) {} +} + + +message Channel{ + string name = 1; + string csvName = 2; +} + +message PackageName{ + string name = 1; +} + +message Package{ + string name = 1; + repeated Channel channels = 2; + string defaultChannelName = 3; +} + +message Bundle{ + string csvName = 1; + string packageName = 2; + string channelName = 3; + string csvJson = 4; + repeated string object = 5; +} + +message ChannelEntry{ + string packageName = 1; + string channelName = 2; + string bundleName = 3; + string replaces = 4; +} + +message ListPackageRequest{} + +message GetPackageRequest{ + string name = 1; +} + +message GetBundleRequest{ + string csvName = 1; +} + +message GetBundleInChannelRequest{ + string pkgName = 1; + string channelName = 2; +} + +message GetAllReplacementsRequest{ + string csvName = 1; +} + +message GetReplacementRequest{ + string csvName = 1; + string pkgName = 2; + string channelName = 3; +} + +message GetAllProvidersRequest{ + string groupOrName = 1; + string version = 2; + string kind = 3; +} + +message GetLatestProvidersRequest{ + string groupOrName = 1; + string version = 2; + string kind = 3; +} + +message GetDefaultProviderRequest{ + string groupOrName = 1; + string version = 2; + string kind = 3; +} + 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 new file mode 100644 index 00000000000..5e27e9908aa --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/client/client.go @@ -0,0 +1,63 @@ +package client + +import ( + "context" + "github.com/operator-framework/operator-registry/pkg/api" + "github.com/operator-framework/operator-registry/pkg/registry" + "google.golang.org/grpc" +) + +type Interface interface { + 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, groupOrName, version, kind string) (*registry.Bundle, error) +} + +type Client struct { + client api.RegistryClient + health api.HealthClient + conn *grpc.ClientConn +} + +var _ Interface = &Client{} + +func (c *Client) GetBundleInPackageChannel(ctx context.Context, packageName, channelName string) (*registry.Bundle, error) { + bundle, err := c.client.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) GetReplacementBundleInPackageChannel(ctx context.Context, currentName, packageName, channelName string) (*registry.Bundle, error) { + bundle, err := c.client.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) GetBundleThatProvides(ctx context.Context, groupOrName, version, kind string) (*registry.Bundle, error) { + bundle, err := c.client.GetDefaultBundleThatProvides(ctx, &api.GetDefaultProviderRequest{GroupOrName:groupOrName, 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 NewClient(address string) (*Client, error) { + conn, err := grpc.Dial(address, grpc.WithInsecure()) + if err!=nil { + return nil, err + } + return &Client{ + client: api.NewRegistryClient(conn), + health: api.NewHealthClient(conn), + conn: conn, + }, nil +} + 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 new file mode 100644 index 00000000000..4fcfb268dd6 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/registry/bundle.go @@ -0,0 +1,217 @@ +package registry + +import ( + "fmt" + "k8s.io/apimachinery/pkg/util/yaml" + "strings" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + "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" + "k8s.io/apimachinery/pkg/runtime/serializer" +) + +// Scheme is the default instance of runtime.Scheme to which types in the Kubernetes API are already registered. +var Scheme = runtime.NewScheme() + +// Codecs provides access to encoding and decoding for the scheme +var Codecs = serializer.NewCodecFactory(Scheme) + +func DefaultYAMLDecoder() runtime.Decoder { + return Codecs.UniversalDeserializer() +} + +func init() { + if err := v1alpha1.AddToScheme(Scheme); err != nil { + panic(err) + } + + if err := v1beta1.AddToScheme(Scheme); err != nil { + panic(err) + } +} + +type Bundle struct { + Name string + Objects []*unstructured.Unstructured + Package string + Channel string + csv *v1alpha1.ClusterServiceVersion + crds []*apiextensions.CustomResourceDefinition + cacheStale bool +} + +func NewBundle(name, pkgName, channelName string, objs ...*unstructured.Unstructured) *Bundle { + bundle := &Bundle{Name: name, Package:pkgName, Channel:channelName, cacheStale: false} + for _, o := range objs { + bundle.Add(o) + } + return bundle +} + +func NewBundleFromStrings(name, pkgName, channelName string, objs []string) (*Bundle, error) { + unstObjs := []*unstructured.Unstructured{} + for _, o := range objs { + dec := yaml.NewYAMLOrJSONDecoder(strings.NewReader(o), 10) + unst := &unstructured.Unstructured{} + if err := dec.Decode(unst); err != nil { + return nil, err + } + unstObjs = append(unstObjs, unst) + } + return NewBundle(name, pkgName, channelName, unstObjs...), nil +} + +func (b *Bundle) Size() int { + return len(b.Objects) +} + +func (b *Bundle) Add(obj *unstructured.Unstructured) { + b.Objects = append(b.Objects, obj) + b.cacheStale = true +} + +func (b *Bundle) ClusterServiceVersion() (*v1alpha1.ClusterServiceVersion, error) { + if err := b.cache(); err != nil { + return nil, err + } + return b.csv, nil +} + +func (b *Bundle) CustomResourceDefinitions() ([]*apiextensions.CustomResourceDefinition, error) { + if err := b.cache(); err != nil { + return nil, err + } + return b.crds, nil +} + +func (b *Bundle) ProvidedAPIs() (map[APIKey]struct{}, error) { + provided := map[APIKey]struct{}{} + crds, err := b.CustomResourceDefinitions() + if err != nil { + return nil, err + } + for _, crd := range crds { + for _, v := range crd.Spec.Versions { + provided[APIKey{Group: crd.Spec.Group, Version: v.Name, Kind: crd.Spec.Names.Kind, Plural: crd.Spec.Names.Plural}] = struct{}{} + } + if crd.Spec.Version != "" { + provided[APIKey{Group: crd.Spec.Group, Version: crd.Spec.Version, Kind: crd.Spec.Names.Kind, Plural:crd.Spec.Names.Plural}] = struct{}{} + } + } + + csv, err := b.ClusterServiceVersion() + if err != nil { + return nil, err + } + + for _, api := range csv.Spec.APIServiceDefinitions.Owned { + provided[APIKey{Group: api.Group, Version: api.Version, Kind: api.Kind, Plural: api.Name}] = struct{}{} + } + return provided, nil +} + +func (b *Bundle) RequiredAPIs() (map[APIKey]struct{}, error) { + required := map[APIKey]struct{}{} + csv, err := b.ClusterServiceVersion() + if err != nil { + return nil, err + } + for _, api := range csv.Spec.CustomResourceDefinitions.Required { + parts := strings.SplitN(api.Name, ".", 2) + if len(parts) < 2 { + return nil, fmt.Errorf("couldn't parse plural.group from crd name: %s", api.Name) + } + required[APIKey{parts[1], api.Version, api.Kind, parts[0]}] = struct{}{} + + } + for _, api := range csv.Spec.APIServiceDefinitions.Required { + required[APIKey{Group: api.Group, Version: api.Version, Kind: api.Kind, Plural: api.Name}] = struct{}{} + } + return required, nil +} + +func (b *Bundle) AllProvidedAPIsInBundle() error { + csv, err := b.ClusterServiceVersion() + if err != nil { + return err + } + bundleAPIs, err := b.ProvidedAPIs() + if err != nil { + return err + } + shouldExist := make(map[APIKey]struct{}, len(csv.Spec.CustomResourceDefinitions.Owned)) + for _, crdDef := range csv.Spec.CustomResourceDefinitions.Owned { + parts := strings.SplitN(crdDef.Name, ".", 2) + if len(parts) < 2 { + return fmt.Errorf("couldn't parse plural.group from crd name: %s", crdDef.Name) + } + shouldExist[APIKey{parts[1], crdDef.Version, crdDef.Kind, parts[0]}] = struct{}{} + } + for key := range shouldExist { + if _, ok := bundleAPIs[key]; !ok { + return fmt.Errorf("couldn't find %v in bundle. found: %v", key, bundleAPIs) + } + } + // note: don't need to check bundle for extension apiserver types, which don't require extra bundle entries + return nil +} + +func (b *Bundle) Serialize() (csvName string, csvBytes []byte, bundleBytes []byte, err error) { + csvCount := 0 + for _, obj := range b.Objects { + objBytes, err := runtime.Encode(unstructured.UnstructuredJSONScheme, obj) + if err != nil { + return "", nil, nil, err + } + bundleBytes = append(bundleBytes, objBytes...) + + if obj.GetObjectKind().GroupVersionKind().Kind == "ClusterServiceVersion" { + csvName = obj.GetName() + csvBytes, err = runtime.Encode(unstructured.UnstructuredJSONScheme, obj) + if err != nil { + return "", nil, nil, err + } + csvCount += 1 + if csvCount > 1 { + return "", nil, nil, fmt.Errorf("two csvs found in one bundle") + } + } + } + + return csvName, csvBytes, bundleBytes, nil +} + +func (b *Bundle) cache() error { + if !b.cacheStale { + return nil + } + for _, o := range b.Objects { + if o.GetObjectKind().GroupVersionKind().Kind == "ClusterServiceVersion" { + csv := &v1alpha1.ClusterServiceVersion{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(o.UnstructuredContent(), csv); err != nil { + return err + } + b.csv = csv + break + } + } + + if b.crds == nil { + b.crds = []*apiextensions.CustomResourceDefinition{} + } + for _, o := range b.Objects { + if o.GetObjectKind().GroupVersionKind().Kind == "CustomResourceDefinition" { + crd := &apiextensions.CustomResourceDefinition{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(o.UnstructuredContent(), crd); err != nil { + return err + } + b.crds = append(b.crds, crd) + } + } + + b.cacheStale = false + return nil +} 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 new file mode 100644 index 00000000000..ffb15ace97f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/registry/interface.go @@ -0,0 +1,28 @@ +package registry + +import ( + "context" +) + +type Load interface { + AddOperatorBundle(bundle *Bundle) error + AddPackageChannels(manifest PackageManifest) error + AddProvidedApis() error +} + +type Query interface { + ListTables(ctx context.Context) ([]string, error) + ListPackages(ctx context.Context) ([]string, error) + GetPackage(ctx context.Context, name string) (*PackageManifest, error) + GetBundleForChannel(ctx context.Context, pkgName string, channelName string) (string, 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) + // Get all channel entries that provide an api + GetChannelEntriesThatProvide(ctx context.Context, groupOrName, version, kind string) (entries []*ChannelEntry, err error) + // Get latest channel entries that provide an api + GetLatestChannelEntriesThatProvide(ctx context.Context, groupOrName, version, kind string) (entries []*ChannelEntry, err error) + // Get the the latest bundle that provides the API in a default channel + GetBundleThatProvides(ctx context.Context, groupOrName, version, kind string) (string, *ChannelEntry, error) +} diff --git a/vendor/github.com/operator-framework/operator-registry/pkg/registry/types.go b/vendor/github.com/operator-framework/operator-registry/pkg/registry/types.go new file mode 100644 index 00000000000..300a36672cd --- /dev/null +++ b/vendor/github.com/operator-framework/operator-registry/pkg/registry/types.go @@ -0,0 +1,66 @@ +package registry + +import "fmt" + +// APIKey stores GroupVersionKind for use as map keys +type APIKey struct { + Group string + Version string + Kind string + Plural string +} + +func (k APIKey) String() string { + return fmt.Sprintf("%s/%s/%s (%s)", k.Group, k.Version, k.Kind, k.Plural) +} + +// PackageManifest holds information about a package, which is a reference to one (or more) +// channels under a single package. +type PackageManifest struct { + // PackageName is the name of the overall package, ala `etcd`. + PackageName string `json:"packageName"` + + // Channels are the declared channels for the package, ala `stable` or `alpha`. + Channels []PackageChannel `json:"channels"` + + // DefaultChannelName is, if specified, the name of the default channel for the package. The + // default channel will be installed if no other channel is explicitly given. If the package + // has a single channel, then that channel is implicitly the default. + DefaultChannelName string `json:"defaultChannel"` +} + +// GetDefaultChannel gets the default channel or returns the only one if there's only one. returns empty string if it +// can't determine the default +func (m PackageManifest) GetDefaultChannel() string { + if m.DefaultChannelName != "" { + return m.DefaultChannelName + } + if len(m.Channels) == 1 { + return m.Channels[0].Name + } + return "" +} + +// PackageChannel defines a single channel under a package, pointing to a version of that +// package. +type PackageChannel struct { + // Name is the name of the channel, e.g. `alpha` or `stable` + Name string `json:"name"` + + // CurrentCSVName defines a reference to the CSV holding the version of this package currently + // for the channel. + CurrentCSVName string `json:"currentCSV"` +} + +// IsDefaultChannel returns true if the PackageChennel is the default for the PackageManifest +func (pc PackageChannel) IsDefaultChannel(pm PackageManifest) bool { + return pc.Name == pm.DefaultChannelName || len(pm.Channels) == 1 +} + +// ChannelEntry is a denormalized node in a channel graph +type ChannelEntry struct { + PackageName string + ChannelName string + BundleName string + Replaces string +} diff --git a/vendor/modules.txt b/vendor/modules.txt index f3568884380..da0ff20dfcc 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -123,6 +123,10 @@ github.com/mitchellh/mapstructure github.com/modern-go/concurrent # github.com/modern-go/reflect2 v1.0.1 github.com/modern-go/reflect2 +# github.com/operator-framework/operator-registry v1.0.1 +github.com/operator-framework/operator-registry/pkg/client +github.com/operator-framework/operator-registry/pkg/api +github.com/operator-framework/operator-registry/pkg/registry # github.com/pborman/uuid v1.2.0 github.com/pborman/uuid # github.com/peterbourgon/diskv v2.0.1+incompatible @@ -202,31 +206,31 @@ google.golang.org/appengine/internal/remote_api google.golang.org/genproto/googleapis/rpc/status # google.golang.org/grpc v1.16.0 google.golang.org/grpc -google.golang.org/grpc/codes -google.golang.org/grpc/credentials -google.golang.org/grpc/grpclog -google.golang.org/grpc/health/grpc_health_v1 -google.golang.org/grpc/keepalive -google.golang.org/grpc/metadata -google.golang.org/grpc/status google.golang.org/grpc/balancer google.golang.org/grpc/balancer/roundrobin +google.golang.org/grpc/codes google.golang.org/grpc/connectivity +google.golang.org/grpc/credentials google.golang.org/grpc/encoding google.golang.org/grpc/encoding/proto +google.golang.org/grpc/grpclog google.golang.org/grpc/internal google.golang.org/grpc/internal/backoff google.golang.org/grpc/internal/channelz google.golang.org/grpc/internal/envconfig google.golang.org/grpc/internal/grpcrand google.golang.org/grpc/internal/transport +google.golang.org/grpc/keepalive +google.golang.org/grpc/metadata google.golang.org/grpc/naming google.golang.org/grpc/peer google.golang.org/grpc/resolver google.golang.org/grpc/resolver/dns google.golang.org/grpc/resolver/passthrough google.golang.org/grpc/stats +google.golang.org/grpc/status google.golang.org/grpc/tap +google.golang.org/grpc/health/grpc_health_v1 google.golang.org/grpc/balancer/base # gopkg.in/inf.v0 v0.9.1 gopkg.in/inf.v0 @@ -290,8 +294,8 @@ k8s.io/apimachinery/pkg/runtime/serializer k8s.io/apimachinery/pkg/watch k8s.io/apimachinery/pkg/labels k8s.io/apimachinery/pkg/api/errors -k8s.io/apimachinery/pkg/util/intstr k8s.io/apimachinery/pkg/util/runtime +k8s.io/apimachinery/pkg/util/intstr k8s.io/apimachinery/pkg/api/equality k8s.io/apimachinery/pkg/runtime/serializer/json k8s.io/apimachinery/pkg/api/meta @@ -432,8 +436,8 @@ k8s.io/client-go/discovery/fake k8s.io/client-go/testing k8s.io/client-go/tools/cache k8s.io/client-go/listers/rbac/v1 -k8s.io/client-go/util/workqueue k8s.io/client-go/informers +k8s.io/client-go/util/workqueue k8s.io/client-go/listers/core/v1 k8s.io/client-go/kubernetes/typed/core/v1 k8s.io/client-go/kubernetes