From cf4b582282bb374b11746752d2ac8fd0840863b8 Mon Sep 17 00:00:00 2001 From: Edward Mezarina Date: Fri, 25 Oct 2019 16:07:37 -0400 Subject: [PATCH] Report serverless operator status. --- Gopkg.lock | 29 +- config/samples/full.yaml | 2 +- .../crds/kabanero_v1alpha1_kabanero_crd.yaml | 17 +- pkg/apis/kabanero/v1alpha1/kabanero_types.go | 18 +- .../v1alpha1/zz_generated.deepcopy.go | 19 +- .../kabanero/v1alpha1/zz_generated.openapi.go | 8 +- pkg/assets/config/config_vfsdata.go | 66 +- .../kabaneroplatform_controller.go | 4 +- .../kabaneroplatform/knative_serving.go | 87 - pkg/controller/kabaneroplatform/serverless.go | 193 ++ ...operator.v0.3.0.clusterserviceversion.yaml | 7 +- .../0.3.0/kabanero_kabanero_crd.yaml | 17 +- vendor/github.com/coreos/go-semver/LICENSE | 202 ++ vendor/github.com/coreos/go-semver/example.go | 20 + .../coreos/go-semver/semver/semver.go | 268 +++ .../coreos/go-semver/semver/sort.go | 38 + .../jcrossley3/manifestival/manifestival.go | 176 -- .../jcrossley3/manifestival/transform.go | 105 - .../jcrossley3/manifestival/yaml.go | 136 -- .../operator-lifecycle-manager}/LICENSE | 0 .../cmd/catalog/main.go | 74 + .../cmd/olm/main.go | 115 + .../cmd/package-server/main.go | 61 + .../cmd/validator/main.go | 32 + .../pkg/api/apis/operators/doc.go | 5 + .../pkg/api/apis/operators/register.go | 3 + .../operators/v1alpha1/catalogsource_types.go | 54 + .../v1alpha1/clusterserviceversion.go | 57 + .../v1alpha1/clusterserviceversion_types.go | 284 +++ .../pkg/api/apis/operators/v1alpha1/doc.go | 3 + .../operators/v1alpha1/installplan_types.go | 285 +++ .../api/apis/operators/v1alpha1/register.go | 48 + .../operators/v1alpha1/subscription_types.go | 81 + .../v1alpha1/zz_generated.deepcopy.go | 893 ++++++++ .../pkg/api/client/client.go | 16 + .../client/clientset/versioned/clientset.go | 98 + .../pkg/api/client/clientset/versioned/doc.go | 20 + .../versioned/fake/clientset_generated.go | 82 + .../client/clientset/versioned/fake/doc.go | 20 + .../clientset/versioned/fake/register.go | 54 + .../client/clientset/versioned/scheme/doc.go | 20 + .../clientset/versioned/scheme/register.go | 54 + .../typed/operators/v1alpha1/catalogsource.go | 174 ++ .../v1alpha1/clusterserviceversion.go | 174 ++ .../versioned/typed/operators/v1alpha1/doc.go | 20 + .../typed/operators/v1alpha1/fake/doc.go | 20 + .../v1alpha1/fake/fake_catalogsource.go | 140 ++ .../fake/fake_clusterserviceversion.go | 140 ++ .../v1alpha1/fake/fake_installplan.go | 140 ++ .../v1alpha1/fake/fake_operators_client.go | 52 + .../v1alpha1/fake/fake_subscription.go | 140 ++ .../operators/v1alpha1/generated_expansion.go | 27 + .../typed/operators/v1alpha1/installplan.go | 174 ++ .../operators/v1alpha1/operators_client.go | 105 + .../typed/operators/v1alpha1/subscription.go | 174 ++ .../informers/externalversions/factory.go | 180 ++ .../informers/externalversions/generic.go | 68 + .../internalinterfaces/factory_interfaces.go | 38 + .../externalversions/operators/interface.go | 46 + .../operators/v1alpha1/catalogsource.go | 89 + .../v1alpha1/clusterserviceversion.go | 89 + .../operators/v1alpha1/installplan.go | 89 + .../operators/v1alpha1/interface.go | 66 + .../operators/v1alpha1/subscription.go | 89 + .../operators/v1alpha1/catalogsource.go | 94 + .../v1alpha1/clusterserviceversion.go | 94 + .../operators/v1alpha1/expansion_generated.go | 51 + .../listers/operators/v1alpha1/installplan.go | 94 + .../operators/v1alpha1/subscription.go | 94 + .../pkg/api/client/util.go | 36 + .../api/wrappers/deployment_install_client.go | 117 + ...e_install_strategy_deployment_interface.go | 571 +++++ .../pkg/controller/annotator/annotator.go | 162 ++ .../pkg/controller/errors/errors.go | 32 + .../pkg/controller/install/deployment.go | 232 ++ .../pkg/controller/install/errors.go | 49 + .../pkg/controller/install/resolver.go | 66 + .../pkg/controller/install/status_viewer.go | 47 + .../controller/operators/catalog/operator.go | 648 ++++++ .../operators/catalog/subscriptions.go | 153 ++ .../pkg/controller/operators/olm/operator.go | 484 ++++ .../controller/registry/configmap_loader.go | 123 + .../controller/registry/directory_loader.go | 120 + .../pkg/controller/registry/manifest.go | 68 + .../pkg/controller/registry/mem.go | 435 ++++ .../controller/registry/resolver/resolver.go | 247 ++ .../pkg/controller/registry/types.go | 122 + .../fakes/fake_deployment_install_client.go | 571 +++++ .../pkg/fakes/fake_registry_source.go | 548 +++++ .../pkg/fakes/fake_resources.go | 71 + .../pkg/fakes/fake_strategy.go | 88 + .../pkg/fakes/fake_strategy_installer.go | 164 ++ .../pkg/fakes/fake_strategy_resolver.go | 173 ++ .../pkg/lib/operatorclient/client.go | 104 + .../pkg/lib/operatorclient/customresources.go | 313 +++ .../pkg/lib/operatorclient/deployment.go | 203 ++ .../pkg/lib/operatorclient/mock_client.go | 805 +++++++ .../pkg/lib/operatorclient/patch.go | 367 +++ .../pkg/lib/operatorclient/serviceaccount.go | 39 + .../pkg/lib/ownerutil/util.go | 105 + .../pkg/lib/queueinformer/queueinformer.go | 112 + .../queueinformer/queueinformer_operator.go | 144 ++ .../pkg/lib/schema/schema.go | 319 +++ .../pkg/lib/schema/upgrade_path.go | 66 + .../pkg/lib/signals/signals.go | 29 + .../apis/packagemanifest/install/install.go | 11 + .../apis/packagemanifest/v1alpha1/doc.go | 3 + .../v1alpha1/packagemanifest.go | 29 + .../v1alpha1/packagemanifest_types.go | 112 + .../apis/packagemanifest/v1alpha1/register.go | 42 + .../v1alpha1/zz_generated.deepcopy.go | 198 ++ .../pkg/package-server/apiserver/config.go | 102 + .../apiserver/generic/storage.go | 66 + .../pkg/package-server/client/client.go | 16 + .../client/clientset/versioned/clientset.go | 98 + .../client/clientset/versioned/doc.go | 20 + .../versioned/fake/clientset_generated.go | 82 + .../client/clientset/versioned/fake/doc.go | 20 + .../clientset/versioned/fake/register.go | 54 + .../client/clientset/versioned/scheme/doc.go | 20 + .../clientset/versioned/scheme/register.go | 54 + .../typed/packagemanifest/v1alpha1/doc.go | 20 + .../packagemanifest/v1alpha1/fake/doc.go | 20 + .../v1alpha1/fake/fake_packagemanifest.go | 140 ++ .../fake/fake_packagemanifest_client.go | 40 + .../v1alpha1/generated_expansion.go | 21 + .../v1alpha1/packagemanifest.go | 174 ++ .../v1alpha1/packagemanifest_client.go | 90 + .../informers/externalversions/factory.go | 180 ++ .../informers/externalversions/generic.go | 62 + .../internalinterfaces/factory_interfaces.go | 38 + .../packagemanifest/interface.go | 46 + .../packagemanifest/v1alpha1/interface.go | 45 + .../v1alpha1/packagemanifest.go | 89 + .../v1alpha1/expansion_generated.go | 27 + .../v1alpha1/packagemanifest.go | 94 + .../pkg/package-server/client/util.go | 36 + .../generated/openapi/zz_generated.openapi.go | 1994 +++++++++++++++++ .../pkg/package-server/provider/inmem.go | 263 +++ .../pkg/package-server/provider/interfaces.go | 10 + .../pkg/package-server/server/server.go | 206 ++ .../storage/packagemanifest/reststorage.go | 102 + .../pkg/package-server/version/doc.go | 2 + .../pkg/package-server/version/version.go | 43 + .../pkg/version/version.go | 14 + 145 files changed, 18490 insertions(+), 558 deletions(-) delete mode 100644 pkg/controller/kabaneroplatform/knative_serving.go create mode 100644 pkg/controller/kabaneroplatform/serverless.go create mode 100644 vendor/github.com/coreos/go-semver/LICENSE create mode 100644 vendor/github.com/coreos/go-semver/example.go create mode 100644 vendor/github.com/coreos/go-semver/semver/semver.go create mode 100644 vendor/github.com/coreos/go-semver/semver/sort.go delete mode 100644 vendor/github.com/jcrossley3/manifestival/manifestival.go delete mode 100644 vendor/github.com/jcrossley3/manifestival/transform.go delete mode 100644 vendor/github.com/jcrossley3/manifestival/yaml.go rename vendor/github.com/{jcrossley3/manifestival => operator-framework/operator-lifecycle-manager}/LICENSE (100%) create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/catalog/main.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/olm/main.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/package-server/main.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/validator/main.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/register.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/catalogsource_types.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/installplan_types.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/register.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/subscription_types.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/zz_generated.deepcopy.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/client.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/clientset.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/fake/clientset_generated.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/fake/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/fake/register.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/scheme/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/scheme/register.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/catalogsource.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/clusterserviceversion.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_catalogsource.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_clusterserviceversion.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_installplan.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_operators_client.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_subscription.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/generated_expansion.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/installplan.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/operators_client.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/subscription.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/factory.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/generic.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/interface.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/catalogsource.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/clusterserviceversion.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/installplan.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/interface.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/subscription.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/catalogsource.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/clusterserviceversion.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/expansion_generated.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/installplan.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/subscription.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/util.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/wrappers/deployment_install_client.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/wrappers/wrappersfakes/fake_install_strategy_deployment_interface.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/annotator/annotator.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/errors/errors.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install/deployment.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install/errors.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install/resolver.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install/status_viewer.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/subscriptions.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/olm/operator.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/configmap_loader.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/directory_loader.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/manifest.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/mem.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver/resolver.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/types.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_deployment_install_client.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_registry_source.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_resources.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_strategy.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_strategy_installer.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_strategy_resolver.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/client.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/customresources.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/deployment.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/mock_client.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/patch.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/serviceaccount.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil/util.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer/queueinformer.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer/queueinformer_operator.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/schema/schema.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/schema/upgrade_path.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/signals/signals.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/install/install.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/packagemanifest.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/packagemanifest_types.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/register.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/zz_generated.deepcopy.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apiserver/config.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apiserver/generic/storage.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/client.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/clientset.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/fake/clientset_generated.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/fake/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/fake/register.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/scheme/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/scheme/register.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/fake/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/fake/fake_packagemanifest.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/fake/fake_packagemanifest_client.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/generated_expansion.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/packagemanifest.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/packagemanifest_client.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/factory.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/generic.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/packagemanifest/interface.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/packagemanifest/v1alpha1/interface.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/packagemanifest/v1alpha1/packagemanifest.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/listers/packagemanifest/v1alpha1/expansion_generated.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/listers/packagemanifest/v1alpha1/packagemanifest.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/util.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/generated/openapi/zz_generated.openapi.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/provider/inmem.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/provider/interfaces.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/server/server.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/storage/packagemanifest/reststorage.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/version/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/version/version.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/version/version.go diff --git a/Gopkg.lock b/Gopkg.lock index ba90a4c6..ab3afdd9 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -87,6 +87,14 @@ revision = "a105b96453fe85139acc07b68de48f2cbdd71249" version = "v0.2.0" +[[projects]] + digest = "1:ef796be125d656ea1556ea57c6b1911092c9c763085644ef9035c63ac3f2b573" + name = "github.com/coreos/go-semver" + packages = ["semver"] + pruneopts = "NT" + revision = "8ab6407b697782a06568d4b7f1db25550ec2e4c6" + version = "v0.2.0" + [[projects]] digest = "1:0c4193043b1a33c7f9ba4ea42b8af2c09bb3d51970212d42e4dac8aa217b4ca5" name = "github.com/coreos/prometheus-operator" @@ -354,14 +362,6 @@ revision = "7c29201646fa3de8506f701213473dd407f19646" version = "v0.3.7" -[[projects]] - branch = "master" - digest = "1:dae0138fbbe600485b882ba294d569d4b438f2ebfa9bd0c4572990d1fa3aa795" - name = "github.com/jcrossley3/manifestival" - packages = ["."] - pruneopts = "NT" - revision = "c8f99ce4c2a29e0531817d4954a950c1daa4a352" - [[projects]] digest = "1:f5b9328966ccea0970b1d15075698eff0ddb3e75889560aad2e9f76b289b536a" name = "github.com/joho/godotenv" @@ -482,6 +482,17 @@ pruneopts = "NT" revision = "fe9d3d9993d493cc8681085643e73b1b3f7c909b" +[[projects]] + digest = "1:5f7d166863096a9fb654cedff9e14ea2ec1fe48dc1dd69f7504ef3d87943dc3f" + name = "github.com/operator-framework/operator-lifecycle-manager" + packages = [ + "pkg/api/apis/operators", + "pkg/api/apis/operators/v1alpha1", + ] + pruneopts = "NT" + revision = "2abd0e2b4d93b4100220204d429d68a9990a160b" + version = "v3.11.0" + [[projects]] branch = "master" digest = "1:7d83b66e4edc43ff4a71b25ab55fe325a04a0e660cbe3e9fcc4beb425745af34" @@ -1329,7 +1340,6 @@ "github.com/blang/semver", "github.com/go-logr/logr", "github.com/go-openapi/spec", - "github.com/jcrossley3/manifestival", "github.com/kabanero-io/manifestival", "github.com/knative/serving-operator/pkg/apis", "github.com/knative/serving-operator/pkg/apis/serving/v1alpha1", @@ -1337,6 +1347,7 @@ "github.com/openshift-knative/knative-eventing-operator/pkg/apis/eventing/v1alpha1", "github.com/openshift/api/route/v1", "github.com/openshift/tektoncd-pipeline-operator/pkg/apis", + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1", "github.com/operator-framework/operator-sdk/pkg/k8sutil", "github.com/operator-framework/operator-sdk/pkg/leader", "github.com/operator-framework/operator-sdk/pkg/log/zap", diff --git a/config/samples/full.yaml b/config/samples/full.yaml index e35f5bed..65b527d4 100644 --- a/config/samples/full.yaml +++ b/config/samples/full.yaml @@ -75,7 +75,7 @@ spec: # Sets the collection resource's initial desiredState value to active or inactive when # the CR instance is initially deployed. Post CR instance deployment, updates to - # a collection's desired state can be done manually by editing each collection resource manually. + # a collection's desired state can be done by editing each collection resource manually. # A collection's desiredState value of active or inactive is what determines whether the # assets associated with a collection object are activated or deactived. # Setting activateDefaultCollections to true sets the collection's initial desiredState to "active". diff --git a/deploy/crds/kabanero_v1alpha1_kabanero_crd.yaml b/deploy/crds/kabanero_v1alpha1_kabanero_crd.yaml index 02d0a1d6..b8e25f71 100644 --- a/deploy/crds/kabanero_v1alpha1_kabanero_crd.yaml +++ b/deploy/crds/kabanero_v1alpha1_kabanero_crd.yaml @@ -209,8 +209,8 @@ spec: version: type: string type: object - knativeServing: - description: Knative serving instance readiness status. + landing: + description: Kabanero Landing page readiness status. properties: errorMessage: type: string @@ -219,11 +219,20 @@ spec: version: type: string type: object - landing: - description: Kabanero Landing page readiness status. + serverless: + description: OpenShift serverless operator status. properties: errorMessage: type: string + knativeServing: + properties: + errorMessage: + type: string + ready: + type: string + version: + type: string + type: object ready: type: string version: diff --git a/pkg/apis/kabanero/v1alpha1/kabanero_types.go b/pkg/apis/kabanero/v1alpha1/kabanero_types.go index 7a417e2d..80da09f3 100644 --- a/pkg/apis/kabanero/v1alpha1/kabanero_types.go +++ b/pkg/apis/kabanero/v1alpha1/kabanero_types.go @@ -33,6 +33,7 @@ type KabaneroSpec struct { Che CheCustomizationSpec `json:"che,omitempty"` } +// InstanceCollectionConfig defines the customization entries for a set of collections. type InstanceCollectionConfig struct { Repositories []RepositoryConfig `json:"repositories,omitempty"` } @@ -47,6 +48,7 @@ type GithubConfig struct { ApiUrl string `json:"apiUrl,omitempty"` } +// RepositoryConfig defines customization entries for a collection. type RepositoryConfig struct { Name string `json:"name,omitempty"` Url string `json:"url,omitempty"` @@ -60,6 +62,7 @@ type TektonCustomizationSpec struct { Version string `json:"version,omitempty"` } +// KabaneroCliServicesCustomizationSpec defines customization entries for the Kabanero CLI. type KabaneroCliServicesCustomizationSpec struct { //Future: Enable bool `json:"enable,omitempty"` Version string `json:"version,omitempty"` @@ -69,6 +72,7 @@ type KabaneroCliServicesCustomizationSpec struct { SessionExpirationSeconds string `json:"sessionExpirationSeconds,omitempty"` } +// KabaneroLandingCustomizationSpec defines customization entries for Kabanero landing page. type KabaneroLandingCustomizationSpec struct { Enable *bool `json:"enable,omitempty"` Version string `json:"version,omitempty"` @@ -82,7 +86,7 @@ type CheCustomizationSpec struct { KabaneroChe KabaneroCheSpec `json:"kabaneroChe,omitempty"` } -// CheOperatorSpec defines customization entries for the Che operator +// CheOperatorSpec defines customization entries for the Che operator. type CheOperatorSpec struct { Version string `json:"version,omitempty"` Image string `json:"image,omitempty"` @@ -112,8 +116,8 @@ type KabaneroStatus struct { // Knative eventing instance readiness status. KnativeEventing KnativeEventingStatus `json:"knativeEventing,omitempty"` - // Knative serving instance readiness status. - KnativeServing KnativeServingStatus `json:"knativeServing,omitempty"` + // OpenShift serverless operator status. + Serverless ServerlessStatus `json:"serverless,omitempty"` // Tekton instance readiness status. Tekton TektonStatus `json:"tekton,omitempty"` @@ -155,6 +159,14 @@ type KnativeEventingStatus struct { Version string `json:"version,omitempty"` } +// ServerlessStatus defines the observed status details of Open Shift serverless. +type ServerlessStatus struct { + Ready string `json:"ready,omitempty"` + ErrorMessage string `json:"errorMessage,omitempty"` + Version string `json:"version,omitempty"` + KnativeServing KnativeServingStatus `json:"knativeServing,omitempty"` +} + // KnativeServingStatus defines the observed status details of Knative Serving. type KnativeServingStatus struct { Ready string `json:"ready,omitempty"` diff --git a/pkg/apis/kabanero/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/kabanero/v1alpha1/zz_generated.deepcopy.go index 84476807..f7d72af5 100644 --- a/pkg/apis/kabanero/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/kabanero/v1alpha1/zz_generated.deepcopy.go @@ -507,7 +507,7 @@ func (in *KabaneroStatus) DeepCopyInto(out *KabaneroStatus) { *out = *in out.KabaneroInstance = in.KabaneroInstance out.KnativeEventing = in.KnativeEventing - out.KnativeServing = in.KnativeServing + out.Serverless = in.Serverless out.Tekton = in.Tekton in.Cli.DeepCopyInto(&out.Cli) if in.Landing != nil { @@ -629,6 +629,23 @@ func (in *RepositoryConfig) DeepCopy() *RepositoryConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServerlessStatus) DeepCopyInto(out *ServerlessStatus) { + *out = *in + out.KnativeServing = in.KnativeServing + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServerlessStatus. +func (in *ServerlessStatus) DeepCopy() *ServerlessStatus { + if in == nil { + return nil + } + out := new(ServerlessStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TektonCustomizationSpec) DeepCopyInto(out *TektonCustomizationSpec) { *out = *in diff --git a/pkg/apis/kabanero/v1alpha1/zz_generated.openapi.go b/pkg/apis/kabanero/v1alpha1/zz_generated.openapi.go index 564cfd25..dbbb122f 100644 --- a/pkg/apis/kabanero/v1alpha1/zz_generated.openapi.go +++ b/pkg/apis/kabanero/v1alpha1/zz_generated.openapi.go @@ -306,10 +306,10 @@ func schema_pkg_apis_kabanero_v1alpha1_KabaneroStatus(ref common.ReferenceCallba Ref: ref("github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.KnativeEventingStatus"), }, }, - "knativeServing": { + "serverless": { SchemaProps: spec.SchemaProps{ - Description: "Knative serving instance readiness status.", - Ref: ref("github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.KnativeServingStatus"), + Description: "OpenShift serverless operator status.", + Ref: ref("github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.ServerlessStatus"), }, }, "tekton": { @@ -352,6 +352,6 @@ func schema_pkg_apis_kabanero_v1alpha1_KabaneroStatus(ref common.ReferenceCallba }, }, Dependencies: []string{ - "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.AppsodyStatus", "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.CheStatus", "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.CliStatus", "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.KabaneroInstanceStatus", "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.KabaneroLandingPageStatus", "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.KappnavStatus", "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.KnativeEventingStatus", "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.KnativeServingStatus", "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.TektonStatus"}, + "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.AppsodyStatus", "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.CheStatus", "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.CliStatus", "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.KabaneroInstanceStatus", "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.KabaneroLandingPageStatus", "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.KappnavStatus", "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.KnativeEventingStatus", "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.ServerlessStatus", "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1.TektonStatus"}, } } diff --git a/pkg/assets/config/config_vfsdata.go b/pkg/assets/config/config_vfsdata.go index b3480a55..a34efe75 100644 --- a/pkg/assets/config/config_vfsdata.go +++ b/pkg/assets/config/config_vfsdata.go @@ -21,143 +21,159 @@ var assets = func() http.FileSystem { fs := vfsgen۰FS{ "/": &vfsgen۰DirInfo{ name: "/", - modTime: time.Date(2019, 10, 25, 15, 2, 27, 769200529, time.UTC), + modTime: time.Date(2019, 10, 25, 15, 17, 1, 340572037, time.UTC), + }, + "/.DS_Store": &vfsgen۰CompressedFileInfo{ + name: ".DS_Store", + modTime: time.Date(2019, 9, 23, 19, 36, 40, 710172366, time.UTC), + uncompressedSize: 6148, + + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x98\xc1\x4a\xc4\x30\x10\x86\xff\x89\x3d\x04\x04\xc9\xd1\x63\x5e\xc1\x37\x08\xcb\xfa\x04\xbe\x80\xda\x2a\x0a\x8b\x81\xcd\x7a\xef\xcd\xd7\x96\x35\xbf\x18\x69\x8b\x27\xb1\x2e\xff\x07\xe5\x3b\x74\x66\x5a\x7a\xc8\xcc\x14\x80\x6d\x5e\x87\x2b\x20\x00\xf0\xa8\xc6\x1b\x66\xf1\xbc\x26\xb8\xc6\xf6\x51\xe3\x01\x05\x07\xec\x71\x87\xc3\x7c\xad\xd9\x1a\x17\xc8\xd8\xa3\xc7\xd3\xb7\xfc\x67\x64\xbc\xa0\x0c\xa5\xdf\xdd\xe7\xbc\xb3\x9f\x02\x1f\x87\xd2\x7f\x06\x0a\x21\x84\x10\x62\x09\x76\x4a\x7f\xfe\xd7\x2f\x22\x84\x58\x1d\xc7\xf3\x21\xd2\x89\x1e\xab\x8d\xf7\x1d\xdd\x35\x39\x81\x8e\x74\xa2\xc7\x6a\x63\x9c\xa3\x3b\xda\xd3\x81\x8e\x74\xa2\xc7\x6a\x1e\x5a\xc6\xe5\xc3\xf8\x64\xe3\x86\x62\x81\x8e\x74\xfa\x9d\x6f\x23\xc4\x7f\xe7\xac\x2a\x1c\xfb\xff\xf5\xf2\xfe\x2f\x84\x38\x61\xac\xdb\xde\x6c\x37\x5f\x0b\xc1\x04\xc7\x41\xe0\xb6\x4d\x5a\x18\x02\x5c\xfd\x59\x78\xd9\xc4\x69\x10\x10\x62\x65\xbc\x07\x00\x00\xff\xff\xe4\xf4\xb1\x1e\x04\x18\x00\x00"), }, "/orchestrations": &vfsgen۰DirInfo{ name: "orchestrations", - modTime: time.Date(2019, 10, 25, 15, 2, 27, 791200425, time.UTC), + modTime: time.Date(2019, 10, 25, 15, 17, 1, 339221407, time.UTC), + }, + "/orchestrations/.DS_Store": &vfsgen۰CompressedFileInfo{ + name: ".DS_Store", + modTime: time.Date(2019, 9, 23, 19, 36, 40, 713145546, time.UTC), + uncompressedSize: 6148, + + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xd8\xbf\xaa\xc2\x30\x1c\xc5\xf1\xf3\x4b\x3b\x04\xee\x92\xf1\x8e\x59\xee\x03\xdc\x37\x08\xa5\x3e\x81\x2f\x20\xb6\x8a\x83\xd0\x41\xdc\xfb\xe8\x52\x72\xc4\x60\xd1\x4d\xac\x72\x3e\xcb\x57\x48\xaa\xe2\x90\x3f\x02\xb0\xe6\xdc\xff\x03\x01\x80\x47\x2e\xfe\x30\x67\x00\x2a\x74\x38\x60\xb7\xef\x4f\xdd\x76\x18\x8e\x76\x1d\x73\xc5\x1c\x9b\xde\xe3\x6e\x5c\x44\x44\x44\x96\x87\x1b\xb5\xff\x79\xf7\x17\x11\x91\xc5\x99\xd6\x87\xc8\x26\x76\xcc\x35\x8e\x3b\xb6\x2e\x9e\x09\x6c\x64\x13\x3b\xe6\x1a\xe7\x39\xb6\x66\x3d\x1b\xd8\xc8\x26\x76\xcc\xe5\xa2\x65\xbc\x7c\x18\x3f\xd9\x3c\x1b\xd8\xc8\xa6\xd7\xfc\x36\x22\x9f\xae\xca\x09\xd3\xfe\xbf\x7a\x70\xff\x17\x91\xef\x66\x75\xbb\x6e\x9b\xdb\x85\x60\x3e\x01\xc0\xa6\x78\xfd\xec\x10\xe0\xf2\x1f\x8a\xbf\xc5\xb3\x3a\x08\x88\x2c\xcc\x25\x00\x00\xff\xff\xc5\x4d\x91\xdd\x04\x18\x00\x00"), }, "/orchestrations/che": &vfsgen۰DirInfo{ name: "che", - modTime: time.Date(2019, 10, 2, 21, 6, 31, 725925394, time.UTC), + modTime: time.Date(2019, 10, 2, 21, 20, 4, 930960742, time.UTC), }, "/orchestrations/che/0.1": &vfsgen۰DirInfo{ name: "0.1", - modTime: time.Date(2019, 10, 2, 21, 6, 31, 725925394, time.UTC), + modTime: time.Date(2019, 10, 20, 4, 3, 53, 518641775, time.UTC), }, "/orchestrations/che/0.1/che-operator-crd.yaml": &vfsgen۰CompressedFileInfo{ name: "che-operator-crd.yaml", - modTime: time.Date(2019, 10, 2, 21, 6, 31, 725925394, time.UTC), + modTime: time.Date(2019, 10, 2, 21, 20, 4, 931216573, time.UTC), uncompressedSize: 322, compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x90\xb1\x4e\xc4\x30\x10\x44\x7b\x7f\xc5\x7e\x81\xd1\x75\xc8\xed\xd1\x81\x28\x28\xe8\xf7\x9c\x21\x59\x9d\x63\x5b\xde\x75\x84\x84\xf8\x77\xe4\x5c\x90\xe0\x4a\xcf\x1b\xcd\x8c\x97\xab\xbc\xa3\xa9\x94\x1c\x88\xab\xe0\xd3\x90\xc7\x4b\xfd\xf5\x51\xbd\x94\x87\xed\x74\x81\xf1\xc9\x5d\x25\x4f\x81\xce\x5d\xad\xac\x6f\xd0\xd2\x5b\xc4\x13\x3e\x24\x8b\x49\xc9\x6e\x85\xf1\xc4\xc6\xc1\x11\x65\x5e\x11\x28\x2e\x88\xa9\xab\xa1\xa9\x2f\x6d\xf6\x88\x49\xaa\xc2\xc7\x05\x4e\x2b\xe2\x70\xce\xad\xf4\x1a\xe8\x1e\xdf\x22\x74\x38\x88\x8e\xe2\x05\xe7\x5b\xda\x2e\x26\x51\x7b\xbe\x03\x2f\xa2\xb6\xc3\x9a\x7a\xe3\xf4\x6f\xc1\xae\xab\xe4\xb9\x27\x6e\x7f\x89\x23\xd2\x58\x2a\x02\xbd\x8e\xca\xca\x11\x93\x23\xda\x7e\x6f\xb2\x9d\x86\xa3\x5f\xda\xf1\xe5\x63\x94\x1a\x5b\xd7\x40\x5f\xdf\xee\x27\x00\x00\xff\xff\x70\x2d\xa3\xc6\x42\x01\x00\x00"), }, "/orchestrations/che/0.1/che-operator.yaml": &vfsgen۰CompressedFileInfo{ name: "che-operator.yaml", - modTime: time.Date(2019, 10, 2, 21, 6, 31, 725925394, time.UTC), + modTime: time.Date(2019, 10, 2, 21, 20, 4, 931629692, time.UTC), uncompressedSize: 2575, compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x56\xc1\x6e\xe3\x36\x10\xbd\xeb\x2b\x88\xf4\xb0\x40\x01\x49\x49\xbb\x2d\x0a\xde\xdc\x4d\xba\x3d\xb4\x6b\x23\x31\xda\x63\x41\x53\x63\x6b\x1a\x92\x43\x0c\x29\x27\xee\x62\xff\xbd\xa0\x24\xdb\x92\xa5\x6c\xb6\x45\xab\x93\x35\xf3\xf4\xde\xe3\x70\x66\x60\xe5\xf1\x37\xe0\x80\xe4\xa4\xd8\xdf\x64\x8f\xe8\x2a\x29\x1e\x80\xf7\xa8\x61\xa1\x35\x35\x2e\x66\x16\xa2\xaa\x54\x54\x32\x13\xc2\x29\x0b\x52\xe8\x1a\x72\xf2\xc0\x2a\x12\x67\x79\x9e\x67\x43\x1a\xde\x28\x5d\xa8\x26\xd6\xc4\xf8\x97\x8a\x48\xae\x78\xfc\x21\x14\x48\xe5\x49\xe0\x9e\x0c\x8c\x68\x35\x43\x8b\x5c\xa3\x85\x10\x95\xf5\x52\xb8\xc6\x98\x79\x41\x6e\x0c\x04\x99\xe5\x42\x79\x7c\xcf\xd4\xf8\x90\x28\x72\x01\xcf\x11\x5c\xf2\x10\x32\x21\x18\x02\x35\xac\xa1\xcf\xa1\xdb\x31\x84\x00\x29\xb5\x07\xde\xf4\xe1\x37\x5f\xbf\x99\xf2\x30\x35\x11\x0a\xf2\xe0\x42\x8d\xdb\x58\x20\x4d\xf9\x5a\xcc\x17\x91\xbd\x54\x8d\x39\x4e\xd3\x52\x76\xbf\x36\xe8\x2a\x74\xbb\xff\x58\x43\x9b\x26\x44\xe0\xb3\xd4\x20\xf0\x0f\x14\xaf\xae\xa6\xd4\x9e\xaa\x8e\x32\x74\xed\x33\x7a\x51\x5d\x2f\x75\x31\x70\x95\x27\x3c\xbe\xf9\xd4\x38\x21\x82\x8b\x7b\x32\x8d\x05\x6d\x14\xda\x1e\xb8\x87\x23\x4a\x93\xdb\xe2\xce\x2a\x7f\xa4\xd5\x0c\x47\x02\xaa\x42\x09\xcf\xa0\xcf\x6f\x86\x76\xff\xf2\x14\xa9\xdf\x82\x57\xfa\xf2\x72\x77\x10\xa7\x04\xca\xfb\x99\x5e\xab\xc0\x1b\x3a\xd8\xde\xfa\x6b\x26\x2c\x39\x8c\xc4\xe8\x76\x85\x26\x06\x0a\x85\x26\x3b\x25\xed\xeb\xd8\xa3\x67\xcc\xb5\x45\x4a\x63\x04\x53\x0d\xe2\x5d\x01\xda\xa0\x0f\x50\xe8\x1a\xa6\xec\xc9\xd9\xd4\x6a\x9e\x0f\xe6\xf5\xc7\xae\x3b\xbe\x7c\xd4\x5f\x59\x1b\xa1\xd9\xfc\x09\x3a\xb6\x83\x3c\xbb\x76\xe6\x67\x9f\x0c\xdc\xc3\x36\x71\x0e\x56\xc9\x2c\x54\x9c\xaa\xf0\x19\xa3\x93\xed\x95\xae\xf4\xbc\xa8\x6e\x4f\x57\xf9\xea\x71\x3c\x68\xd9\x16\xd6\x1b\xd4\x2a\x48\x71\x93\x09\x11\xc0\x80\x8e\xc4\x29\x23\x84\x55\x51\xd7\xbf\xa8\x0d\x98\xd0\x05\x92\x45\x3f\xb1\x1d\xc1\x7a\xa3\x22\xf4\x1f\x0d\x74\xd3\x63\x46\xdf\xcf\x33\x08\x71\xb4\x93\x1e\x4d\x2e\x2a\x74\xc0\x83\xaf\xf2\xf9\x8a\x1d\x1f\xb4\x6a\x07\x52\x7c\xfc\x28\x8a\xf6\xa7\xf8\xf4\x69\x90\xf5\xc4\x71\xc0\xd5\x8f\x67\xa7\xb1\x22\x8e\x52\x7c\x7f\x7d\x7d\x7d\x3d\x00\x1c\x4b\x66\x21\x32\xea\x30\xc8\x68\xb2\x56\xb9\x6a\xcc\x56\x36\x81\x4b\x43\x5a\x99\x72\x83\xae\xfc\x9c\xc9\x55\x63\xcc\x8a\x0c\xea\x83\x14\x0b\xf3\xa4\x0e\x21\xfb\xea\x0c\x59\x2f\x6f\x97\x52\x44\x12\x1b\x10\x8d\x4b\x5a\xe0\x22\x54\xe2\xa9\x06\x27\x30\x84\x06\x86\xe8\x3a\x46\x1f\x64\x59\xee\x30\xd6\xcd\x26\xcd\x61\x79\x94\xcd\xb7\xac\x2c\x3c\x11\x3f\x9e\x43\xa1\x7a\x2c\x5b\x8e\x50\xde\x7c\xf3\xed\xdb\x21\x13\x06\xb1\xc5\x67\xa8\x86\x31\x06\x55\xa1\x83\x10\x56\x4c\x1b\x90\xc3\x94\x10\x69\x7d\x5d\x84\x06\xb5\xb9\x88\xb7\xfb\x20\xaa\x38\x17\x2f\xa3\xf5\x23\x8b\x79\xd2\x3d\x8c\xa1\xe8\x30\xa2\x32\xb7\x60\xd4\xe1\x01\x34\xb9\x2a\x48\xf1\x76\x8c\xf1\xc0\x48\xd5\x29\x7b\x73\x3d\x4e\x6f\x15\x9a\x86\x61\x5d\x33\x84\x9a\x4c\xd5\xf5\xfb\xe9\x38\x6e\x2f\xb3\xb1\xb1\xae\x01\x7e\x5f\xac\xdf\xfd\xfc\xc7\x87\xc5\xaf\x77\x0f\xab\xc5\xbb\xbb\x6c\x6c\x7f\xaf\x4c\x03\x3f\x31\x59\x99\x5d\x9e\x6c\x8b\x60\xaa\x7e\xf2\x67\x73\x2b\x15\x6b\x79\x9a\x96\xe2\xb4\xc7\x67\x6d\xac\x96\xb7\xad\x89\xff\x57\x7f\x56\x7a\xb9\xba\xbb\x5f\xac\x97\xf7\x2f\xea\x4b\x71\x35\x6c\xf8\xab\x1e\xc3\xe9\x8f\x11\xc7\x8b\x5e\xef\x72\x61\xb4\x39\x3f\xbc\x34\xd9\x11\xd8\xa2\x6b\xd7\xdf\x7b\x56\x1a\x56\xe3\x2b\xfe\x2e\xcb\xfe\x0e\x00\x00\xff\xff\x93\xd6\xe0\xb4\x0f\x0a\x00\x00"), }, "/orchestrations/che/0.1/codewind-che-cr.yaml": &vfsgen۰CompressedFileInfo{ name: "codewind-che-cr.yaml", - modTime: time.Date(2019, 10, 2, 21, 6, 31, 725925394, time.UTC), + modTime: time.Date(2019, 10, 2, 21, 20, 4, 931921333, time.UTC), uncompressedSize: 5772, compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x58\x6d\x73\xdb\xb8\x11\xfe\xee\x5f\xb1\x33\xfd\x10\xbb\x95\xe8\xb1\x73\xd7\x17\x4d\x26\x33\xae\xdc\xe4\x92\x26\x8d\x46\x4a\x7c\x1f\x2f\x10\xb0\x22\x51\x81\x00\x0d\x80\xb2\x75\x97\xfc\xf7\xce\xe2\x85\xa4\x68\xb9\x71\xd3\xb9\x2f\x89\x45\x2e\x9e\x7d\xb0\xd8\x97\x07\x64\x8d\xbc\x41\xeb\xa4\xd1\x33\x30\xb6\x2c\x90\x2b\xd9\x38\x2c\x78\x85\xe7\xbb\x8b\x93\xad\xd4\x62\x06\xf3\x0a\xe7\xaa\x75\x1e\xed\x49\x8d\x9e\x09\xe6\xd9\xec\x04\x40\xb3\x1a\x67\xc0\x8d\xc0\x3b\xa9\xc5\x94\x57\x78\xe2\x1a\xe4\xf4\xca\xa1\xdd\xa1\xa5\xbf\x00\xfe\x90\x7e\x81\xac\x59\x89\xd0\x3a\x14\x20\x35\x81\x82\xc0\x46\x99\x7d\x8d\xda\x07\x4b\x5e\xe1\x1b\xb2\x99\xc1\x6f\xbf\x41\x61\xb1\x31\x4e\x7a\x63\xf7\xf0\xf5\x6b\x42\xf2\xac\x04\xb3\x01\xa6\x9f\x0e\xf6\x91\x95\x11\x8f\xd6\x76\x40\x61\xf9\x8c\x1e\x65\x88\x6b\xdc\x6d\xa4\x42\xb0\x58\x4a\xe7\xed\x7e\x8c\x27\xe2\xfb\x65\x7a\x9d\x88\x3e\xbb\x6d\xd9\xbe\x90\xe6\x3c\x05\xee\x9c\x57\x38\x4d\xa6\xd3\x0c\x35\x23\xf7\xbc\x22\x2a\xf0\xf5\xeb\xb3\x47\x29\x34\xaa\x2d\xa5\x7e\x94\x41\x7c\xfd\x14\x02\xd1\xf2\x1b\xfe\x05\x6e\x58\xab\xbc\x03\x6f\xe0\x33\xaf\xf0\x73\x01\x3f\x57\xa8\xc1\xa1\x8f\x8f\x8c\x40\x8b\x4c\xec\x3f\x4f\x60\x6e\x04\x2e\xe9\x6f\xf8\xd9\xd8\xad\x6b\x18\x47\x07\xd2\x25\x86\x28\xf2\xf1\xd0\x31\xc8\xcd\x06\x2d\x6a\x8e\x64\x20\xd3\x49\xb9\x09\x28\xb6\x46\xe5\x26\x80\xf7\xc8\x81\x9b\xba\x66\x5a\xb8\x7c\x54\xaf\x14\xdb\x19\x3b\x83\x67\x99\x1d\x65\x92\xdc\x48\x74\xc0\x80\xb7\xce\x9b\x1a\x78\xcc\x41\xb0\x46\x21\x31\x6c\x1d\x5a\xd8\x18\x1b\xdc\x52\x06\xdc\x75\xdc\x12\xc8\x27\x87\x2e\x92\x8a\x7b\x0d\x4b\x1d\xc8\x0d\x28\xdc\x78\x58\x2b\xa6\xb7\x45\xa6\xd0\xed\x2c\xe5\xfa\xd2\xa8\x94\x89\x77\x47\xde\xf4\xa9\x74\x37\x08\x9a\xb7\x2d\x06\x87\xa6\x41\xcb\xbc\xb1\x70\x27\x95\x02\xe6\x3d\xd6\x4d\xb0\x28\xd1\x03\x03\x87\xdc\xa2\xa7\xe8\x7c\x68\x50\xaf\x2a\xb9\x21\x6e\x2d\xed\x8e\xaa\x2a\x38\xcb\x31\x35\xc0\x84\x00\x19\x56\xbf\x65\x3b\x46\x4e\x9c\x07\xe7\x8d\x45\x2a\x06\xda\x79\xac\xb0\x02\x96\x78\xdb\x4a\x8b\x2e\xc7\x6a\xca\x44\x4d\x89\x65\xe5\x4e\x2a\x2c\xd1\x85\x78\x75\xe4\x68\x99\xe4\x08\x8c\x73\xd3\xa6\x2c\x73\xa8\x36\x2b\x59\x6a\x14\x73\xb4\x7e\x06\x1b\xa6\x5c\xe6\xf2\xf1\xdd\x0a\x6a\x23\x30\xa0\xcc\x2b\x2c\xe0\x3d\xdb\x22\xb8\xd6\x22\xec\x4d\x0b\x28\x7d\x85\x16\x2a\xb6\x43\x68\xda\xb5\x92\x1c\x38\x5a\x3f\x81\xe0\xcb\x8f\xb0\x73\xc0\x02\xb8\x57\x6e\xd5\x36\x8d\x19\xbb\x6c\xac\xf1\x86\x1b\xf5\xa7\xca\x38\x4f\xb1\x09\xf5\x4f\x8f\xef\xf7\xdd\xb6\xaf\x5a\x6f\x6a\xe6\x25\x67\x4a\xed\x29\x5c\x28\x80\x39\x78\x7b\x75\x73\xf5\xcb\x87\xc5\xc7\x15\x30\x2d\xa0\xf2\xbe\x71\xa7\xee\xec\x97\xb0\xb6\x8f\x6e\x1f\xbf\x60\xd6\x27\x11\x70\xa3\x3d\x93\x1a\x6d\xcc\xa7\xb0\xee\xd3\xf2\xdd\x20\x4b\x89\xef\x43\x42\xbd\xf5\x22\xec\xa7\x33\xa7\x8c\x0d\x7b\xa0\xf8\x3d\xb6\xe6\x93\xc3\x61\x21\x34\xcc\xb9\x3b\x63\xc5\xc1\x1a\x02\x1a\x78\x49\x26\x83\x55\x0c\x94\x74\x81\x9a\x36\x7a\x1a\x17\x51\x04\x5d\x41\x45\x01\x5f\x28\x3c\x02\x95\xac\xa5\x47\x3b\x01\x2c\x41\x19\xce\x14\x99\x7c\xa9\xf7\x05\xfd\x5f\x70\x53\x7f\xb9\xb8\x7c\x5e\xfc\x70\x59\x5c\x5c\x16\xcf\x2f\x03\xb4\x36\x7a\x41\x68\x3f\x11\xd8\xb0\x5e\xd1\x3b\xa8\xb1\x06\x8b\xb7\x2d\x3a\x1f\xe8\xa6\xb0\xf6\x7d\xac\x80\xeb\x41\xd7\xf9\xf1\xe2\xf2\xbd\x4c\x49\x47\x86\xef\xb1\x36\x76\xbf\x8c\x00\xc7\xb0\x03\xdf\xa7\x20\x5f\xbc\x7e\x88\xfb\x8e\x16\x27\x54\x1a\x61\x6b\xe6\x70\xf6\x48\x0d\x4f\x0e\x8b\xd8\x6d\x65\x93\x9b\x9d\xd4\x25\x2c\x8c\xf3\xa5\xa5\xa6\x46\x19\x43\x27\x14\xb3\x45\x23\xf7\xd2\x68\x10\xe8\x99\x54\x8e\xc2\x8f\xf7\xd2\x79\x5a\x73\xfd\xf7\xc3\x64\x4b\x9e\x0d\x55\xcc\x9d\x74\x08\xac\x83\x1d\x6c\x8b\x7a\x28\xb7\xc8\x7c\xea\xb1\x78\xef\x29\x85\xd4\xf5\xfa\xb0\x4c\xba\xa5\xd7\x69\x67\xd0\xd5\x8b\xaf\x98\x1f\x26\x79\x1b\x9a\xa2\xc9\x7c\xc1\x9b\xc3\xd8\x35\x09\x2a\xf7\xc5\x0c\x4d\x27\xfe\xaf\x30\xf2\xbb\x83\x79\xe8\x35\x14\xc4\xff\xea\xf1\xc7\x1f\x52\x72\x0d\xbc\x8d\x2a\xa7\xf3\x14\x9a\xfe\xd8\x41\x38\xbe\x9a\x6d\x29\xce\x0c\xc4\x7a\x70\x16\xa3\xbd\x95\xa4\x52\x46\xae\x1e\x2b\xb8\x58\xd7\x43\xc7\xb1\xd3\x4c\x4b\xd4\x94\x18\x28\xa2\xe3\x7e\x96\x3c\xd8\xc4\xc3\xc2\xec\xcf\x38\x87\xec\xbb\x0e\x49\xac\x8f\x6c\x84\x92\xe2\x88\xa3\x41\x32\x69\x2a\x9e\x9a\xf9\x5e\x7c\x1c\xc2\x66\xc5\x50\x58\x14\x15\xf3\xa4\x2b\x6c\xe5\xb8\x3a\xcf\x61\xb8\x55\xd3\xbf\xfd\x79\x6a\x2b\x54\x7f\x81\x53\x87\x08\xcd\xb6\x3c\x8f\x1e\xce\xb3\xa0\x28\x4a\x13\x6a\x54\x31\x4f\x8d\xc0\xb3\xf2\x2c\xf6\xaa\x84\x91\x95\x0b\x31\xa5\x29\x46\xbf\x72\xec\x49\x8b\x3a\x4f\x5c\x77\x46\xb5\x35\x02\x57\x4c\xd6\xe0\x3c\xc5\xbb\xdc\xe7\xc1\xd3\x75\xfe\x39\xd3\xb0\xc6\x20\x27\x8c\x86\x53\xa6\xd4\xb0\x81\x2f\x6e\xe6\x41\x82\x18\x8d\x09\xef\x6c\xd2\x7b\x9a\x76\x96\x70\x4a\x16\x8b\x9b\x39\x3d\xee\x01\x62\xcb\x55\x0a\x04\x72\xc5\x2c\x8a\x04\xe2\xce\x42\xdd\xb7\x5a\xde\xb6\xa3\xb5\x23\xcb\xb3\xc3\xf0\x46\x9a\x31\x18\x3b\xbe\x4a\x9b\x9a\xc1\xb3\x03\x36\x5d\xdb\x93\xbf\xe6\x69\xf7\x48\x58\x88\x5f\xbf\xdd\xe3\x2d\xb0\xd9\xf1\x39\x19\xaf\xe4\xaf\x14\xf4\x8b\xd7\xb2\x13\xa0\xda\x79\xdb\xf2\x83\xbc\xf3\x06\x14\x6b\x35\xaf\x48\xa4\x90\x04\x63\x0a\x1a\x23\x42\xed\x58\x8c\x9d\x88\x5e\xb5\xeb\x86\xf9\x8a\x62\xcb\x60\x71\x93\x46\x11\xce\xc3\xfb\x55\xbb\x5e\x30\x5f\xb9\x59\x3f\xdd\x87\x6a\x97\x48\x3f\xb0\x85\x7f\x9b\xb5\xcb\x7c\xdf\x9a\xf5\x41\x92\xd0\xfa\x2d\x62\x13\x8b\x0c\x5a\xad\xd0\xb9\x20\x38\x34\xa2\x48\x52\x10\x18\xcd\xa6\x4e\xe9\xa5\xc4\xa2\x40\xb9\xa8\x7a\xba\x82\x58\xdc\xcc\x0f\xf2\x71\x71\x33\x5f\x45\xeb\x39\x19\x8f\x7a\xdc\xff\xef\xb8\xcf\xa7\xc5\xcd\xfc\xd4\xc5\x62\xe8\x1e\x3e\xe6\xfd\x04\x80\xb5\xbe\x9a\x8d\x0e\xcb\xf5\x53\xc9\x68\xea\x3f\x41\x71\x19\x0b\xda\x84\xe9\x15\x6b\x11\xfe\x89\x7b\xae\x0c\xdb\x9e\x2f\x7f\x82\xd5\xea\x43\x58\xce\x34\xc7\x43\x8d\x1f\xe4\x6a\x63\xcd\x4e\xd2\x0d\xf0\xc8\x04\x3b\x98\x39\x6f\x04\x6a\x2f\xfd\x7e\x41\x0b\x04\xf5\xcc\xe1\x04\xb2\xe8\xad\xc4\x1d\x0a\xd8\x58\x43\x32\x80\xd2\xc7\xcb\x1d\x46\x61\x7b\x2e\x35\xc5\xda\xe5\x20\xe2\x7d\xa3\x24\x97\x5e\xed\x3b\xa9\x1f\x6f\x72\x4b\x38\x0d\x5d\xf5\x1f\xc9\x6b\xde\x09\x4d\x42\xe2\x1b\xc3\x27\x47\x5c\x46\xb2\x6c\xa8\x99\xb6\x19\xa0\xeb\xb8\x7d\x2b\x87\xbe\x95\x1f\x5c\x0a\x02\x4e\x5e\xf8\x5f\xba\xb9\x40\x27\xa9\xda\xa3\xcc\xee\xe4\x9d\xd9\x74\x07\x30\x78\x05\xa7\xac\xa1\x4d\xb3\xb5\x42\x30\x5a\xed\xe3\xf8\x78\x2c\xbc\xb4\xe1\x10\xe0\xe3\x3b\xbe\x22\x5c\x1a\x5d\xa3\x7c\xcd\x94\x86\x63\xec\x77\x27\x33\x08\x4d\x70\x91\xc9\xf4\x82\xbd\x3b\x05\x8b\x4c\xd5\x05\x7c\xac\xa4\x8b\x7f\xc7\x2b\x12\x35\xf1\xa8\x73\x26\xdf\x66\x12\x25\x5a\x2f\x9d\x82\x02\x13\x47\xf4\xd5\x98\xe7\x92\x1c\x0e\x82\x25\xc5\x88\x1d\x57\x32\x88\xc9\x40\x2f\xfe\xf8\x0e\x7e\x21\x52\xdf\x45\x70\x1e\x5c\xbe\x19\xe6\x58\x5f\xf9\x2c\x5c\x17\x63\xf1\x7b\x03\xa8\xc3\xe1\xf5\x37\xc8\xdd\xf3\x0e\x2f\x56\x75\xa0\xa3\xbb\xe3\xcf\xb3\x8f\x39\xb8\x43\xba\x96\x66\x6d\x39\xac\x56\x73\xd5\xfa\x2a\xd2\x08\x53\x8e\x1b\xbd\x91\x25\xdd\xf0\x88\x7a\xfc\xf5\x9e\x35\xe1\xce\x68\x85\xd4\xa5\x8a\x77\x29\x93\x69\x04\x80\xc3\xde\x90\xd3\x60\x88\x9d\x3f\x7a\x3c\x9d\x7e\x4e\x9d\x6f\x16\xee\xc0\xcd\xa8\x38\xd2\xbd\x3b\xfb\x1e\x18\x3e\x15\x76\x15\x10\x86\xc7\xf3\xe0\x33\x4e\xc7\x77\xf4\xfd\x66\x7c\xd6\x79\xc4\x0d\xbf\xdc\xe4\x44\x7c\xf8\xc9\x66\xfb\x57\x97\x67\xc1\xde\xb4\x16\x4a\x65\xd6\x4c\x41\x6e\xab\xc2\xd4\x4c\x46\x69\x91\x1e\x5d\x87\x27\xc3\x49\xd6\xae\xd1\x6a\xf4\xe8\x48\xd7\x25\xab\x22\xcc\xa9\xc9\xc1\xd7\x20\x5d\x4a\x7d\x3f\x84\x0a\x93\x69\x80\xf4\x26\x3e\xce\x02\x26\x94\x64\x85\x70\xc7\xf6\x79\x05\x3a\x60\xb6\x2b\x99\x22\xad\x4b\x6a\xad\x6e\x95\x97\x53\xba\xa0\xc0\x69\xf8\x57\x1e\xcc\x83\x74\xf6\x21\x96\x09\x6e\x02\x2f\xd2\x5f\x53\xca\xa5\x97\xd3\x17\xdd\x67\x92\x97\xc5\x8b\x18\x8a\x69\xb6\x88\xa1\x78\xd9\x49\x3d\x47\x49\x8a\x23\x7f\xd9\xc9\x04\x82\x90\xa1\xb9\x20\xc0\xb6\x0a\x87\xbe\x12\xd2\x39\x99\x44\xcd\x97\xc2\x14\xc1\xfe\x78\xaa\x0d\x7c\x1b\xf0\x6c\x18\xca\x81\xe8\x1b\x25\x65\x28\x92\x90\x43\xe1\x9b\x96\x72\xe0\xd1\xd6\x52\x33\x1a\xc8\xdd\x37\x92\x60\x3b\xca\xea\x57\xab\xd7\xd6\xb4\x4d\xf7\x1d\x6c\xf1\xe1\x3a\x90\xed\xbe\x68\x05\x09\xd7\x7f\xcd\x00\x57\x99\x56\x11\x3b\x0a\x30\x40\xba\x2a\xf3\xd6\x4a\xbf\x9f\x1b\xed\xf1\xde\xbf\x72\x01\x93\xbc\x40\xff\x35\xcd\x7e\x97\x0f\xe6\x8e\xfb\x58\xb6\xfa\xaa\xbb\x7d\xc1\xc9\x7f\x02\x00\x00\xff\xff\xe4\xa3\xce\x90\x8c\x16\x00\x00"), }, "/orchestrations/che/0.1/codewind-cluster-role.yaml": &vfsgen۰CompressedFileInfo{ name: "codewind-cluster-role.yaml", - modTime: time.Date(2019, 10, 2, 21, 6, 31, 725925394, time.UTC), + modTime: time.Date(2019, 10, 2, 21, 20, 4, 932398535, time.UTC), uncompressedSize: 2384, compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x95\x3d\x73\xa3\x3c\x10\xc7\x7b\x3e\x85\xc6\x75\x62\x4f\xba\x67\xdc\x3e\xc5\xf5\x57\x5c\x73\x93\x62\x11\x7f\xe3\xbd\x08\xad\x4e\x2b\xe1\x24\x9f\xfe\x06\x70\x4c\x62\x20\x43\x3c\xa9\x90\xc4\xce\xee\x6f\xdf\x29\xf0\x2f\x44\x65\xf1\x7b\x13\x4b\xb2\x5b\xca\xe9\x28\x91\x5f\x29\xb1\xf8\xed\xd3\x7f\xba\x65\xd9\xb5\x0f\x25\x12\x3d\x14\x4f\xec\xab\xbd\xf9\xdf\x65\x4d\x88\x3f\xc5\xa1\x68\x90\xa8\xa2\x44\xfb\xc2\x18\x4f\x0d\xf6\x06\xd6\x71\x50\xdc\x5b\xa9\x70\x62\x5f\x15\xc6\x38\x2a\xe1\xb4\x13\x31\x86\x42\x98\x91\x89\xd9\x41\xf7\xc5\xbd\xa1\xc0\x3f\xa2\xe4\xa0\x7b\xf3\x7b\x83\xe7\x04\xdf\xb1\xe9\xe6\xce\x6c\x36\x8f\x85\x31\x11\x2a\x39\x5a\xf4\xff\xd9\xd7\x11\xaa\xe8\x7f\x5f\x2e\x3b\x4d\x94\x72\xff\x16\xa4\x52\xd8\x1c\x39\xbd\x04\x71\x6c\x19\xda\x6b\x69\x11\xcb\x5e\x43\x05\x87\x84\x4e\xd4\x46\xd0\x70\x0a\x94\xec\xb1\x3b\xd4\x48\xdd\xc7\xb1\xf6\xdf\x1c\xaa\xb3\xc4\xe9\x4d\x22\x2b\x36\x8f\xc5\x35\xf6\x14\xb4\x8b\x8c\x06\xb2\x37\x9b\x5f\x63\xa4\x73\xf6\xcd\xe9\x5d\x90\x98\x0e\x12\x4f\x14\xab\xcb\x9b\x93\xfa\x72\xc6\x33\xec\x47\x96\x2b\x6f\x47\xa0\x11\x72\xf0\x7b\x0d\x8b\xc2\x46\x24\x5d\x69\xe1\x2b\x7a\x63\xcb\x16\x64\xad\x64\xbf\xa0\x3f\x7c\x55\xdb\x5a\xcc\x31\x10\xeb\x4d\x78\xa9\x3e\xd3\xbf\x46\x85\x15\x7f\xe0\xba\xa1\xb0\x96\x73\x2c\xd4\x5b\x88\x43\x37\x0e\x34\xc1\xa7\x56\x5c\x6e\x60\x1d\x71\xf3\x7d\x75\xcb\x36\x6c\xb9\x6c\xb6\x56\x9a\x99\x86\x6e\xa8\x5e\x9d\x8e\xa5\xaa\xa1\x10\xfa\x3e\x78\x37\x3d\x26\x86\x2a\x04\x27\x2f\x0d\x26\x35\x74\x5a\x68\xfe\xdb\xa2\xfb\x71\x80\xf5\x60\x13\x94\x88\xe0\xd8\x92\x76\xed\x72\x67\xde\x5f\x77\x07\xf6\xe4\xf8\x15\xf1\xf3\x90\x4c\x88\xe6\x62\xc2\x23\xcb\x79\xaa\xcf\x54\x5a\xd6\x24\xcd\xdb\x53\x85\x03\x7b\x4e\x97\x00\xae\x6e\x90\xa9\x79\x8b\x98\xf8\xc0\x96\x12\x3e\xb1\xfe\x4e\x88\x6b\xdf\xcf\xf3\xbf\x19\x7a\x9d\xa2\x31\xec\x57\x20\x97\xdc\x9d\x89\xbe\x9d\x63\x47\x21\x44\x69\xc9\xf5\x46\x96\xc5\xce\x0b\xe8\x03\xf5\x39\x49\x33\xa9\x99\x59\xb8\x33\xa3\x2a\x97\x7f\x60\x13\x59\x0b\xd5\x88\x96\x71\xba\x32\xb0\xe8\xf4\xe2\x5a\x9f\xa9\x45\x71\x28\xd9\x57\xec\xeb\xa1\x18\xc5\x0d\xcb\xd5\x0e\x2b\x7f\xb8\xcf\x99\x1d\xb3\x71\x99\x03\xab\x07\x1c\xda\x69\x1f\xce\xcc\x95\xc5\x08\x46\xc9\x09\x5b\x09\xf0\x7a\xe4\x43\x5a\xf0\x2c\x27\x9c\x7d\xea\x4e\xbb\xa1\xd6\xef\x8f\xd2\x43\xde\xb2\x07\x67\xd9\xfe\x05\x00\x00\xff\xff\x65\xf8\xf8\x8d\x50\x09\x00\x00"), }, "/orchestrations/che/0.1/codewind-role-binding.yaml": &vfsgen۰CompressedFileInfo{ name: "codewind-role-binding.yaml", - modTime: time.Date(2019, 10, 2, 21, 6, 31, 725925394, time.UTC), + modTime: time.Date(2019, 10, 2, 21, 20, 4, 932735376, time.UTC), uncompressedSize: 245, compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x8e\x3d\x4e\xc5\x30\x0c\x80\xf7\x9c\xc2\x17\x48\x11\x1b\xca\x06\x0c\xec\x0f\x89\xdd\x75\x0c\xcf\x34\xb5\x23\x27\x69\x25\x4e\x8f\xaa\xf2\xb3\xbd\x03\x7c\x3f\x8b\x68\x4e\x70\xb1\xc2\x4f\xa2\x59\xf4\x23\x60\x95\x37\xf6\x26\xa6\x09\x7c\x46\x9a\x70\xf4\xab\xb9\x7c\x61\x17\xd3\x69\x79\x68\x93\xd8\xdd\x76\x1f\x56\xee\x98\xb1\x63\x0a\x00\x8a\x2b\x27\x20\xcb\xbc\x8b\xe6\xe8\x56\x78\xfe\xf1\xb5\x31\x7f\x32\xf5\x96\x42\x84\xb3\xf6\xca\xbe\x09\xf1\x23\x91\x0d\xed\xff\xf4\x95\xe3\x6e\xbe\xb4\x8a\xc4\xe1\x50\x5c\xf8\xfd\x90\x9f\xd4\x73\x19\xad\xb3\x1f\xab\x7f\x08\x53\x91\xda\x38\xfe\x86\x03\x00\x56\x79\x71\x1b\xf5\xc6\x7c\xf8\x0e\x00\x00\xff\xff\x91\xad\xe9\x4a\xf5\x00\x00\x00"), }, "/orchestrations/cli-services": &vfsgen۰DirInfo{ name: "cli-services", - modTime: time.Date(2019, 9, 16, 18, 53, 3, 426969143, time.UTC), + modTime: time.Date(2019, 9, 15, 14, 51, 26, 213481415, time.UTC), }, "/orchestrations/cli-services/0.1": &vfsgen۰DirInfo{ name: "0.1", - modTime: time.Date(2019, 9, 16, 18, 53, 3, 426969143, time.UTC), + modTime: time.Date(2019, 9, 15, 14, 51, 26, 213567847, time.UTC), }, "/orchestrations/cli-services/0.1/kabanero-cli.yaml": &vfsgen۰CompressedFileInfo{ name: "kabanero-cli.yaml", - modTime: time.Date(2019, 9, 16, 18, 53, 3, 426969143, time.UTC), + modTime: time.Date(2019, 9, 15, 14, 51, 26, 213869263, time.UTC), uncompressedSize: 1286, compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x93\xcd\x8e\xd3\x40\x0c\xc7\xef\x79\x0a\x6b\x2f\x2b\x21\x25\x2b\xc4\x1e\x20\x37\xe0\xc0\x0d\xad\x96\x15\x77\x77\xe2\xa6\xa6\x93\xf1\xc8\xe3\x29\x62\x9f\x1e\xcd\xb4\x85\x6d\x9a\xb2\x95\x38\x25\xe3\x8f\xbf\x7f\xb6\x6c\x8c\xfc\x9d\x34\xb1\x84\x1e\x76\x6f\x9b\x2d\x87\xa1\x87\x6f\xa4\x3b\x76\xd4\x4c\x64\x38\xa0\x61\xdf\x00\x04\x9c\xa8\x87\x2d\xae\x30\x90\x4a\xeb\x3c\x37\x29\x92\x2b\xae\x44\x9e\x9c\x89\x96\x7f\x00\x8c\x71\x16\x07\x10\x45\x2d\x15\x77\x0b\x51\xc5\xc4\x89\xef\xe1\xe9\xf3\x43\x4d\x28\xce\x1e\xee\xef\xdf\xd5\x97\xa1\x8e\x64\x0f\xd5\xf6\xa1\x18\xdb\xb6\x6d\x5e\x52\xaa\x64\xa3\x4e\x22\x85\xb4\xe1\xb5\x75\x2c\x77\x7f\xc0\x1f\x8b\xef\x5a\x6c\x93\x3d\xf0\x69\xcf\xc5\xb2\x90\x04\x60\x3e\xed\xe3\x8d\x74\xe2\x80\x56\x69\x22\xa6\x64\x1b\x95\x3c\x6e\xce\x49\x57\xe8\x3a\xcc\xb6\x11\xe5\xe7\x1a\xdf\x6d\xdf\xa7\x19\xb0\x3f\xe5\x75\x4a\x35\xf2\x89\x27\x4a\x86\x53\xec\x21\x64\xef\x97\x3b\xd1\xec\x29\xf5\x4d\x0b\x18\xf9\x8b\x4a\x8e\x87\x19\xdf\xdc\x34\x00\x4a\x49\xb2\x3a\x3a\xce\x5d\x86\xd4\x00\xec\x48\x57\x07\xcb\x48\x56\xbf\x9e\xd3\xfe\xe7\x27\x9a\xdb\x5c\xa7\xe6\x24\xac\x79\x9c\x30\xa6\xfa\x4c\xfb\xe1\x5d\x28\x50\x7b\xa2\x73\x61\x8c\x35\x7d\x26\x3d\x50\xf4\xf2\x6b\xa2\x60\x7b\x6d\xa5\xe8\xd9\x61\x22\x5b\x90\x3f\xd3\x9c\x24\xb0\x89\x72\x18\x3b\x27\x4a\x92\x3a\x27\xd3\x79\x91\x03\xf0\x21\xfa\xff\xb8\xbf\xe2\x74\x94\x9d\xad\xcc\xe5\xce\xee\xd6\x1c\xd0\xf3\x33\xcd\x6b\xe7\x38\x2c\xd6\x3c\x2a\x77\x2c\xe7\xc2\xb7\x6f\x6e\x4f\x55\x8a\x61\xbe\x8d\xf3\xeb\xfe\xe8\x9c\xe4\x60\xaf\x5d\x4b\x91\xf9\xbb\xab\x9f\x38\x0c\x1c\xc6\xeb\xd7\xfc\xb5\x5b\xcc\xab\x1f\xe4\xac\x2e\xf1\x22\xdd\xf2\xde\x8b\xa7\x47\x5a\x17\xcd\x17\x67\x74\xe1\x6e\x8f\x83\xfc\x07\x68\xf3\x3b\x00\x00\xff\xff\x6f\x24\x8d\x56\x06\x05\x00\x00"), }, "/orchestrations/landing": &vfsgen۰DirInfo{ name: "landing", - modTime: time.Date(2019, 9, 16, 18, 53, 3, 426969143, time.UTC), + modTime: time.Date(2019, 9, 15, 14, 51, 26, 214500223, time.UTC), }, "/orchestrations/landing/0.1": &vfsgen۰DirInfo{ name: "0.1", - modTime: time.Date(2019, 9, 25, 18, 54, 19, 529823783, time.UTC), + modTime: time.Date(2019, 9, 27, 17, 56, 47, 699252494, time.UTC), }, "/orchestrations/landing/0.1/kabanero-landing.yaml": &vfsgen۰CompressedFileInfo{ name: "kabanero-landing.yaml", - modTime: time.Date(2019, 9, 25, 18, 54, 19, 529823783, time.UTC), + modTime: time.Date(2019, 9, 27, 17, 56, 47, 699327988, time.UTC), uncompressedSize: 1215, compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x92\x41\x6f\xd4\x30\x10\x85\xef\xfe\x15\xa3\x5e\x2a\x21\x65\x2b\x44\x0f\x90\x1b\xf4\xc0\xb5\x5a\x10\xf7\x89\x77\x9a\x98\xf5\x7a\xac\x99\xf1\x22\xf1\xeb\x91\x9d\x2d\x6a\x49\xbb\x0a\x8b\x38\xd9\x99\x67\xcf\x7c\xef\xc5\x98\xc3\x37\x12\x0d\x9c\x7a\x38\xbe\x75\xfb\x90\x76\x3d\x7c\x21\x39\x06\x4f\xee\x40\x86\x3b\x34\xec\x1d\x40\xc2\x03\xf5\xb0\xc7\x01\x13\x09\x77\x11\xd3\x2e\xa4\xd1\x69\x26\x5f\x65\xa5\x48\xde\x58\xea\x1e\x00\x73\x7e\xe1\x2c\x40\x66\x31\xad\x47\x3a\xc8\xc2\xc6\x9e\x63\x0f\x5f\xef\xee\xdb\xa5\x2a\xf6\x70\x7b\xfb\xae\x7d\x19\xca\x48\x76\xdf\x6a\x1f\x6a\xb1\xeb\x3a\xf7\x94\x56\xb8\x18\x6d\x38\x53\xd2\x29\x3c\xd8\x26\xf0\xcd\x6f\x03\xdb\xaa\xfd\x0d\xbe\xf1\x0c\xfe\xdc\x7f\xad\xbc\x72\x11\xc0\xa2\xce\x77\x8c\xe4\x10\x12\x5a\xa3\xca\xa8\x6a\x93\x70\x19\xa7\x05\xf1\x9f\xf9\x7e\xf4\x9e\x4b\xb2\x35\x9c\x0b\xf3\x03\xfa\x0d\x16\x9b\x58\xc2\xcf\x36\x7a\xb3\x7f\xaf\xcf\x32\xb8\x8b\x45\x8d\x64\xcb\x91\x3e\x85\xb9\xcb\x9a\x40\xca\xf0\x9d\x7c\xfd\x49\x1d\xbc\x08\x7b\x26\x91\x2a\x68\x46\xff\x44\x75\xc2\x91\xb6\xf4\x50\x27\x2e\xb0\xce\xf5\xc2\x1c\x3e\x0b\x97\x7c\xc6\xea\x3f\x86\xb2\x26\x8d\x57\x3c\x95\x48\x2d\xa0\x47\xc8\xd3\x93\xbe\xba\x6a\xcb\xf2\x61\x56\x3f\x66\x12\x86\x62\xb4\x25\x35\x09\xbe\xd2\x69\x0f\xa9\xc4\xe8\x00\x84\x94\x8b\x78\x3a\x35\x6a\x1d\xd4\x01\x1c\x49\x86\x53\x6d\x24\x6b\x6b\x0c\x3a\x6f\x7e\xa0\xf9\xe9\xbf\x43\xdc\xa8\xa1\x95\x0b\x59\x1e\x13\xbb\x60\xfa\xf5\x9b\xeb\x35\x33\x7f\x05\x00\x00\xff\xff\xb8\xf8\x68\xeb\xbf\x04\x00\x00"), }, "/samples": &vfsgen۰DirInfo{ name: "samples", - modTime: time.Date(2019, 10, 25, 15, 2, 27, 769200529, time.UTC), + modTime: time.Date(2019, 10, 28, 20, 4, 29, 63746667, time.UTC), }, "/samples/README.md": &vfsgen۰CompressedFileInfo{ name: "README.md", - modTime: time.Date(2019, 10, 1, 14, 19, 8, 439115457, time.UTC), + modTime: time.Date(2019, 10, 1, 23, 12, 48, 58401102, time.UTC), uncompressedSize: 1302, compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x94\xcf\x6e\xdb\x4c\x0c\xc4\xef\x79\x8a\x01\xbe\x4b\xbe\x22\x91\xef\xb9\xf5\x50\x14\x45\xd1\x53\x7b\x2b\x8a\x98\x5e\x51\x16\x91\xd5\x72\xbb\xa4\xe4\xb8\x4f\x5f\xac\x64\xd9\xf9\x77\x68\x4e\x36\x28\x91\xfb\x9b\x19\x6a\xff\xc3\xa7\xc7\x1c\x29\x91\x8b\x26\x68\x07\xa3\x21\x47\xb6\xab\xab\x0f\xd8\xb6\xdc\xd1\x18\xbd\x39\xd2\x10\xb7\xb0\x5e\x0f\x06\xef\x19\x3b\x32\x09\x08\x9a\x3a\xd9\x8f\x65\x69\xf5\x9e\x1c\x83\x9a\x23\xb3\xe6\xc8\x18\x8d\x1b\xe0\x8b\x43\x0c\x85\x3b\x2e\x9c\x02\xb7\x90\x34\x8f\xf8\xf9\x95\x76\x94\xb8\x28\x24\x99\x53\x8c\xcb\x14\x0b\x45\xb2\xff\xba\xee\xdd\xb3\xdd\x6d\x36\x7b\xf1\x7e\xdc\x35\x41\x87\xcd\xc3\xa9\xe1\x56\xf4\xf2\xbf\xd3\x31\xb5\x73\xeb\xc6\x0b\xf3\x66\x20\x73\x2e\x9b\x65\x8c\xfd\xdf\x00\x1f\xb1\x9d\xb8\x98\x68\xda\x56\x92\x5c\x74\x92\x96\x5b\x98\xce\x1c\x41\x87\xac\x89\x93\xdb\x49\x01\x3d\x30\xc6\x8c\x33\xde\x41\x62\x44\x52\xc7\xae\xd6\xf7\x85\x6a\x33\x2d\x3e\x68\xe6\x42\xae\x05\xad\x58\xd0\x7a\x0c\x12\x1f\x50\x38\x32\x19\x5b\x33\x9b\xd8\x8d\x31\x3e\x73\x90\x27\x2e\x47\x64\x35\x93\x5d\xe4\x17\x36\x6a\xae\x3f\x0d\xf0\x8d\xd2\xb1\xe6\xe1\x3d\x1b\x9f\xca\x06\x2a\x0c\x4d\xf1\x58\xdd\x6d\xb1\x3b\xa2\xe5\x89\x63\xe5\x30\x5c\x77\x5a\xc0\x8f\x73\x7e\x37\xa8\x38\xb7\x45\x5a\x49\xfb\x93\xd0\xe4\x24\x89\x0b\x64\xa0\x3d\x9f\x07\xd4\x67\x13\x15\xd1\xd1\x2e\xa2\x2f\xae\x54\x0b\x7f\xf4\x62\xa8\x0a\xaa\x81\xd5\x0a\x1b\xc5\xa9\xb2\xd7\x13\x47\x63\x90\xdd\x8a\xdd\x40\x1c\xc3\x68\xb3\x55\x61\x34\xd7\x41\xfe\x70\xbb\xb8\x60\x52\xb1\x5e\x6d\xd2\x52\xae\x4b\xf3\xa6\x1d\x0d\xf0\x5d\x52\x60\x24\x7d\x3b\xc6\x9b\x77\x84\xf8\xef\x01\x9e\x4e\x5a\xec\xa6\x89\x24\xce\x6a\x25\x81\x90\x68\xe0\x76\x8d\xb8\x01\x66\x75\xb5\xb5\x48\xcb\xf7\xa6\x9d\x1f\xa8\xf0\xfd\x3a\xe2\x99\x62\xab\xd1\x53\x5c\x43\xb2\x9a\xef\xf6\x41\x52\x7b\x77\x46\xdd\x2e\x0a\xd6\xf4\x78\xc6\xbc\x48\xd7\x0e\x9a\x18\x5a\x30\x68\xe1\xb7\x02\x7b\x4f\x5e\x36\x7b\x2b\xbe\x2e\xc7\x85\xf0\x15\xd5\xfc\x95\xa6\xb0\x2e\x75\xd0\x18\x39\xcc\x11\x3d\x15\xd8\xeb\x01\xae\xa0\xe0\x32\x91\x33\x08\x96\x39\x48\x27\xe1\x29\xea\xda\x8a\xae\xe8\x70\x0a\xf0\x5c\x2b\x9c\xd5\xc4\xb5\x1c\xcf\xab\xb0\xdc\x1a\x2f\x91\x1a\xe0\x33\xa7\x4a\x1b\xeb\x16\x8b\xad\x6a\x0b\xff\x1e\xa5\x36\x2d\xf2\xea\xfc\xd3\x45\x86\x1d\xf7\x34\x89\x96\xfa\xea\x33\xce\x18\x9f\x30\x58\xf3\x37\x00\x00\xff\xff\x7a\xb9\x1e\x3e\x16\x05\x00\x00"), }, "/samples/collection.yaml": &vfsgen۰CompressedFileInfo{ name: "collection.yaml", - modTime: time.Date(2019, 10, 21, 15, 28, 15, 180370227, time.UTC), + modTime: time.Date(2019, 10, 21, 16, 52, 32, 491930559, time.UTC), uncompressedSize: 666, compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x91\x31\x8f\xd4\x40\x0c\x85\xfb\xfc\x8a\x27\x51\x5c\x03\xe1\x8e\x32\xed\xd1\xd0\x21\x40\xf4\xde\x8c\xb3\x6b\x6e\x62\x47\x63\x27\xe8\xfe\x3d\x9a\xc9\xee\x5e\x4e\xa2\xb4\x2c\x7f\xef\x3d\x3f\x5a\xe4\x37\x17\x17\xd3\x01\x2f\x74\x22\xe5\x62\xbd\xd8\xe7\xed\x89\xf2\x72\xa1\xa7\xee\x45\x34\x0d\x78\xb6\x9c\x79\x0c\x31\xed\x66\x0e\x4a\x14\x34\x74\x80\xd2\xcc\x03\xfe\xd0\x46\x9f\x66\x19\x8b\x2d\xc5\x26\xc9\xdc\xf9\xc2\x63\xdd\x6f\x37\xf4\x63\xff\xd8\x7f\xe9\x3a\xe0\x03\x7e\x15\x39\x9f\xb9\x38\xe2\xc2\xa0\x31\x64\xa3\xca\x85\x15\x24\x3e\xce\x13\x08\xe3\x5d\xf7\xc1\x41\xee\x1c\x8e\x13\x39\x27\x98\xa2\xe1\x1a\x25\x67\xfb\x9b\xb0\x51\x5e\xd9\xdb\x61\xc5\x30\x48\x13\x44\xf7\xa1\xdf\xc5\x2f\x0c\x51\x09\xa1\x8c\xc4\x2e\x85\xd3\xcf\xa0\xe0\xfd\x16\x93\x95\x77\xa2\x10\x47\xe2\xe0\x32\x8b\x72\xc2\xe9\xb5\xc9\x35\xd2\xd5\x29\x7f\xe5\x89\xd6\x1c\x6f\x0f\x72\x38\x47\x88\x9e\x51\xbf\x20\x93\x70\x35\xd1\x0e\x0f\xe0\xc2\x8b\xc1\xaf\x83\x4d\x6f\x59\x6e\x25\xe0\xf9\x07\x44\x3d\x48\x47\xee\xf1\xdd\x3c\xfe\xbb\x42\xe2\x25\xdb\xeb\xcc\x1a\x1f\xdb\xfd\x31\x55\x83\xee\xc9\x6c\x3a\xaa\x8f\xa4\x38\x31\xd6\x25\x51\xec\xb9\x38\x49\xf3\xfc\xde\xe6\x83\xa3\xb0\xdb\x5a\xaa\x87\x6f\x53\xdd\x1e\x98\xac\xc1\xa5\xa6\x73\xa8\x05\x4c\x9b\xcc\xbd\x10\xbe\x35\xb2\x1b\xbb\xfb\xb8\x96\x23\x8e\xd5\x39\xd5\x5e\x8e\x9e\x87\xeb\xbe\xfb\x17\x00\x00\xff\xff\x74\x81\xca\x77\x9a\x02\x00\x00"), }, "/samples/default.yaml": &vfsgen۰CompressedFileInfo{ name: "default.yaml", - modTime: time.Date(2019, 10, 21, 15, 28, 15, 182370218, time.UTC), + modTime: time.Date(2019, 10, 18, 21, 20, 32, 458039396, time.UTC), uncompressedSize: 292, compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x4c\x8e\xb1\x6e\xc3\x30\x0c\x44\x77\x7d\x05\x91\x3d\x52\xd2\x51\x6b\xbb\x75\xef\xce\x48\xd7\x9a\x88\x2c\x0a\x12\xed\xb6\x7f\x5f\x34\xb0\x11\xaf\x8f\xbc\x77\xc7\x4d\x3e\xd0\x87\x68\x8d\x74\xe7\x1b\x57\x74\xf5\xa2\x61\xbd\x72\x69\x13\x5f\xdd\x5d\x6a\x8e\xf4\xbe\x9d\xdc\x0c\xe3\xcc\xc6\xd1\x11\x55\x9e\xf1\x4c\xb9\xd1\x90\xfe\xf1\xba\xfb\x4e\x17\xff\xe2\x2f\x27\x47\x94\xb4\x14\x24\x13\xad\x23\x92\x23\x22\xea\x68\x3a\xc4\xb4\x0b\x76\x74\xde\x84\x09\xd5\x3a\x97\x07\x23\x5a\x7a\x89\x34\x99\xb5\x11\x43\xf8\x12\x9b\x96\x9b\x4f\x3a\x87\xbd\xf6\x2c\x1a\x0e\xfa\xd0\x51\xc0\x03\x23\x64\xfd\xae\x45\x39\x87\xc7\x8a\xc3\x7f\xcd\xf8\xf1\xbf\x3c\xef\x0d\x9c\x4c\x56\x36\xbc\xe1\x93\x97\x62\xaf\xc7\xad\xd6\x17\xb8\xbf\x00\x00\x00\xff\xff\x59\x4a\x81\xab\x24\x01\x00\x00"), }, "/samples/full.yaml": &vfsgen۰CompressedFileInfo{ name: "full.yaml", - modTime: time.Date(2019, 10, 25, 15, 2, 27, 769200529, time.UTC), - uncompressedSize: 4038, + modTime: time.Date(2019, 10, 28, 20, 4, 29, 63947107, time.UTC), + uncompressedSize: 4029, - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x57\x4b\x93\x1b\xc7\x0d\xbe\xf3\x57\xa0\x56\x07\x69\xab\x96\xc3\x5d\xcb\x29\x57\x78\x53\x6d\x14\x47\x15\xc7\x76\x69\xe5\xa4\x72\x04\xa7\x41\x0e\xb2\x3d\x8d\x71\xa3\x87\x14\xf3\xeb\x53\xe8\x9e\x17\xbd\xab\x47\xa5\x12\x9f\xa4\x9d\xee\xfe\xf0\xe1\xf1\x01\xe0\x0b\xf8\xd0\xb0\x02\x7d\xc4\xb6\xf3\x04\x8e\x5a\x09\x9a\x22\x26\x52\x40\xef\x41\xf6\x90\x1a\x82\x4e\x54\x79\xe7\x09\x6a\x09\x7b\x3e\xf4\x11\x13\x4b\x00\xf2\xd4\x52\x48\xba\x7a\xb1\x7a\x01\x3f\x4a\x22\x48\x0d\x26\x50\x69\x69\x7c\x89\x29\x45\xde\xf5\x86\xd7\xe2\x19\x82\x24\x68\xf1\x91\x40\x29\x28\x01\x07\xa8\xa5\xdd\x71\x28\x78\x27\x4e\x0d\x48\x6a\x28\x2e\xde\xad\x5e\x00\x06\x57\x90\x93\x91\xd5\xc2\xb5\xe5\x43\x93\x32\xe0\x8e\x20\xf6\x01\x8d\x1f\xea\x9a\x75\x85\x1d\xff\x9d\xa2\xb2\x84\x2d\x3c\xe2\x0e\x03\x45\xa9\x58\x36\xc7\x3b\xf4\x5d\x83\x77\xab\x47\x0e\x6e\x0b\x7f\x1d\x8e\x56\x2d\x25\x74\x98\x70\xbb\x02\x08\xd8\xd2\xfc\x6a\xa5\x1d\xd5\xf6\xd9\x02\x45\xd0\x79\x4c\x7b\x89\x2d\x1c\x0b\x3c\x38\x4a\x14\x5b\x0e\xa4\xd9\x5b\x47\xca\x91\xdc\x74\xbc\x97\x98\xc3\x58\x4b\xdb\x49\xb0\x50\xdd\xc0\xae\x37\x3f\x44\x29\xa3\xd6\x18\x8c\xbf\x1c\x29\x46\x76\x14\x80\x83\xe3\x23\xbb\x1e\xbd\x3f\x03\x2a\x9c\xc8\xfb\x15\x8c\x88\x5b\xb8\xba\xad\xbe\xa9\x6e\xaf\x56\x2b\x80\x84\xf1\x40\xe9\x47\x6c\x49\x3b\xac\x49\x8d\xe7\x1a\x82\xde\x0d\xff\x7e\x63\x97\x6a\xcf\x0f\x14\x8f\x3c\x9c\x9b\xcd\x9f\x06\x63\x85\xb3\x52\x4a\x1c\x0e\x99\xeb\xc8\x5b\x42\x09\xf5\xc4\x3b\xbf\x7c\x8e\xc3\x53\x3c\x6e\xf1\x60\x89\x00\x04\xa5\x0e\xad\x96\x20\x52\x27\xca\x49\xe2\x19\x24\x42\xc2\x43\x7e\x39\x7f\x9d\x03\xbe\x19\xff\xb3\xae\xa5\x6d\x31\xb8\xb5\xe7\x40\x6b\x1d\x5c\xc8\xef\x12\x1e\xbe\x8a\x43\x1f\x39\x9f\xe6\xbf\xbe\xda\xc4\x36\x03\x8f\xb8\xef\x82\xe3\x3a\xcb\xc1\x70\x93\x3c\x52\x00\xfa\xd8\xf1\xa0\x80\xc4\x2d\xc1\x70\xf5\xa1\xa3\x9a\xf7\x67\x40\xc8\x6e\xf1\xd1\xea\x3b\xd1\x81\x22\xec\xc5\x7b\x39\x91\x83\x9d\x1d\xf7\x81\x53\xd6\x07\xb7\x74\x03\xa7\x86\xeb\x66\xac\x83\x46\xfa\xa8\xf0\xaa\xb9\xbe\x81\x96\x43\x96\xcd\xab\xf6\xfa\xc6\xa2\xa6\x54\x4b\x70\x0a\xaf\xf4\xba\x1a\x4d\xfe\x59\xe2\xa8\xdd\x1b\xd0\xc1\xfe\xeb\xdb\xe9\x2e\x2a\xbc\xbe\xd5\xe9\xfa\x3f\xa5\xcf\x86\x38\xd4\xbe\x77\x04\x6d\xef\x13\x9b\x96\x8e\xe8\x7b\x52\x93\x23\x82\x72\x38\x78\x02\x0a\x29\x9e\xab\x4b\x0b\x77\xed\xeb\x5b\x05\xeb\x17\xbf\xf6\x7c\x44\x4f\x21\x41\x12\xf8\xe3\x64\xb0\xca\x86\x94\xd4\xea\xe4\xed\x14\xa6\x87\x72\xba\x85\xab\xbb\x6f\xbf\xbd\x6d\x73\xd2\x3c\x06\xc7\xe1\x30\xd6\xa4\xa9\x6b\xf8\x04\x9d\x25\xcf\xac\x64\x4d\xe7\xa0\x39\xda\x63\xef\x53\x05\x1f\x04\x1c\x6b\xd6\xfa\xe8\xef\x1e\xbd\x52\xb1\x5c\x5e\x6c\x21\xc5\x9e\x72\xf1\x37\x34\x1a\xa8\x9b\x8c\x39\x3c\xbe\x04\x7d\xa0\x94\xd3\x5b\x9e\x97\x68\x98\x63\x06\xb3\xc9\xf0\xf6\x57\x39\xdd\x8c\xe6\xed\xc1\xbd\x81\x06\x4d\xe8\x7d\x76\xf4\x79\x16\x30\x95\xde\xfd\xc8\xe7\x69\xc9\x4e\xad\xe5\xc4\x6e\x12\xa5\x7e\x5e\x95\xd5\x80\xb5\x14\xe6\x1f\x26\x51\xfc\x97\xd2\x1c\x41\xbf\xa0\xce\x86\x86\x7b\xa3\x1a\xbf\x6c\xb8\x8f\x3c\x82\x7f\x5a\x92\x0d\x6d\x33\x56\x81\xaa\x1b\xfa\xa9\xa3\x88\x49\xe2\xff\x37\x70\xdf\x2d\xba\xc9\xff\x30\x70\xbf\xf6\x78\xb6\xc9\x43\xb5\xe7\x4e\x69\x53\x37\xb4\x96\xc1\xa1\x8b\xf8\x7d\x8d\xfd\xb1\x9f\x4d\xe1\xfb\x1c\xfa\xf6\xbb\xb9\x8d\x2d\xa2\xf8\xce\xaa\x35\xd4\x9f\x2c\xc3\x93\xc4\xc7\x3c\x4d\xee\x7d\xaf\x89\xe2\x7b\xf1\xb9\xf8\x77\x04\xbd\x92\x83\x53\x43\x36\xf5\x3a\x2f\x67\x93\x6a\x6e\x26\x05\x71\x9c\xf8\xa6\x89\xfb\xf7\xd5\x84\xff\x21\xcf\xc5\xac\xb4\xe7\xd1\x6d\xe2\x66\xb9\x17\x2f\xd6\xb5\x38\x3a\x71\x70\x23\x44\xdd\xd0\x3f\x9e\x79\xb7\x7d\xf2\x20\x2b\x5e\xbc\xa7\xda\xb4\x38\x8d\xbb\x37\xe0\x59\x4b\xc3\xb5\xb1\x3b\xe7\x87\x49\x87\xee\x8b\xd1\x2a\x07\x63\xdd\x90\xcb\x95\xb3\x80\xb9\x1c\x55\x4c\xba\x2d\xed\x74\x3d\xac\x0a\x1c\xea\x7e\xb7\xc8\x67\x1f\xfd\x16\x9a\x94\x3a\xdd\x6e\x36\x07\x4e\x4d\xbf\xab\x6a\x69\xe7\x12\x67\xd9\x2c\xe0\x37\x91\x3c\xa1\x92\x6e\x9c\x9c\x82\x17\x74\x9b\x3c\x80\x16\xf7\x83\xa3\x8f\xd5\x19\x5b\x3f\x97\xc7\x03\xa5\x92\xaf\x19\x09\x22\xa9\xf4\xb1\xa6\x97\xd6\xc8\x39\x31\xfa\x71\x1f\x79\x48\x56\xb0\x53\x5b\xc3\x3a\x0f\x27\x89\xc0\x61\xf8\x7f\x4e\xeb\x84\x9e\xd3\xf8\x7e\xce\x2c\x4f\x88\xfe\x3c\x24\x9f\x5c\x05\x3f\x8b\xa6\x8b\x7b\xe5\xc8\x56\xc2\x1b\xe8\x3b\x57\xc6\xa6\xcc\xb8\xb8\xa0\xfb\x52\xa7\x6d\x49\x33\xbd\x61\x02\x3a\x09\x04\x2d\x86\xb2\x00\xed\xce\x40\x8e\xf3\x7e\x42\x68\x63\xf2\xa9\xbb\xd3\xe5\xb9\xe4\xde\x3c\x6b\x67\x19\x05\xd9\x3f\x17\x05\xb6\x7a\xc0\xb4\xdc\xea\x4e\x0d\xe5\x7d\xd4\x42\x32\xfb\xa1\x6a\xf1\x47\x55\xa9\x19\x93\xc9\xc2\x36\xd7\xa5\x7b\x20\xbb\x7f\x51\x9d\x72\x65\x65\xf4\x7c\x4d\x22\x38\x2a\xc6\x5c\xb5\x4c\x66\xf6\x70\xbc\xf7\xa7\xa2\x96\xfb\xb9\x48\xc6\x61\x04\xfa\x34\xef\x9f\x4a\x77\x12\xb8\x2a\xa6\xae\x2a\xf8\x1d\x6c\x8d\x51\xbc\x5a\xe4\xe1\x93\x46\x5e\x4e\x2d\xa1\xe4\x83\x75\x39\xc6\xe1\x33\xf4\xe6\xb1\x5a\x5a\x0b\x07\x6b\xfe\x65\x1b\xe3\x90\xf9\x7e\x9f\x45\x67\x3b\x49\xf9\xaa\xa5\x75\xed\xce\xf9\x74\xdc\xfa\xe1\xfe\x87\x77\x90\x24\x03\x75\x14\xf3\x08\xe9\xd5\x52\x2d\x10\xad\x2f\xb5\xd8\x75\x16\xaa\xac\x0d\xac\x6b\xdb\x6a\xc2\xe1\x37\x11\x31\xc2\x45\xe4\xcb\x4d\xe6\xcd\xcf\xef\xe0\x97\xf7\x3f\x40\xa4\x3d\xc5\x12\xd1\x99\xd7\x24\x97\x57\x12\xe1\xfb\xbf\xbc\x9d\x3e\x5c\xe7\x1f\x39\xe3\xbe\x22\x21\x21\x87\x92\x01\x89\x07\x0c\xfc\xef\xe1\x57\x52\x43\x91\x7e\x2b\xfe\x13\x2a\xd4\x5e\x82\xe9\xd2\x28\x0c\x28\xe6\xe3\x89\xbd\x37\xcf\xca\x0c\x34\x5a\x49\xf2\x66\x1a\xb1\x4e\xa5\x72\x07\x66\x03\xa1\xeb\x92\x05\xec\xf8\x97\x65\x2f\xc3\x8e\xab\xb9\x9f\x2d\xbc\x1d\x5e\x5f\x90\xbc\xa0\xbf\x18\x95\x13\xf9\xc9\xcd\xe7\x5c\xc8\x87\x4b\xbc\x79\x55\x58\xb3\x2c\x57\xc6\xb1\xb3\x13\xb6\x63\x33\xd7\x46\x7a\xef\xa0\xc1\x23\x01\xba\xd6\x96\xda\x3e\x35\x12\x39\x9d\x87\x4c\x3c\xb1\x5d\x01\xbc\xb5\xf6\x62\x30\xd0\xf6\x9a\x7f\x53\x3a\xda\x73\x20\x77\x59\x55\xc3\xd3\x25\xb7\x0a\xe0\x6f\xd4\xee\x2c\xd1\xc3\x08\x1c\xd8\x58\xdc\x77\x04\x65\x5b\x14\xf0\x72\x30\xa8\x25\x83\x8b\x5a\xb4\x5f\xb9\x99\x2f\xdb\x88\x7b\xa6\xce\xa0\x00\x6f\x87\xf1\x93\xef\x7e\x20\x6c\x57\xff\x09\x00\x00\xff\xff\x82\xd5\x96\xb7\xc6\x0f\x00\x00"), + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x57\x4b\x93\x1b\xc7\x0d\xbe\xf3\x57\xa0\x56\x07\x69\xab\x96\xc3\x5d\xcb\x29\x57\x78\x53\x6d\x14\x47\x15\xc7\x76\x69\xe5\xa4\x72\x04\xa7\x41\x0e\xb2\x3d\x8d\x71\xa3\x87\x14\xf3\xeb\x53\xe8\x9e\x17\xbd\xab\x47\xa5\x12\x9f\xa4\x9d\xee\xfe\xf0\xe1\xf1\x01\xe0\x0b\xf8\xd0\xb0\x02\x7d\xc4\xb6\xf3\x04\x8e\x5a\x09\x9a\x22\x26\x52\x40\xef\x41\xf6\x90\x1a\x82\x4e\x54\x79\xe7\x09\x6a\x09\x7b\x3e\xf4\x11\x13\x4b\x00\xf2\xd4\x52\x48\xba\x7a\xb1\x7a\x01\x3f\x4a\x22\x48\x0d\x26\x50\x69\x69\x7c\x89\x29\x45\xde\xf5\x86\xd7\xe2\x19\x82\x24\x68\xf1\x91\x40\x29\x28\x01\x07\xa8\xa5\xdd\x71\x28\x78\x27\x4e\x0d\x48\x6a\x28\x2e\xde\xad\x5e\x00\x06\x57\x90\x93\x91\xd5\xc2\xb5\xe5\x43\x93\x32\xe0\x8e\x20\xf6\x01\x8d\x1f\xea\x9a\x75\x85\x1d\xff\x9d\xa2\xb2\x84\x2d\x3c\xe2\x0e\x03\x45\xa9\x58\x36\xc7\x3b\xf4\x5d\x83\x77\xab\x47\x0e\x6e\x0b\x7f\x1d\x8e\x56\x2d\x25\x74\x98\x70\xbb\x02\x08\xd8\xd2\xfc\x6a\xa5\x1d\xd5\xf6\xd9\x02\x45\xd0\x79\x4c\x7b\x89\x2d\x1c\x0b\x3c\x38\x4a\x14\x5b\x0e\xa4\xd9\x5b\x47\xca\x91\xdc\x74\xbc\x97\x98\xc3\x58\x4b\xdb\x49\xb0\x50\xdd\xc0\xae\x37\x3f\x44\x29\xa3\xd6\x18\x8c\xbf\x1c\x29\x46\x76\x14\x80\x83\xe3\x23\xbb\x1e\xbd\x3f\x03\x2a\x9c\xc8\xfb\x15\x8c\x88\x5b\xb8\xba\xad\xbe\xa9\x6e\xaf\x56\x2b\x80\x84\xf1\x40\xe9\x47\x6c\x49\x3b\xac\x49\x8d\xe7\x1a\x82\xde\x0d\xff\x7e\x63\x97\x6a\xcf\x0f\x14\x8f\x3c\x9c\x9b\xcd\x9f\x06\x63\x85\xb3\x52\x4a\x1c\x0e\x99\xeb\xc8\x5b\x42\x09\xf5\xc4\x3b\xbf\x7c\x8e\xc3\x53\x3c\x6e\xf1\x60\x89\x00\x04\xa5\x0e\xad\x96\x20\x52\x27\xca\x49\xe2\x19\x24\x42\xc2\x43\x7e\x39\x7f\x9d\x03\xbe\x19\xff\xb3\xae\xa5\x6d\x31\xb8\xb5\xe7\x40\x6b\x1d\x5c\xc8\xef\x12\x1e\xbe\x8a\x43\x1f\x39\x9f\xe6\xbf\xbe\xda\xc4\x36\x03\x8f\xb8\xef\x82\xe3\x3a\xcb\xc1\x70\x93\x3c\x52\x00\xfa\xd8\xf1\xa0\x80\xc4\x2d\xc1\x70\xf5\xa1\xa3\x9a\xf7\x67\x40\xc8\x6e\xf1\xd1\xea\x3b\xd1\x81\x22\xec\xc5\x7b\x39\x91\x83\x9d\x1d\xf7\x81\x53\xd6\x07\xb7\x74\x03\xa7\x86\xeb\x66\xac\x83\x46\xfa\xa8\xf0\xaa\xb9\xbe\x81\x96\x43\x96\xcd\xab\xf6\xfa\xc6\xa2\xa6\x54\x4b\x70\x0a\xaf\xf4\xba\x1a\x4d\xfe\x59\xe2\xa8\xdd\x1b\xd0\xc1\xfe\xeb\xdb\xe9\x2e\x2a\xbc\xbe\xd5\xe9\xfa\x3f\xa5\xcf\x86\x38\xd4\xbe\x77\x04\x6d\xef\x13\x9b\x96\x8e\xe8\x7b\x52\x93\x23\x82\x72\x38\x78\x02\x0a\x29\x9e\xab\x4b\x0b\x77\xed\xeb\x5b\x05\xeb\x17\xbf\xf6\x7c\x44\x4f\x21\x41\x12\xf8\xe3\x64\xb0\xca\x86\x94\xd4\xea\xe4\xed\x14\xa6\x87\x72\xba\x85\xab\xbb\x6f\xbf\xbd\x6d\x73\xd2\x3c\x06\xc7\xe1\x30\xd6\xa4\xa9\x6b\xf8\x04\x9d\x25\xcf\xac\x64\x4d\xe7\xa0\x39\xda\x63\xef\x53\x05\x1f\x04\x1c\x6b\xd6\xfa\xe8\xef\x1e\xbd\x52\xb1\x5c\x5e\x6c\x21\xc5\x9e\x72\xf1\x37\x34\x1a\xa8\x9b\x8c\x39\x3c\xbe\x04\x7d\xa0\x94\xd3\x5b\x9e\x97\x68\x98\x63\x06\xb3\xc9\xf0\xf6\x57\x39\xdd\x8c\xe6\xed\xc1\xbd\x81\x06\x4d\xe8\x7d\x76\xf4\x79\x16\x30\x95\xde\xfd\xc8\xe7\x69\xc9\x4e\xad\xe5\xc4\x6e\x12\xa5\x7e\x5e\x95\xd5\x80\xb5\x14\xe6\x1f\x26\x51\xfc\x97\xd2\x1c\x41\xbf\xa0\xce\x86\x86\x7b\xa3\x1a\xbf\x6c\xb8\x8f\x3c\x82\x7f\x5a\x92\x0d\x6d\x33\x56\x81\xaa\x1b\xfa\xa9\xa3\x88\x49\xe2\xff\x37\x70\xdf\x2d\xba\xc9\xff\x30\x70\xbf\xf6\x78\xb6\xc9\x43\xb5\xe7\x4e\x69\x53\x37\xb4\x96\xc1\xa1\x8b\xf8\x7d\x8d\xfd\xb1\x9f\x4d\xe1\xfb\x1c\xfa\xf6\xbb\xb9\x8d\x2d\xa2\xf8\xce\xaa\x35\xd4\x9f\x2c\xc3\x93\xc4\xc7\x3c\x4d\xee\x7d\xaf\x89\xe2\x7b\xf1\xb9\xf8\x77\x04\xbd\x92\x83\x53\x43\x36\xf5\x3a\x2f\x67\x93\x6a\x6e\x26\x05\x71\x9c\xf8\xa6\x89\xfb\xf7\xd5\x84\xff\x21\xcf\xc5\xac\xb4\xe7\xd1\x6d\xe2\x66\xb9\x17\x2f\xd6\xb5\x38\x3a\x71\x70\x23\x44\xdd\xd0\x3f\x9e\x79\xb7\x7d\xf2\x20\x2b\x5e\xbc\xa7\xda\xb4\x38\x8d\xbb\x37\xe0\x59\x4b\xc3\xb5\xb1\x3b\xe7\x87\x49\x87\xee\x8b\xd1\x2a\x07\x63\xdd\x90\xcb\x95\xb3\x80\xb9\x1c\x55\x4c\xba\x2d\xed\x74\x3d\xac\x0a\x1c\xea\x7e\xb7\xc8\x67\x1f\xfd\x16\x9a\x94\x3a\xdd\x6e\x36\x07\x4e\x4d\xbf\xab\x6a\x69\xe7\x12\x67\xd9\x2c\xe0\x37\x91\x3c\xa1\x92\x6e\x9c\x9c\x82\x17\x74\x9b\x3c\x80\x16\xf7\x83\xa3\x8f\xd5\x19\x5b\x3f\x97\xc7\x03\xa5\x92\xaf\x19\x09\x22\xa9\xf4\xb1\xa6\x97\xd6\xc8\x39\x31\xfa\x71\x1f\x79\x48\x56\xb0\x53\x5b\xc3\x3a\x0f\x27\x89\xc0\x61\xf8\x7f\x4e\xeb\x84\x9e\xd3\xf8\x7e\xce\x2c\x4f\x88\xfe\x3c\x24\x9f\x5c\x05\x3f\x8b\xa6\x8b\x7b\xe5\xc8\x56\xc2\x1b\xe8\x3b\x57\xc6\xa6\xcc\xb8\xb8\xa0\xfb\x52\xa7\x6d\x49\x33\xbd\x61\x02\x3a\x09\x64\xcd\x99\x1c\xe7\xb5\x84\xd0\xa6\xe3\x53\x2f\xa1\xc5\x90\x97\xa4\xb9\xd2\xde\x3c\x0b\xbf\x74\x5e\xf6\xcf\x39\xcf\x56\x06\x98\x96\xcb\xdc\xa9\xa1\xbc\x86\x5a\x24\x66\xfa\xaa\x16\x76\x54\x95\x9a\x31\x99\x1a\x6c\x61\x5d\x7a\x05\xb2\xfb\x17\xd5\x29\x17\x54\x46\xcf\xd7\x24\x82\xa3\x62\xcc\x55\xcb\x1c\x66\x0f\xc7\x7b\x7f\x2a\x22\xb9\x9f\x6b\x63\x9c\x41\xa0\x4f\xd3\xfd\xa9\x2c\x27\x81\xab\x62\xea\xaa\x82\xdf\xc1\xd6\x18\xc5\xab\x45\x1e\x3e\x69\xe4\xe5\xd4\x09\x4a\x3e\x58\x97\xd3\x1b\x3e\x43\x6f\x9e\xa6\xa5\xa3\x70\xb0\x9e\x5f\x96\x30\x0e\x99\xef\xf7\x59\x6b\xb6\x8a\x94\xaf\x5a\x3a\xd6\xee\x9c\x4f\xc7\x65\x1f\xee\x7f\x78\x07\x49\x32\x50\x47\x31\x4f\x8e\x5e\x2d\xd5\x02\xd1\xda\x51\x8b\x5d\x67\xa1\xca\x92\xc0\xba\xb6\x65\x26\x1c\x7e\x13\x11\x23\x5c\xb4\xbd\x5c\x60\xde\xfc\xfc\x0e\x7e\x79\xff\x03\x44\xda\x53\x2c\x11\x9d\x79\x4d\x2a\x79\x25\x11\xbe\xff\xcb\xdb\xe9\xc3\x75\xfe\x6d\x33\xae\x29\x12\x12\x72\x28\x19\x90\x78\xc0\xc0\xff\x1e\x7e\x1c\x35\x14\xe9\xb7\x9a\x3f\xa1\x42\xed\x25\x98\x1c\x8d\xc2\x80\x62\x3e\x9e\xd8\x7b\xf3\xac\x8c\x3e\xa3\x95\x24\x2f\xa4\x11\xeb\x54\x2a\x77\x60\x36\x10\xba\x2e\x59\xc0\x8e\x7f\x59\xb6\x30\xec\xb8\x9a\xdb\xd8\xc2\xdb\xe1\xf5\x05\xc9\x0b\xfa\x8b\x09\x39\x91\x9f\xdc\x7c\xce\x85\x7c\xb8\xc4\x9b\x37\x84\x35\xcb\x72\x53\x1c\x1b\x3a\x61\x3b\xf6\x70\x6d\xa4\xf7\x0e\x1a\x3c\x12\xa0\x6b\x6d\x97\xed\x53\x23\x91\xd3\x79\xc8\xc4\x13\xdb\x15\xc0\x5b\x6b\x2f\x06\x03\x6d\xaf\xf9\xa7\xa4\xa3\x3d\x07\x72\x97\x55\x35\x3c\x5d\x72\xab\x00\xfe\x46\xed\xce\x12\x3d\x4c\xbe\x81\x8d\xc5\x7d\x47\x50\x96\x44\x01\x2f\x07\x83\x5a\x32\xb8\xa8\x45\xfb\x71\x9b\xf9\xb2\x4d\xb6\x67\xea\x0c\x0a\xf0\x76\x98\x3a\xf9\xee\x07\xc2\x76\xf5\x9f\x00\x00\x00\xff\xff\xa1\xe1\x2e\xde\xbd\x0f\x00\x00"), }, "/samples/override_software_versions.yaml": &vfsgen۰CompressedFileInfo{ name: "override_software_versions.yaml", - modTime: time.Date(2019, 10, 25, 15, 2, 27, 769200529, time.UTC), + modTime: time.Date(2019, 10, 25, 15, 17, 1, 340441964, time.UTC), uncompressedSize: 1285, compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x93\x41\x6f\x9b\x40\x10\x85\xef\xfb\x2b\x46\xee\xb5\x60\xd3\xde\xb8\xf6\x54\xb5\x52\x0f\x8d\x92\xf3\xc0\x8e\xcc\xc8\xcb\x2c\xda\x1d\x63\xf1\xef\x23\x16\xb0\x91\xa2\x38\x56\xe2\x28\x37\x34\xbc\x79\xc3\xf7\xf4\xc0\x8e\x1f\x29\x44\xf6\x52\xc2\x01\x2b\x14\x0a\x3e\x67\xbf\xed\x0b\x74\x5d\x83\x85\x39\xb0\xd8\x12\xfe\xcc\xaf\x4c\x4b\x8a\x16\x15\x4b\x03\x20\xd8\xd2\x65\xab\x30\xb1\xa3\x7a\x9c\xf7\x8b\xe1\x2e\x2f\xf2\x9d\x01\x30\x00\xb5\xe3\xff\x14\x7a\xae\x29\x8e\x12\x80\x6f\xf0\xaf\xa7\x10\xd8\x52\x04\x6d\x08\x58\x94\x82\xa0\x73\x03\x58\x52\x0a\x2d\x0b\x59\xf8\xf5\xf7\x37\xc4\x79\x6f\xf1\x85\x13\x6b\x93\x76\xba\xe0\x7b\xb6\x64\xa1\x47\x77\xa4\x64\x7b\xbe\xbd\x49\xc7\x37\x26\xcb\x32\xf3\x19\x90\xf7\x00\xe2\x16\xf7\x74\x15\x27\x29\x2e\xe7\xb7\xcb\x43\x56\xfb\xb6\x45\xb1\x99\x63\xa1\x6c\x31\x2c\xa7\xc0\xef\x8b\xfc\xe3\x36\x64\x2f\x6e\x48\x14\x81\x3a\x1f\x59\x7d\x18\xe0\x18\xc9\x42\x35\x8d\xd7\xe0\xf9\xbc\xfd\xd0\x10\x28\xee\xe1\xc4\xce\x41\xf5\x4a\x64\x49\x7b\x31\xbd\x39\x8c\x2f\x8e\x61\xe4\x4a\xfc\x2c\x2f\xf8\xc1\x52\xe7\xfc\xd0\x92\xe8\x2a\x89\x55\x70\x6f\x07\xa2\xb8\x9f\x3b\x5e\xdc\xbb\xe3\x3f\xaf\x91\x3e\x35\x24\x50\x79\x6d\xe6\xf2\xa2\xd8\xf5\x87\xfb\x73\x10\x18\xc6\x42\x53\x24\xd1\xef\xd3\xff\x30\xe9\x55\x03\x57\x47\xa5\xd9\x2f\x91\x2a\x1e\x92\xb8\x26\x4b\x52\x7f\xa0\xf9\xef\xac\xca\x73\x00\x00\x00\xff\xff\xf0\xb8\x4f\xcd\x05\x05\x00\x00"), }, "/samples/simple.yaml": &vfsgen۰FileInfo{ name: "simple.yaml", - modTime: time.Date(2019, 7, 30, 17, 44, 17, 334534490, time.UTC), + modTime: time.Date(2019, 6, 26, 20, 20, 34, 484370429, time.UTC), content: []byte("\x61\x70\x69\x56\x65\x72\x73\x69\x6f\x6e\x3a\x20\x6b\x61\x62\x61\x6e\x65\x72\x6f\x2e\x69\x6f\x2f\x76\x31\x61\x6c\x70\x68\x61\x31\x0a\x6b\x69\x6e\x64\x3a\x20\x4b\x61\x62\x61\x6e\x65\x72\x6f\x0a\x6d\x65\x74\x61\x64\x61\x74\x61\x3a\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x6b\x61\x62\x61\x6e\x65\x72\x6f\x0a\x73\x70\x65\x63\x3a\x20\x7b\x7d\x0a"), }, "/versions.yaml": &vfsgen۰CompressedFileInfo{ name: "versions.yaml", - modTime: time.Date(2019, 10, 25, 15, 2, 27, 769200529, time.UTC), + modTime: time.Date(2019, 10, 25, 15, 17, 1, 340685688, time.UTC), uncompressedSize: 2860, compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x96\xcf\x8e\xa3\x38\x10\xc6\xef\x3c\x45\x89\x5c\x76\xa5\x40\xfe\x48\xad\x96\xb8\xb6\xf6\xb0\x5a\xed\xee\xa5\x47\x73\x76\x4c\x11\xac\x31\x2e\xda\x65\x92\xe1\xed\x47\x36\x98\x40\x92\x43\xa6\xa5\x9e\xe9\xab\xed\xfa\xea\x57\x9f\x0b\x17\x2b\xf8\x57\xb4\x0c\xff\x88\x83\x30\x68\x09\x5a\x2d\x5c\x45\xb6\x81\x13\x5a\x56\x64\xc0\x11\x58\xd4\xc2\x61\x09\x92\x9a\x96\x0c\x1a\x17\x37\x39\x59\x41\x67\x4a\xb4\xec\x88\x4a\x38\xf4\xe0\x6a\x04\x72\x35\x5a\xa0\x16\xad\x70\x64\x39\x87\x24\x59\xc1\x7f\xe4\x30\xec\x56\xa4\x35\x9d\x95\x39\x02\xe3\x5b\x87\x46\x62\x11\xd6\x27\x82\x18\x08\x07\x94\xd4\x20\x83\x38\x0b\x8b\xc9\x0a\xa8\x02\x01\x06\xcf\x13\x1a\x55\xcb\xc8\xc8\xbe\x06\x65\xa0\x15\xd6\x79\x22\x2c\x95\xf3\xd9\x5c\xad\x18\x2a\xa5\xbd\xd2\xff\x46\x0e\x30\x13\x24\x08\x8b\x60\x49\x6b\x2c\x81\x3a\xb7\x0e\xbb\xa2\x6c\x94\x51\xec\x06\x1c\x29\x0c\xc8\x9a\x88\xd1\x7b\xd2\xb1\x17\xf2\xa7\x3c\xd1\x84\x10\xd1\x16\x89\x67\x88\x16\x99\x3a\x2b\x31\x87\x57\xcf\x23\x45\xc7\xe8\x5d\x1c\x3c\x8b\xbb\xec\x33\x1c\x10\xba\xb6\x0c\xc6\x77\x3c\x55\xd0\x88\xb6\x55\xe6\xe8\x2d\xfd\x5a\xa3\x59\xaa\x2b\xc3\x4e\xf8\xda\x4a\x42\x06\x43\x0e\xb8\x45\xa9\xaa\x1e\xce\xb5\x92\xf5\xdc\xb8\x29\x66\xa8\x65\x1d\x8a\x51\x0c\x8a\x83\xe4\x49\xe8\x0e\x93\x12\x2b\xd1\x69\x57\x40\xba\xcd\xf7\xf9\x36\xf5\x59\x5f\xa9\x05\x8d\x27\xd4\xc5\xd8\x17\x7c\x53\x7d\xc0\x67\xaa\x9c\xbf\xb8\x4b\xaf\x7c\x1b\x8f\x15\x49\x16\x17\x83\xf2\x2e\xdf\xa5\x09\xc4\x2e\xcb\xe2\xf9\x02\x12\x00\x00\xa9\x55\xc6\x68\x4f\x4a\x22\x8f\xc7\xb7\x69\xd8\xd1\xc2\x94\xca\x1c\x2f\x8b\xd7\xb2\xfb\x8f\x90\xdd\x0f\xe7\x1e\x95\xdd\xdf\x93\x9d\x16\x65\x8d\x59\xec\xc1\x02\xd2\xe7\xcb\x4e\x34\x2b\x93\x35\x86\x98\xa7\xe0\x7f\x4c\x1b\xdd\x2d\x92\x8b\x72\x02\x70\xed\xc0\x28\x46\x56\xd6\x18\xfa\x78\x40\x4d\x97\x0b\x9b\x51\x61\xb3\x1d\x6e\x02\x40\x95\x68\x9c\xaa\x14\x5a\x2e\xc2\x82\x2f\xb8\x25\x56\x8e\x6c\x5f\x40\x1a\xe9\x62\x64\x3a\x1e\x72\xe2\x38\xcf\x7c\xd7\xb9\xdf\x80\x33\xf4\xee\xf5\xed\xbc\x1f\x70\xae\xf3\x0e\xca\xcb\xdd\x52\xd3\x08\x53\x66\x5a\x19\x9c\x04\xef\xc2\xdf\x41\xcd\xac\x8c\x99\x3f\x11\xef\x29\xb0\x59\xb9\xbb\x65\xde\xe5\xbb\xcf\xc9\xbc\x44\xbb\xfb\x38\x7d\x34\x6f\xa6\xe6\xc8\x5a\x3d\xf4\x41\x3d\xfc\x7d\xff\x62\x2f\xc7\x8f\x6d\xfe\xb6\x25\x00\x2b\x78\xa1\xa6\x15\x4e\x1d\x34\xc2\x59\xb9\x7a\xf1\xc6\x4d\xb3\x29\xbc\x74\xf9\x55\xad\xcf\x3f\xf1\x6d\xd6\xf8\x78\x89\x6f\x9d\xe8\x73\x45\x1b\x94\x5a\xb5\x8c\x9b\x39\xf3\xb2\xae\xe7\xe9\x11\x59\x2d\xb9\x4b\x6c\x35\xf5\x0c\x62\x9c\xb5\x4a\xce\xc7\xec\x5f\x83\x30\xbc\xd4\x61\xe4\xe3\xc2\x95\x78\x30\x88\xfa\xd9\x6b\x80\x7b\x23\x07\x73\xdc\xcc\x93\xa5\xd0\x30\xe6\xc3\xaf\xca\xa1\x5f\xc0\xe4\x10\xa4\xfe\x1e\x7f\x94\xd0\xce\x15\x16\xd4\xa3\x04\xdf\xfe\x51\xcd\x13\x05\xb5\x3f\x16\xa3\xa8\xa5\x26\xff\xde\xe8\x3f\xd7\x63\xe4\xbd\x7a\x00\x8d\xb3\xbd\xaf\xc8\xe2\x5b\xa7\x2c\x96\xfe\x3e\x17\x32\x41\xf9\x0b\x23\x2f\xf2\xc5\xf8\x60\xf6\xfa\xa6\xdf\x9f\x3e\xa4\x07\xee\xb4\x79\x8d\xd7\x4d\x1d\x52\xff\x08\x00\x00\xff\xff\x12\x27\x79\x07\x2c\x0b\x00\x00"), }, } fs["/"].(*vfsgen۰DirInfo).entries = []os.FileInfo{ + fs["/.DS_Store"].(os.FileInfo), fs["/orchestrations"].(os.FileInfo), fs["/samples"].(os.FileInfo), fs["/versions.yaml"].(os.FileInfo), } fs["/orchestrations"].(*vfsgen۰DirInfo).entries = []os.FileInfo{ + fs["/orchestrations/.DS_Store"].(os.FileInfo), fs["/orchestrations/che"].(os.FileInfo), fs["/orchestrations/cli-services"].(os.FileInfo), fs["/orchestrations/landing"].(os.FileInfo), diff --git a/pkg/controller/kabaneroplatform/kabaneroplatform_controller.go b/pkg/controller/kabaneroplatform/kabaneroplatform_controller.go index b866ce80..cccc814a 100644 --- a/pkg/controller/kabaneroplatform/kabaneroplatform_controller.go +++ b/pkg/controller/kabaneroplatform/kabaneroplatform_controller.go @@ -327,7 +327,7 @@ func processStatus(ctx context.Context, request reconcile.Request, k *kabanerov1 // Gather the status of all resource dependencies. isAppsodyReady, _ := getAppsodyStatus(k, c, reqLogger) isTektonReady, _ := getTektonStatus(k, c) - isKnativeServingReady, _ := getKnativeServingStatus(k, c, reqLogger) + isServerlessReady, _ := getServerlessStatus(k, c, reqLogger) isKnativeEventingReady, _ := getKnativeEventingStatus(k, c, reqLogger) isCliRouteReady, _ := getCliRouteStatus(k, reqLogger, c) isKabaneroLandingReady, _ := getKabaneroLandingPageStatus(k, c) @@ -337,7 +337,7 @@ func processStatus(ctx context.Context, request reconcile.Request, k *kabanerov1 // Set the overall status. isKabaneroReady := isTektonReady && isKnativeEventingReady && - isKnativeServingReady && + isServerlessReady && isCliRouteReady && isKabaneroLandingReady && isAppsodyReady && diff --git a/pkg/controller/kabaneroplatform/knative_serving.go b/pkg/controller/kabaneroplatform/knative_serving.go deleted file mode 100644 index 06b5ef9c..00000000 --- a/pkg/controller/kabaneroplatform/knative_serving.go +++ /dev/null @@ -1,87 +0,0 @@ -package kabaneroplatform - -import ( - "context" - "encoding/json" - "strings" - - "github.com/go-logr/logr" - kabanerov1alpha1 "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1" - knsv1alpha1 "github.com/knative/serving-operator/pkg/apis/serving/v1alpha1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -// Retrieves the knative serving instance status. -func getKnativeServingStatus(k *kabanerov1alpha1.Kabanero, c client.Client, reqLogger logr.Logger) (bool, error) { - k.Status.KnativeServing.ErrorMessage = "" - k.Status.KnativeServing.Ready = "False" - - // Hack get unstructured and then feed it into the knative-serving object as JSON. - // The controller-runtime client is a caching client for reads and I can't figure out - // how to get it to cache arbitrary objects in another namespace. Unstructured reads - // are not cached. - knsInstance := &unstructured.Unstructured{} - knsInstance.SetGroupVersionKind(schema.GroupVersionKind{ - Kind: "KnativeServing", - Group: "serving.knative.dev", - Version: "v1alpha1", - }) - - knsInstNamespace, knsInstName := "knative-serving", "knative-serving" - err := c.Get(context.TODO(), client.ObjectKey{ - Name: knsInstName, - Namespace: knsInstNamespace}, knsInstance) - - if err != nil { - if apierrors.IsNotFound(err) { - k.Status.KnativeServing.ErrorMessage = "Knative serving instance with the name of " + knsInstName + " under the namespace of " + knsInstNamespace + " could not be found." - } else { - k.Status.KnativeServing.ErrorMessage = "Error retrieving KnativeServing instance: " + err.Error() - } - - reqLogger.Error(err, k.Status.KnativeServing.ErrorMessage) - return false, err - } - - data, err := knsInstance.MarshalJSON() - if err != nil { - k.Status.KnativeServing.ErrorMessage = err.Error() - reqLogger.Error(err, "Error marshalling unstructured KnativeServing data") - return false, err - } - - kns := &knsv1alpha1.KnativeServing{} - err = json.Unmarshal(data, kns) - if err != nil { - k.Status.KnativeServing.ErrorMessage = err.Error() - reqLogger.Error(err, "Error unmarshalling unstructured KnativeServing data") - return false, err - } - - // Find the ready type condition. A status can be either True, False, or Unknown. - // An Unknown status value is treated the same as a value of False. - statusReadyType := "ready" - ready := false - k.Status.KnativeServing.Version = kns.Status.Version - - knsConditions := kns.Status.Conditions - for _, condition := range knsConditions { - if strings.ToLower(string(condition.Type)) == statusReadyType { - status := string(condition.Status) - k.Status.KnativeServing.Ready = status - - if strings.ToLower(status) == "true" { - ready = true - } else { - k.Status.KnativeServing.ErrorMessage = condition.Message - } - - break - } - } - - return ready, err -} diff --git a/pkg/controller/kabaneroplatform/serverless.go b/pkg/controller/kabaneroplatform/serverless.go new file mode 100644 index 00000000..685ea049 --- /dev/null +++ b/pkg/controller/kabaneroplatform/serverless.go @@ -0,0 +1,193 @@ +package kabaneroplatform + +import ( + "context" + "encoding/json" + "fmt" + "strings" + + "github.com/go-logr/logr" + kabanerov1alpha1 "github.com/kabanero-io/kabanero-operator/pkg/apis/kabanero/v1alpha1" + knsv1alpha1 "github.com/knative/serving-operator/pkg/apis/serving/v1alpha1" + olmapiv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +// Constansts +const ( + serverlessSubscriptionName = "serverless-operator" + serverlessSubscriptionNamespace = "openshift-operators" +) + +// Returns the OpenShift serverless status. The status is based on the availability of the components +// that make up OpenShift serverless. +func getServerlessStatus(k *kabanerov1alpha1.Kabanero, c client.Client, reqLogger logr.Logger) (bool, error) { + // Find the installed CSV name. + installedCSVName, err := getInstalledCSVName(k, c, reqLogger) + if err != nil { + message := "Unable to retrieve the name of the installed CSV from the serverless subscription" + k.Status.Serverless.Ready = "False" + k.Status.Serverless.ErrorMessage = message + ". Error: " + err.Error() + reqLogger.Error(err, message) + return false, err + } + + // Find and set the serveless version. + csvVersion, err := getServerlessCSVVersion(k, c, installedCSVName, reqLogger) + if err != nil { + message := "Unable to retrieve the version of installed serverless CSV with the name of " + installedCSVName + k.Status.Serverless.Ready = "False" + k.Status.Serverless.ErrorMessage = message + ". Error: " + err.Error() + reqLogger.Error(err, message) + return false, err + } + k.Status.Serverless.Version = csvVersion + + // Set the status. The serverless status is based on the status of the components that are part of + // the serverless operator. + ready, _ := getKnativeServingStatus(k, c, reqLogger) + + if !ready { + k.Status.Serverless.Ready = "False" + k.Status.Serverless.KnativeServing.ErrorMessage = "Knative serving not ready." + return ready, nil + } + + k.Status.Serverless.Ready = "True" + k.Status.Serverless.ErrorMessage = "" + + return ready, err +} + +// Returns the name of the installed serverless CSV. +func getInstalledCSVName(k *kabanerov1alpha1.Kabanero, c client.Client, reqLogger logr.Logger) (string, error) { + sInstance := &unstructured.Unstructured{} + sInstance.SetGroupVersionKind(schema.GroupVersionKind{ + Group: olmapiv1alpha1.GroupName, + Version: olmapiv1alpha1.GroupVersion, + Kind: olmapiv1alpha1.SubscriptionKind, + }) + + err := c.Get(context.TODO(), client.ObjectKey{ + Namespace: serverlessSubscriptionNamespace, + Name: serverlessSubscriptionName}, sInstance) + + if err != nil { + return "", err + } + + installedCSVName, found, err := unstructured.NestedString(sInstance.Object, "status", "installedCSV") + if err != nil { + return "", err + } + if !found { + err = fmt.Errorf("The value of the installedCSV entry in the serverless subscription entry was not found") + return "", err + } + + return installedCSVName, nil +} + +// Returns the version of the serverless CSV associated with the input CSV name. +func getServerlessCSVVersion(k *kabanerov1alpha1.Kabanero, c client.Client, csvName string, reqLogger logr.Logger) (string, error) { + csvInstance := &unstructured.Unstructured{} + csvInstance.SetGroupVersionKind(schema.GroupVersionKind{ + Group: olmapiv1alpha1.GroupName, + Version: olmapiv1alpha1.GroupVersion, + Kind: olmapiv1alpha1.ClusterServiceVersionKind, + }) + + err := c.Get(context.TODO(), client.ObjectKey{ + Namespace: serverlessSubscriptionNamespace, + Name: csvName}, csvInstance) + + if err != nil { + return "", err + } + + csvVersion, found, err := unstructured.NestedString(csvInstance.Object, "spec", "version") + if err != nil { + return "", err + } + if !found { + err = fmt.Errorf("The value of the spec.version entry in the serverless CSV was not found") + return "", err + } + + return csvVersion, nil +} + +// Retrieves the knative serving instance status. +func getKnativeServingStatus(k *kabanerov1alpha1.Kabanero, c client.Client, reqLogger logr.Logger) (bool, error) { + k.Status.Serverless.KnativeServing.ErrorMessage = "" + k.Status.Serverless.KnativeServing.Ready = "False" + + // Hack get unstructured and then feed it into the knative-serving object as JSON. + // The controller-runtime client is a caching client for reads and I can't figure out + // how to get it to cache arbitrary objects in another namespace. Unstructured reads + // are not cached. + knsInstance := &unstructured.Unstructured{} + knsInstance.SetGroupVersionKind(schema.GroupVersionKind{ + Kind: "KnativeServing", + Group: "serving.knative.dev", + Version: "v1alpha1", + }) + + knsInstNamespace, knsInstName := "knative-serving", "knative-serving" + err := c.Get(context.TODO(), client.ObjectKey{ + Name: knsInstName, + Namespace: knsInstNamespace}, knsInstance) + + if err != nil { + if apierrors.IsNotFound(err) { + k.Status.Serverless.KnativeServing.ErrorMessage = "Knative serving instance with the name of " + knsInstName + " under the namespace of " + knsInstNamespace + " could not be found." + } else { + k.Status.Serverless.KnativeServing.ErrorMessage = "Error retrieving KnativeServing instance: " + err.Error() + } + + reqLogger.Error(err, k.Status.Serverless.KnativeServing.ErrorMessage) + return false, err + } + + data, err := knsInstance.MarshalJSON() + if err != nil { + k.Status.Serverless.KnativeServing.ErrorMessage = err.Error() + reqLogger.Error(err, "Error marshalling unstructured KnativeServing data") + return false, err + } + + kns := &knsv1alpha1.KnativeServing{} + err = json.Unmarshal(data, kns) + if err != nil { + k.Status.Serverless.KnativeServing.ErrorMessage = err.Error() + reqLogger.Error(err, "Error unmarshalling unstructured KnativeServing data") + return false, err + } + + // Find the ready type condition. A status can be either True, False, or Unknown. + // An Unknown status value is treated the same as a value of False. + statusReadyType := "ready" + ready := false + k.Status.Serverless.KnativeServing.Version = kns.Status.Version + + knsConditions := kns.Status.Conditions + for _, condition := range knsConditions { + if strings.ToLower(string(condition.Type)) == statusReadyType { + status := string(condition.Status) + k.Status.Serverless.KnativeServing.Ready = status + + if strings.ToLower(status) == "true" { + ready = true + } else { + k.Status.Serverless.KnativeServing.ErrorMessage = condition.Message + } + + break + } + } + + return ready, err +} diff --git a/registry/manifests/kabanero-operator/0.3.0/kabanero-operator.v0.3.0.clusterserviceversion.yaml b/registry/manifests/kabanero-operator/0.3.0/kabanero-operator.v0.3.0.clusterserviceversion.yaml index b357d563..f39ededb 100644 --- a/registry/manifests/kabanero-operator/0.3.0/kabanero-operator.v0.3.0.clusterserviceversion.yaml +++ b/registry/manifests/kabanero-operator/0.3.0/kabanero-operator.v0.3.0.clusterserviceversion.yaml @@ -170,9 +170,14 @@ spec: path: knativeEventing.ready x-descriptors: - 'urn:alm:descriptor:com.tectonic.ui:label' + - description: Serverless readiness status. + displayName: Serverless Readiness + path: serverless.ready + x-descriptors: + - 'urn:alm:descriptor:com.tectonic.ui:label' - description: Knative serving readiness status. displayName: Knative Serving Readiness - path: knativeServing.ready + path: serverless.knativeServing.ready x-descriptors: - 'urn:alm:descriptor:com.tectonic.ui:label' - description: Tekton readiness status. diff --git a/registry/manifests/kabanero-operator/0.3.0/kabanero_kabanero_crd.yaml b/registry/manifests/kabanero-operator/0.3.0/kabanero_kabanero_crd.yaml index 61ab77ed..51d89ea4 100644 --- a/registry/manifests/kabanero-operator/0.3.0/kabanero_kabanero_crd.yaml +++ b/registry/manifests/kabanero-operator/0.3.0/kabanero_kabanero_crd.yaml @@ -194,8 +194,8 @@ spec: version: type: string type: object - knativeServing: - description: Knative serving instance readiness status. + landing: + description: Kabanero Landing page readiness status. properties: errorMessage: type: string @@ -204,11 +204,20 @@ spec: version: type: string type: object - landing: - description: Kabanero Landing page readiness status. + serverless: + description: OpenShift serverless operator status. properties: errorMessage: type: string + knativeServing: + properties: + errorMessage: + type: string + ready: + type: string + version: + type: string + type: object ready: type: string version: diff --git a/vendor/github.com/coreos/go-semver/LICENSE b/vendor/github.com/coreos/go-semver/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/vendor/github.com/coreos/go-semver/LICENSE @@ -0,0 +1,202 @@ + + 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/coreos/go-semver/example.go b/vendor/github.com/coreos/go-semver/example.go new file mode 100644 index 00000000..fd2ee5af --- /dev/null +++ b/vendor/github.com/coreos/go-semver/example.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + "github.com/coreos/go-semver/semver" + "os" +) + +func main() { + vA, err := semver.NewVersion(os.Args[1]) + if err != nil { + fmt.Println(err.Error()) + } + vB, err := semver.NewVersion(os.Args[2]) + if err != nil { + fmt.Println(err.Error()) + } + + fmt.Printf("%s < %s == %t\n", vA, vB, vA.LessThan(*vB)) +} diff --git a/vendor/github.com/coreos/go-semver/semver/semver.go b/vendor/github.com/coreos/go-semver/semver/semver.go new file mode 100644 index 00000000..110fc23e --- /dev/null +++ b/vendor/github.com/coreos/go-semver/semver/semver.go @@ -0,0 +1,268 @@ +// Copyright 2013-2015 CoreOS, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Semantic Versions http://semver.org +package semver + +import ( + "bytes" + "errors" + "fmt" + "strconv" + "strings" +) + +type Version struct { + Major int64 + Minor int64 + Patch int64 + PreRelease PreRelease + Metadata string +} + +type PreRelease string + +func splitOff(input *string, delim string) (val string) { + parts := strings.SplitN(*input, delim, 2) + + if len(parts) == 2 { + *input = parts[0] + val = parts[1] + } + + return val +} + +func New(version string) *Version { + return Must(NewVersion(version)) +} + +func NewVersion(version string) (*Version, error) { + v := Version{} + + if err := v.Set(version); err != nil { + return nil, err + } + + return &v, nil +} + +// Must is a helper for wrapping NewVersion and will panic if err is not nil. +func Must(v *Version, err error) *Version { + if err != nil { + panic(err) + } + return v +} + +// Set parses and updates v from the given version string. Implements flag.Value +func (v *Version) Set(version string) error { + metadata := splitOff(&version, "+") + preRelease := PreRelease(splitOff(&version, "-")) + dotParts := strings.SplitN(version, ".", 3) + + if len(dotParts) != 3 { + return fmt.Errorf("%s is not in dotted-tri format", version) + } + + parsed := make([]int64, 3, 3) + + for i, v := range dotParts[:3] { + val, err := strconv.ParseInt(v, 10, 64) + parsed[i] = val + if err != nil { + return err + } + } + + v.Metadata = metadata + v.PreRelease = preRelease + v.Major = parsed[0] + v.Minor = parsed[1] + v.Patch = parsed[2] + return nil +} + +func (v Version) String() string { + var buffer bytes.Buffer + + fmt.Fprintf(&buffer, "%d.%d.%d", v.Major, v.Minor, v.Patch) + + if v.PreRelease != "" { + fmt.Fprintf(&buffer, "-%s", v.PreRelease) + } + + if v.Metadata != "" { + fmt.Fprintf(&buffer, "+%s", v.Metadata) + } + + return buffer.String() +} + +func (v *Version) UnmarshalYAML(unmarshal func(interface{}) error) error { + var data string + if err := unmarshal(&data); err != nil { + return err + } + return v.Set(data) +} + +func (v Version) MarshalJSON() ([]byte, error) { + return []byte(`"` + v.String() + `"`), nil +} + +func (v *Version) UnmarshalJSON(data []byte) error { + l := len(data) + if l == 0 || string(data) == `""` { + return nil + } + if l < 2 || data[0] != '"' || data[l-1] != '"' { + return errors.New("invalid semver string") + } + return v.Set(string(data[1 : l-1])) +} + +// Compare tests if v is less than, equal to, or greater than versionB, +// returning -1, 0, or +1 respectively. +func (v Version) Compare(versionB Version) int { + if cmp := recursiveCompare(v.Slice(), versionB.Slice()); cmp != 0 { + return cmp + } + return preReleaseCompare(v, versionB) +} + +// Equal tests if v is equal to versionB. +func (v Version) Equal(versionB Version) bool { + return v.Compare(versionB) == 0 +} + +// LessThan tests if v is less than versionB. +func (v Version) LessThan(versionB Version) bool { + return v.Compare(versionB) < 0 +} + +// Slice converts the comparable parts of the semver into a slice of integers. +func (v Version) Slice() []int64 { + return []int64{v.Major, v.Minor, v.Patch} +} + +func (p PreRelease) Slice() []string { + preRelease := string(p) + return strings.Split(preRelease, ".") +} + +func preReleaseCompare(versionA Version, versionB Version) int { + a := versionA.PreRelease + b := versionB.PreRelease + + /* Handle the case where if two versions are otherwise equal it is the + * one without a PreRelease that is greater */ + if len(a) == 0 && (len(b) > 0) { + return 1 + } else if len(b) == 0 && (len(a) > 0) { + return -1 + } + + // If there is a prerelease, check and compare each part. + return recursivePreReleaseCompare(a.Slice(), b.Slice()) +} + +func recursiveCompare(versionA []int64, versionB []int64) int { + if len(versionA) == 0 { + return 0 + } + + a := versionA[0] + b := versionB[0] + + if a > b { + return 1 + } else if a < b { + return -1 + } + + return recursiveCompare(versionA[1:], versionB[1:]) +} + +func recursivePreReleaseCompare(versionA []string, versionB []string) int { + // A larger set of pre-release fields has a higher precedence than a smaller set, + // if all of the preceding identifiers are equal. + if len(versionA) == 0 { + if len(versionB) > 0 { + return -1 + } + return 0 + } else if len(versionB) == 0 { + // We're longer than versionB so return 1. + return 1 + } + + a := versionA[0] + b := versionB[0] + + aInt := false + bInt := false + + aI, err := strconv.Atoi(versionA[0]) + if err == nil { + aInt = true + } + + bI, err := strconv.Atoi(versionB[0]) + if err == nil { + bInt = true + } + + // Handle Integer Comparison + if aInt && bInt { + if aI > bI { + return 1 + } else if aI < bI { + return -1 + } + } + + // Handle String Comparison + if a > b { + return 1 + } else if a < b { + return -1 + } + + return recursivePreReleaseCompare(versionA[1:], versionB[1:]) +} + +// BumpMajor increments the Major field by 1 and resets all other fields to their default values +func (v *Version) BumpMajor() { + v.Major += 1 + v.Minor = 0 + v.Patch = 0 + v.PreRelease = PreRelease("") + v.Metadata = "" +} + +// BumpMinor increments the Minor field by 1 and resets all other fields to their default values +func (v *Version) BumpMinor() { + v.Minor += 1 + v.Patch = 0 + v.PreRelease = PreRelease("") + v.Metadata = "" +} + +// BumpPatch increments the Patch field by 1 and resets all other fields to their default values +func (v *Version) BumpPatch() { + v.Patch += 1 + v.PreRelease = PreRelease("") + v.Metadata = "" +} diff --git a/vendor/github.com/coreos/go-semver/semver/sort.go b/vendor/github.com/coreos/go-semver/semver/sort.go new file mode 100644 index 00000000..e256b41a --- /dev/null +++ b/vendor/github.com/coreos/go-semver/semver/sort.go @@ -0,0 +1,38 @@ +// Copyright 2013-2015 CoreOS, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semver + +import ( + "sort" +) + +type Versions []*Version + +func (s Versions) Len() int { + return len(s) +} + +func (s Versions) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} + +func (s Versions) Less(i, j int) bool { + return s[i].LessThan(*s[j]) +} + +// Sort sorts the given slice of Version +func Sort(versions []*Version) { + sort.Sort(Versions(versions)) +} diff --git a/vendor/github.com/jcrossley3/manifestival/manifestival.go b/vendor/github.com/jcrossley3/manifestival/manifestival.go deleted file mode 100644 index 9f3996a5..00000000 --- a/vendor/github.com/jcrossley3/manifestival/manifestival.go +++ /dev/null @@ -1,176 +0,0 @@ -package manifestival - -import ( - "context" - "fmt" - - "k8s.io/apimachinery/pkg/api/equality" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "sigs.k8s.io/controller-runtime/pkg/client" - logf "sigs.k8s.io/controller-runtime/pkg/runtime/log" -) - -var ( - log = logf.Log.WithName("manifestival") -) - -type Manifestival interface { - // Either updates or creates all resources in the manifest - ApplyAll() error - // Updates or creates a particular resource - Apply(*unstructured.Unstructured) error - // Deletes all resources in the manifest - DeleteAll(opts ...client.DeleteOptionFunc) error - // Deletes a particular resource - Delete(spec *unstructured.Unstructured, opts ...client.DeleteOptionFunc) error - // Returns a copy of the resource from the api server, nil if not found - Get(spec *unstructured.Unstructured) (*unstructured.Unstructured, error) - // Transforms the resources within a Manifest - Transform(fns ...Transformer) error -} - -type Manifest struct { - Resources []unstructured.Unstructured - client client.Client -} - -var _ Manifestival = &Manifest{} - -func NewManifest(pathname string, recursive bool, client client.Client) (Manifest, error) { - log.Info("Reading file", "name", pathname) - resources, err := Parse(pathname, recursive) - if err != nil { - return Manifest{}, err - } - return Manifest{Resources: resources, client: client}, nil -} - -func (f *Manifest) ApplyAll() error { - for _, spec := range f.Resources { - if err := f.Apply(&spec); err != nil { - return err - } - } - return nil -} - -func (f *Manifest) Apply(spec *unstructured.Unstructured) error { - current, err := f.Get(spec) - if err != nil { - return err - } - if current == nil { - logResource("Creating", spec) - annotate(spec, "manifestival", resourceCreated) - if err = f.client.Create(context.TODO(), spec.DeepCopy()); err != nil { - return err - } - } else { - // Update existing one - if UpdateChanged(spec.UnstructuredContent(), current.UnstructuredContent()) { - logResource("Updating", spec) - if err = f.client.Update(context.TODO(), current); err != nil { - return err - } - } - } - return nil -} - -func (f *Manifest) DeleteAll(opts ...client.DeleteOptionFunc) error { - a := make([]unstructured.Unstructured, len(f.Resources)) - copy(a, f.Resources) - // we want to delete in reverse order - for left, right := 0, len(a)-1; left < right; left, right = left+1, right-1 { - a[left], a[right] = a[right], a[left] - } - for _, spec := range a { - if okToDelete(&spec) { - if err := f.Delete(&spec, opts...); err != nil { - return err - } - } - } - return nil -} - -func (f *Manifest) Delete(spec *unstructured.Unstructured, opts ...client.DeleteOptionFunc) error { - current, err := f.Get(spec) - if current == nil && err == nil { - return nil - } - logResource("Deleting", spec) - if err := f.client.Delete(context.TODO(), spec, opts...); err != nil { - // ignore GC race conditions triggered by owner references - if !errors.IsNotFound(err) { - return err - } - } - return nil -} - -func (f *Manifest) Get(spec *unstructured.Unstructured) (*unstructured.Unstructured, error) { - key := client.ObjectKey{Namespace: spec.GetNamespace(), Name: spec.GetName()} - result := &unstructured.Unstructured{} - result.SetGroupVersionKind(spec.GroupVersionKind()) - err := f.client.Get(context.TODO(), key, result) - if err != nil { - result = nil - if errors.IsNotFound(err) { - err = nil - } - } - return result, err -} - -// We need to preserve the top-level target keys, specifically -// 'metadata.resourceVersion', 'spec.clusterIP', and any existing -// entries in a ConfigMap's 'data' field. So we only overwrite fields -// set in our src resource. -// TODO: Use Patch instead -func UpdateChanged(src, tgt map[string]interface{}) bool { - changed := false - for k, v := range src { - if v, ok := v.(map[string]interface{}); ok { - if tgt[k] == nil { - tgt[k], changed = v, true - } else if UpdateChanged(v, tgt[k].(map[string]interface{})) { - // This could be an issue if a field in a nested src - // map doesn't overwrite its corresponding tgt - changed = true - } - continue - } - if !equality.Semantic.DeepEqual(v, tgt[k]) { - tgt[k], changed = v, true - } - } - return changed -} - -func logResource(msg string, spec *unstructured.Unstructured) { - name := fmt.Sprintf("%s/%s", spec.GetNamespace(), spec.GetName()) - log.Info(msg, "name", name, "type", spec.GroupVersionKind()) -} - -func annotate(spec *unstructured.Unstructured, key string, value string) { - annotations := spec.GetAnnotations() - if annotations == nil { - annotations = make(map[string]string) - } - annotations[key] = value - spec.SetAnnotations(annotations) -} - -func okToDelete(spec *unstructured.Unstructured) bool { - switch spec.GetKind() { - case "Namespace": - return spec.GetAnnotations()["manifestival"] == resourceCreated - } - return true -} - -const ( - resourceCreated = "new" -) diff --git a/vendor/github.com/jcrossley3/manifestival/transform.go b/vendor/github.com/jcrossley3/manifestival/transform.go deleted file mode 100644 index e43f5bd8..00000000 --- a/vendor/github.com/jcrossley3/manifestival/transform.go +++ /dev/null @@ -1,105 +0,0 @@ -package manifestival - -import ( - "os" - "strings" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// Transform a resource from the manifest -type Transformer func(u *unstructured.Unstructured) error - -type Owner interface { - v1.Object - schema.ObjectKind -} - -// If an error occurs, no resources are transformed -func (f *Manifest) Transform(fns ...Transformer) error { - var results []unstructured.Unstructured - for i := 0; i < len(f.Resources); i++ { - spec := f.Resources[i].DeepCopy() - for _, transform := range fns { - err := transform(spec) - if err != nil { - return err - } - } - results = append(results, *spec) - } - f.Resources = results - return nil -} - -// We assume all resources in the manifest live in the same namespace -func InjectNamespace(ns string) Transformer { - namespace := resolveEnv(ns) - return func(u *unstructured.Unstructured) error { - switch strings.ToLower(u.GetKind()) { - case "namespace": - u.SetName(namespace) - case "clusterrolebinding": - subjects, _, _ := unstructured.NestedFieldNoCopy(u.Object, "subjects") - for _, subject := range subjects.([]interface{}) { - m := subject.(map[string]interface{}) - if _, ok := m["namespace"]; ok { - m["namespace"] = namespace - } - } - } - if !isClusterScoped(u.GetKind()) { - u.SetNamespace(namespace) - } - return nil - } -} - -func InjectOwner(owner Owner) Transformer { - return func(u *unstructured.Unstructured) error { - if !isClusterScoped(u.GetKind()) { - // apparently reference counting for cluster-scoped - // resources is broken, so trust the GC only for ns-scoped - // dependents - u.SetOwnerReferences([]v1.OwnerReference{*v1.NewControllerRef(owner, owner.GroupVersionKind())}) - } - return nil - } -} - -func isClusterScoped(kind string) bool { - // TODO: something more clever using !APIResource.Namespaced maybe? - switch strings.ToLower(kind) { - case "componentstatus", - "namespace", - "node", - "persistentvolume", - "mutatingwebhookconfiguration", - "validatingwebhookconfiguration", - "customresourcedefinition", - "apiservice", - "meshpolicy", - "tokenreview", - "selfsubjectaccessreview", - "selfsubjectrulesreview", - "subjectaccessreview", - "certificatesigningrequest", - "podsecuritypolicy", - "clusterrolebinding", - "clusterrole", - "priorityclass", - "storageclass", - "volumeattachment": - return true - } - return false -} - -func resolveEnv(x string) string { - if len(x) > 1 && x[:1] == "$" { - return os.Getenv(x[1:]) - } - return x -} diff --git a/vendor/github.com/jcrossley3/manifestival/yaml.go b/vendor/github.com/jcrossley3/manifestival/yaml.go deleted file mode 100644 index 175035b4..00000000 --- a/vendor/github.com/jcrossley3/manifestival/yaml.go +++ /dev/null @@ -1,136 +0,0 @@ -package manifestival - -import ( - "io" - "io/ioutil" - "net/http" - "net/url" - "os" - "path" - "strings" - - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/util/yaml" -) - -// Parse parses YAML files into Unstructured objects. -// -// It supports 5 cases today: -// 1. pathname = path to a file --> parses that file. -// 2. pathname = path to a directory, recursive = false --> parses all files in -// that directory. -// 3. pathname = path to a directory, recursive = true --> parses all files in -// that directory and it's descendants -// 4. pathname = url --> fetches the contents of that URL and parses them as YAML. -// 5. pathname = combination of all previous cases, the string can contain -// multiple records (file, directory or url) separated by comma -func Parse(pathname string, recursive bool) ([]unstructured.Unstructured, error) { - - pathnames := strings.Split(pathname, ",") - aggregated := []unstructured.Unstructured{} - for _, pth := range pathnames { - els, err := read(pth, recursive) - if err != nil { - return nil, err - } - - aggregated = append(aggregated, els...) - } - return aggregated, nil -} - -// read cotains a logic to distinguish the type of record in pathname -// (file, directory or url) and calls the appropriate function -func read(pathname string, recursive bool) ([]unstructured.Unstructured, error) { - if isURL(pathname) { - return readURL(pathname) - } - - info, err := os.Stat(pathname) - if err != nil { - return nil, err - } - - if info.IsDir() { - return readDir(pathname, recursive) - } - return readFile(pathname) -} - -// readFile parses a single file. -func readFile(pathname string) ([]unstructured.Unstructured, error) { - file, err := os.Open(pathname) - if err != nil { - return nil, err - } - defer file.Close() - - return decode(file) -} - -// readDir parses all files in a single directory and it's descendant directories -// if the recursive flag is set to true. -func readDir(pathname string, recursive bool) ([]unstructured.Unstructured, error) { - list, err := ioutil.ReadDir(pathname) - if err != nil { - return nil, err - } - - aggregated := []unstructured.Unstructured{} - for _, f := range list { - name := path.Join(pathname, f.Name()) - var els []unstructured.Unstructured - - switch { - case f.IsDir() && recursive: - els, err = readDir(name, recursive) - case !f.IsDir(): - els, err = readFile(name) - } - - if err != nil { - return nil, err - } - aggregated = append(aggregated, els...) - } - return aggregated, nil -} - -// readURL fetches a URL and parses its contents as YAML. -func readURL(url string) ([]unstructured.Unstructured, error) { - resp, err := http.Get(url) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - return decode(resp.Body) -} - -// decode consumes the given reader and parses its contents as YAML. -func decode(reader io.Reader) ([]unstructured.Unstructured, error) { - decoder := yaml.NewYAMLToJSONDecoder(reader) - objs := []unstructured.Unstructured{} - var err error - for { - out := unstructured.Unstructured{} - err = decoder.Decode(&out) - if err != nil { - break - } - if len(out.Object) == 0 { - continue - } - objs = append(objs, out) - } - if err != io.EOF { - return nil, err - } - return objs, nil -} - -// isURL checks whether or not the given path parses as a URL. -func isURL(pathname string) bool { - _, err := url.ParseRequestURI(pathname) - return err == nil -} diff --git a/vendor/github.com/jcrossley3/manifestival/LICENSE b/vendor/github.com/operator-framework/operator-lifecycle-manager/LICENSE similarity index 100% rename from vendor/github.com/jcrossley3/manifestival/LICENSE rename to vendor/github.com/operator-framework/operator-lifecycle-manager/LICENSE diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/catalog/main.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/catalog/main.go new file mode 100644 index 00000000..6160ce97 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/catalog/main.go @@ -0,0 +1,74 @@ +package main + +import ( + "flag" + "fmt" + "net/http" + "os" + "strings" + "time" + + log "github.com/sirupsen/logrus" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/signals" + olmversion "github.com/operator-framework/operator-lifecycle-manager/pkg/version" +) + +const ( + defaultWakeupInterval = 15 * time.Minute + defaultCatalogNamespace = "tectonic-system" +) + +// config flags defined globally so that they appear on the test binary as well +var ( + kubeConfigPath = flag.String( + "kubeconfig", "", "absolute path to the kubeconfig file") + + wakeupInterval = flag.Duration( + "interval", defaultWakeupInterval, "wakeup interval") + + watchedNamespaces = flag.String( + "watchedNamespaces", "", "comma separated list of namespaces that catalog watches, leave empty to watch all namespaces") + + catalogNamespace = flag.String( + "namespace", defaultCatalogNamespace, "namespace where catalog will run and install catalog resources") + + debug = flag.Bool( + "debug", false, "use debug log level") + + version = flag.Bool("version", false, "displays olm version") +) + +func main() { + stopCh := signals.SetupSignalHandler() + + // Parse the command-line flags. + flag.Parse() + + // Check if version flag was set + if *version { + fmt.Print(olmversion.String()) + + // Exit early + os.Exit(0) + } + + if *debug { + log.SetLevel(log.DebugLevel) + } + + // Serve a health check. + http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + }) + go http.ListenAndServe(":8080", nil) + + // Create a new instance of the operator. + catalogOperator, err := catalog.NewOperator(*kubeConfigPath, *wakeupInterval, *catalogNamespace, strings.Split(*watchedNamespaces, ",")...) + if err != nil { + log.Panicf("error configuring operator: %s", err.Error()) + } + + catalogOperator.Run(stopCh) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/olm/main.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/olm/main.go new file mode 100644 index 00000000..0577d99e --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/olm/main.go @@ -0,0 +1,115 @@ +package main + +import ( + "flag" + "fmt" + "net/http" + "os" + "strings" + "time" + + log "github.com/sirupsen/logrus" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client" + "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install" + "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/olm" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/signals" + olmversion "github.com/operator-framework/operator-lifecycle-manager/pkg/version" +) + +const ( + envOperatorName = "OPERATOR_NAME" + envOperatorNamespace = "OPERATOR_NAMESPACE" + ALMManagedAnnotationKey = "alm-manager" + + defaultWakeupInterval = 5 * time.Minute +) + +// helper function for required env vars +func envOrDie(varname, description string) string { + val := os.Getenv(varname) + if len(val) == 0 { + log.Fatalf("must set env %s - %s", varname, description) + } + return val +} + +// config flags defined globally so that they appear on the test binary as well +var ( + kubeConfigPath = flag.String( + "kubeconfig", "", "absolute path to the kubeconfig file") + + wakeupInterval = flag.Duration( + "interval", defaultWakeupInterval, "wake up interval") + + watchedNamespaces = flag.String( + "watchedNamespaces", "", "comma separated list of namespaces for alm operator to watch. "+ + "If not set, or set to the empty string (e.g. `-watchedNamespaces=\"\"`), "+ + "alm operator will watch all namespaces in the cluster.") + + debug = flag.Bool( + "debug", false, "use debug log level") + + version = flag.Bool("version", false, "displays olm version") +) + +// main function - entrypoint to ALM operator +func main() { + stopCh := signals.SetupSignalHandler() + + // Parse the command-line flags. + flag.Parse() + + // Check if version flag was set + if *version { + fmt.Print(olmversion.String()) + + // Exit early + os.Exit(0) + } + + // Env Vars + operatorNamespace := envOrDie( + envOperatorNamespace, "used to set annotation indicating which ALM operator manages a namespace") + + operatorName := envOrDie( + envOperatorName, "used to distinguish ALM operators of the same name") + + annotation := map[string]string{ + ALMManagedAnnotationKey: fmt.Sprintf("%s.%s", operatorNamespace, operatorName), + } + + // Set log level to debug if `debug` flag set + if *debug { + log.SetLevel(log.DebugLevel) + } + + // `namespaces` will always contain at least one entry: if `*watchedNamespaces` is + // the empty string, the resulting array will be `[]string{""}`. + namespaces := strings.Split(*watchedNamespaces, ",") + + // Create a client for OLM + crClient, err := client.NewClient(*kubeConfigPath) + if err != nil { + log.Fatalf("error configuring client: %s", err.Error()) + } + + opClient := operatorclient.NewClientFromConfig(*kubeConfigPath) + + // Create a new instance of the operator. + operator, err := olm.NewOperator(crClient, opClient, &install.StrategyResolver{}, *wakeupInterval, annotation, namespaces) + + if err != nil { + log.Fatalf("error configuring operator: %s", err.Error()) + } + defer operator.Cleanup() + + // Serve a health check. + http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + }) + go http.ListenAndServe(":8080", nil) + + operator.Run(stopCh) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/package-server/main.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/package-server/main.go new file mode 100644 index 00000000..cd1a7e22 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/package-server/main.go @@ -0,0 +1,61 @@ +package main + +import ( + "flag" + "os" + "time" + + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" + k8sserver "k8s.io/apiserver/pkg/server" + "k8s.io/apiserver/pkg/util/logs" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/server" +) + +const ( + defaultWakeupInterval = 5 * time.Minute +) + +// config flags defined globally so that they appear on the test binary as well +var ( + stopCh = k8sserver.SetupSignalHandler() + options = server.NewPackageServerOptions(os.Stdout, os.Stderr) + cmd = &cobra.Command{ + Short: "Launch a package-server", + Long: "Launch a package-server", + RunE: func(c *cobra.Command, args []string) error { + if err := options.Run(stopCh); err != nil { + return err + } + return nil + }, + } +) + +func init() { + flags := cmd.Flags() + + // flags.BoolVar(&options.InsecureKubeletTLS, "kubelet-insecure-tls", options.InsecureKubeletTLS, "Do not verify CA of serving certificates presented by Kubelets. For testing purposes only.") + flags.DurationVar(&options.WakeupInterval, "interval", options.WakeupInterval, "Interval at which to re-sync CatalogSources") + flags.StringSliceVar(&options.WatchedNamespaces, "watched-namespaces", options.WatchedNamespaces, "List of namespaces the package-server will watch watch for CatalogSources") + flags.StringVar(&options.Kubeconfig, "kubeconfig", options.Kubeconfig, "The path to the kubeconfig used to connect to the Kubernetes API server and the Kubelets (defaults to in-cluster config)") + flags.BoolVar(&options.Debug, "debug", options.Debug, "use debug log level") + + options.SecureServing.AddFlags(flags) + options.Authentication.AddFlags(flags) + options.Authorization.AddFlags(flags) + options.Features.AddFlags(flags) + + flags.AddGoFlagSet(flag.CommandLine) + flags.Parse(flag.Args()) +} + +func main() { + logs.InitLogs() + defer logs.FlushLogs() + + if err := cmd.Execute(); err != nil { + log.Fatal(err) + } +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/validator/main.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/validator/main.go new file mode 100644 index 00000000..06827d46 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/validator/main.go @@ -0,0 +1,32 @@ +package main + +import ( + "fmt" + "log" + "os" + "path/filepath" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/schema" +) + +func main() { + manifestDir := os.Args[1] + + err := schema.CheckCatalogResources(manifestDir) + if err != nil { + log.Fatal(err) + } + + filepath.Walk(manifestDir, func(path string, f os.FileInfo, err error) error { + if path == manifestDir || !f.IsDir() { + return nil + } + + fmt.Printf("Validating upgrade path for %s in %s\n", f.Name(), path) + err = schema.CheckUpgradePath(path) + if err != nil { + log.Fatal(err) + } + return nil + }) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/doc.go new file mode 100644 index 00000000..c5345ebc --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/doc.go @@ -0,0 +1,5 @@ +// +k8s:deepcopy-gen=package + +// Package api is the internal version of the API. +// +groupName=operators.coreos.com +package operators diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/register.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/register.go new file mode 100644 index 00000000..d8b84c13 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/register.go @@ -0,0 +1,3 @@ +package operators + +const GroupName = "operators.coreos.com" diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/catalogsource_types.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/catalogsource_types.go new file mode 100644 index 00000000..cd285034 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/catalogsource_types.go @@ -0,0 +1,54 @@ +package v1alpha1 + +import ( + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +const ( + CatalogSourceCRDAPIVersion = operators.GroupName + "/" + GroupVersion + CatalogSourceKind = "CatalogSource" +) + +type CatalogSourceSpec struct { + SourceType string `json:"sourceType"` + ConfigMap string `json:"configMap,omitempty"` + Secrets []string `json:"secrets,omitempty"` + + // Metadata + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + Publisher string `json:"publisher,omitempty"` + Icon Icon `json:"icon,omitempty"` +} + +type CatalogSourceStatus struct { + ConfigMapResource *ConfigMapResourceReference `json:"configMapReference,omitempty"` + LastSync metav1.Time `json:"lastSync,omitempty"` +} +type ConfigMapResourceReference struct { + Name string `json:"name"` + Namespace string `json:"namespace"` + + UID types.UID `json:"uid,omitempty"` + ResourceVersion string `json:"resourceVersion,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient +type CatalogSource struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec CatalogSourceSpec `json:"spec"` + Status CatalogSourceStatus `json:"status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type CatalogSourceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []CatalogSource `json:"items"` +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion.go new file mode 100644 index 00000000..19720772 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion.go @@ -0,0 +1,57 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// obsoleteReasons are the set of reasons that mean a CSV should no longer be processed as active +var obsoleteReasons = map[ConditionReason]struct{}{ + CSVReasonReplaced: {}, + CSVReasonBeingReplaced: {}, +} + +// SetPhase sets the current phase and adds a condition if necessary +func (c *ClusterServiceVersion) SetPhase(phase ClusterServiceVersionPhase, reason ConditionReason, message string) { + c.Status.LastUpdateTime = metav1.Now() + if c.Status.Phase != phase { + c.Status.Phase = phase + c.Status.LastTransitionTime = metav1.Now() + } + c.Status.Message = message + c.Status.Reason = reason + if len(c.Status.Conditions) == 0 { + c.Status.Conditions = append(c.Status.Conditions, ClusterServiceVersionCondition{ + Phase: c.Status.Phase, + LastTransitionTime: c.Status.LastTransitionTime, + LastUpdateTime: c.Status.LastUpdateTime, + Message: message, + Reason: reason, + }) + } + previousCondition := c.Status.Conditions[len(c.Status.Conditions)-1] + if previousCondition.Phase != c.Status.Phase || previousCondition.Reason != c.Status.Reason { + c.Status.Conditions = append(c.Status.Conditions, ClusterServiceVersionCondition{ + Phase: c.Status.Phase, + LastTransitionTime: c.Status.LastTransitionTime, + LastUpdateTime: c.Status.LastUpdateTime, + Message: message, + Reason: reason, + }) + } +} + +// SetRequirementStatus adds the status of all requirements to the CSV status +func (c *ClusterServiceVersion) SetRequirementStatus(statuses []RequirementStatus) { + c.Status.RequirementStatus = statuses +} + +// IsObsolete returns if this CSV is being replaced or is marked for deletion +func (c *ClusterServiceVersion) IsObsolete() bool { + for _, condition := range c.Status.Conditions { + _, ok := obsoleteReasons[condition.Reason] + if ok { + return true + } + } + return false +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go new file mode 100644 index 00000000..0581f2ba --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go @@ -0,0 +1,284 @@ +// Package v1alpha1 implements all the required types and methods for parsing +// resources for v1alpha1 versioned ClusterServiceVersions. +package v1alpha1 + +import ( + "encoding/json" + "sort" + + "github.com/coreos/go-semver/semver" + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + ClusterServiceVersionAPIVersion = operators.GroupName + "/" + GroupVersion + ClusterServiceVersionKind = "ClusterServiceVersion" +) + +// NamedInstallStrategy represents the block of an ClusterServiceVersion resource +// where the install strategy is specified. +type NamedInstallStrategy struct { + StrategyName string `json:"strategy"` + StrategySpecRaw json.RawMessage `json:"spec,omitempty"` +} + +// StatusDescriptor describes a field in a status block of a CRD so that ALM can consume it +type StatusDescriptor struct { + Path string `json:"path"` + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + XDescriptors []string `json:"x-descriptors,omitempty"` + Value *json.RawMessage `json:"value,omitempty"` +} + +// SpecDescriptor describes a field in a spec block of a CRD so that ALM can consume it +type SpecDescriptor struct { + Path string `json:"path"` + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + XDescriptors []string `json:"x-descriptors,omitempty"` + Value *json.RawMessage `json:"value,omitempty"` +} + +// ActionDescriptor describes a declarative action that can be performed on a custom resource instance +type ActionDescriptor struct { + Path string `json:"path"` + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + XDescriptors []string `json:"x-descriptors,omitempty"` + Value *json.RawMessage `json:"value,omitempty"` +} + +// CRDDescription provides details to ALM about the CRDs +type CRDDescription struct { + Name string `json:"name"` + Version string `json:"version"` + Kind string `json:"kind"` + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + Resources []CRDResourceReference `json:"resources,omitempty"` + StatusDescriptors []StatusDescriptor `json:"statusDescriptors,omitempty"` + SpecDescriptors []SpecDescriptor `json:"specDescriptors,omitempty"` + ActionDescriptor []ActionDescriptor `json:"actionDescriptors,omitempty"` +} + +// CRDResourceReference is a Kubernetes resource type used by a custom resource +type CRDResourceReference struct { + Name string `json:"name"` + Kind string `json:"kind"` + Version string `json:"version"` +} + +// CustomResourceDefinitions declares all of the CRDs managed or required by +// an operator being ran by ClusterServiceVersion. +// +// If the CRD is present in the Owned list, it is implicitly required. +type CustomResourceDefinitions struct { + Owned []CRDDescription `json:"owned,omitempty"` + Required []CRDDescription `json:"required,omitempty"` +} + +// ClusterServiceVersionSpec declarations tell the ALM how to install an operator +// that can manage apps for given version and AppType. +type ClusterServiceVersionSpec struct { + InstallStrategy NamedInstallStrategy `json:"install"` + Version semver.Version `json:"version,omitempty"` + Maturity string `json:"maturity,omitempty"` + CustomResourceDefinitions CustomResourceDefinitions `json:"customresourcedefinitions,omitempty"` + DisplayName string `json:"displayName"` + Description string `json:"description,omitempty"` + Keywords []string `json:"keywords,omitempty"` + Maintainers []Maintainer `json:"maintainers,omitempty"` + Provider AppLink `json:"provider,omitempty"` + Links []AppLink `json:"links,omitempty"` + Icon []Icon `json:"icon,omitempty"` + + // The name of a CSV this one replaces. Should match the `metadata.Name` field of the old CSV. + // +optional + Replaces string `json:"replaces,omitempty"` + + // Map of string keys and values that can be used to organize and categorize + // (scope and select) objects. + // +optional + Labels map[string]string `json:"labels,omitempty" protobuf:"bytes,11,rep,name=labels"` + + // Annotations is an unstructured key value map stored with a resource that may be + // set by external tools to store and retrieve arbitrary metadata. + // +optional + Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,12,rep,name=annotations"` + + // Label selector for related resources. + // +optional + Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"` +} + +type Maintainer struct { + Name string `json:"name,omitempty"` + Email string `json:"email,omitempty"` +} + +type AppLink struct { + Name string `json:"name,omitempty"` + URL string `json:"url,omitempty"` +} + +type Icon struct { + Data string `json:"base64data"` + MediaType string `json:"mediatype"` +} + +// ClusterServiceVersionPhase is a label for the condition of a ClusterServiceVersion at the current time. +type ClusterServiceVersionPhase string + +// These are the valid phases of ClusterServiceVersion +const ( + CSVPhaseNone = "" + // CSVPhasePending means the csv has been accepted by the system, but the install strategy has not been attempted. + // This is likely because there are unmet requirements. + CSVPhasePending ClusterServiceVersionPhase = "Pending" + // CSVPhaseInstallReady means that the requirements are met but the install strategy has not been run. + CSVPhaseInstallReady ClusterServiceVersionPhase = "InstallReady" + // CSVPhaseInstalling means that the install strategy has been initiated but not completed. + CSVPhaseInstalling ClusterServiceVersionPhase = "Installing" + // CSVPhaseSucceeded means that the resources in the CSV were created successfully. + CSVPhaseSucceeded ClusterServiceVersionPhase = "Succeeded" + // CSVPhaseFailed means that the install strategy could not be successfully completed. + CSVPhaseFailed ClusterServiceVersionPhase = "Failed" + // CSVPhaseUnknown means that for some reason the state of the csv could not be obtained. + CSVPhaseUnknown ClusterServiceVersionPhase = "Unknown" + // CSVPhaseReplacing means that a newer CSV has been created and the csv's resources will be transitioned to a new owner. + CSVPhaseReplacing ClusterServiceVersionPhase = "Replacing" + // CSVPhaseDeleting means that a CSV has been replaced by a new one and will be checked for safety before being deleted + CSVPhaseDeleting ClusterServiceVersionPhase = "Deleting" +) + +// ConditionReason is a camelcased reason for the state transition +type ConditionReason string + +const ( + CSVReasonRequirementsUnknown ConditionReason = "RequirementsUnknown" + CSVReasonRequirementsNotMet ConditionReason = "RequirementsNotMet" + CSVReasonRequirementsMet ConditionReason = "AllRequirementsMet" + CSVReasonOwnerConflict ConditionReason = "OwnerConflict" + CSVReasonComponentFailed ConditionReason = "InstallComponentFailed" + CSVReasonInvalidStrategy ConditionReason = "InvalidInstallStrategy" + CSVReasonWaiting ConditionReason = "InstallWaiting" + CSVReasonInstallSuccessful ConditionReason = "InstallSucceeded" + CSVReasonInstallCheckFailed ConditionReason = "InstallCheckFailed" + CSVReasonComponentUnhealthy ConditionReason = "ComponentUnhealthy" + CSVReasonBeingReplaced ConditionReason = "BeingReplaced" + CSVReasonReplaced ConditionReason = "Replaced" +) + +// Conditions appear in the status as a record of state transitions on the ClusterServiceVersion +type ClusterServiceVersionCondition struct { + // Condition of the ClusterServiceVersion + Phase ClusterServiceVersionPhase `json:"phase,omitempty"` + // A human readable message indicating details about why the ClusterServiceVersion is in this condition. + // +optional + Message string `json:"message,omitempty"` + // A brief CamelCase message indicating details about why the ClusterServiceVersion is in this state. + // e.g. 'RequirementsNotMet' + // +optional + Reason ConditionReason `json:"reason,omitempty"` + // Last time we updated the status + // +optional + LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` + // Last time the status transitioned from one status to another. + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` +} + +// OwnsCRD determines whether the current CSV owns a paritcular CRD. +func (csv ClusterServiceVersion) OwnsCRD(name string) bool { + for _, crdDescription := range csv.Spec.CustomResourceDefinitions.Owned { + if crdDescription.Name == name { + return true + } + } + + return false +} + +type RequirementStatus struct { + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Name string `json:"name"` + Status string `json:"status"` + UUID string `json:"uuid,omitempty"` +} + +// ClusterServiceVersionStatus represents information about the status of a pod. Status may trail the actual +// state of a system. +type ClusterServiceVersionStatus struct { + // Current condition of the ClusterServiceVersion + Phase ClusterServiceVersionPhase `json:"phase,omitempty"` + // A human readable message indicating details about why the ClusterServiceVersion is in this condition. + // +optional + Message string `json:"message,omitempty"` + // A brief CamelCase message indicating details about why the ClusterServiceVersion is in this state. + // e.g. 'RequirementsNotMet' + // +optional + Reason ConditionReason `json:"reason,omitempty"` + // Last time we updated the status + // +optional + LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` + // Last time the status transitioned from one status to another. + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + // List of conditions, a history of state transitions + Conditions []ClusterServiceVersionCondition `json:"conditions,omitempty"` + // The status of each requirement for this CSV + RequirementStatus []RequirementStatus `json:"requirementStatus,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient +// ClusterServiceVersion is a Custom Resource of type `ClusterServiceVersionSpec`. +type ClusterServiceVersion struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec ClusterServiceVersionSpec `json:"spec"` + Status ClusterServiceVersionStatus `json:"status"` +} + +// ClusterServiceVersionList represents a list of ClusterServiceVersions. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ClusterServiceVersionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []ClusterServiceVersion `json:"items"` +} + +// GetAllCRDDescriptions returns a deduplicated set of CRDDescriptions that is +// the union of the owned and required CRDDescriptions. +// +// Descriptions with the same name prefer the value in Owned. +// Descriptions are returned in alphabetical order. +func (csv ClusterServiceVersion) GetAllCRDDescriptions() []CRDDescription { + set := make(map[string]CRDDescription) + for _, required := range csv.Spec.CustomResourceDefinitions.Required { + set[required.Name] = required + } + + for _, owned := range csv.Spec.CustomResourceDefinitions.Owned { + set[owned.Name] = owned + } + + keys := make([]string, 0) + for key := range set { + keys = append(keys, key) + } + sort.StringSlice(keys).Sort() + + descs := make([]CRDDescription, 0) + for _, key := range keys { + descs = append(descs, set[key]) + } + + return descs +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/doc.go new file mode 100644 index 00000000..a1bf654e --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/doc.go @@ -0,0 +1,3 @@ +// +k8s:deepcopy-gen=package +// +groupName=operators.coreos.com +package v1alpha1 diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/installplan_types.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/installplan_types.go new file mode 100644 index 00000000..63eef233 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/installplan_types.go @@ -0,0 +1,285 @@ +package v1alpha1 + +import ( + "bytes" + "errors" + "fmt" + + corev1 "k8s.io/api/core/v1" + rbacv1 "k8s.io/api/rbac/v1" + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + k8sjson "k8s.io/apimachinery/pkg/runtime/serializer/json" + k8sscheme "k8s.io/client-go/kubernetes/scheme" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators" +) + +const ( + InstallPlanKind = "InstallPlan" + InstallPlanAPIVersion = operators.GroupName + "/" + GroupVersion +) + +// Approval is the user approval policy for an InstallPlan. +type Approval string + +const ( + ApprovalAutomatic Approval = "Automatic" + ApprovalManual Approval = "Manual" +) + +// InstallPlanSpec defines a set of Application resources to be installed +type InstallPlanSpec struct { + CatalogSource string `json:"source"` + CatalogSourceNamespace string `json:"sourceNamespace"` + ClusterServiceVersionNames []string `json:"clusterServiceVersionNames"` + Approval Approval `json:"approval"` + Approved bool `json:"approved"` +} + +// InstallPlanPhase is the current status of a InstallPlan as a whole. +type InstallPlanPhase string + +const ( + InstallPlanPhaseNone InstallPlanPhase = "" + InstallPlanPhasePlanning InstallPlanPhase = "Planning" + InstallPlanPhaseRequiresApproval InstallPlanPhase = "RequiresApproval" + InstallPlanPhaseInstalling InstallPlanPhase = "Installing" + InstallPlanPhaseComplete InstallPlanPhase = "Complete" + InstallPlanPhaseFailed InstallPlanPhase = "Failed" +) + +// InstallPlanConditionType describes the state of an InstallPlan at a certain point as a whole. +type InstallPlanConditionType string + +const ( + InstallPlanResolved InstallPlanConditionType = "Resolved" + InstallPlanInstalled InstallPlanConditionType = "Installed" +) + +// ConditionReason is a camelcased reason for the state transition. +type InstallPlanConditionReason string + +const ( + InstallPlanReasonPlanUnknown InstallPlanConditionReason = "PlanUnknown" + InstallPlanReasonInstallCheckFailed InstallPlanConditionReason = "InstallCheckFailed" + InstallPlanReasonDependencyConflict InstallPlanConditionReason = "DependenciesConflict" + InstallPlanReasonComponentFailed InstallPlanConditionReason = "InstallComponentFailed" +) + +// StepStatus is the current status of a particular resource an in +// InstallPlan +type StepStatus string + +const ( + StepStatusUnknown StepStatus = "Unknown" + StepStatusNotPresent StepStatus = "NotPresent" + StepStatusPresent StepStatus = "Present" + StepStatusCreated StepStatus = "Created" +) + +// ErrInvalidInstallPlan is the error returned by functions that operate on +// InstallPlans when the InstallPlan does not contain totally valid data. +var ErrInvalidInstallPlan = errors.New("the InstallPlan contains invalid data") + +// InstallPlanStatus represents the information about the status of +// steps required to complete installation. +// +// Status may trail the actual state of a system. +type InstallPlanStatus struct { + Phase InstallPlanPhase `json:"phase"` + Conditions []InstallPlanCondition `json:"conditions,omitempty"` + CatalogSources []string `json:"catalogSources"` + Plan []Step `json:"plan,omitempty"` +} + +// InstallPlanCondition represents the overall status of the execution of +// an InstallPlan. +type InstallPlanCondition struct { + Type InstallPlanConditionType `json:"type,omitempty"` + Status corev1.ConditionStatus `json:"status,omitempty"` // True, False, or Unknown + LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + Reason InstallPlanConditionReason `json:"reason,omitempty"` + Message string `json:"message,omitempty"` +} + +// allow overwriting `now` function for deterministic tests +var now = metav1.Now + +// SetCondition adds or updates a condition, using `Type` as merge key +func (s *InstallPlanStatus) SetCondition(cond InstallPlanCondition) InstallPlanCondition { + updated := now() + cond.LastUpdateTime = updated + cond.LastTransitionTime = updated + + for i, existing := range s.Conditions { + if existing.Type != cond.Type { + continue + } + if existing.Status == cond.Status { + cond.LastTransitionTime = existing.LastTransitionTime + } + s.Conditions[i] = cond + return cond + } + s.Conditions = append(s.Conditions, cond) + return cond +} + +func ConditionFailed(cond InstallPlanConditionType, reason InstallPlanConditionReason, err error) InstallPlanCondition { + return InstallPlanCondition{ + Type: cond, + Status: corev1.ConditionFalse, + Reason: reason, + Message: err.Error(), + } +} + +func ConditionMet(cond InstallPlanConditionType) InstallPlanCondition { + return InstallPlanCondition{ + Type: cond, + Status: corev1.ConditionTrue, + } +} + +// Step represents the status of an individual step in an InstallPlan. +type Step struct { + Resolving string `json:"resolving"` + Resource StepResource `json:"resource"` + Status StepStatus `json:"status"` +} + +// StepResource represents the status of a resource to be tracked by an +// InstallPlan. +type StepResource struct { + CatalogSource string `json:"sourceName"` + CatalogSourceNamespace string `json:"sourceNamespace"` + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Name string `json:"name"` + Manifest string `json:"manifest,omitempty"` +} + +// NewStepResourceFromCSV creates an unresolved Step for the provided CSV. +func NewStepResourceFromCSV(csv *ClusterServiceVersion) (StepResource, error) { + csvScheme := runtime.NewScheme() + if err := AddToScheme(csvScheme); err != nil { + return StepResource{}, err + } + csvSerializer := k8sjson.NewSerializer(k8sjson.DefaultMetaFactory, csvScheme, csvScheme, true) + + var manifestCSV bytes.Buffer + if err := csvSerializer.Encode(csv, &manifestCSV); err != nil { + return StepResource{}, err + } + + step := StepResource{ + Name: csv.Name, + Kind: csv.Kind, + Group: csv.GroupVersionKind().Group, + Version: csv.GroupVersionKind().Version, + Manifest: manifestCSV.String(), + } + + return step, nil +} + +// NewStepResourceFromCRD creates an unresolved Step for the provided CRD. +func NewStepResourcesFromCRD(crd *v1beta1.CustomResourceDefinition) ([]StepResource, error) { + serScheme := runtime.NewScheme() + k8sscheme.AddToScheme(serScheme) + scheme.AddToScheme(serScheme) + serializer := k8sjson.NewSerializer(k8sjson.DefaultMetaFactory, serScheme, serScheme, true) + + var manifest bytes.Buffer + if err := serializer.Encode(crd, &manifest); err != nil { + return nil, err + } + + crdStep := StepResource{ + Name: crd.Name, + Kind: crd.Kind, + Group: crd.Spec.Group, + Version: crd.Spec.Version, + Manifest: manifest.String(), + } + + editRole := rbacv1.ClusterRole{ + ObjectMeta: metav1.ObjectMeta{ + Name: fmt.Sprintf("edit-%s-%s", crd.Name, crd.Spec.Version), + Labels: map[string]string{ + "rbac.authorization.k8s.io/aggregate-to-admin": "true", + "rbac.authorization.k8s.io/aggregate-to-edit": "true", + }, + }, + Rules: []rbacv1.PolicyRule{{Verbs: []string{"create", "update", "patch", "delete"}, APIGroups: []string{crd.Spec.Group}, Resources: []string{crd.Spec.Names.Plural}}}, + } + var editRoleManifest bytes.Buffer + if err := serializer.Encode(&editRole, &editRoleManifest); err != nil { + return nil, err + } + aggregatedEditClusterRoleStep := StepResource{ + Name: editRole.Name, + Kind: "ClusterRole", + Group: "rbac.authorization.k8s.io", + Version: "v1", + Manifest: editRoleManifest.String(), + } + + viewRole := rbacv1.ClusterRole{ + ObjectMeta: metav1.ObjectMeta{ + Name: fmt.Sprintf("view-%s-%s", crd.Name, crd.Spec.Version), + Labels: map[string]string{ + "rbac.authorization.k8s.io/aggregate-to-view": "true", + }, + }, + Rules: []rbacv1.PolicyRule{{Verbs: []string{"get", "list", "watch"}, APIGroups: []string{crd.Spec.Group}, Resources: []string{crd.Spec.Names.Plural}}}, + } + var viewRoleManifest bytes.Buffer + if err := serializer.Encode(&viewRole, &viewRoleManifest); err != nil { + return nil, err + } + aggregatedViewClusterRoleStep := StepResource{ + Name: viewRole.Name, + Kind: "ClusterRole", + Group: "rbac.authorization.k8s.io", + Version: "v1", + Manifest: viewRoleManifest.String(), + } + + return []StepResource{crdStep, aggregatedEditClusterRoleStep, aggregatedViewClusterRoleStep}, nil +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient +type InstallPlan struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec InstallPlanSpec `json:"spec"` + Status InstallPlanStatus `json:"status"` +} + +// EnsureCatalogSource ensures that a CatalogSource is present in the Status +// block of an InstallPlan. +func (p *InstallPlan) EnsureCatalogSource(sourceName string) { + for _, srcName := range p.Status.CatalogSources { + if srcName == sourceName { + return + } + } + + p.Status.CatalogSources = append(p.Status.CatalogSources, sourceName) +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type InstallPlanList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []InstallPlan `json:"items"` +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/register.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/register.go new file mode 100644 index 00000000..a3a5ced6 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/register.go @@ -0,0 +1,48 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators" +) + +const ( + GroupName = "operators.coreos.com" + GroupVersion = "v1alpha1" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: operators.GroupName, Version: GroupVersion} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +// Adds the list of known types to Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &CatalogSource{}, + &CatalogSourceList{}, + &InstallPlan{}, + &InstallPlanList{}, + &Subscription{}, + &SubscriptionList{}, + &ClusterServiceVersion{}, + &ClusterServiceVersionList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/subscription_types.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/subscription_types.go new file mode 100644 index 00000000..7ae4dbce --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/subscription_types.go @@ -0,0 +1,81 @@ +package v1alpha1 + +import ( + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +const ( + SubscriptionKind = "Subscription" + SubscriptionCRDAPIVersion = operators.GroupName + "/" + GroupVersion +) + +// SubscriptionState tracks when updates are available, installing, or service is up to date +type SubscriptionState string + +const ( + SubscriptionStateNone = "" + SubscriptionStateFailed = "UpgradeFailed" + SubscriptionStateUpgradeAvailable = "UpgradeAvailable" + SubscriptionStateUpgradePending = "UpgradePending" + SubscriptionStateAtLatest = "AtLatestKnown" +) + +const ( + SubscriptionReasonInvalidCatalog ConditionReason = "InvalidCatalog" + SubscriptionReasonUpgradeSucceeded ConditionReason = "UpgradeSucceeded" +) + +// SubscriptionSpec defines an Application that can be installed +type SubscriptionSpec struct { + CatalogSource string `json:"source"` + CatalogSourceNamespace string `json:"sourceNamespace"` + Package string `json:"name"` + Channel string `json:"channel,omitempty"` + StartingCSV string `json:"startingCSV,omitempty"` + InstallPlanApproval Approval `json:"installPlanApproval,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient +type Subscription struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec *SubscriptionSpec `json:"spec"` + Status SubscriptionStatus `json:"status"` +} + +type SubscriptionStatus struct { + CurrentCSV string `json:"currentCSV,omitempty"` + InstalledCSV string `json:"installedCSV, omitempty"` + Install *InstallPlanReference `json:"installplan,omitempty"` + + State SubscriptionState `json:"state,omitempty"` + Reason ConditionReason `json:"reason,omitempty"` + LastUpdated metav1.Time `json:"lastUpdated"` +} + +type InstallPlanReference struct { + APIVersion string `json:"apiVersion"` + Kind string `json:"kind"` + Name string `json:"name"` + UID types.UID `json:"uuid"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type SubscriptionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []Subscription `json:"items"` +} + +// GetInstallPlanApproval gets the configured install plan approval or the default +func (s *Subscription) GetInstallPlanApproval() Approval { + if s.Spec.InstallPlanApproval == ApprovalManual { + return ApprovalManual + } + return ApprovalAutomatic +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 00000000..f3509e73 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,893 @@ +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + json "encoding/json" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ActionDescriptor) DeepCopyInto(out *ActionDescriptor) { + *out = *in + if in.XDescriptors != nil { + in, out := &in.XDescriptors, &out.XDescriptors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Value != nil { + in, out := &in.Value, &out.Value + if *in == nil { + *out = nil + } else { + *out = new(json.RawMessage) + if **in != nil { + in, out := *in, *out + *out = make([]byte, len(*in)) + copy(*out, *in) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ActionDescriptor. +func (in *ActionDescriptor) DeepCopy() *ActionDescriptor { + if in == nil { + return nil + } + out := new(ActionDescriptor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AppLink) DeepCopyInto(out *AppLink) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppLink. +func (in *AppLink) DeepCopy() *AppLink { + if in == nil { + return nil + } + out := new(AppLink) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CRDDescription) DeepCopyInto(out *CRDDescription) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]CRDResourceReference, len(*in)) + copy(*out, *in) + } + if in.StatusDescriptors != nil { + in, out := &in.StatusDescriptors, &out.StatusDescriptors + *out = make([]StatusDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SpecDescriptors != nil { + in, out := &in.SpecDescriptors, &out.SpecDescriptors + *out = make([]SpecDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ActionDescriptor != nil { + in, out := &in.ActionDescriptor, &out.ActionDescriptor + *out = make([]ActionDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CRDDescription. +func (in *CRDDescription) DeepCopy() *CRDDescription { + if in == nil { + return nil + } + out := new(CRDDescription) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CRDResourceReference) DeepCopyInto(out *CRDResourceReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CRDResourceReference. +func (in *CRDResourceReference) DeepCopy() *CRDResourceReference { + if in == nil { + return nil + } + out := new(CRDResourceReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CatalogSource) DeepCopyInto(out *CatalogSource) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSource. +func (in *CatalogSource) DeepCopy() *CatalogSource { + if in == nil { + return nil + } + out := new(CatalogSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CatalogSource) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CatalogSourceList) DeepCopyInto(out *CatalogSourceList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CatalogSource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSourceList. +func (in *CatalogSourceList) DeepCopy() *CatalogSourceList { + if in == nil { + return nil + } + out := new(CatalogSourceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CatalogSourceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CatalogSourceSpec) DeepCopyInto(out *CatalogSourceSpec) { + *out = *in + if in.Secrets != nil { + in, out := &in.Secrets, &out.Secrets + *out = make([]string, len(*in)) + copy(*out, *in) + } + out.Icon = in.Icon + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSourceSpec. +func (in *CatalogSourceSpec) DeepCopy() *CatalogSourceSpec { + if in == nil { + return nil + } + out := new(CatalogSourceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CatalogSourceStatus) DeepCopyInto(out *CatalogSourceStatus) { + *out = *in + if in.ConfigMapResource != nil { + in, out := &in.ConfigMapResource, &out.ConfigMapResource + if *in == nil { + *out = nil + } else { + *out = new(ConfigMapResourceReference) + **out = **in + } + } + in.LastSync.DeepCopyInto(&out.LastSync) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSourceStatus. +func (in *CatalogSourceStatus) DeepCopy() *CatalogSourceStatus { + if in == nil { + return nil + } + out := new(CatalogSourceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersion) DeepCopyInto(out *ClusterServiceVersion) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersion. +func (in *ClusterServiceVersion) DeepCopy() *ClusterServiceVersion { + if in == nil { + return nil + } + out := new(ClusterServiceVersion) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterServiceVersion) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersionCondition) DeepCopyInto(out *ClusterServiceVersionCondition) { + *out = *in + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersionCondition. +func (in *ClusterServiceVersionCondition) DeepCopy() *ClusterServiceVersionCondition { + if in == nil { + return nil + } + out := new(ClusterServiceVersionCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersionList) DeepCopyInto(out *ClusterServiceVersionList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterServiceVersion, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersionList. +func (in *ClusterServiceVersionList) DeepCopy() *ClusterServiceVersionList { + if in == nil { + return nil + } + out := new(ClusterServiceVersionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterServiceVersionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersionSpec) DeepCopyInto(out *ClusterServiceVersionSpec) { + *out = *in + in.InstallStrategy.DeepCopyInto(&out.InstallStrategy) + out.Version = in.Version + in.CustomResourceDefinitions.DeepCopyInto(&out.CustomResourceDefinitions) + if in.Keywords != nil { + in, out := &in.Keywords, &out.Keywords + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Maintainers != nil { + in, out := &in.Maintainers, &out.Maintainers + *out = make([]Maintainer, len(*in)) + copy(*out, *in) + } + out.Provider = in.Provider + if in.Links != nil { + in, out := &in.Links, &out.Links + *out = make([]AppLink, len(*in)) + copy(*out, *in) + } + if in.Icon != nil { + in, out := &in.Icon, &out.Icon + *out = make([]Icon, len(*in)) + copy(*out, *in) + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + if *in == nil { + *out = nil + } else { + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersionSpec. +func (in *ClusterServiceVersionSpec) DeepCopy() *ClusterServiceVersionSpec { + if in == nil { + return nil + } + out := new(ClusterServiceVersionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersionStatus) DeepCopyInto(out *ClusterServiceVersionStatus) { + *out = *in + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]ClusterServiceVersionCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RequirementStatus != nil { + in, out := &in.RequirementStatus, &out.RequirementStatus + *out = make([]RequirementStatus, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersionStatus. +func (in *ClusterServiceVersionStatus) DeepCopy() *ClusterServiceVersionStatus { + if in == nil { + return nil + } + out := new(ClusterServiceVersionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConfigMapResourceReference) DeepCopyInto(out *ConfigMapResourceReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapResourceReference. +func (in *ConfigMapResourceReference) DeepCopy() *ConfigMapResourceReference { + if in == nil { + return nil + } + out := new(ConfigMapResourceReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CustomResourceDefinitions) DeepCopyInto(out *CustomResourceDefinitions) { + *out = *in + if in.Owned != nil { + in, out := &in.Owned, &out.Owned + *out = make([]CRDDescription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Required != nil { + in, out := &in.Required, &out.Required + *out = make([]CRDDescription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomResourceDefinitions. +func (in *CustomResourceDefinitions) DeepCopy() *CustomResourceDefinitions { + if in == nil { + return nil + } + out := new(CustomResourceDefinitions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Icon) DeepCopyInto(out *Icon) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Icon. +func (in *Icon) DeepCopy() *Icon { + if in == nil { + return nil + } + out := new(Icon) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlan) DeepCopyInto(out *InstallPlan) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlan. +func (in *InstallPlan) DeepCopy() *InstallPlan { + if in == nil { + return nil + } + out := new(InstallPlan) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InstallPlan) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanCondition) DeepCopyInto(out *InstallPlanCondition) { + *out = *in + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanCondition. +func (in *InstallPlanCondition) DeepCopy() *InstallPlanCondition { + if in == nil { + return nil + } + out := new(InstallPlanCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanList) DeepCopyInto(out *InstallPlanList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]InstallPlan, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanList. +func (in *InstallPlanList) DeepCopy() *InstallPlanList { + if in == nil { + return nil + } + out := new(InstallPlanList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InstallPlanList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanReference) DeepCopyInto(out *InstallPlanReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanReference. +func (in *InstallPlanReference) DeepCopy() *InstallPlanReference { + if in == nil { + return nil + } + out := new(InstallPlanReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanSpec) DeepCopyInto(out *InstallPlanSpec) { + *out = *in + if in.ClusterServiceVersionNames != nil { + in, out := &in.ClusterServiceVersionNames, &out.ClusterServiceVersionNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanSpec. +func (in *InstallPlanSpec) DeepCopy() *InstallPlanSpec { + if in == nil { + return nil + } + out := new(InstallPlanSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanStatus) DeepCopyInto(out *InstallPlanStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]InstallPlanCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CatalogSources != nil { + in, out := &in.CatalogSources, &out.CatalogSources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Plan != nil { + in, out := &in.Plan, &out.Plan + *out = make([]Step, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanStatus. +func (in *InstallPlanStatus) DeepCopy() *InstallPlanStatus { + if in == nil { + return nil + } + out := new(InstallPlanStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Maintainer) DeepCopyInto(out *Maintainer) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Maintainer. +func (in *Maintainer) DeepCopy() *Maintainer { + if in == nil { + return nil + } + out := new(Maintainer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NamedInstallStrategy) DeepCopyInto(out *NamedInstallStrategy) { + *out = *in + if in.StrategySpecRaw != nil { + in, out := &in.StrategySpecRaw, &out.StrategySpecRaw + *out = make(json.RawMessage, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedInstallStrategy. +func (in *NamedInstallStrategy) DeepCopy() *NamedInstallStrategy { + if in == nil { + return nil + } + out := new(NamedInstallStrategy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RequirementStatus) DeepCopyInto(out *RequirementStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequirementStatus. +func (in *RequirementStatus) DeepCopy() *RequirementStatus { + if in == nil { + return nil + } + out := new(RequirementStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpecDescriptor) DeepCopyInto(out *SpecDescriptor) { + *out = *in + if in.XDescriptors != nil { + in, out := &in.XDescriptors, &out.XDescriptors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Value != nil { + in, out := &in.Value, &out.Value + if *in == nil { + *out = nil + } else { + *out = new(json.RawMessage) + if **in != nil { + in, out := *in, *out + *out = make([]byte, len(*in)) + copy(*out, *in) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpecDescriptor. +func (in *SpecDescriptor) DeepCopy() *SpecDescriptor { + if in == nil { + return nil + } + out := new(SpecDescriptor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StatusDescriptor) DeepCopyInto(out *StatusDescriptor) { + *out = *in + if in.XDescriptors != nil { + in, out := &in.XDescriptors, &out.XDescriptors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Value != nil { + in, out := &in.Value, &out.Value + if *in == nil { + *out = nil + } else { + *out = new(json.RawMessage) + if **in != nil { + in, out := *in, *out + *out = make([]byte, len(*in)) + copy(*out, *in) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatusDescriptor. +func (in *StatusDescriptor) DeepCopy() *StatusDescriptor { + if in == nil { + return nil + } + out := new(StatusDescriptor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Step) DeepCopyInto(out *Step) { + *out = *in + out.Resource = in.Resource + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Step. +func (in *Step) DeepCopy() *Step { + if in == nil { + return nil + } + out := new(Step) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StepResource) DeepCopyInto(out *StepResource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StepResource. +func (in *StepResource) DeepCopy() *StepResource { + if in == nil { + return nil + } + out := new(StepResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Subscription) DeepCopyInto(out *Subscription) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Spec != nil { + in, out := &in.Spec, &out.Spec + if *in == nil { + *out = nil + } else { + *out = new(SubscriptionSpec) + **out = **in + } + } + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subscription. +func (in *Subscription) DeepCopy() *Subscription { + if in == nil { + return nil + } + out := new(Subscription) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Subscription) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionList) DeepCopyInto(out *SubscriptionList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Subscription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionList. +func (in *SubscriptionList) DeepCopy() *SubscriptionList { + if in == nil { + return nil + } + out := new(SubscriptionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SubscriptionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionSpec) DeepCopyInto(out *SubscriptionSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionSpec. +func (in *SubscriptionSpec) DeepCopy() *SubscriptionSpec { + if in == nil { + return nil + } + out := new(SubscriptionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionStatus) DeepCopyInto(out *SubscriptionStatus) { + *out = *in + if in.Install != nil { + in, out := &in.Install, &out.Install + if *in == nil { + *out = nil + } else { + *out = new(InstallPlanReference) + **out = **in + } + } + in.LastUpdated.DeepCopyInto(&out.LastUpdated) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionStatus. +func (in *SubscriptionStatus) DeepCopy() *SubscriptionStatus { + if in == nil { + return nil + } + out := new(SubscriptionStatus) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/client.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/client.go new file mode 100644 index 00000000..e044473a --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/client.go @@ -0,0 +1,16 @@ +package client + +import ( + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned" + "k8s.io/client-go/rest" +) + +// NewClient creates a client that can interact with the ALM resources in k8s api +func NewClient(kubeconfig string) (client versioned.Interface, err error) { + var config *rest.Config + config, err = getConfig(kubeconfig) + if err != nil { + return + } + return versioned.NewForConfig(config) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/clientset.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/clientset.go new file mode 100644 index 00000000..bd96eb1e --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/clientset.go @@ -0,0 +1,98 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package versioned + +import ( + operatorsv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + OperatorsV1alpha1() operatorsv1alpha1.OperatorsV1alpha1Interface + // Deprecated: please explicitly pick a version if possible. + Operators() operatorsv1alpha1.OperatorsV1alpha1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + operatorsV1alpha1 *operatorsv1alpha1.OperatorsV1alpha1Client +} + +// OperatorsV1alpha1 retrieves the OperatorsV1alpha1Client +func (c *Clientset) OperatorsV1alpha1() operatorsv1alpha1.OperatorsV1alpha1Interface { + return c.operatorsV1alpha1 +} + +// Deprecated: Operators retrieves the default version of OperatorsClient. +// Please explicitly pick a version. +func (c *Clientset) Operators() operatorsv1alpha1.OperatorsV1alpha1Interface { + return c.operatorsV1alpha1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.operatorsV1alpha1, err = operatorsv1alpha1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.operatorsV1alpha1 = operatorsv1alpha1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.operatorsV1alpha1 = operatorsv1alpha1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/doc.go new file mode 100644 index 00000000..41721ca5 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated clientset. +package versioned diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/fake/clientset_generated.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 00000000..2432a97b --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,82 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + clientset "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned" + operatorsv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1" + fakeoperatorsv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// OperatorsV1alpha1 retrieves the OperatorsV1alpha1Client +func (c *Clientset) OperatorsV1alpha1() operatorsv1alpha1.OperatorsV1alpha1Interface { + return &fakeoperatorsv1alpha1.FakeOperatorsV1alpha1{Fake: &c.Fake} +} + +// Operators retrieves the OperatorsV1alpha1Client +func (c *Clientset) Operators() operatorsv1alpha1.OperatorsV1alpha1Interface { + return &fakeoperatorsv1alpha1.FakeOperatorsV1alpha1{Fake: &c.Fake} +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/fake/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/fake/doc.go new file mode 100644 index 00000000..9b99e716 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/fake/register.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/fake/register.go new file mode 100644 index 00000000..3f47492a --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/fake/register.go @@ -0,0 +1,54 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + operatorsv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + operatorsv1alpha1.AddToScheme(scheme) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/scheme/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/scheme/doc.go new file mode 100644 index 00000000..7dc37561 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/scheme/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/scheme/register.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/scheme/register.go new file mode 100644 index 00000000..213c024c --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/scheme/register.go @@ -0,0 +1,54 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + operatorsv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + operatorsv1alpha1.AddToScheme(scheme) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/catalogsource.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/catalogsource.go new file mode 100644 index 00000000..8195245a --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/catalogsource.go @@ -0,0 +1,174 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + scheme "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CatalogSourcesGetter has a method to return a CatalogSourceInterface. +// A group's client should implement this interface. +type CatalogSourcesGetter interface { + CatalogSources(namespace string) CatalogSourceInterface +} + +// CatalogSourceInterface has methods to work with CatalogSource resources. +type CatalogSourceInterface interface { + Create(*v1alpha1.CatalogSource) (*v1alpha1.CatalogSource, error) + Update(*v1alpha1.CatalogSource) (*v1alpha1.CatalogSource, error) + UpdateStatus(*v1alpha1.CatalogSource) (*v1alpha1.CatalogSource, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.CatalogSource, error) + List(opts v1.ListOptions) (*v1alpha1.CatalogSourceList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CatalogSource, err error) + CatalogSourceExpansion +} + +// catalogSources implements CatalogSourceInterface +type catalogSources struct { + client rest.Interface + ns string +} + +// newCatalogSources returns a CatalogSources +func newCatalogSources(c *OperatorsV1alpha1Client, namespace string) *catalogSources { + return &catalogSources{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the catalogSource, and returns the corresponding catalogSource object, and an error if there is any. +func (c *catalogSources) Get(name string, options v1.GetOptions) (result *v1alpha1.CatalogSource, err error) { + result = &v1alpha1.CatalogSource{} + err = c.client.Get(). + Namespace(c.ns). + Resource("catalogsources"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CatalogSources that match those selectors. +func (c *catalogSources) List(opts v1.ListOptions) (result *v1alpha1.CatalogSourceList, err error) { + result = &v1alpha1.CatalogSourceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("catalogsources"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested catalogSources. +func (c *catalogSources) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("catalogsources"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a catalogSource and creates it. Returns the server's representation of the catalogSource, and an error, if there is any. +func (c *catalogSources) Create(catalogSource *v1alpha1.CatalogSource) (result *v1alpha1.CatalogSource, err error) { + result = &v1alpha1.CatalogSource{} + err = c.client.Post(). + Namespace(c.ns). + Resource("catalogsources"). + Body(catalogSource). + Do(). + Into(result) + return +} + +// Update takes the representation of a catalogSource and updates it. Returns the server's representation of the catalogSource, and an error, if there is any. +func (c *catalogSources) Update(catalogSource *v1alpha1.CatalogSource) (result *v1alpha1.CatalogSource, err error) { + result = &v1alpha1.CatalogSource{} + err = c.client.Put(). + Namespace(c.ns). + Resource("catalogsources"). + Name(catalogSource.Name). + Body(catalogSource). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *catalogSources) UpdateStatus(catalogSource *v1alpha1.CatalogSource) (result *v1alpha1.CatalogSource, err error) { + result = &v1alpha1.CatalogSource{} + err = c.client.Put(). + Namespace(c.ns). + Resource("catalogsources"). + Name(catalogSource.Name). + SubResource("status"). + Body(catalogSource). + Do(). + Into(result) + return +} + +// Delete takes name of the catalogSource and deletes it. Returns an error if one occurs. +func (c *catalogSources) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("catalogsources"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *catalogSources) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("catalogsources"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched catalogSource. +func (c *catalogSources) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CatalogSource, err error) { + result = &v1alpha1.CatalogSource{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("catalogsources"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/clusterserviceversion.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/clusterserviceversion.go new file mode 100644 index 00000000..8b4866fb --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/clusterserviceversion.go @@ -0,0 +1,174 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + scheme "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ClusterServiceVersionsGetter has a method to return a ClusterServiceVersionInterface. +// A group's client should implement this interface. +type ClusterServiceVersionsGetter interface { + ClusterServiceVersions(namespace string) ClusterServiceVersionInterface +} + +// ClusterServiceVersionInterface has methods to work with ClusterServiceVersion resources. +type ClusterServiceVersionInterface interface { + Create(*v1alpha1.ClusterServiceVersion) (*v1alpha1.ClusterServiceVersion, error) + Update(*v1alpha1.ClusterServiceVersion) (*v1alpha1.ClusterServiceVersion, error) + UpdateStatus(*v1alpha1.ClusterServiceVersion) (*v1alpha1.ClusterServiceVersion, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.ClusterServiceVersion, error) + List(opts v1.ListOptions) (*v1alpha1.ClusterServiceVersionList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ClusterServiceVersion, err error) + ClusterServiceVersionExpansion +} + +// clusterServiceVersions implements ClusterServiceVersionInterface +type clusterServiceVersions struct { + client rest.Interface + ns string +} + +// newClusterServiceVersions returns a ClusterServiceVersions +func newClusterServiceVersions(c *OperatorsV1alpha1Client, namespace string) *clusterServiceVersions { + return &clusterServiceVersions{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the clusterServiceVersion, and returns the corresponding clusterServiceVersion object, and an error if there is any. +func (c *clusterServiceVersions) Get(name string, options v1.GetOptions) (result *v1alpha1.ClusterServiceVersion, err error) { + result = &v1alpha1.ClusterServiceVersion{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusterserviceversions"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterServiceVersions that match those selectors. +func (c *clusterServiceVersions) List(opts v1.ListOptions) (result *v1alpha1.ClusterServiceVersionList, err error) { + result = &v1alpha1.ClusterServiceVersionList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusterserviceversions"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterServiceVersions. +func (c *clusterServiceVersions) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("clusterserviceversions"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a clusterServiceVersion and creates it. Returns the server's representation of the clusterServiceVersion, and an error, if there is any. +func (c *clusterServiceVersions) Create(clusterServiceVersion *v1alpha1.ClusterServiceVersion) (result *v1alpha1.ClusterServiceVersion, err error) { + result = &v1alpha1.ClusterServiceVersion{} + err = c.client.Post(). + Namespace(c.ns). + Resource("clusterserviceversions"). + Body(clusterServiceVersion). + Do(). + Into(result) + return +} + +// Update takes the representation of a clusterServiceVersion and updates it. Returns the server's representation of the clusterServiceVersion, and an error, if there is any. +func (c *clusterServiceVersions) Update(clusterServiceVersion *v1alpha1.ClusterServiceVersion) (result *v1alpha1.ClusterServiceVersion, err error) { + result = &v1alpha1.ClusterServiceVersion{} + err = c.client.Put(). + Namespace(c.ns). + Resource("clusterserviceversions"). + Name(clusterServiceVersion.Name). + Body(clusterServiceVersion). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *clusterServiceVersions) UpdateStatus(clusterServiceVersion *v1alpha1.ClusterServiceVersion) (result *v1alpha1.ClusterServiceVersion, err error) { + result = &v1alpha1.ClusterServiceVersion{} + err = c.client.Put(). + Namespace(c.ns). + Resource("clusterserviceversions"). + Name(clusterServiceVersion.Name). + SubResource("status"). + Body(clusterServiceVersion). + Do(). + Into(result) + return +} + +// Delete takes name of the clusterServiceVersion and deletes it. Returns an error if one occurs. +func (c *clusterServiceVersions) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusterserviceversions"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterServiceVersions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusterserviceversions"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched clusterServiceVersion. +func (c *clusterServiceVersions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ClusterServiceVersion, err error) { + result = &v1alpha1.ClusterServiceVersion{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("clusterserviceversions"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/doc.go new file mode 100644 index 00000000..df51baa4 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/doc.go new file mode 100644 index 00000000..16f44399 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_catalogsource.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_catalogsource.go new file mode 100644 index 00000000..cac9eb90 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_catalogsource.go @@ -0,0 +1,140 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCatalogSources implements CatalogSourceInterface +type FakeCatalogSources struct { + Fake *FakeOperatorsV1alpha1 + ns string +} + +var catalogsourcesResource = schema.GroupVersionResource{Group: "operators.coreos.com", Version: "v1alpha1", Resource: "catalogsources"} + +var catalogsourcesKind = schema.GroupVersionKind{Group: "operators.coreos.com", Version: "v1alpha1", Kind: "CatalogSource"} + +// Get takes name of the catalogSource, and returns the corresponding catalogSource object, and an error if there is any. +func (c *FakeCatalogSources) Get(name string, options v1.GetOptions) (result *v1alpha1.CatalogSource, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(catalogsourcesResource, c.ns, name), &v1alpha1.CatalogSource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CatalogSource), err +} + +// List takes label and field selectors, and returns the list of CatalogSources that match those selectors. +func (c *FakeCatalogSources) List(opts v1.ListOptions) (result *v1alpha1.CatalogSourceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(catalogsourcesResource, catalogsourcesKind, c.ns, opts), &v1alpha1.CatalogSourceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.CatalogSourceList{ListMeta: obj.(*v1alpha1.CatalogSourceList).ListMeta} + for _, item := range obj.(*v1alpha1.CatalogSourceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested catalogSources. +func (c *FakeCatalogSources) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(catalogsourcesResource, c.ns, opts)) + +} + +// Create takes the representation of a catalogSource and creates it. Returns the server's representation of the catalogSource, and an error, if there is any. +func (c *FakeCatalogSources) Create(catalogSource *v1alpha1.CatalogSource) (result *v1alpha1.CatalogSource, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(catalogsourcesResource, c.ns, catalogSource), &v1alpha1.CatalogSource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CatalogSource), err +} + +// Update takes the representation of a catalogSource and updates it. Returns the server's representation of the catalogSource, and an error, if there is any. +func (c *FakeCatalogSources) Update(catalogSource *v1alpha1.CatalogSource) (result *v1alpha1.CatalogSource, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(catalogsourcesResource, c.ns, catalogSource), &v1alpha1.CatalogSource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CatalogSource), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeCatalogSources) UpdateStatus(catalogSource *v1alpha1.CatalogSource) (*v1alpha1.CatalogSource, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(catalogsourcesResource, "status", c.ns, catalogSource), &v1alpha1.CatalogSource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CatalogSource), err +} + +// Delete takes name of the catalogSource and deletes it. Returns an error if one occurs. +func (c *FakeCatalogSources) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(catalogsourcesResource, c.ns, name), &v1alpha1.CatalogSource{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCatalogSources) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(catalogsourcesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.CatalogSourceList{}) + return err +} + +// Patch applies the patch and returns the patched catalogSource. +func (c *FakeCatalogSources) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CatalogSource, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(catalogsourcesResource, c.ns, name, data, subresources...), &v1alpha1.CatalogSource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CatalogSource), err +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_clusterserviceversion.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_clusterserviceversion.go new file mode 100644 index 00000000..f264a889 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_clusterserviceversion.go @@ -0,0 +1,140 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeClusterServiceVersions implements ClusterServiceVersionInterface +type FakeClusterServiceVersions struct { + Fake *FakeOperatorsV1alpha1 + ns string +} + +var clusterserviceversionsResource = schema.GroupVersionResource{Group: "operators.coreos.com", Version: "v1alpha1", Resource: "clusterserviceversions"} + +var clusterserviceversionsKind = schema.GroupVersionKind{Group: "operators.coreos.com", Version: "v1alpha1", Kind: "ClusterServiceVersion"} + +// Get takes name of the clusterServiceVersion, and returns the corresponding clusterServiceVersion object, and an error if there is any. +func (c *FakeClusterServiceVersions) Get(name string, options v1.GetOptions) (result *v1alpha1.ClusterServiceVersion, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(clusterserviceversionsResource, c.ns, name), &v1alpha1.ClusterServiceVersion{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterServiceVersion), err +} + +// List takes label and field selectors, and returns the list of ClusterServiceVersions that match those selectors. +func (c *FakeClusterServiceVersions) List(opts v1.ListOptions) (result *v1alpha1.ClusterServiceVersionList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(clusterserviceversionsResource, clusterserviceversionsKind, c.ns, opts), &v1alpha1.ClusterServiceVersionList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ClusterServiceVersionList{ListMeta: obj.(*v1alpha1.ClusterServiceVersionList).ListMeta} + for _, item := range obj.(*v1alpha1.ClusterServiceVersionList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterServiceVersions. +func (c *FakeClusterServiceVersions) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(clusterserviceversionsResource, c.ns, opts)) + +} + +// Create takes the representation of a clusterServiceVersion and creates it. Returns the server's representation of the clusterServiceVersion, and an error, if there is any. +func (c *FakeClusterServiceVersions) Create(clusterServiceVersion *v1alpha1.ClusterServiceVersion) (result *v1alpha1.ClusterServiceVersion, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(clusterserviceversionsResource, c.ns, clusterServiceVersion), &v1alpha1.ClusterServiceVersion{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterServiceVersion), err +} + +// Update takes the representation of a clusterServiceVersion and updates it. Returns the server's representation of the clusterServiceVersion, and an error, if there is any. +func (c *FakeClusterServiceVersions) Update(clusterServiceVersion *v1alpha1.ClusterServiceVersion) (result *v1alpha1.ClusterServiceVersion, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(clusterserviceversionsResource, c.ns, clusterServiceVersion), &v1alpha1.ClusterServiceVersion{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterServiceVersion), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeClusterServiceVersions) UpdateStatus(clusterServiceVersion *v1alpha1.ClusterServiceVersion) (*v1alpha1.ClusterServiceVersion, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(clusterserviceversionsResource, "status", c.ns, clusterServiceVersion), &v1alpha1.ClusterServiceVersion{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterServiceVersion), err +} + +// Delete takes name of the clusterServiceVersion and deletes it. Returns an error if one occurs. +func (c *FakeClusterServiceVersions) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(clusterserviceversionsResource, c.ns, name), &v1alpha1.ClusterServiceVersion{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterServiceVersions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(clusterserviceversionsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.ClusterServiceVersionList{}) + return err +} + +// Patch applies the patch and returns the patched clusterServiceVersion. +func (c *FakeClusterServiceVersions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ClusterServiceVersion, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(clusterserviceversionsResource, c.ns, name, data, subresources...), &v1alpha1.ClusterServiceVersion{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterServiceVersion), err +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_installplan.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_installplan.go new file mode 100644 index 00000000..4e8f879d --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_installplan.go @@ -0,0 +1,140 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeInstallPlans implements InstallPlanInterface +type FakeInstallPlans struct { + Fake *FakeOperatorsV1alpha1 + ns string +} + +var installplansResource = schema.GroupVersionResource{Group: "operators.coreos.com", Version: "v1alpha1", Resource: "installplans"} + +var installplansKind = schema.GroupVersionKind{Group: "operators.coreos.com", Version: "v1alpha1", Kind: "InstallPlan"} + +// Get takes name of the installPlan, and returns the corresponding installPlan object, and an error if there is any. +func (c *FakeInstallPlans) Get(name string, options v1.GetOptions) (result *v1alpha1.InstallPlan, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(installplansResource, c.ns, name), &v1alpha1.InstallPlan{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.InstallPlan), err +} + +// List takes label and field selectors, and returns the list of InstallPlans that match those selectors. +func (c *FakeInstallPlans) List(opts v1.ListOptions) (result *v1alpha1.InstallPlanList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(installplansResource, installplansKind, c.ns, opts), &v1alpha1.InstallPlanList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.InstallPlanList{ListMeta: obj.(*v1alpha1.InstallPlanList).ListMeta} + for _, item := range obj.(*v1alpha1.InstallPlanList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested installPlans. +func (c *FakeInstallPlans) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(installplansResource, c.ns, opts)) + +} + +// Create takes the representation of a installPlan and creates it. Returns the server's representation of the installPlan, and an error, if there is any. +func (c *FakeInstallPlans) Create(installPlan *v1alpha1.InstallPlan) (result *v1alpha1.InstallPlan, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(installplansResource, c.ns, installPlan), &v1alpha1.InstallPlan{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.InstallPlan), err +} + +// Update takes the representation of a installPlan and updates it. Returns the server's representation of the installPlan, and an error, if there is any. +func (c *FakeInstallPlans) Update(installPlan *v1alpha1.InstallPlan) (result *v1alpha1.InstallPlan, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(installplansResource, c.ns, installPlan), &v1alpha1.InstallPlan{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.InstallPlan), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeInstallPlans) UpdateStatus(installPlan *v1alpha1.InstallPlan) (*v1alpha1.InstallPlan, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(installplansResource, "status", c.ns, installPlan), &v1alpha1.InstallPlan{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.InstallPlan), err +} + +// Delete takes name of the installPlan and deletes it. Returns an error if one occurs. +func (c *FakeInstallPlans) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(installplansResource, c.ns, name), &v1alpha1.InstallPlan{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeInstallPlans) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(installplansResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.InstallPlanList{}) + return err +} + +// Patch applies the patch and returns the patched installPlan. +func (c *FakeInstallPlans) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstallPlan, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(installplansResource, c.ns, name, data, subresources...), &v1alpha1.InstallPlan{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.InstallPlan), err +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_operators_client.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_operators_client.go new file mode 100644 index 00000000..25b4be99 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_operators_client.go @@ -0,0 +1,52 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeOperatorsV1alpha1 struct { + *testing.Fake +} + +func (c *FakeOperatorsV1alpha1) CatalogSources(namespace string) v1alpha1.CatalogSourceInterface { + return &FakeCatalogSources{c, namespace} +} + +func (c *FakeOperatorsV1alpha1) ClusterServiceVersions(namespace string) v1alpha1.ClusterServiceVersionInterface { + return &FakeClusterServiceVersions{c, namespace} +} + +func (c *FakeOperatorsV1alpha1) InstallPlans(namespace string) v1alpha1.InstallPlanInterface { + return &FakeInstallPlans{c, namespace} +} + +func (c *FakeOperatorsV1alpha1) Subscriptions(namespace string) v1alpha1.SubscriptionInterface { + return &FakeSubscriptions{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeOperatorsV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_subscription.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_subscription.go new file mode 100644 index 00000000..527bc9f5 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/fake/fake_subscription.go @@ -0,0 +1,140 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeSubscriptions implements SubscriptionInterface +type FakeSubscriptions struct { + Fake *FakeOperatorsV1alpha1 + ns string +} + +var subscriptionsResource = schema.GroupVersionResource{Group: "operators.coreos.com", Version: "v1alpha1", Resource: "subscriptions"} + +var subscriptionsKind = schema.GroupVersionKind{Group: "operators.coreos.com", Version: "v1alpha1", Kind: "Subscription"} + +// Get takes name of the subscription, and returns the corresponding subscription object, and an error if there is any. +func (c *FakeSubscriptions) Get(name string, options v1.GetOptions) (result *v1alpha1.Subscription, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(subscriptionsResource, c.ns, name), &v1alpha1.Subscription{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Subscription), err +} + +// List takes label and field selectors, and returns the list of Subscriptions that match those selectors. +func (c *FakeSubscriptions) List(opts v1.ListOptions) (result *v1alpha1.SubscriptionList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(subscriptionsResource, subscriptionsKind, c.ns, opts), &v1alpha1.SubscriptionList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.SubscriptionList{ListMeta: obj.(*v1alpha1.SubscriptionList).ListMeta} + for _, item := range obj.(*v1alpha1.SubscriptionList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested subscriptions. +func (c *FakeSubscriptions) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(subscriptionsResource, c.ns, opts)) + +} + +// Create takes the representation of a subscription and creates it. Returns the server's representation of the subscription, and an error, if there is any. +func (c *FakeSubscriptions) Create(subscription *v1alpha1.Subscription) (result *v1alpha1.Subscription, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(subscriptionsResource, c.ns, subscription), &v1alpha1.Subscription{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Subscription), err +} + +// Update takes the representation of a subscription and updates it. Returns the server's representation of the subscription, and an error, if there is any. +func (c *FakeSubscriptions) Update(subscription *v1alpha1.Subscription) (result *v1alpha1.Subscription, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(subscriptionsResource, c.ns, subscription), &v1alpha1.Subscription{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Subscription), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeSubscriptions) UpdateStatus(subscription *v1alpha1.Subscription) (*v1alpha1.Subscription, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(subscriptionsResource, "status", c.ns, subscription), &v1alpha1.Subscription{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Subscription), err +} + +// Delete takes name of the subscription and deletes it. Returns an error if one occurs. +func (c *FakeSubscriptions) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(subscriptionsResource, c.ns, name), &v1alpha1.Subscription{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSubscriptions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(subscriptionsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.SubscriptionList{}) + return err +} + +// Patch applies the patch and returns the patched subscription. +func (c *FakeSubscriptions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Subscription, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(subscriptionsResource, c.ns, name, data, subresources...), &v1alpha1.Subscription{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Subscription), err +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/generated_expansion.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/generated_expansion.go new file mode 100644 index 00000000..2311410d --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/generated_expansion.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +type CatalogSourceExpansion interface{} + +type ClusterServiceVersionExpansion interface{} + +type InstallPlanExpansion interface{} + +type SubscriptionExpansion interface{} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/installplan.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/installplan.go new file mode 100644 index 00000000..6a5160fc --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/installplan.go @@ -0,0 +1,174 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + scheme "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// InstallPlansGetter has a method to return a InstallPlanInterface. +// A group's client should implement this interface. +type InstallPlansGetter interface { + InstallPlans(namespace string) InstallPlanInterface +} + +// InstallPlanInterface has methods to work with InstallPlan resources. +type InstallPlanInterface interface { + Create(*v1alpha1.InstallPlan) (*v1alpha1.InstallPlan, error) + Update(*v1alpha1.InstallPlan) (*v1alpha1.InstallPlan, error) + UpdateStatus(*v1alpha1.InstallPlan) (*v1alpha1.InstallPlan, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.InstallPlan, error) + List(opts v1.ListOptions) (*v1alpha1.InstallPlanList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstallPlan, err error) + InstallPlanExpansion +} + +// installPlans implements InstallPlanInterface +type installPlans struct { + client rest.Interface + ns string +} + +// newInstallPlans returns a InstallPlans +func newInstallPlans(c *OperatorsV1alpha1Client, namespace string) *installPlans { + return &installPlans{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the installPlan, and returns the corresponding installPlan object, and an error if there is any. +func (c *installPlans) Get(name string, options v1.GetOptions) (result *v1alpha1.InstallPlan, err error) { + result = &v1alpha1.InstallPlan{} + err = c.client.Get(). + Namespace(c.ns). + Resource("installplans"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of InstallPlans that match those selectors. +func (c *installPlans) List(opts v1.ListOptions) (result *v1alpha1.InstallPlanList, err error) { + result = &v1alpha1.InstallPlanList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("installplans"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested installPlans. +func (c *installPlans) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("installplans"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a installPlan and creates it. Returns the server's representation of the installPlan, and an error, if there is any. +func (c *installPlans) Create(installPlan *v1alpha1.InstallPlan) (result *v1alpha1.InstallPlan, err error) { + result = &v1alpha1.InstallPlan{} + err = c.client.Post(). + Namespace(c.ns). + Resource("installplans"). + Body(installPlan). + Do(). + Into(result) + return +} + +// Update takes the representation of a installPlan and updates it. Returns the server's representation of the installPlan, and an error, if there is any. +func (c *installPlans) Update(installPlan *v1alpha1.InstallPlan) (result *v1alpha1.InstallPlan, err error) { + result = &v1alpha1.InstallPlan{} + err = c.client.Put(). + Namespace(c.ns). + Resource("installplans"). + Name(installPlan.Name). + Body(installPlan). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *installPlans) UpdateStatus(installPlan *v1alpha1.InstallPlan) (result *v1alpha1.InstallPlan, err error) { + result = &v1alpha1.InstallPlan{} + err = c.client.Put(). + Namespace(c.ns). + Resource("installplans"). + Name(installPlan.Name). + SubResource("status"). + Body(installPlan). + Do(). + Into(result) + return +} + +// Delete takes name of the installPlan and deletes it. Returns an error if one occurs. +func (c *installPlans) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("installplans"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *installPlans) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("installplans"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched installPlan. +func (c *installPlans) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstallPlan, err error) { + result = &v1alpha1.InstallPlan{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("installplans"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/operators_client.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/operators_client.go new file mode 100644 index 00000000..8e727107 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/operators_client.go @@ -0,0 +1,105 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type OperatorsV1alpha1Interface interface { + RESTClient() rest.Interface + CatalogSourcesGetter + ClusterServiceVersionsGetter + InstallPlansGetter + SubscriptionsGetter +} + +// OperatorsV1alpha1Client is used to interact with features provided by the operators.coreos.com group. +type OperatorsV1alpha1Client struct { + restClient rest.Interface +} + +func (c *OperatorsV1alpha1Client) CatalogSources(namespace string) CatalogSourceInterface { + return newCatalogSources(c, namespace) +} + +func (c *OperatorsV1alpha1Client) ClusterServiceVersions(namespace string) ClusterServiceVersionInterface { + return newClusterServiceVersions(c, namespace) +} + +func (c *OperatorsV1alpha1Client) InstallPlans(namespace string) InstallPlanInterface { + return newInstallPlans(c, namespace) +} + +func (c *OperatorsV1alpha1Client) Subscriptions(namespace string) SubscriptionInterface { + return newSubscriptions(c, namespace) +} + +// NewForConfig creates a new OperatorsV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*OperatorsV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &OperatorsV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new OperatorsV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *OperatorsV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new OperatorsV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *OperatorsV1alpha1Client { + return &OperatorsV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *OperatorsV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/subscription.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/subscription.go new file mode 100644 index 00000000..63a46656 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/subscription.go @@ -0,0 +1,174 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + scheme "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// SubscriptionsGetter has a method to return a SubscriptionInterface. +// A group's client should implement this interface. +type SubscriptionsGetter interface { + Subscriptions(namespace string) SubscriptionInterface +} + +// SubscriptionInterface has methods to work with Subscription resources. +type SubscriptionInterface interface { + Create(*v1alpha1.Subscription) (*v1alpha1.Subscription, error) + Update(*v1alpha1.Subscription) (*v1alpha1.Subscription, error) + UpdateStatus(*v1alpha1.Subscription) (*v1alpha1.Subscription, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.Subscription, error) + List(opts v1.ListOptions) (*v1alpha1.SubscriptionList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Subscription, err error) + SubscriptionExpansion +} + +// subscriptions implements SubscriptionInterface +type subscriptions struct { + client rest.Interface + ns string +} + +// newSubscriptions returns a Subscriptions +func newSubscriptions(c *OperatorsV1alpha1Client, namespace string) *subscriptions { + return &subscriptions{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the subscription, and returns the corresponding subscription object, and an error if there is any. +func (c *subscriptions) Get(name string, options v1.GetOptions) (result *v1alpha1.Subscription, err error) { + result = &v1alpha1.Subscription{} + err = c.client.Get(). + Namespace(c.ns). + Resource("subscriptions"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Subscriptions that match those selectors. +func (c *subscriptions) List(opts v1.ListOptions) (result *v1alpha1.SubscriptionList, err error) { + result = &v1alpha1.SubscriptionList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("subscriptions"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested subscriptions. +func (c *subscriptions) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("subscriptions"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a subscription and creates it. Returns the server's representation of the subscription, and an error, if there is any. +func (c *subscriptions) Create(subscription *v1alpha1.Subscription) (result *v1alpha1.Subscription, err error) { + result = &v1alpha1.Subscription{} + err = c.client.Post(). + Namespace(c.ns). + Resource("subscriptions"). + Body(subscription). + Do(). + Into(result) + return +} + +// Update takes the representation of a subscription and updates it. Returns the server's representation of the subscription, and an error, if there is any. +func (c *subscriptions) Update(subscription *v1alpha1.Subscription) (result *v1alpha1.Subscription, err error) { + result = &v1alpha1.Subscription{} + err = c.client.Put(). + Namespace(c.ns). + Resource("subscriptions"). + Name(subscription.Name). + Body(subscription). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *subscriptions) UpdateStatus(subscription *v1alpha1.Subscription) (result *v1alpha1.Subscription, err error) { + result = &v1alpha1.Subscription{} + err = c.client.Put(). + Namespace(c.ns). + Resource("subscriptions"). + Name(subscription.Name). + SubResource("status"). + Body(subscription). + Do(). + Into(result) + return +} + +// Delete takes name of the subscription and deletes it. Returns an error if one occurs. +func (c *subscriptions) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("subscriptions"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *subscriptions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("subscriptions"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched subscription. +func (c *subscriptions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Subscription, err error) { + result = &v1alpha1.Subscription{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("subscriptions"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/factory.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/factory.go new file mode 100644 index 00000000..cf69c3c4 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/factory.go @@ -0,0 +1,180 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + reflect "reflect" + sync "sync" + time "time" + + versioned "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned" + internalinterfaces "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/internalinterfaces" + operators "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Operators() operators.Interface +} + +func (f *sharedInformerFactory) Operators() operators.Interface { + return operators.New(f, f.namespace, f.tweakListOptions) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/generic.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/generic.go new file mode 100644 index 00000000..6527f494 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/generic.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + "fmt" + + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=operators.coreos.com, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("catalogsources"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Operators().V1alpha1().CatalogSources().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("clusterserviceversions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Operators().V1alpha1().ClusterServiceVersions().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("installplans"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Operators().V1alpha1().InstallPlans().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("subscriptions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Operators().V1alpha1().Subscriptions().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 00000000..fc49555d --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,38 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + versioned "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/interface.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/interface.go new file mode 100644 index 00000000..1758289a --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/interface.go @@ -0,0 +1,46 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package operators + +import ( + internalinterfaces "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/catalogsource.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/catalogsource.go new file mode 100644 index 00000000..3f52c1f6 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/catalogsource.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + operators_v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + versioned "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned" + internalinterfaces "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// CatalogSourceInformer provides access to a shared informer and lister for +// CatalogSources. +type CatalogSourceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.CatalogSourceLister +} + +type catalogSourceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCatalogSourceInformer constructs a new informer for CatalogSource type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCatalogSourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCatalogSourceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCatalogSourceInformer constructs a new informer for CatalogSource type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCatalogSourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OperatorsV1alpha1().CatalogSources(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OperatorsV1alpha1().CatalogSources(namespace).Watch(options) + }, + }, + &operators_v1alpha1.CatalogSource{}, + resyncPeriod, + indexers, + ) +} + +func (f *catalogSourceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCatalogSourceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *catalogSourceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&operators_v1alpha1.CatalogSource{}, f.defaultInformer) +} + +func (f *catalogSourceInformer) Lister() v1alpha1.CatalogSourceLister { + return v1alpha1.NewCatalogSourceLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/clusterserviceversion.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/clusterserviceversion.go new file mode 100644 index 00000000..4f42ffad --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/clusterserviceversion.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + operators_v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + versioned "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned" + internalinterfaces "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterServiceVersionInformer provides access to a shared informer and lister for +// ClusterServiceVersions. +type ClusterServiceVersionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ClusterServiceVersionLister +} + +type clusterServiceVersionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewClusterServiceVersionInformer constructs a new informer for ClusterServiceVersion type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterServiceVersionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterServiceVersionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterServiceVersionInformer constructs a new informer for ClusterServiceVersion type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterServiceVersionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OperatorsV1alpha1().ClusterServiceVersions(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OperatorsV1alpha1().ClusterServiceVersions(namespace).Watch(options) + }, + }, + &operators_v1alpha1.ClusterServiceVersion{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterServiceVersionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterServiceVersionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterServiceVersionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&operators_v1alpha1.ClusterServiceVersion{}, f.defaultInformer) +} + +func (f *clusterServiceVersionInformer) Lister() v1alpha1.ClusterServiceVersionLister { + return v1alpha1.NewClusterServiceVersionLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/installplan.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/installplan.go new file mode 100644 index 00000000..2d3c76d4 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/installplan.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + operators_v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + versioned "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned" + internalinterfaces "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// InstallPlanInformer provides access to a shared informer and lister for +// InstallPlans. +type InstallPlanInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.InstallPlanLister +} + +type installPlanInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewInstallPlanInformer constructs a new informer for InstallPlan type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewInstallPlanInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredInstallPlanInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredInstallPlanInformer constructs a new informer for InstallPlan type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredInstallPlanInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OperatorsV1alpha1().InstallPlans(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OperatorsV1alpha1().InstallPlans(namespace).Watch(options) + }, + }, + &operators_v1alpha1.InstallPlan{}, + resyncPeriod, + indexers, + ) +} + +func (f *installPlanInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredInstallPlanInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *installPlanInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&operators_v1alpha1.InstallPlan{}, f.defaultInformer) +} + +func (f *installPlanInformer) Lister() v1alpha1.InstallPlanLister { + return v1alpha1.NewInstallPlanLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/interface.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/interface.go new file mode 100644 index 00000000..9af49c46 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/interface.go @@ -0,0 +1,66 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CatalogSources returns a CatalogSourceInformer. + CatalogSources() CatalogSourceInformer + // ClusterServiceVersions returns a ClusterServiceVersionInformer. + ClusterServiceVersions() ClusterServiceVersionInformer + // InstallPlans returns a InstallPlanInformer. + InstallPlans() InstallPlanInformer + // Subscriptions returns a SubscriptionInformer. + Subscriptions() SubscriptionInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CatalogSources returns a CatalogSourceInformer. +func (v *version) CatalogSources() CatalogSourceInformer { + return &catalogSourceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ClusterServiceVersions returns a ClusterServiceVersionInformer. +func (v *version) ClusterServiceVersions() ClusterServiceVersionInformer { + return &clusterServiceVersionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// InstallPlans returns a InstallPlanInformer. +func (v *version) InstallPlans() InstallPlanInformer { + return &installPlanInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Subscriptions returns a SubscriptionInformer. +func (v *version) Subscriptions() SubscriptionInformer { + return &subscriptionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/subscription.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/subscription.go new file mode 100644 index 00000000..e594d914 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/operators/v1alpha1/subscription.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + operators_v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + versioned "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned" + internalinterfaces "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// SubscriptionInformer provides access to a shared informer and lister for +// Subscriptions. +type SubscriptionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.SubscriptionLister +} + +type subscriptionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSubscriptionInformer constructs a new informer for Subscription type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSubscriptionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSubscriptionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSubscriptionInformer constructs a new informer for Subscription type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredSubscriptionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OperatorsV1alpha1().Subscriptions(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OperatorsV1alpha1().Subscriptions(namespace).Watch(options) + }, + }, + &operators_v1alpha1.Subscription{}, + resyncPeriod, + indexers, + ) +} + +func (f *subscriptionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSubscriptionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *subscriptionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&operators_v1alpha1.Subscription{}, f.defaultInformer) +} + +func (f *subscriptionInformer) Lister() v1alpha1.SubscriptionLister { + return v1alpha1.NewSubscriptionLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/catalogsource.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/catalogsource.go new file mode 100644 index 00000000..75894163 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/catalogsource.go @@ -0,0 +1,94 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CatalogSourceLister helps list CatalogSources. +type CatalogSourceLister interface { + // List lists all CatalogSources in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.CatalogSource, err error) + // CatalogSources returns an object that can list and get CatalogSources. + CatalogSources(namespace string) CatalogSourceNamespaceLister + CatalogSourceListerExpansion +} + +// catalogSourceLister implements the CatalogSourceLister interface. +type catalogSourceLister struct { + indexer cache.Indexer +} + +// NewCatalogSourceLister returns a new CatalogSourceLister. +func NewCatalogSourceLister(indexer cache.Indexer) CatalogSourceLister { + return &catalogSourceLister{indexer: indexer} +} + +// List lists all CatalogSources in the indexer. +func (s *catalogSourceLister) List(selector labels.Selector) (ret []*v1alpha1.CatalogSource, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.CatalogSource)) + }) + return ret, err +} + +// CatalogSources returns an object that can list and get CatalogSources. +func (s *catalogSourceLister) CatalogSources(namespace string) CatalogSourceNamespaceLister { + return catalogSourceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CatalogSourceNamespaceLister helps list and get CatalogSources. +type CatalogSourceNamespaceLister interface { + // List lists all CatalogSources in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.CatalogSource, err error) + // Get retrieves the CatalogSource from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.CatalogSource, error) + CatalogSourceNamespaceListerExpansion +} + +// catalogSourceNamespaceLister implements the CatalogSourceNamespaceLister +// interface. +type catalogSourceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all CatalogSources in the indexer for a given namespace. +func (s catalogSourceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.CatalogSource, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.CatalogSource)) + }) + return ret, err +} + +// Get retrieves the CatalogSource from the indexer for a given namespace and name. +func (s catalogSourceNamespaceLister) Get(name string) (*v1alpha1.CatalogSource, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("catalogsource"), name) + } + return obj.(*v1alpha1.CatalogSource), nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/clusterserviceversion.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/clusterserviceversion.go new file mode 100644 index 00000000..d1ca80d9 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/clusterserviceversion.go @@ -0,0 +1,94 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterServiceVersionLister helps list ClusterServiceVersions. +type ClusterServiceVersionLister interface { + // List lists all ClusterServiceVersions in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.ClusterServiceVersion, err error) + // ClusterServiceVersions returns an object that can list and get ClusterServiceVersions. + ClusterServiceVersions(namespace string) ClusterServiceVersionNamespaceLister + ClusterServiceVersionListerExpansion +} + +// clusterServiceVersionLister implements the ClusterServiceVersionLister interface. +type clusterServiceVersionLister struct { + indexer cache.Indexer +} + +// NewClusterServiceVersionLister returns a new ClusterServiceVersionLister. +func NewClusterServiceVersionLister(indexer cache.Indexer) ClusterServiceVersionLister { + return &clusterServiceVersionLister{indexer: indexer} +} + +// List lists all ClusterServiceVersions in the indexer. +func (s *clusterServiceVersionLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterServiceVersion, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ClusterServiceVersion)) + }) + return ret, err +} + +// ClusterServiceVersions returns an object that can list and get ClusterServiceVersions. +func (s *clusterServiceVersionLister) ClusterServiceVersions(namespace string) ClusterServiceVersionNamespaceLister { + return clusterServiceVersionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ClusterServiceVersionNamespaceLister helps list and get ClusterServiceVersions. +type ClusterServiceVersionNamespaceLister interface { + // List lists all ClusterServiceVersions in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.ClusterServiceVersion, err error) + // Get retrieves the ClusterServiceVersion from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.ClusterServiceVersion, error) + ClusterServiceVersionNamespaceListerExpansion +} + +// clusterServiceVersionNamespaceLister implements the ClusterServiceVersionNamespaceLister +// interface. +type clusterServiceVersionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ClusterServiceVersions in the indexer for a given namespace. +func (s clusterServiceVersionNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterServiceVersion, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ClusterServiceVersion)) + }) + return ret, err +} + +// Get retrieves the ClusterServiceVersion from the indexer for a given namespace and name. +func (s clusterServiceVersionNamespaceLister) Get(name string) (*v1alpha1.ClusterServiceVersion, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("clusterserviceversion"), name) + } + return obj.(*v1alpha1.ClusterServiceVersion), nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/expansion_generated.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/expansion_generated.go new file mode 100644 index 00000000..8c6cf66e --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/expansion_generated.go @@ -0,0 +1,51 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// CatalogSourceListerExpansion allows custom methods to be added to +// CatalogSourceLister. +type CatalogSourceListerExpansion interface{} + +// CatalogSourceNamespaceListerExpansion allows custom methods to be added to +// CatalogSourceNamespaceLister. +type CatalogSourceNamespaceListerExpansion interface{} + +// ClusterServiceVersionListerExpansion allows custom methods to be added to +// ClusterServiceVersionLister. +type ClusterServiceVersionListerExpansion interface{} + +// ClusterServiceVersionNamespaceListerExpansion allows custom methods to be added to +// ClusterServiceVersionNamespaceLister. +type ClusterServiceVersionNamespaceListerExpansion interface{} + +// InstallPlanListerExpansion allows custom methods to be added to +// InstallPlanLister. +type InstallPlanListerExpansion interface{} + +// InstallPlanNamespaceListerExpansion allows custom methods to be added to +// InstallPlanNamespaceLister. +type InstallPlanNamespaceListerExpansion interface{} + +// SubscriptionListerExpansion allows custom methods to be added to +// SubscriptionLister. +type SubscriptionListerExpansion interface{} + +// SubscriptionNamespaceListerExpansion allows custom methods to be added to +// SubscriptionNamespaceLister. +type SubscriptionNamespaceListerExpansion interface{} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/installplan.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/installplan.go new file mode 100644 index 00000000..aa24e502 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/installplan.go @@ -0,0 +1,94 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// InstallPlanLister helps list InstallPlans. +type InstallPlanLister interface { + // List lists all InstallPlans in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.InstallPlan, err error) + // InstallPlans returns an object that can list and get InstallPlans. + InstallPlans(namespace string) InstallPlanNamespaceLister + InstallPlanListerExpansion +} + +// installPlanLister implements the InstallPlanLister interface. +type installPlanLister struct { + indexer cache.Indexer +} + +// NewInstallPlanLister returns a new InstallPlanLister. +func NewInstallPlanLister(indexer cache.Indexer) InstallPlanLister { + return &installPlanLister{indexer: indexer} +} + +// List lists all InstallPlans in the indexer. +func (s *installPlanLister) List(selector labels.Selector) (ret []*v1alpha1.InstallPlan, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.InstallPlan)) + }) + return ret, err +} + +// InstallPlans returns an object that can list and get InstallPlans. +func (s *installPlanLister) InstallPlans(namespace string) InstallPlanNamespaceLister { + return installPlanNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// InstallPlanNamespaceLister helps list and get InstallPlans. +type InstallPlanNamespaceLister interface { + // List lists all InstallPlans in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.InstallPlan, err error) + // Get retrieves the InstallPlan from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.InstallPlan, error) + InstallPlanNamespaceListerExpansion +} + +// installPlanNamespaceLister implements the InstallPlanNamespaceLister +// interface. +type installPlanNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all InstallPlans in the indexer for a given namespace. +func (s installPlanNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.InstallPlan, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.InstallPlan)) + }) + return ret, err +} + +// Get retrieves the InstallPlan from the indexer for a given namespace and name. +func (s installPlanNamespaceLister) Get(name string) (*v1alpha1.InstallPlan, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("installplan"), name) + } + return obj.(*v1alpha1.InstallPlan), nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/subscription.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/subscription.go new file mode 100644 index 00000000..8b12e3aa --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1/subscription.go @@ -0,0 +1,94 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SubscriptionLister helps list Subscriptions. +type SubscriptionLister interface { + // List lists all Subscriptions in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.Subscription, err error) + // Subscriptions returns an object that can list and get Subscriptions. + Subscriptions(namespace string) SubscriptionNamespaceLister + SubscriptionListerExpansion +} + +// subscriptionLister implements the SubscriptionLister interface. +type subscriptionLister struct { + indexer cache.Indexer +} + +// NewSubscriptionLister returns a new SubscriptionLister. +func NewSubscriptionLister(indexer cache.Indexer) SubscriptionLister { + return &subscriptionLister{indexer: indexer} +} + +// List lists all Subscriptions in the indexer. +func (s *subscriptionLister) List(selector labels.Selector) (ret []*v1alpha1.Subscription, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Subscription)) + }) + return ret, err +} + +// Subscriptions returns an object that can list and get Subscriptions. +func (s *subscriptionLister) Subscriptions(namespace string) SubscriptionNamespaceLister { + return subscriptionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// SubscriptionNamespaceLister helps list and get Subscriptions. +type SubscriptionNamespaceLister interface { + // List lists all Subscriptions in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.Subscription, err error) + // Get retrieves the Subscription from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.Subscription, error) + SubscriptionNamespaceListerExpansion +} + +// subscriptionNamespaceLister implements the SubscriptionNamespaceLister +// interface. +type subscriptionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Subscriptions in the indexer for a given namespace. +func (s subscriptionNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Subscription, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Subscription)) + }) + return ret, err +} + +// Get retrieves the Subscription from the indexer for a given namespace and name. +func (s subscriptionNamespaceLister) Get(name string) (*v1alpha1.Subscription, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("subscription"), name) + } + return obj.(*v1alpha1.Subscription), nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/util.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/util.go new file mode 100644 index 00000000..60bfa220 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/util.go @@ -0,0 +1,36 @@ +package client + +import ( + "net" + "os" + + log "github.com/sirupsen/logrus" + _ "k8s.io/client-go/plugin/pkg/client/auth/oidc" + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/clientcmd" +) + +// getConfig returns a kubernetes config for configuring a client from a kubeconfig string +func getConfig(kubeconfig string) (*rest.Config, error) { + if len(kubeconfig) == 0 { + // Work around https://github.com/kubernetes/kubernetes/issues/40973 + // See https://github.com/coreos/etcd-operator/issues/731#issuecomment-283804819 + if len(os.Getenv("KUBERNETES_SERVICE_HOST")) == 0 { + addrs, err := net.LookupHost("kubernetes.default.svc") + if err != nil { + return nil, err + } + + os.Setenv("KUBERNETES_SERVICE_HOST", addrs[0]) + } + + if len(os.Getenv("KUBERNETES_SERVICE_PORT")) == 0 { + os.Setenv("KUBERNETES_SERVICE_PORT", "443") + } + + log.Infof("Using in-cluster kube client config") + return rest.InClusterConfig() + } + log.Infof("Loading kube client config from path %q", kubeconfig) + return clientcmd.BuildConfigFromFlags("", kubeconfig) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/wrappers/deployment_install_client.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/wrappers/deployment_install_client.go new file mode 100644 index 00000000..5a1e8476 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/wrappers/deployment_install_client.go @@ -0,0 +1,117 @@ +//go:generate counterfeiter deployment_install_client.go InstallStrategyDeploymentInterface +package wrappers + +import ( + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil" + "github.com/pkg/errors" + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + v1beta1rbac "k8s.io/api/rbac/v1beta1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +var ErrNilObject = errors.New("Bad object supplied: ") + +type InstallStrategyDeploymentInterface interface { + CreateRole(role *v1beta1rbac.Role) (*v1beta1rbac.Role, error) + CreateRoleBinding(roleBinding *v1beta1rbac.RoleBinding) (*v1beta1rbac.RoleBinding, error) + EnsureServiceAccount(serviceAccount *corev1.ServiceAccount, owner ownerutil.Owner) (*corev1.ServiceAccount, error) + CreateDeployment(deployment *appsv1.Deployment) (*appsv1.Deployment, error) + CreateOrUpdateDeployment(deployment *appsv1.Deployment) (*appsv1.Deployment, error) + DeleteDeployment(name string) error + GetServiceAccountByName(serviceAccountName string) (*corev1.ServiceAccount, error) + FindAnyDeploymentsMatchingNames(depNames []string) ([]*appsv1.Deployment, error) +} + +type InstallStrategyDeploymentClientForNamespace struct { + opClient operatorclient.ClientInterface + Namespace string +} + +var _ InstallStrategyDeploymentInterface = &InstallStrategyDeploymentClientForNamespace{} + +func NewInstallStrategyDeploymentClient(opClient operatorclient.ClientInterface, namespace string) InstallStrategyDeploymentInterface { + return &InstallStrategyDeploymentClientForNamespace{ + opClient: opClient, + Namespace: namespace, + } +} + +func (c *InstallStrategyDeploymentClientForNamespace) CreateRole(role *v1beta1rbac.Role) (*v1beta1rbac.Role, error) { + return c.opClient.KubernetesInterface().RbacV1beta1().Roles(c.Namespace).Create(role) +} + +func (c *InstallStrategyDeploymentClientForNamespace) CreateRoleBinding(roleBinding *v1beta1rbac.RoleBinding) (*v1beta1rbac.RoleBinding, error) { + return c.opClient.KubernetesInterface().RbacV1beta1().RoleBindings(c.Namespace).Create(roleBinding) +} + +func (c *InstallStrategyDeploymentClientForNamespace) EnsureServiceAccount(serviceAccount *corev1.ServiceAccount, owner ownerutil.Owner) (*corev1.ServiceAccount, error) { + if serviceAccount == nil { + return nil, ErrNilObject + } + + foundAccount, err := c.opClient.GetServiceAccount(c.Namespace, serviceAccount.Name) + if err != nil && !apierrors.IsNotFound(err) { + return nil, errors.Wrap(err, "checking for existing serviceacccount failed") + } + + // create if not found + if err != nil && apierrors.IsNotFound(err) { + serviceAccount.SetNamespace(c.Namespace) + createdAccount, err := c.opClient.CreateServiceAccount(serviceAccount) + if err != nil && !apierrors.IsAlreadyExists(err) { + return nil, errors.Wrap(err, "creating serviceacccount failed") + } + if apierrors.IsAlreadyExists(err) { + return serviceAccount, nil + } + return createdAccount, nil + } + + // if found, ensure ownerreferences + if ownerutil.IsOwnedBy(foundAccount, owner) { + return foundAccount, nil + } + // set owner if missing + ownerutil.AddNonBlockingOwner(foundAccount, owner) + return c.opClient.UpdateServiceAccount(foundAccount) +} + +func (c *InstallStrategyDeploymentClientForNamespace) CreateDeployment(deployment *appsv1.Deployment) (*appsv1.Deployment, error) { + return c.opClient.CreateDeployment(deployment) +} + +func (c *InstallStrategyDeploymentClientForNamespace) DeleteDeployment(name string) error { + foregroundDelete := metav1.DeletePropagationForeground // cascading delete + immediate := int64(0) + immediateForegroundDelete := &metav1.DeleteOptions{GracePeriodSeconds: &immediate, PropagationPolicy: &foregroundDelete} + return c.opClient.DeleteDeployment(c.Namespace, name, immediateForegroundDelete) +} + +func (c *InstallStrategyDeploymentClientForNamespace) CreateOrUpdateDeployment(deployment *appsv1.Deployment) (*appsv1.Deployment, error) { + d, _, err := c.opClient.CreateOrRollingUpdateDeployment(deployment) + return d, err +} + +func (c *InstallStrategyDeploymentClientForNamespace) GetServiceAccountByName(serviceAccountName string) (*corev1.ServiceAccount, error) { + return c.opClient.KubernetesInterface().CoreV1().ServiceAccounts(c.Namespace).Get(serviceAccountName, metav1.GetOptions{}) +} + +func (c *InstallStrategyDeploymentClientForNamespace) FindAnyDeploymentsMatchingNames(depNames []string) ([]*appsv1.Deployment, error) { + var deployments []*appsv1.Deployment + for _, depName := range depNames { + fetchedDep, err := c.opClient.GetDeployment(c.Namespace, depName) + + if err == nil { + deployments = append(deployments, fetchedDep) + } else { + // Any errors other than !exists are propagated up + if !apierrors.IsNotFound(err) { + return deployments, err + } + } + } + return deployments, nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/wrappers/wrappersfakes/fake_install_strategy_deployment_interface.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/wrappers/wrappersfakes/fake_install_strategy_deployment_interface.go new file mode 100644 index 00000000..78f535be --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/wrappers/wrappersfakes/fake_install_strategy_deployment_interface.go @@ -0,0 +1,571 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package wrappersfakes + +import ( + "sync" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/wrappers" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil" + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + v1beta1rbac "k8s.io/api/rbac/v1beta1" +) + +type FakeInstallStrategyDeploymentInterface struct { + CreateRoleStub func(role *v1beta1rbac.Role) (*v1beta1rbac.Role, error) + createRoleMutex sync.RWMutex + createRoleArgsForCall []struct { + role *v1beta1rbac.Role + } + createRoleReturns struct { + result1 *v1beta1rbac.Role + result2 error + } + createRoleReturnsOnCall map[int]struct { + result1 *v1beta1rbac.Role + result2 error + } + CreateRoleBindingStub func(roleBinding *v1beta1rbac.RoleBinding) (*v1beta1rbac.RoleBinding, error) + createRoleBindingMutex sync.RWMutex + createRoleBindingArgsForCall []struct { + roleBinding *v1beta1rbac.RoleBinding + } + createRoleBindingReturns struct { + result1 *v1beta1rbac.RoleBinding + result2 error + } + createRoleBindingReturnsOnCall map[int]struct { + result1 *v1beta1rbac.RoleBinding + result2 error + } + EnsureServiceAccountStub func(serviceAccount *corev1.ServiceAccount, owner ownerutil.Owner) (*corev1.ServiceAccount, error) + ensureServiceAccountMutex sync.RWMutex + ensureServiceAccountArgsForCall []struct { + serviceAccount *corev1.ServiceAccount + owner ownerutil.Owner + } + ensureServiceAccountReturns struct { + result1 *corev1.ServiceAccount + result2 error + } + ensureServiceAccountReturnsOnCall map[int]struct { + result1 *corev1.ServiceAccount + result2 error + } + CreateDeploymentStub func(deployment *appsv1.Deployment) (*appsv1.Deployment, error) + createDeploymentMutex sync.RWMutex + createDeploymentArgsForCall []struct { + deployment *appsv1.Deployment + } + createDeploymentReturns struct { + result1 *appsv1.Deployment + result2 error + } + createDeploymentReturnsOnCall map[int]struct { + result1 *appsv1.Deployment + result2 error + } + CreateOrUpdateDeploymentStub func(deployment *appsv1.Deployment) (*appsv1.Deployment, error) + createOrUpdateDeploymentMutex sync.RWMutex + createOrUpdateDeploymentArgsForCall []struct { + deployment *appsv1.Deployment + } + createOrUpdateDeploymentReturns struct { + result1 *appsv1.Deployment + result2 error + } + createOrUpdateDeploymentReturnsOnCall map[int]struct { + result1 *appsv1.Deployment + result2 error + } + DeleteDeploymentStub func(name string) error + deleteDeploymentMutex sync.RWMutex + deleteDeploymentArgsForCall []struct { + name string + } + deleteDeploymentReturns struct { + result1 error + } + deleteDeploymentReturnsOnCall map[int]struct { + result1 error + } + GetServiceAccountByNameStub func(serviceAccountName string) (*corev1.ServiceAccount, error) + getServiceAccountByNameMutex sync.RWMutex + getServiceAccountByNameArgsForCall []struct { + serviceAccountName string + } + getServiceAccountByNameReturns struct { + result1 *corev1.ServiceAccount + result2 error + } + getServiceAccountByNameReturnsOnCall map[int]struct { + result1 *corev1.ServiceAccount + result2 error + } + FindAnyDeploymentsMatchingNamesStub func(depNames []string) ([]*appsv1.Deployment, error) + findAnyDeploymentsMatchingNamesMutex sync.RWMutex + findAnyDeploymentsMatchingNamesArgsForCall []struct { + depNames []string + } + findAnyDeploymentsMatchingNamesReturns struct { + result1 []*appsv1.Deployment + result2 error + } + findAnyDeploymentsMatchingNamesReturnsOnCall map[int]struct { + result1 []*appsv1.Deployment + result2 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRole(role *v1beta1rbac.Role) (*v1beta1rbac.Role, error) { + fake.createRoleMutex.Lock() + ret, specificReturn := fake.createRoleReturnsOnCall[len(fake.createRoleArgsForCall)] + fake.createRoleArgsForCall = append(fake.createRoleArgsForCall, struct { + role *v1beta1rbac.Role + }{role}) + fake.recordInvocation("CreateRole", []interface{}{role}) + fake.createRoleMutex.Unlock() + if fake.CreateRoleStub != nil { + return fake.CreateRoleStub(role) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.createRoleReturns.result1, fake.createRoleReturns.result2 +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleCallCount() int { + fake.createRoleMutex.RLock() + defer fake.createRoleMutex.RUnlock() + return len(fake.createRoleArgsForCall) +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleArgsForCall(i int) *v1beta1rbac.Role { + fake.createRoleMutex.RLock() + defer fake.createRoleMutex.RUnlock() + return fake.createRoleArgsForCall[i].role +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleReturns(result1 *v1beta1rbac.Role, result2 error) { + fake.CreateRoleStub = nil + fake.createRoleReturns = struct { + result1 *v1beta1rbac.Role + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleReturnsOnCall(i int, result1 *v1beta1rbac.Role, result2 error) { + fake.CreateRoleStub = nil + if fake.createRoleReturnsOnCall == nil { + fake.createRoleReturnsOnCall = make(map[int]struct { + result1 *v1beta1rbac.Role + result2 error + }) + } + fake.createRoleReturnsOnCall[i] = struct { + result1 *v1beta1rbac.Role + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBinding(roleBinding *v1beta1rbac.RoleBinding) (*v1beta1rbac.RoleBinding, error) { + fake.createRoleBindingMutex.Lock() + ret, specificReturn := fake.createRoleBindingReturnsOnCall[len(fake.createRoleBindingArgsForCall)] + fake.createRoleBindingArgsForCall = append(fake.createRoleBindingArgsForCall, struct { + roleBinding *v1beta1rbac.RoleBinding + }{roleBinding}) + fake.recordInvocation("CreateRoleBinding", []interface{}{roleBinding}) + fake.createRoleBindingMutex.Unlock() + if fake.CreateRoleBindingStub != nil { + return fake.CreateRoleBindingStub(roleBinding) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.createRoleBindingReturns.result1, fake.createRoleBindingReturns.result2 +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingCallCount() int { + fake.createRoleBindingMutex.RLock() + defer fake.createRoleBindingMutex.RUnlock() + return len(fake.createRoleBindingArgsForCall) +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingArgsForCall(i int) *v1beta1rbac.RoleBinding { + fake.createRoleBindingMutex.RLock() + defer fake.createRoleBindingMutex.RUnlock() + return fake.createRoleBindingArgsForCall[i].roleBinding +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingReturns(result1 *v1beta1rbac.RoleBinding, result2 error) { + fake.CreateRoleBindingStub = nil + fake.createRoleBindingReturns = struct { + result1 *v1beta1rbac.RoleBinding + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingReturnsOnCall(i int, result1 *v1beta1rbac.RoleBinding, result2 error) { + fake.CreateRoleBindingStub = nil + if fake.createRoleBindingReturnsOnCall == nil { + fake.createRoleBindingReturnsOnCall = make(map[int]struct { + result1 *v1beta1rbac.RoleBinding + result2 error + }) + } + fake.createRoleBindingReturnsOnCall[i] = struct { + result1 *v1beta1rbac.RoleBinding + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccount(serviceAccount *corev1.ServiceAccount, owner ownerutil.Owner) (*corev1.ServiceAccount, error) { + fake.ensureServiceAccountMutex.Lock() + ret, specificReturn := fake.ensureServiceAccountReturnsOnCall[len(fake.ensureServiceAccountArgsForCall)] + fake.ensureServiceAccountArgsForCall = append(fake.ensureServiceAccountArgsForCall, struct { + serviceAccount *corev1.ServiceAccount + owner ownerutil.Owner + }{serviceAccount, owner}) + fake.recordInvocation("EnsureServiceAccount", []interface{}{serviceAccount, owner}) + fake.ensureServiceAccountMutex.Unlock() + if fake.EnsureServiceAccountStub != nil { + return fake.EnsureServiceAccountStub(serviceAccount, owner) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.ensureServiceAccountReturns.result1, fake.ensureServiceAccountReturns.result2 +} + +func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountCallCount() int { + fake.ensureServiceAccountMutex.RLock() + defer fake.ensureServiceAccountMutex.RUnlock() + return len(fake.ensureServiceAccountArgsForCall) +} + +func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountArgsForCall(i int) (*corev1.ServiceAccount, ownerutil.Owner) { + fake.ensureServiceAccountMutex.RLock() + defer fake.ensureServiceAccountMutex.RUnlock() + return fake.ensureServiceAccountArgsForCall[i].serviceAccount, fake.ensureServiceAccountArgsForCall[i].owner +} + +func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountReturns(result1 *corev1.ServiceAccount, result2 error) { + fake.EnsureServiceAccountStub = nil + fake.ensureServiceAccountReturns = struct { + result1 *corev1.ServiceAccount + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountReturnsOnCall(i int, result1 *corev1.ServiceAccount, result2 error) { + fake.EnsureServiceAccountStub = nil + if fake.ensureServiceAccountReturnsOnCall == nil { + fake.ensureServiceAccountReturnsOnCall = make(map[int]struct { + result1 *corev1.ServiceAccount + result2 error + }) + } + fake.ensureServiceAccountReturnsOnCall[i] = struct { + result1 *corev1.ServiceAccount + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateDeployment(deployment *appsv1.Deployment) (*appsv1.Deployment, error) { + fake.createDeploymentMutex.Lock() + ret, specificReturn := fake.createDeploymentReturnsOnCall[len(fake.createDeploymentArgsForCall)] + fake.createDeploymentArgsForCall = append(fake.createDeploymentArgsForCall, struct { + deployment *appsv1.Deployment + }{deployment}) + fake.recordInvocation("CreateDeployment", []interface{}{deployment}) + fake.createDeploymentMutex.Unlock() + if fake.CreateDeploymentStub != nil { + return fake.CreateDeploymentStub(deployment) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.createDeploymentReturns.result1, fake.createDeploymentReturns.result2 +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateDeploymentCallCount() int { + fake.createDeploymentMutex.RLock() + defer fake.createDeploymentMutex.RUnlock() + return len(fake.createDeploymentArgsForCall) +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateDeploymentArgsForCall(i int) *appsv1.Deployment { + fake.createDeploymentMutex.RLock() + defer fake.createDeploymentMutex.RUnlock() + return fake.createDeploymentArgsForCall[i].deployment +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateDeploymentReturns(result1 *appsv1.Deployment, result2 error) { + fake.CreateDeploymentStub = nil + fake.createDeploymentReturns = struct { + result1 *appsv1.Deployment + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateDeploymentReturnsOnCall(i int, result1 *appsv1.Deployment, result2 error) { + fake.CreateDeploymentStub = nil + if fake.createDeploymentReturnsOnCall == nil { + fake.createDeploymentReturnsOnCall = make(map[int]struct { + result1 *appsv1.Deployment + result2 error + }) + } + fake.createDeploymentReturnsOnCall[i] = struct { + result1 *appsv1.Deployment + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateOrUpdateDeployment(deployment *appsv1.Deployment) (*appsv1.Deployment, error) { + fake.createOrUpdateDeploymentMutex.Lock() + ret, specificReturn := fake.createOrUpdateDeploymentReturnsOnCall[len(fake.createOrUpdateDeploymentArgsForCall)] + fake.createOrUpdateDeploymentArgsForCall = append(fake.createOrUpdateDeploymentArgsForCall, struct { + deployment *appsv1.Deployment + }{deployment}) + fake.recordInvocation("CreateOrUpdateDeployment", []interface{}{deployment}) + fake.createOrUpdateDeploymentMutex.Unlock() + if fake.CreateOrUpdateDeploymentStub != nil { + return fake.CreateOrUpdateDeploymentStub(deployment) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.createOrUpdateDeploymentReturns.result1, fake.createOrUpdateDeploymentReturns.result2 +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateOrUpdateDeploymentCallCount() int { + fake.createOrUpdateDeploymentMutex.RLock() + defer fake.createOrUpdateDeploymentMutex.RUnlock() + return len(fake.createOrUpdateDeploymentArgsForCall) +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateOrUpdateDeploymentArgsForCall(i int) *appsv1.Deployment { + fake.createOrUpdateDeploymentMutex.RLock() + defer fake.createOrUpdateDeploymentMutex.RUnlock() + return fake.createOrUpdateDeploymentArgsForCall[i].deployment +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateOrUpdateDeploymentReturns(result1 *appsv1.Deployment, result2 error) { + fake.CreateOrUpdateDeploymentStub = nil + fake.createOrUpdateDeploymentReturns = struct { + result1 *appsv1.Deployment + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateOrUpdateDeploymentReturnsOnCall(i int, result1 *appsv1.Deployment, result2 error) { + fake.CreateOrUpdateDeploymentStub = nil + if fake.createOrUpdateDeploymentReturnsOnCall == nil { + fake.createOrUpdateDeploymentReturnsOnCall = make(map[int]struct { + result1 *appsv1.Deployment + result2 error + }) + } + fake.createOrUpdateDeploymentReturnsOnCall[i] = struct { + result1 *appsv1.Deployment + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) DeleteDeployment(name string) error { + fake.deleteDeploymentMutex.Lock() + ret, specificReturn := fake.deleteDeploymentReturnsOnCall[len(fake.deleteDeploymentArgsForCall)] + fake.deleteDeploymentArgsForCall = append(fake.deleteDeploymentArgsForCall, struct { + name string + }{name}) + fake.recordInvocation("DeleteDeployment", []interface{}{name}) + fake.deleteDeploymentMutex.Unlock() + if fake.DeleteDeploymentStub != nil { + return fake.DeleteDeploymentStub(name) + } + if specificReturn { + return ret.result1 + } + return fake.deleteDeploymentReturns.result1 +} + +func (fake *FakeInstallStrategyDeploymentInterface) DeleteDeploymentCallCount() int { + fake.deleteDeploymentMutex.RLock() + defer fake.deleteDeploymentMutex.RUnlock() + return len(fake.deleteDeploymentArgsForCall) +} + +func (fake *FakeInstallStrategyDeploymentInterface) DeleteDeploymentArgsForCall(i int) string { + fake.deleteDeploymentMutex.RLock() + defer fake.deleteDeploymentMutex.RUnlock() + return fake.deleteDeploymentArgsForCall[i].name +} + +func (fake *FakeInstallStrategyDeploymentInterface) DeleteDeploymentReturns(result1 error) { + fake.DeleteDeploymentStub = nil + fake.deleteDeploymentReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeInstallStrategyDeploymentInterface) DeleteDeploymentReturnsOnCall(i int, result1 error) { + fake.DeleteDeploymentStub = nil + if fake.deleteDeploymentReturnsOnCall == nil { + fake.deleteDeploymentReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.deleteDeploymentReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByName(serviceAccountName string) (*corev1.ServiceAccount, error) { + fake.getServiceAccountByNameMutex.Lock() + ret, specificReturn := fake.getServiceAccountByNameReturnsOnCall[len(fake.getServiceAccountByNameArgsForCall)] + fake.getServiceAccountByNameArgsForCall = append(fake.getServiceAccountByNameArgsForCall, struct { + serviceAccountName string + }{serviceAccountName}) + fake.recordInvocation("GetServiceAccountByName", []interface{}{serviceAccountName}) + fake.getServiceAccountByNameMutex.Unlock() + if fake.GetServiceAccountByNameStub != nil { + return fake.GetServiceAccountByNameStub(serviceAccountName) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.getServiceAccountByNameReturns.result1, fake.getServiceAccountByNameReturns.result2 +} + +func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByNameCallCount() int { + fake.getServiceAccountByNameMutex.RLock() + defer fake.getServiceAccountByNameMutex.RUnlock() + return len(fake.getServiceAccountByNameArgsForCall) +} + +func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByNameArgsForCall(i int) string { + fake.getServiceAccountByNameMutex.RLock() + defer fake.getServiceAccountByNameMutex.RUnlock() + return fake.getServiceAccountByNameArgsForCall[i].serviceAccountName +} + +func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByNameReturns(result1 *corev1.ServiceAccount, result2 error) { + fake.GetServiceAccountByNameStub = nil + fake.getServiceAccountByNameReturns = struct { + result1 *corev1.ServiceAccount + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByNameReturnsOnCall(i int, result1 *corev1.ServiceAccount, result2 error) { + fake.GetServiceAccountByNameStub = nil + if fake.getServiceAccountByNameReturnsOnCall == nil { + fake.getServiceAccountByNameReturnsOnCall = make(map[int]struct { + result1 *corev1.ServiceAccount + result2 error + }) + } + fake.getServiceAccountByNameReturnsOnCall[i] = struct { + result1 *corev1.ServiceAccount + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) FindAnyDeploymentsMatchingNames(depNames []string) ([]*appsv1.Deployment, error) { + var depNamesCopy []string + if depNames != nil { + depNamesCopy = make([]string, len(depNames)) + copy(depNamesCopy, depNames) + } + fake.findAnyDeploymentsMatchingNamesMutex.Lock() + ret, specificReturn := fake.findAnyDeploymentsMatchingNamesReturnsOnCall[len(fake.findAnyDeploymentsMatchingNamesArgsForCall)] + fake.findAnyDeploymentsMatchingNamesArgsForCall = append(fake.findAnyDeploymentsMatchingNamesArgsForCall, struct { + depNames []string + }{depNamesCopy}) + fake.recordInvocation("FindAnyDeploymentsMatchingNames", []interface{}{depNamesCopy}) + fake.findAnyDeploymentsMatchingNamesMutex.Unlock() + if fake.FindAnyDeploymentsMatchingNamesStub != nil { + return fake.FindAnyDeploymentsMatchingNamesStub(depNames) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.findAnyDeploymentsMatchingNamesReturns.result1, fake.findAnyDeploymentsMatchingNamesReturns.result2 +} + +func (fake *FakeInstallStrategyDeploymentInterface) FindAnyDeploymentsMatchingNamesCallCount() int { + fake.findAnyDeploymentsMatchingNamesMutex.RLock() + defer fake.findAnyDeploymentsMatchingNamesMutex.RUnlock() + return len(fake.findAnyDeploymentsMatchingNamesArgsForCall) +} + +func (fake *FakeInstallStrategyDeploymentInterface) FindAnyDeploymentsMatchingNamesArgsForCall(i int) []string { + fake.findAnyDeploymentsMatchingNamesMutex.RLock() + defer fake.findAnyDeploymentsMatchingNamesMutex.RUnlock() + return fake.findAnyDeploymentsMatchingNamesArgsForCall[i].depNames +} + +func (fake *FakeInstallStrategyDeploymentInterface) FindAnyDeploymentsMatchingNamesReturns(result1 []*appsv1.Deployment, result2 error) { + fake.FindAnyDeploymentsMatchingNamesStub = nil + fake.findAnyDeploymentsMatchingNamesReturns = struct { + result1 []*appsv1.Deployment + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) FindAnyDeploymentsMatchingNamesReturnsOnCall(i int, result1 []*appsv1.Deployment, result2 error) { + fake.FindAnyDeploymentsMatchingNamesStub = nil + if fake.findAnyDeploymentsMatchingNamesReturnsOnCall == nil { + fake.findAnyDeploymentsMatchingNamesReturnsOnCall = make(map[int]struct { + result1 []*appsv1.Deployment + result2 error + }) + } + fake.findAnyDeploymentsMatchingNamesReturnsOnCall[i] = struct { + result1 []*appsv1.Deployment + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.createRoleMutex.RLock() + defer fake.createRoleMutex.RUnlock() + fake.createRoleBindingMutex.RLock() + defer fake.createRoleBindingMutex.RUnlock() + fake.ensureServiceAccountMutex.RLock() + defer fake.ensureServiceAccountMutex.RUnlock() + fake.createDeploymentMutex.RLock() + defer fake.createDeploymentMutex.RUnlock() + fake.createOrUpdateDeploymentMutex.RLock() + defer fake.createOrUpdateDeploymentMutex.RUnlock() + fake.deleteDeploymentMutex.RLock() + defer fake.deleteDeploymentMutex.RUnlock() + fake.getServiceAccountByNameMutex.RLock() + defer fake.getServiceAccountByNameMutex.RUnlock() + fake.findAnyDeploymentsMatchingNamesMutex.RLock() + defer fake.findAnyDeploymentsMatchingNamesMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *FakeInstallStrategyDeploymentInterface) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} + +var _ wrappers.InstallStrategyDeploymentInterface = new(FakeInstallStrategyDeploymentInterface) diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/annotator/annotator.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/annotator/annotator.go new file mode 100644 index 00000000..2100e084 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/annotator/annotator.go @@ -0,0 +1,162 @@ +package annotator + +import ( + "encoding/json" + "fmt" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/strategicpatch" +) + +// Annotator talks to kubernetes and adds annotations to objects. +type Annotator struct { + OpClient operatorclient.ClientInterface + Annotations map[string]string +} + +func NewAnnotator(opClient operatorclient.ClientInterface, annotations map[string]string) *Annotator { + return &Annotator{ + OpClient: opClient, + Annotations: annotations, + } +} + +// AnnotateNamespaces takes a list of namespace names and adds annotations to them +func (a *Annotator) AnnotateNamespaces(namespaceNames []string) error { + if a.Annotations == nil { + return nil + } + + namespaces, err := a.getNamespaces(namespaceNames) + if err != nil { + return err + } + + for _, n := range namespaces { + if err := a.AnnotateNamespace(&n); err != nil { + return err + } + } + + return nil +} + +// CleanNamespaceAnnotations takes a list of namespace names and removes annotations from them +func (a *Annotator) CleanNamespaceAnnotations(namespaceNames []string) error { + if a.Annotations == nil { + return nil + } + + namespaces, err := a.getNamespaces(namespaceNames) + if err != nil { + return err + } + + for _, n := range namespaces { + if err := a.CleanNamespaceAnnotation(&n); err != nil { + return err + } + } + + return nil +} + +// getNamespaces gets the set of Namespace API objects given a list of names +// if NamespaceAll is passed (""), all namespaces will be returned +func (a *Annotator) getNamespaces(namespaceNames []string) (namespaces []corev1.Namespace, err error) { + if len(namespaceNames) == 1 && namespaceNames[0] == corev1.NamespaceAll { + namespaceList, err := a.OpClient.KubernetesInterface().CoreV1().Namespaces().List(metav1.ListOptions{}) + if err != nil { + return nil, err + } + namespaces = namespaceList.Items + return namespaces, nil + } + for _, n := range namespaceNames { + namespace, err := a.OpClient.KubernetesInterface().CoreV1().Namespaces().Get(n, metav1.GetOptions{}) + if err != nil { + return nil, err + } + namespaces = append(namespaces, *namespace) + } + return namespaces, nil +} + +func (a *Annotator) AnnotateNamespace(namespace *corev1.Namespace) error { + originalName := namespace.GetName() + originalData, err := json.Marshal(namespace) + if err != nil { + return err + } + + if namespace.Annotations == nil { + namespace.Annotations = map[string]string{} + } + + for key, value := range a.Annotations { + if existing, ok := namespace.Annotations[key]; ok && existing != value { + return fmt.Errorf("attempted to annotate namespace %s with %s:%s, but already annotated by %s:%s", namespace.Name, key, value, key, existing) + } + namespace.Annotations[key] = value + } + + modifiedData, err := json.Marshal(namespace) + if err != nil { + return err + } + patchBytes, err := strategicpatch.CreateTwoWayMergePatch(originalData, modifiedData, corev1.Namespace{}) + if err != nil { + return fmt.Errorf("error creating patch for Namespace: %v", err) + } + _, err = a.OpClient.KubernetesInterface().CoreV1().Namespaces().Patch(originalName, types.StrategicMergePatchType, patchBytes) + if err != nil { + return err + } + return nil +} + +func (a *Annotator) CleanNamespaceAnnotation(namespace *corev1.Namespace) error { + originalName := namespace.GetName() + originalData, err := json.Marshal(namespace) + if err != nil { + return err + } + + if namespace.Annotations == nil { + namespace.Annotations = map[string]string{} + } + + annotations := map[string]string{} + for k, v := range namespace.Annotations { + annotations[k] = v + } + + for key, value := range a.Annotations { + if existing, ok := namespace.Annotations[key]; ok && existing != value { + return fmt.Errorf("attempted to clean annotation %s:%s from namespace %s, but found unexpected annotation %s:%s", key, value, namespace.Name, key, existing) + } else if !ok { + // no namespace key to remove + return nil + } + delete(annotations, key) + } + namespace.SetAnnotations(annotations) + + modifiedData, err := json.Marshal(namespace) + if err != nil { + return err + } + patchBytes, err := strategicpatch.CreateTwoWayMergePatch(originalData, modifiedData, corev1.Namespace{}) + if err != nil { + return fmt.Errorf("error creating patch for Namespace: %v", err) + } + fmt.Println(string(patchBytes)) + _, err = a.OpClient.KubernetesInterface().CoreV1().Namespaces().Patch(originalName, types.StrategicMergePatchType, patchBytes) + if err != nil { + return err + } + return nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/errors/errors.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/errors/errors.go new file mode 100644 index 00000000..5015f086 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/errors/errors.go @@ -0,0 +1,32 @@ +package errors + +import "fmt" + +// MultipleExistingCRDOwnersError is an error that denotes multiple owners of a CRD exist +// simultaneously in the same namespace +type MultipleExistingCRDOwnersError struct { + CSVNames []string + CRDName string + Namespace string +} + +func (m MultipleExistingCRDOwnersError) Error() string { + return fmt.Sprintf("Existing CSVs %v in namespace %s all claim to own CRD %s", m.CSVNames, m.Namespace, m.CRDName) +} + +func NewMultipleExistingCRDOwnersError(csvNames []string, crdName string, namespace string) MultipleExistingCRDOwnersError { + return MultipleExistingCRDOwnersError{ + CSVNames: csvNames, + CRDName: crdName, + Namespace: namespace, + } +} + +func IsMultipleExistingCRDOwnersError(err error) bool { + switch err.(type) { + case MultipleExistingCRDOwnersError: + return true + } + + return false +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install/deployment.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install/deployment.go new file mode 100644 index 00000000..be5a9b84 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install/deployment.go @@ -0,0 +1,232 @@ +package install + +import ( + "fmt" + + log "github.com/sirupsen/logrus" + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + rbac "k8s.io/api/rbac/v1beta1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/wrappers" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil" +) + +const ( + InstallStrategyNameDeployment = "deployment" +) + +// StrategyDeploymentPermissions describe the rbac rules and service account needed by the install strategy +type StrategyDeploymentPermissions struct { + ServiceAccountName string `json:"serviceAccountName"` + Rules []rbac.PolicyRule `json:"rules"` +} + +// StrategyDeploymentSpec contains the name and spec for the deployment ALM should create +type StrategyDeploymentSpec struct { + Name string `json:"name"` + Spec appsv1.DeploymentSpec `json:"spec"` +} + +// StrategyDetailsDeployment represents the parsed details of a Deployment +// InstallStrategy. +type StrategyDetailsDeployment struct { + DeploymentSpecs []StrategyDeploymentSpec `json:"deployments"` + Permissions []StrategyDeploymentPermissions `json:"permissions,omitempty"` +} + +type StrategyDeploymentInstaller struct { + strategyClient wrappers.InstallStrategyDeploymentInterface + owner ownerutil.Owner + previousStrategy Strategy +} + +func (d *StrategyDetailsDeployment) GetStrategyName() string { + return InstallStrategyNameDeployment +} + +var _ Strategy = &StrategyDetailsDeployment{} +var _ StrategyInstaller = &StrategyDeploymentInstaller{} + +func NewStrategyDeploymentInstaller(strategyClient wrappers.InstallStrategyDeploymentInterface, owner ownerutil.Owner, previousStrategy Strategy) StrategyInstaller { + return &StrategyDeploymentInstaller{ + strategyClient: strategyClient, + owner: owner, + previousStrategy: previousStrategy, + } +} + +func (i *StrategyDeploymentInstaller) installPermissions(perms []StrategyDeploymentPermissions) error { + for _, permission := range perms { + // create role + role := &rbac.Role{ + Rules: permission.Rules, + } + ownerutil.AddNonBlockingOwner(role, i.owner) + role.SetGenerateName(fmt.Sprintf("%s-role-", i.owner.GetName())) + createdRole, err := i.strategyClient.CreateRole(role) + if err != nil { + return err + } + + // create serviceaccount if necessary + serviceAccount := &corev1.ServiceAccount{} + serviceAccount.SetName(permission.ServiceAccountName) + // EnsureServiceAccount verifies/creates ownerreferences so we don't add them here + serviceAccount, err = i.strategyClient.EnsureServiceAccount(serviceAccount, i.owner) + if err != nil { + return err + } + + // create rolebinding + roleBinding := &rbac.RoleBinding{ + RoleRef: rbac.RoleRef{ + Kind: "Role", + Name: createdRole.GetName(), + APIGroup: rbac.GroupName}, + Subjects: []rbac.Subject{{ + Kind: "ServiceAccount", + Name: permission.ServiceAccountName, + Namespace: i.owner.GetNamespace(), + }}, + } + ownerutil.AddNonBlockingOwner(roleBinding, i.owner) + roleBinding.SetGenerateName(fmt.Sprintf("%s-%s-rolebinding-", createdRole.Name, serviceAccount.Name)) + + if _, err := i.strategyClient.CreateRoleBinding(roleBinding); err != nil { + return err + } + } + return nil +} + +func (i *StrategyDeploymentInstaller) installDeployments(deps []StrategyDeploymentSpec) error { + for _, d := range deps { + // Create or Update Deployment + dep := &appsv1.Deployment{Spec: d.Spec} + dep.SetName(d.Name) + dep.SetNamespace(i.owner.GetNamespace()) + ownerutil.AddNonBlockingOwner(dep, i.owner) + if dep.Labels == nil { + dep.SetLabels(map[string]string{}) + } + dep.Labels["alm-owner-name"] = i.owner.GetName() + dep.Labels["alm-owner-namespace"] = i.owner.GetNamespace() + if _, err := i.strategyClient.CreateOrUpdateDeployment(dep); err != nil { + return err + } + } + + return nil +} + +func (i *StrategyDeploymentInstaller) cleanupPrevious(current *StrategyDetailsDeployment, previous *StrategyDetailsDeployment) error { + previousDeploymentsMap := map[string]struct{}{} + for _, d := range previous.DeploymentSpecs { + previousDeploymentsMap[d.Name] = struct{}{} + } + for _, d := range current.DeploymentSpecs { + delete(previousDeploymentsMap, d.Name) + } + log.Debugf("preparing to cleanup: %s", previousDeploymentsMap) + // delete deployments in old strategy but not new + var err error = nil + for name := range previousDeploymentsMap { + err = i.strategyClient.DeleteDeployment(name) + } + return err +} + +func (i *StrategyDeploymentInstaller) Install(s Strategy) error { + strategy, ok := s.(*StrategyDetailsDeployment) + if !ok { + return fmt.Errorf("attempted to install %s strategy with deployment installer", strategy.GetStrategyName()) + } + + if err := i.installPermissions(strategy.Permissions); err != nil { + return err + } + + if err := i.installDeployments(strategy.DeploymentSpecs); err != nil { + return err + } + + if i.previousStrategy != nil { + previous, ok := i.previousStrategy.(*StrategyDetailsDeployment) + if !ok { + return fmt.Errorf("couldn't parse old install %s strategy with deployment installer", previous.GetStrategyName()) + } + return i.cleanupPrevious(strategy, previous) + } + return nil +} + +// CheckInstalled can return nil (installed), or errors +// Errors can indicate: some component missing (keep installing), unable to query (check again later), or unrecoverable (failed in a way we know we can't recover from) +func (i *StrategyDeploymentInstaller) CheckInstalled(s Strategy) (installed bool, err error) { + strategy, ok := s.(*StrategyDetailsDeployment) + if !ok { + return false, StrategyError{Reason: StrategyErrReasonInvalidStrategy, Message: fmt.Sprintf("attempted to check %s strategy with deployment installer", strategy.GetStrategyName())} + } + + // Check service accounts + for _, perm := range strategy.Permissions { + if err := i.checkForServiceAccount(perm.ServiceAccountName); err != nil { + return false, err + } + } + + // Check deployments + if err := i.checkForDeployments(strategy.DeploymentSpecs); err != nil { + return false, err + } + return true, nil +} + +func (i *StrategyDeploymentInstaller) checkForServiceAccount(serviceAccountName string) error { + if _, err := i.strategyClient.GetServiceAccountByName(serviceAccountName); err != nil { + if apierrors.IsNotFound(err) { + log.Debugf("service account not found: %s", serviceAccountName) + return StrategyError{Reason: StrategyErrReasonComponentMissing, Message: fmt.Sprintf("service account not found: %s", serviceAccountName)} + } + log.Debugf("error querying for %s: %s", serviceAccountName, err) + return StrategyError{Reason: StrategyErrReasonComponentMissing, Message: fmt.Sprintf("error querying for %s: %s", serviceAccountName, err)} + } + // TODO: use a SelfSubjectRulesReview (or a sync version) to verify ServiceAccount has correct access + return nil +} + +func (i *StrategyDeploymentInstaller) checkForDeployments(deploymentSpecs []StrategyDeploymentSpec) error { + var depNames []string + for _, dep := range deploymentSpecs { + depNames = append(depNames, dep.Name) + } + + existingDeployments, err := i.strategyClient.FindAnyDeploymentsMatchingNames(depNames) + if err != nil { + return StrategyError{Reason: StrategyErrReasonComponentMissing, Message: fmt.Sprintf("error querying for %s: %s", depNames, err)} + } + + // compare deployments to see if any need to be created/updated + existingMap := map[string]*appsv1.Deployment{} + for _, d := range existingDeployments { + existingMap[d.GetName()] = d + } + for _, spec := range deploymentSpecs { + dep, exists := existingMap[spec.Name] + if !exists { + log.Debugf("missing deployment with name=%s", spec.Name) + return StrategyError{Reason: StrategyErrReasonComponentMissing, Message: fmt.Sprintf("missing deployment with name=%s", spec.Name)} + } + reason, ready, err := DeploymentStatus(dep) + if err != nil { + log.Debugf("deployment %s not ready before timeout: %s", dep.Name, err.Error()) + return StrategyError{Reason: StrategyErrReasonTimeout, Message: fmt.Sprintf("deployment %s not ready before timeout: %s", dep.Name, err.Error())} + } + if !ready { + return StrategyError{Reason: StrategyErrReasonWaiting, Message: fmt.Sprintf("waiting for deployment %s to become ready: %s", dep.Name, reason)} + } + } + return nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install/errors.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install/errors.go new file mode 100644 index 00000000..7eabd0cd --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install/errors.go @@ -0,0 +1,49 @@ +package install + +import "fmt" + +const ( + StrategyErrReasonComponentMissing = "ComponentMissing" + StrategyErrReasonWaiting = "Waiting" + StrategyErrReasonInvalidStrategy = "InvalidStrategy" + StrategyErrReasonTimeout = "Timeout" + StrategyErrReasonUnknown = "Unknown" +) + +// unrecoverableErrors are the set of errors that mean we can't recover an install strategy +var unrecoverableErrors = map[string]struct{}{ + StrategyErrReasonInvalidStrategy: {}, + StrategyErrReasonTimeout: {}, +} + +// StrategyError is used to represent error types for install strategies +type StrategyError struct { + Reason string + Message string +} + +var _ error = StrategyError{} + +// Error implements the Error interface. +func (e StrategyError) Error() string { + return fmt.Sprintf("%s: %s", e.Reason, e.Message) +} + +// IsErrorUnrecoverable reports if a given strategy error is one of the predefined unrecoverable types +func IsErrorUnrecoverable(err error) bool { + if err == nil { + return false + } + _, ok := unrecoverableErrors[reasonForError(err)] + return ok +} + +func reasonForError(err error) string { + switch t := err.(type) { + case StrategyError: + return t.Reason + case *StrategyError: + return t.Reason + } + return StrategyErrReasonUnknown +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install/resolver.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install/resolver.go new file mode 100644 index 00000000..3f090a5d --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install/resolver.go @@ -0,0 +1,66 @@ +//go:generate counterfeiter -o ../../fakes/fake_strategy.go resolver.go Strategy +//go:generate counterfeiter -o ../../fakes/fake_strategy_installer.go resolver.go StrategyInstaller +//go:generate counterfeiter -o ../../fakes/fake_strategy_resolver.go resolver.go StrategyResolverInterface +package install + +import ( + "encoding/json" + "fmt" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/wrappers" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil" +) + +type Strategy interface { + GetStrategyName() string +} + +type StrategyInstaller interface { + Install(strategy Strategy) error + CheckInstalled(strategy Strategy) (bool, error) +} + +type StrategyResolverInterface interface { + UnmarshalStrategy(s v1alpha1.NamedInstallStrategy) (strategy Strategy, err error) + InstallerForStrategy(strategyName string, opClient operatorclient.ClientInterface, owner ownerutil.Owner, previousStrategy Strategy) StrategyInstaller +} + +type StrategyResolver struct{} + +func (r *StrategyResolver) UnmarshalStrategy(s v1alpha1.NamedInstallStrategy) (strategy Strategy, err error) { + switch s.StrategyName { + case InstallStrategyNameDeployment: + strategy = &StrategyDetailsDeployment{} + if err := json.Unmarshal(s.StrategySpecRaw, strategy); err != nil { + return nil, err + } + return + } + err = fmt.Errorf("unrecognized install strategy") + return +} + +func (r *StrategyResolver) InstallerForStrategy(strategyName string, opClient operatorclient.ClientInterface, owner ownerutil.Owner, previousStrategy Strategy) StrategyInstaller { + switch strategyName { + case InstallStrategyNameDeployment: + strategyClient := wrappers.NewInstallStrategyDeploymentClient(opClient, owner.GetNamespace()) + return NewStrategyDeploymentInstaller(strategyClient, owner, previousStrategy) + } + + // Insurance against these functions being called incorrectly (unmarshal strategy will return a valid strategy name) + return &NullStrategyInstaller{} +} + +type NullStrategyInstaller struct{} + +var _ StrategyInstaller = &NullStrategyInstaller{} + +func (i *NullStrategyInstaller) Install(s Strategy) error { + return fmt.Errorf("null InstallStrategy used") +} + +func (i *NullStrategyInstaller) CheckInstalled(s Strategy) (bool, error) { + return true, nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install/status_viewer.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install/status_viewer.go new file mode 100644 index 00000000..67a857ef --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install/status_viewer.go @@ -0,0 +1,47 @@ +package install + +// See kubernetes/pkg/kubectl/rollout_status.go + +import ( + "fmt" + + appsv1 "k8s.io/api/apps/v1" +) + +const TimedOutReason = "ProgressDeadlineExceeded" + +// Status returns a message describing deployment status, and a bool value indicating if the status is considered done. +func DeploymentStatus(deployment *appsv1.Deployment) (string, bool, error) { + if deployment.Generation <= deployment.Status.ObservedGeneration { + // check if deployment has timed out + cond := getDeploymentCondition(deployment.Status, appsv1.DeploymentProgressing) + if cond != nil && cond.Reason == TimedOutReason { + return "", false, fmt.Errorf("deployment %q exceeded its progress deadline", deployment.Name) + } + // not all replicas are up yet + if deployment.Spec.Replicas != nil && deployment.Status.UpdatedReplicas < *deployment.Spec.Replicas { + return fmt.Sprintf("Waiting for rollout to finish: %d out of %d new replicas have been updated...\n", deployment.Status.UpdatedReplicas, *deployment.Spec.Replicas), false, nil + } + // waiting for old replicas to be cleaned up + if deployment.Status.Replicas > deployment.Status.UpdatedReplicas { + return fmt.Sprintf("Waiting for rollout to finish: %d old replicas are pending termination...\n", deployment.Status.Replicas-deployment.Status.UpdatedReplicas), false, nil + } + // waiting for new replicas to report as available + if deployment.Status.AvailableReplicas < deployment.Status.UpdatedReplicas { + return fmt.Sprintf("Waiting for rollout to finish: %d of %d updated replicas are available...\n", deployment.Status.AvailableReplicas, deployment.Status.UpdatedReplicas), false, nil + } + // deployment is finished + return fmt.Sprintf("deployment %q successfully rolled out\n", deployment.Name), true, nil + } + return fmt.Sprintf("Waiting for deployment spec update to be observed...\n"), false, nil +} + +func getDeploymentCondition(status appsv1.DeploymentStatus, condType appsv1.DeploymentConditionType) *appsv1.DeploymentCondition { + for i := range status.Conditions { + c := status.Conditions[i] + if c.Type == condType { + return &c + } + } + return nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go new file mode 100644 index 00000000..a432772f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go @@ -0,0 +1,648 @@ +package catalog + +import ( + "encoding/json" + "errors" + "fmt" + + "sync" + "time" + + olmerrors "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/errors" + log "github.com/sirupsen/logrus" + "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/client-go/tools/cache" + "k8s.io/client-go/util/workqueue" + + "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" + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions" + "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry" + "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer" +) + +const ( + crdKind = "CustomResourceDefinition" + secretKind = "Secret" + clusterRoleKind = "ClusterRole" +) + +//for test stubbing and for ensuring standardization of timezones to UTC +var timeNow = func() metav1.Time { return metav1.NewTime(time.Now().UTC()) } + +// Operator represents a Kubernetes operator that executes InstallPlans by +// resolving dependencies in a catalog. +type Operator struct { + *queueinformer.Operator + client versioned.Interface + namespace string + sources map[registry.ResourceKey]registry.Source + sourcesLock sync.RWMutex + sourcesLastUpdate metav1.Time + dependencyResolver resolver.DependencyResolver + subQueue workqueue.RateLimitingInterface +} + +// NewOperator creates a new Catalog Operator. +func NewOperator(kubeconfigPath string, wakeupInterval time.Duration, operatorNamespace string, watchedNamespaces ...string) (*Operator, error) { + // Default to watching all namespaces. + if watchedNamespaces == nil { + watchedNamespaces = []string{metav1.NamespaceAll} + } + + // Create a new client for ALM types (CRs) + crClient, err := client.NewClient(kubeconfigPath) + if err != nil { + return nil, err + } + + // Create an informer for each watched namespace. + ipSharedIndexInformers := []cache.SharedIndexInformer{} + subSharedIndexInformers := []cache.SharedIndexInformer{} + for _, namespace := range watchedNamespaces { + nsInformerFactory := externalversions.NewSharedInformerFactoryWithOptions(crClient, wakeupInterval, externalversions.WithNamespace(namespace)) + ipSharedIndexInformers = append(ipSharedIndexInformers, nsInformerFactory.Operators().V1alpha1().InstallPlans().Informer()) + subSharedIndexInformers = append(subSharedIndexInformers, nsInformerFactory.Operators().V1alpha1().Subscriptions().Informer()) + } + + // Create an informer for each catalog namespace + catsrcSharedIndexInformers := []cache.SharedIndexInformer{} + for _, namespace := range []string{operatorNamespace} { + nsInformerFactory := externalversions.NewSharedInformerFactoryWithOptions(crClient, wakeupInterval, externalversions.WithNamespace(namespace)) + catsrcSharedIndexInformers = append(catsrcSharedIndexInformers, nsInformerFactory.Operators().V1alpha1().CatalogSources().Informer()) + } + + // Create a new queueinformer-based operator. + queueOperator, err := queueinformer.NewOperator(kubeconfigPath) + if err != nil { + return nil, err + } + + // Allocate the new instance of an Operator. + op := &Operator{ + Operator: queueOperator, + client: crClient, + namespace: operatorNamespace, + sources: make(map[registry.ResourceKey]registry.Source), + dependencyResolver: &resolver.MultiSourceResolver{}, + } + + // Register CatalogSource informers. + catsrcQueue := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "catalogsources") + catsrcQueueInformer := queueinformer.New( + catsrcQueue, + catsrcSharedIndexInformers, + op.syncCatalogSources, + nil, + "catsrc", + ) + for _, informer := range catsrcQueueInformer { + op.RegisterQueueInformer(informer) + } + + // Register InstallPlan informers. + ipQueue := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "installplans") + ipQueueInformers := queueinformer.New( + ipQueue, + ipSharedIndexInformers, + op.syncInstallPlans, + nil, + "installplan", + ) + for _, informer := range ipQueueInformers { + op.RegisterQueueInformer(informer) + } + + // Register Subscription informers. + subscriptionQueue := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "subscriptions") + subscriptionQueueInformers := queueinformer.New( + subscriptionQueue, + subSharedIndexInformers, + op.syncSubscriptions, + nil, + "subscription", + ) + op.subQueue = subscriptionQueue + for _, informer := range subscriptionQueueInformers { + op.RegisterQueueInformer(informer) + } + + return op, nil +} + +func (o *Operator) syncCatalogSources(obj interface{}) (syncError error) { + catsrc, ok := obj.(*v1alpha1.CatalogSource) + if !ok { + log.Debugf("wrong type: %#v", obj) + return fmt.Errorf("casting CatalogSource failed") + } + + // Get the catalog source's config map + configMap, err := o.OpClient.KubernetesInterface().CoreV1().ConfigMaps(catsrc.GetNamespace()).Get(catsrc.Spec.ConfigMap, metav1.GetOptions{}) + if err != nil { + return fmt.Errorf("failed to get catalog config map %s when updating status: %s", catsrc.Spec.ConfigMap, err) + } + + o.sourcesLock.Lock() + defer o.sourcesLock.Unlock() + sourceKey := registry.ResourceKey{Name: catsrc.GetName(), Namespace: catsrc.GetNamespace()} + _, ok = o.sources[sourceKey] + + // Check for catalog source changes + if ok && catsrc.Status.ConfigMapResource != nil && catsrc.Status.ConfigMapResource.Name == configMap.GetName() && catsrc.Status.ConfigMapResource.ResourceVersion == configMap.GetResourceVersion() { + return nil + } + + // Update status subresource + out := catsrc.DeepCopy() + out.Status.ConfigMapResource = &v1alpha1.ConfigMapResourceReference{ + Name: configMap.GetName(), + Namespace: configMap.GetNamespace(), + UID: configMap.GetUID(), + ResourceVersion: configMap.GetResourceVersion(), + } + out.Status.LastSync = timeNow() + + _, err = o.client.OperatorsV1alpha1().CatalogSources(out.GetNamespace()).UpdateStatus(out) + if err != nil { + return fmt.Errorf("failed to update catalog source %s status: %s", out.GetName(), err) + } + + // Create a new in-mem registry + src, err := registry.NewInMemoryFromConfigMap(o.OpClient, out.GetNamespace(), out.Spec.ConfigMap) + if err != nil { + return fmt.Errorf("failed to create catalog source from ConfigMap %s: %s", out.Spec.ConfigMap, err) + } + + // Update sources map + o.sources[sourceKey] = src + o.sourcesLastUpdate = timeNow() + + return nil +} + +func (o *Operator) syncSubscriptions(obj interface{}) (syncError error) { + sub, ok := obj.(*v1alpha1.Subscription) + if !ok { + log.Debugf("wrong type: %#v", obj) + return fmt.Errorf("casting Subscription failed") + } + + logger := log.WithFields(log.Fields{ + "sub": sub.GetName(), + "namespace": sub.GetNamespace(), + "source": sub.Spec.CatalogSource, + "pkg": sub.Spec.Package, + "channel": sub.Spec.Channel, + }) + + logger.Infof("syncing") + + var updatedSub *v1alpha1.Subscription + updatedSub, syncError = o.syncSubscription(sub) + + if updatedSub == nil || updatedSub.Status.State == sub.Status.State { + return + } + if syncError != nil { + logger = logger.WithField("syncError", syncError) + } + + updatedSub.Status.LastUpdated = timeNow() + // Update Subscription with status of transition. Log errors if we can't write them to the status. + if _, err := o.client.OperatorsV1alpha1().Subscriptions(updatedSub.GetNamespace()).UpdateStatus(updatedSub); err != nil { + logger = logger.WithField("updateError", err.Error()) + updateErr := errors.New("error updating Subscription status: " + err.Error()) + if syncError == nil { + logger.Info("error updating Subscription status") + return updateErr + } + logger.Info("error transitioning Subscription") + syncError = fmt.Errorf("error transitioning Subscription: %s and error updating Subscription status: %s", syncError, updateErr) + } + + return +} + +func (o *Operator) requeueInstallPlan(name, namespace string) { + // we can build the key directly, will need to change if queue uses different key scheme + key := fmt.Sprintf("%s/%s", namespace, name) + o.subQueue.AddRateLimited(key) + return +} + +func (o *Operator) syncInstallPlans(obj interface{}) (syncError error) { + plan, ok := obj.(*v1alpha1.InstallPlan) + if !ok { + log.Debugf("wrong type: %#v", obj) + return fmt.Errorf("casting InstallPlan failed") + } + + logger := log.WithFields(log.Fields{ + "ip": plan.GetName(), + "namespace": plan.GetNamespace(), + "phase": plan.Status.Phase, + }) + + logger.Info("syncing") + outInstallPlan, syncError := transitionInstallPlanState(o, *plan) + + if syncError != nil { + logger = logger.WithField("syncError", syncError) + } + + // no changes in status, don't update + if outInstallPlan.Status.Phase == plan.Status.Phase { + return + } + + // notify subscription loop of installplan changes + if ownerutil.IsOwnedByKind(outInstallPlan, v1alpha1.SubscriptionKind) { + oref := ownerutil.GetOwnerByKind(outInstallPlan, v1alpha1.SubscriptionKind) + o.requeueInstallPlan(oref.Name, outInstallPlan.GetNamespace()) + } + + // Update InstallPlan with status of transition. Log errors if we can't write them to the status. + if _, err := o.client.OperatorsV1alpha1().InstallPlans(plan.GetNamespace()).UpdateStatus(outInstallPlan); err != nil { + logger = logger.WithField("updateError", err.Error()) + updateErr := errors.New("error updating InstallPlan status: " + err.Error()) + if syncError == nil { + logger.Info("error updating InstallPlan status") + return updateErr + } + logger.Info("error transitioning InstallPlan") + syncError = fmt.Errorf("error transitioning InstallPlan: %s and error updating InstallPlan status: %s", syncError, updateErr) + } + return +} + +type installPlanTransitioner interface { + ResolvePlan(*v1alpha1.InstallPlan) error + ExecutePlan(*v1alpha1.InstallPlan) error +} + +var _ installPlanTransitioner = &Operator{} + +func transitionInstallPlanState(transitioner installPlanTransitioner, in v1alpha1.InstallPlan) (*v1alpha1.InstallPlan, error) { + logger := log.WithFields(log.Fields{ + "ip": in.GetName(), + "namespace": in.GetNamespace(), + "phase": in.Status.Phase, + }) + + out := in.DeepCopy() + + switch in.Status.Phase { + case v1alpha1.InstallPlanPhaseNone: + logger.Debugf("setting phase to %s", v1alpha1.InstallPlanPhasePlanning) + out.Status.Phase = v1alpha1.InstallPlanPhasePlanning + return out, nil + + case v1alpha1.InstallPlanPhasePlanning: + logger.Debug("attempting to resolve") + if err := transitioner.ResolvePlan(out); err != nil { + out.Status.SetCondition(v1alpha1.ConditionFailed(v1alpha1.InstallPlanResolved, + v1alpha1.InstallPlanReasonInstallCheckFailed, err)) + out.Status.Phase = v1alpha1.InstallPlanPhaseFailed + return out, err + } + out.Status.SetCondition(v1alpha1.ConditionMet(v1alpha1.InstallPlanResolved)) + + if out.Spec.Approval == v1alpha1.ApprovalManual && out.Spec.Approved != true { + out.Status.Phase = v1alpha1.InstallPlanPhaseRequiresApproval + } else { + out.Status.Phase = v1alpha1.InstallPlanPhaseInstalling + } + return out, nil + + case v1alpha1.InstallPlanPhaseRequiresApproval: + if out.Spec.Approved { + logger.Debugf("approved, setting to %s", v1alpha1.InstallPlanPhasePlanning) + out.Status.Phase = v1alpha1.InstallPlanPhaseInstalling + } else { + logger.Debug("not approved, skipping sync") + } + return out, nil + + case v1alpha1.InstallPlanPhaseInstalling: + logger.Debug("attempting to install") + if err := transitioner.ExecutePlan(out); err != nil { + out.Status.SetCondition(v1alpha1.ConditionFailed(v1alpha1.InstallPlanInstalled, + v1alpha1.InstallPlanReasonComponentFailed, err)) + out.Status.Phase = v1alpha1.InstallPlanPhaseFailed + return out, err + } + out.Status.SetCondition(v1alpha1.ConditionMet(v1alpha1.InstallPlanInstalled)) + out.Status.Phase = v1alpha1.InstallPlanPhaseComplete + return out, nil + default: + return out, nil + } +} + +// ResolvePlan modifies an InstallPlan to contain a Plan in its Status field. +func (o *Operator) ResolvePlan(plan *v1alpha1.InstallPlan) error { + if plan.Status.Phase != v1alpha1.InstallPlanPhasePlanning { + panic("attempted to create a plan that wasn't in the planning phase") + } + + if len(o.sources) == 0 { + return fmt.Errorf("cannot resolve InstallPlan without any Catalog Sources") + } + + // Take a snapshot of the included catalog sources + includedNamespaces := map[string]struct{}{ + o.namespace: {}, + plan.Namespace: {}, + } + sourcesSnapshot := o.getSourcesSnapshot(plan, includedNamespaces) + + // Take a snapshot of the existing CRD owners + existingCRDOwners, err := o.getExistingCRDOwners(plan.Namespace) + if err != nil { + return err + } + + // Attempt to resolve the InstallPlan + steps, usedSources, err := o.dependencyResolver.ResolveInstallPlan(sourcesSnapshot, existingCRDOwners, CatalogLabel, plan) + if err != nil { + return err + } + + // Set the resolved steps + plan.Status.Plan = steps + plan.Status.CatalogSources = []string{} + + // Add secrets for each used catalog source + for _, sourceKey := range usedSources { + // Append the used catalog source + plan.Status.CatalogSources = append(plan.Status.CatalogSources, sourceKey.Name) + + // Get the catalog source + catsrc, err := o.client.OperatorsV1alpha1().CatalogSources(sourceKey.Namespace).Get(sourceKey.Name, metav1.GetOptions{}) + if err != nil { + return err + } + + for _, secretName := range catsrc.Spec.Secrets { + // Attempt to look up the secret + _, err := o.OpClient.KubernetesInterface().CoreV1().Secrets(sourceKey.Namespace).Get(secretName, metav1.GetOptions{}) + status := v1alpha1.StepStatusUnknown + if k8serrors.IsNotFound(err) { + status = v1alpha1.StepStatusNotPresent + } else if err == nil { + status = v1alpha1.StepStatusPresent + } else { + return err + } + + // Prepend any required secrets to the plan for that catalog source + plan.Status.Plan = append([]v1alpha1.Step{{ + Resolving: "", + Resource: v1alpha1.StepResource{ + Name: secretName, + Kind: "Secret", + Group: "", + Version: "v1", + }, + Status: status, + }}, plan.Status.Plan...) + } + } + + return nil +} + +// ExecutePlan applies a planned InstallPlan to a namespace. +func (o *Operator) ExecutePlan(plan *v1alpha1.InstallPlan) error { + if plan.Status.Phase != v1alpha1.InstallPlanPhaseInstalling { + panic("attempted to install a plan that wasn't in the installing phase") + } + + // Get the set of initial installplan csv names + initialCSVNames := getCSVNameSet(plan) + // Get pre-existing CRD owners to make decisions about applying resolved CSVs + existingCRDOwners, err := o.getExistingCRDOwners(plan.GetNamespace()) + if err != nil { + return err + } + + for i, step := range plan.Status.Plan { + switch step.Status { + case v1alpha1.StepStatusPresent, v1alpha1.StepStatusCreated: + continue + + case v1alpha1.StepStatusUnknown, v1alpha1.StepStatusNotPresent: + log.Debugf("resource kind: %s", step.Resource.Kind) + log.Debugf("resource name: %s", step.Resource.Name) + switch step.Resource.Kind { + case crdKind: + // Marshal the manifest into a CRD instance. + var crd v1beta1ext.CustomResourceDefinition + err := json.Unmarshal([]byte(step.Resource.Manifest), &crd) + if err != nil { + return err + } + + // TODO: check that names are accepted + // Attempt to create the CRD. + _, err = o.OpClient.ApiextensionsV1beta1Interface().ApiextensionsV1beta1().CustomResourceDefinitions().Create(&crd) + if k8serrors.IsAlreadyExists(err) { + // If it already existed, mark the step as Present. + plan.Status.Plan[i].Status = v1alpha1.StepStatusPresent + continue + } else if err != nil { + return err + } else { + // If no error occured, mark the step as Created. + plan.Status.Plan[i].Status = v1alpha1.StepStatusCreated + continue + } + + case v1alpha1.ClusterServiceVersionKind: + // Marshal the manifest into a CSV instance. + var csv v1alpha1.ClusterServiceVersion + err := json.Unmarshal([]byte(step.Resource.Manifest), &csv) + if err != nil { + return err + } + + // Check if the resolved CSV is in the initial set + if _, ok := initialCSVNames[csv.GetName()]; !ok { + // Check for pre-existing CSVs that own the same CRDs + competingOwners, err := competingCRDOwnersExist(plan.GetNamespace(), &csv, existingCRDOwners) + if err != nil { + return err + } + + // TODO: decide on fail/continue logic for pre-existing dependent CSVs that own the same CRD(s) + if competingOwners { + // For now, error out + return fmt.Errorf("Pre-existing CRD owners found for owned CRD(s) of dependent CSV %s", csv.GetName()) + } + } + + // Attempt to create the CSV. + _, err = o.client.OperatorsV1alpha1().ClusterServiceVersions(csv.GetNamespace()).Create(&csv) + if k8serrors.IsAlreadyExists(err) { + // If it already existed, mark the step as Present. + plan.Status.Plan[i].Status = v1alpha1.StepStatusPresent + } else if err != nil { + return err + } else { + // If no error occurred, mark the step as Created. + plan.Status.Plan[i].Status = v1alpha1.StepStatusCreated + } + + case secretKind: + // Get the pre-existing secret. + secret, err := o.OpClient.KubernetesInterface().CoreV1().Secrets(o.namespace).Get(step.Resource.Name, metav1.GetOptions{}) + if k8serrors.IsNotFound(err) { + return fmt.Errorf("secret %s does not exist", step.Resource.Name) + } else if err != nil { + return err + } + + // Set the namespace to the InstallPlan's namespace and attempt to + // create a new secret. + secret.Namespace = plan.Namespace + _, err = o.OpClient.KubernetesInterface().CoreV1().Secrets(plan.Namespace).Create(&v1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: secret.Name, + Namespace: plan.Namespace, + }, + Data: secret.Data, + Type: secret.Type, + }) + if k8serrors.IsAlreadyExists(err) { + // If it already existed, mark the step as Present. + plan.Status.Plan[i].Status = v1alpha1.StepStatusPresent + } else if err != nil { + return err + } else { + // If no error occured, mark the step as Created. + plan.Status.Plan[i].Status = v1alpha1.StepStatusCreated + } + + case clusterRoleKind: + // Marshal the manifest into a ClusterRole instance. + var cr rbacv1.ClusterRole + err := json.Unmarshal([]byte(step.Resource.Manifest), &cr) + if err != nil { + return err + } + + // Attempt to create the ClusterRole. + _, err = o.OpClient.KubernetesInterface().RbacV1().ClusterRoles().Create(&cr) + if k8serrors.IsAlreadyExists(err) { + // If it already existed, mark the step as Present. + plan.Status.Plan[i].Status = v1alpha1.StepStatusPresent + } else if err != nil { + return err + } else { + // If no error occurred, mark the step as Created. + plan.Status.Plan[i].Status = v1alpha1.StepStatusCreated + } + + default: + return v1alpha1.ErrInvalidInstallPlan + } + + default: + return v1alpha1.ErrInvalidInstallPlan + } + } + + // Loop over one final time to check and see if everything is good. + for _, step := range plan.Status.Plan { + switch step.Status { + case v1alpha1.StepStatusCreated, v1alpha1.StepStatusPresent: + default: + return nil + } + } + + return nil +} + +func (o *Operator) getSourcesSnapshot(plan *v1alpha1.InstallPlan, includedNamespaces map[string]struct{}) []registry.SourceRef { + o.sourcesLock.RLock() + defer o.sourcesLock.RUnlock() + sourcesSnapshot := []registry.SourceRef{} + + for key, source := range o.sources { + // Only copy catalog sources in included namespaces + if _, ok := includedNamespaces[key.Namespace]; ok { + ref := registry.SourceRef{ + Source: source, + SourceKey: key, + } + if key.Name == plan.Spec.CatalogSource && key.Namespace == plan.Spec.CatalogSourceNamespace { + // Prepend preffered catalog source + sourcesSnapshot = append([]registry.SourceRef{ref}, sourcesSnapshot...) + } else { + // Append the catalog source + sourcesSnapshot = append(sourcesSnapshot, ref) + } + } + } + + return sourcesSnapshot +} + +// getExistingCRDOwners creates a map of CRD names to existing owner CSVs in the given namespace +func (o *Operator) getExistingCRDOwners(namespace string) (map[string][]string, error) { + // Get a list of CSV CRs in the namespace + csvList, err := o.client.OperatorsV1alpha1().ClusterServiceVersions(namespace).List(metav1.ListOptions{}) + + if err != nil { + return nil, err + } + + // Map CRD names to existing owner CSV CRs in the namespace + owners := make(map[string][]string) + for _, csv := range csvList.Items { + for _, crd := range csv.Spec.CustomResourceDefinitions.Owned { + owners[crd.Name] = append(owners[crd.Name], csv.GetName()) + } + } + + return owners, nil +} + +// competingCRDOwnersExist returns true if there exists a CSV that owns at least one of the given CSVs owned CRDs (that's not the given CSV) +func competingCRDOwnersExist(namespace string, csv *v1alpha1.ClusterServiceVersion, existingOwners map[string][]string) (bool, error) { + // Attempt to find a pre-existing owner in the namespace for any owned crd + for _, crdDesc := range csv.Spec.CustomResourceDefinitions.Owned { + crdOwners := existingOwners[crdDesc.Name] + l := len(crdOwners) + switch { + case l == 1: + // One competing owner found + if crdOwners[0] != csv.GetName() { + return true, nil + } + case l > 1: + return true, olmerrors.NewMultipleExistingCRDOwnersError(crdOwners, crdDesc.Name, namespace) + } + } + + return false, nil +} + +// getCSVNameSet returns a set of the given installplan's csv names +func getCSVNameSet(plan *v1alpha1.InstallPlan) map[string]struct{} { + csvNameSet := make(map[string]struct{}) + for _, name := range plan.Spec.ClusterServiceVersionNames { + csvNameSet[name] = struct{}{} + } + + return csvNameSet +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/subscriptions.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/subscriptions.go new file mode 100644 index 00000000..246b402f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/subscriptions.go @@ -0,0 +1,153 @@ +package catalog + +import ( + "errors" + "fmt" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil" + log "github.com/sirupsen/logrus" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +var ( + ErrNilSubscription = errors.New("invalid Subscription object: ") +) + +const ( + PackageLabel = "alm-package" + CatalogLabel = "alm-catalog" + ChannelLabel = "alm-channel" +) + +// FIXME(alecmerdler): Rewrite this whole block to be more clear +func (o *Operator) syncSubscription(in *v1alpha1.Subscription) (*v1alpha1.Subscription, error) { + if in == nil || in.Spec == nil { + return nil, ErrNilSubscription + } + out := in.DeepCopy() + out = ensureLabels(out) + + // Only sync if catalog has been updated since last sync time + if o.sourcesLastUpdate.Before(&out.Status.LastUpdated) && out.Status.State == v1alpha1.SubscriptionStateAtLatest { + log.Infof("skipping sync: no new updates to catalog since last sync at %s", + out.Status.LastUpdated.String()) + return nil, nil + } + + o.sourcesLock.Lock() + defer o.sourcesLock.Unlock() + + catalogNamespace := out.Spec.CatalogSourceNamespace + if catalogNamespace == "" { + catalogNamespace = o.namespace + } + catalog, ok := o.sources[registry.ResourceKey{Name: out.Spec.CatalogSource, Namespace: catalogNamespace}] + if !ok { + out.Status.State = v1alpha1.SubscriptionStateAtLatest + out.Status.Reason = v1alpha1.SubscriptionReasonInvalidCatalog + return out, fmt.Errorf("unknown catalog source %s in namespace %s", out.Spec.CatalogSource, catalogNamespace) + } + + // Find latest CSV if no CSVs are installed already + if out.Status.CurrentCSV == "" { + if out.Spec.StartingCSV != "" { + out.Status.CurrentCSV = out.Spec.StartingCSV + } else { + csv, err := catalog.FindCSVForPackageNameUnderChannel(out.Spec.Package, out.Spec.Channel) + if err != nil { + return out, fmt.Errorf("failed to find CSV for package %s in channel %s: %v", out.Spec.Package, out.Spec.Channel, err) + } + if csv == nil { + return out, fmt.Errorf("failed to find CSV for package %s in channel %s: nil CSV", out.Spec.Package, out.Spec.Channel) + } + out.Status.CurrentCSV = csv.GetName() + } + out.Status.State = v1alpha1.SubscriptionStateUpgradeAvailable + return out, nil + } + + // Check that desired CSV has been installed + csv, err := o.client.OperatorsV1alpha1().ClusterServiceVersions(out.GetNamespace()).Get(out.Status.CurrentCSV, metav1.GetOptions{}) + if err != nil || csv == nil { + log.Infof("error fetching CSV %s via k8s api: %v", out.Status.CurrentCSV, err) + if out.Status.Install != nil && out.Status.Install.Name != "" { + ip, err := o.client.OperatorsV1alpha1().InstallPlans(out.GetNamespace()).Get(out.Status.Install.Name, metav1.GetOptions{}) + if err != nil { + log.Errorf("get installplan %s error: %v", out.Status.Install.Name, err) + } + if err == nil && ip != nil { + log.Infof("installplan for %s already exists", out.Status.CurrentCSV) + return out, nil + } + log.Infof("installplan %s not found: creating new plan", out.Status.Install.Name) + out.Status.Install = nil + } + + // Install CSV if doesn't exist + out.Status.State = v1alpha1.SubscriptionStateUpgradePending + ip := &v1alpha1.InstallPlan{ + ObjectMeta: metav1.ObjectMeta{}, + Spec: v1alpha1.InstallPlanSpec{ + ClusterServiceVersionNames: []string{out.Status.CurrentCSV}, + Approval: out.GetInstallPlanApproval(), + }, + } + ownerutil.AddNonBlockingOwner(ip, out) + ip.SetGenerateName(fmt.Sprintf("install-%s-", out.Status.CurrentCSV)) + ip.SetNamespace(out.GetNamespace()) + + // Inherit the subscription's catalog source + ip.Spec.CatalogSource = out.Spec.CatalogSource + ip.Spec.CatalogSourceNamespace = out.Spec.CatalogSourceNamespace + + res, err := o.client.OperatorsV1alpha1().InstallPlans(out.GetNamespace()).Create(ip) + if err != nil { + return out, fmt.Errorf("failed to ensure current CSV %s installed: %v", out.Status.CurrentCSV, err) + } + if res == nil { + return out, errors.New("unexpected installplan returned by k8s api on create: ") + } + out.Status.Install = &v1alpha1.InstallPlanReference{ + UID: res.GetUID(), + Name: res.GetName(), + APIVersion: v1alpha1.SchemeGroupVersion.String(), + Kind: v1alpha1.InstallPlanKind, + } + return out, nil + } + + // Set the installed CSV + out.Status.InstalledCSV = out.Status.CurrentCSV + + // Poll catalog for an update + repl, err := catalog.FindReplacementCSVForPackageNameUnderChannel(out.Spec.Package, out.Spec.Channel, out.Status.CurrentCSV) + if err != nil { + out.Status.State = v1alpha1.SubscriptionStateAtLatest + return out, fmt.Errorf("failed to lookup replacement CSV for %s: %v", out.Status.CurrentCSV, err) + } + if repl == nil { + out.Status.State = v1alpha1.SubscriptionStateAtLatest + return out, fmt.Errorf("nil replacement CSV for %s returned from catalog", out.Status.CurrentCSV) + } + + // Update subscription with new latest + out.Status.CurrentCSV = repl.GetName() + out.Status.Install = nil + out.Status.State = v1alpha1.SubscriptionStateUpgradeAvailable + return out, nil +} + +func ensureLabels(sub *v1alpha1.Subscription) *v1alpha1.Subscription { + labels := sub.GetLabels() + if labels == nil { + labels = map[string]string{} + } + labels[PackageLabel] = sub.Spec.Package + labels[CatalogLabel] = sub.Spec.CatalogSource + labels[ChannelLabel] = sub.Spec.Channel + sub.SetLabels(labels) + return sub +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/olm/operator.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/olm/operator.go new file mode 100644 index 00000000..110a64cd --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/olm/operator.go @@ -0,0 +1,484 @@ +package olm + +import ( + "errors" + "fmt" + "time" + + log "github.com/sirupsen/logrus" + "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "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/api/apis/operators/v1alpha1" + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned" + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions" + "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/annotator" + "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer" +) + +var ErrRequirementsNotMet = errors.New("requirements were not met") +var ErrCRDOwnerConflict = errors.New("CRD owned by another ClusterServiceVersion") + +const ( + FallbackWakeupInterval = 30 * time.Second +) + +type Operator struct { + *queueinformer.Operator + csvQueue workqueue.RateLimitingInterface + client versioned.Interface + resolver install.StrategyResolverInterface + annotator *annotator.Annotator + cleanupFunc func() +} + +func NewOperator(crClient versioned.Interface, opClient operatorclient.ClientInterface, resolver install.StrategyResolverInterface, wakeupInterval time.Duration, annotations map[string]string, namespaces []string) (*Operator, error) { + if wakeupInterval < 0 { + wakeupInterval = FallbackWakeupInterval + } + if len(namespaces) < 1 { + namespaces = []string{metav1.NamespaceAll} + } + + queueOperator, err := queueinformer.NewOperatorFromClient(opClient) + if err != nil { + return nil, err + } + namespaceAnnotator := annotator.NewAnnotator(queueOperator.OpClient, annotations) + + op := &Operator{ + Operator: queueOperator, + client: crClient, + resolver: resolver, + annotator: namespaceAnnotator, + cleanupFunc: func() { + namespaceAnnotator.CleanNamespaceAnnotations(namespaces) + }, + } + + // if watching all namespaces, set up a watch to annotate new namespaces + if len(namespaces) == 1 && namespaces[0] == metav1.NamespaceAll { + log.Debug("watching all namespaces, setting up queue") + namespaceInformer := informers.NewSharedInformerFactory(queueOperator.OpClient.KubernetesInterface(), wakeupInterval).Core().V1().Namespaces().Informer() + queueInformer := queueinformer.NewInformer( + workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "namespaces"), + namespaceInformer, + op.annotateNamespace, + nil, + "namespace", + ) + op.RegisterQueueInformer(queueInformer) + } + + // annotate namespaces that ALM operator manages + if err := namespaceAnnotator.AnnotateNamespaces(namespaces); err != nil { + return nil, err + } + + // set up watch on CSVs + csvInformers := []cache.SharedIndexInformer{} + for _, namespace := range namespaces { + log.Debugf("watching for CSVs in namespace %s", namespace) + sharedInformerFactory := externalversions.NewSharedInformerFactoryWithOptions(crClient, wakeupInterval, externalversions.WithNamespace(namespace)) + informer := sharedInformerFactory.Operators().V1alpha1().ClusterServiceVersions().Informer() + csvInformers = append(csvInformers, informer) + } + + // csvInformers for each namespace all use the same backing queue + // queue keys are namespaced + csvQueue := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "clusterserviceversions") + queueInformers := queueinformer.New( + csvQueue, + csvInformers, + op.syncClusterServiceVersion, + nil, + "csv", + ) + for _, informer := range queueInformers { + op.RegisterQueueInformer(informer) + } + op.csvQueue = csvQueue + + // set up watch on deployments + depInformers := []cache.SharedIndexInformer{} + for _, namespace := range namespaces { + log.Debugf("watching deployments in namespace %s", namespace) + informer := informers.NewSharedInformerFactoryWithOptions(opClient.KubernetesInterface(), wakeupInterval, informers.WithNamespace(namespace)).Apps().V1().Deployments().Informer() + depInformers = append(depInformers, informer) + } + + depQueue := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "csv-deployments") + depQueueInformers := queueinformer.New( + depQueue, + depInformers, + op.syncDeployment, + nil, + "deployment", + ) + for _, informer := range depQueueInformers { + op.RegisterQueueInformer(informer) + } + return op, nil +} + +func (a *Operator) Cleanup() { + a.cleanupFunc() +} + +func (a *Operator) requeueCSV(name, namespace string) { + // we can build the key directly, will need to change if queue uses different key scheme + key := fmt.Sprintf("%s/%s", namespace, name) + a.csvQueue.AddRateLimited(key) + return +} + +func (a *Operator) syncDeployment(obj interface{}) (syncError error) { + deployment, ok := obj.(*v1.Deployment) + if !ok { + log.Debugf("wrong type: %#v", obj) + return fmt.Errorf("casting Deployment failed") + } + if ownerutil.IsOwnedByKind(deployment, v1alpha1.ClusterServiceVersionKind) { + oref := ownerutil.GetOwnerByKind(deployment, v1alpha1.ClusterServiceVersionKind) + a.requeueCSV(oref.Name, deployment.GetNamespace()) + } + return nil +} + +// syncClusterServiceVersion is the method that gets called when we see a CSV event in the cluster +func (a *Operator) syncClusterServiceVersion(obj interface{}) (syncError error) { + clusterServiceVersion, ok := obj.(*v1alpha1.ClusterServiceVersion) + if !ok { + log.Debugf("wrong type: %#v", obj) + return fmt.Errorf("casting ClusterServiceVersion failed") + } + logger := log.WithFields(log.Fields{ + "csv": clusterServiceVersion.GetName(), + "namespace": clusterServiceVersion.GetNamespace(), + "phase": clusterServiceVersion.Status.Phase, + }) + logger.Info("syncing") + + outCSV, syncError := a.transitionCSVState(*clusterServiceVersion) + + // no changes in status, don't update + if outCSV.Status.Phase == clusterServiceVersion.Status.Phase && outCSV.Status.Reason == clusterServiceVersion.Status.Reason && outCSV.Status.Message == clusterServiceVersion.Status.Message { + return + } + + // Update CSV with status of transition. Log errors if we can't write them to the status. + _, err := a.client.OperatorsV1alpha1().ClusterServiceVersions(clusterServiceVersion.GetNamespace()).UpdateStatus(outCSV) + if err != nil { + updateErr := errors.New("error updating ClusterServiceVersion status: " + err.Error()) + if syncError == nil { + logger.Info(updateErr) + return updateErr + } + syncError = fmt.Errorf("error transitioning ClusterServiceVersion: %s and error updating CSV status: %s", syncError, updateErr) + } + return +} + +// transitionCSVState moves the CSV status state machine along based on the current value and the current cluster +// state. +func (a *Operator) transitionCSVState(in v1alpha1.ClusterServiceVersion) (out *v1alpha1.ClusterServiceVersion, syncError error) { + logger := log.WithFields(log.Fields{ + "csv": in.GetName(), + "namespace": in.GetNamespace(), + "phase": in.Status.Phase, + }) + + out = in.DeepCopy() + + // check if the current CSV is being replaced, return with replacing status if so + if err := a.checkReplacementsAndUpdateStatus(out); err != nil { + logger.WithField("err", err).Info("replacement check") + return + } + + switch out.Status.Phase { + case v1alpha1.CSVPhaseNone: + logger.Infof("scheduling ClusterServiceVersion for requirement verification") + out.SetPhase(v1alpha1.CSVPhasePending, v1alpha1.CSVReasonRequirementsUnknown, "requirements not yet checked") + case v1alpha1.CSVPhasePending: + met, statuses := a.requirementStatus(out) + out.SetRequirementStatus(statuses) + + if !met { + logger.Info("requirements were not met") + out.SetPhase(v1alpha1.CSVPhasePending, v1alpha1.CSVReasonRequirementsNotMet, "one or more requirements couldn't be found") + syncError = ErrRequirementsNotMet + return + } + + // check for CRD ownership conflicts + if syncError = a.crdOwnerConflicts(out, a.csvsInNamespace(out.GetNamespace())); syncError != nil { + out.SetPhase(v1alpha1.CSVPhaseFailed, v1alpha1.CSVReasonOwnerConflict, fmt.Sprintf("owner conflict: %s", syncError)) + return + } + + logger.Info("scheduling ClusterServiceVersion for install") + out.SetPhase(v1alpha1.CSVPhaseInstallReady, v1alpha1.CSVReasonRequirementsMet, "all requirements found, attempting install") + case v1alpha1.CSVPhaseInstallReady: + installer, strategy, _ := a.parseStrategiesAndUpdateStatus(out) + if strategy == nil { + // parseStrategiesAndUpdateStatus sets CSV status + return + } + + if syncError = installer.Install(strategy); syncError != nil { + out.SetPhase(v1alpha1.CSVPhaseFailed, v1alpha1.CSVReasonComponentFailed, fmt.Sprintf("install strategy failed: %s", syncError)) + return + } + + out.SetPhase(v1alpha1.CSVPhaseInstalling, v1alpha1.CSVReasonInstallSuccessful, "waiting for install components to report healthy") + a.requeueCSV(out.GetName(), out.GetNamespace()) + return + case v1alpha1.CSVPhaseInstalling: + installer, strategy, _ := a.parseStrategiesAndUpdateStatus(out) + if strategy == nil { + // parseStrategiesAndUpdateStatus sets CSV status + return + } + + if installErr := a.updateInstallStatus(out, installer, strategy, v1alpha1.CSVReasonWaiting); installErr == nil { + logger.WithField("strategy", out.Spec.InstallStrategy.StrategyName).Infof("install strategy successful") + } + + case v1alpha1.CSVPhaseSucceeded: + installer, strategy, _ := a.parseStrategiesAndUpdateStatus(out) + if strategy == nil { + // parseStrategiesAndUpdateStatus sets CSV status + return + } + if installErr := a.updateInstallStatus(out, installer, strategy, v1alpha1.CSVReasonComponentUnhealthy); installErr != nil { + logger.WithField("strategy", out.Spec.InstallStrategy.StrategyName).Infof("unhealthy component: %s", installErr) + } + case v1alpha1.CSVPhaseReplacing: + // determine CSVs that are safe to delete by finding a replacement chain to a CSV that's running + // since we don't know what order we'll process replacements, we have to guard against breaking that chain + + // if this isn't the earliest csv in a replacement chain, skip gc. + // marking an intermediate for deletion will break the replacement chain + if prev := a.isReplacing(out); prev != nil { + logger.Debugf("being replaced, but is not a leaf. skipping gc") + return + } + + // if we can find a newer version that's successfully installed, we're safe to mark all intermediates + for _, csv := range a.findIntermediatesForDeletion(out) { + // we only mark them in this step, in case some get deleted but others fail and break the replacement chain + csv.SetPhase(v1alpha1.CSVPhaseDeleting, v1alpha1.CSVReasonReplaced, "has been replaced by a newer ClusterServiceVersion that has successfully installed.") + // ignore errors and success here; this step is just an optimization to speed up GC + a.client.OperatorsV1alpha1().ClusterServiceVersions(csv.GetNamespace()).UpdateStatus(csv) + a.requeueCSV(csv.GetName(), csv.GetNamespace()) + } + + // if there's no newer version, requeue for processing (likely will be GCable before resync) + a.requeueCSV(out.GetName(), out.GetNamespace()) + case v1alpha1.CSVPhaseDeleting: + var immediate int64 = 0 + syncError = a.client.OperatorsV1alpha1().ClusterServiceVersions(out.GetNamespace()).Delete(out.GetName(), &metav1.DeleteOptions{GracePeriodSeconds: &immediate}) + if syncError != nil { + logger.Debugf("unable to get delete csv marked for deletion: %s", syncError.Error()) + } + } + + return +} + +// findIntermediatesForDeletion starts at csv and follows the replacement chain until one is running and active +func (a *Operator) findIntermediatesForDeletion(csv *v1alpha1.ClusterServiceVersion) (csvs []*v1alpha1.ClusterServiceVersion) { + csvsInNamespace := a.csvsInNamespace(csv.GetNamespace()) + current := csv + + // isBeingReplaced returns a copy + next := a.isBeingReplaced(current, csvsInNamespace) + for next != nil { + csvs = append(csvs, current) + log.Debugf("checking to see if %s is running so we can delete %s", next.GetName(), csv.GetName()) + installer, nextStrategy, currentStrategy := a.parseStrategiesAndUpdateStatus(next) + if nextStrategy == nil { + log.Debugf("couldn't get strategy for %s", next.GetName()) + continue + } + if currentStrategy == nil { + log.Debugf("couldn't get strategy for %s", next.GetName()) + continue + } + installed, _ := installer.CheckInstalled(nextStrategy) + if installed && !next.IsObsolete() { + return csvs + } + current = next + next = a.isBeingReplaced(current, csvsInNamespace) + } + return nil +} + +// csvsInNamespace finds all CSVs in a namespace +func (a *Operator) csvsInNamespace(namespace string) map[string]*v1alpha1.ClusterServiceVersion { + csvsInNamespace, err := a.client.OperatorsV1alpha1().ClusterServiceVersions(namespace).List(metav1.ListOptions{}) + if err != nil { + return nil + } + csvs := make(map[string]*v1alpha1.ClusterServiceVersion, len(csvsInNamespace.Items)) + for _, csv := range csvsInNamespace.Items { + csvs[csv.Name] = csv.DeepCopy() + } + return csvs +} + +// checkReplacementsAndUpdateStatus returns an error if we can find a newer CSV and sets the status if so +func (a *Operator) checkReplacementsAndUpdateStatus(csv *v1alpha1.ClusterServiceVersion) error { + if csv.Status.Phase == v1alpha1.CSVPhaseReplacing || csv.Status.Phase == v1alpha1.CSVPhaseDeleting { + return nil + } + if replacement := a.isBeingReplaced(csv, a.csvsInNamespace(csv.GetNamespace())); replacement != nil { + log.Infof("newer ClusterServiceVersion replacing %s, no-op", csv.SelfLink) + msg := fmt.Sprintf("being replaced by csv: %s", replacement.SelfLink) + csv.SetPhase(v1alpha1.CSVPhaseReplacing, v1alpha1.CSVReasonBeingReplaced, msg) + + return fmt.Errorf("replacing") + } + return nil +} + +func (a *Operator) updateInstallStatus(csv *v1alpha1.ClusterServiceVersion, installer install.StrategyInstaller, strategy install.Strategy, requeueConditionReason v1alpha1.ConditionReason) error { + installed, strategyErr := installer.CheckInstalled(strategy) + if installed { + // if there's no error, we're successfully running + if csv.Status.Phase != v1alpha1.CSVPhaseSucceeded { + csv.SetPhase(v1alpha1.CSVPhaseSucceeded, v1alpha1.CSVReasonInstallSuccessful, "install strategy completed with no errors") + } + return nil + } + + // installcheck determined we can't progress (e.g. deployment failed to come up in time) + if install.IsErrorUnrecoverable(strategyErr) { + csv.SetPhase(v1alpha1.CSVPhaseFailed, v1alpha1.CSVReasonInstallCheckFailed, fmt.Sprintf("install failed: %s", strategyErr)) + return strategyErr + } + + // if there's an error checking install that shouldn't fail the strategy, requeue with message + if strategyErr != nil { + csv.SetPhase(v1alpha1.CSVPhaseInstalling, requeueConditionReason, fmt.Sprintf("installing: %s", strategyErr)) + return strategyErr + } + + return nil +} + +// parseStrategiesAndUpdateStatus returns a StrategyInstaller and a Strategy for a CSV if it can, else it sets a status on the CSV and returns +func (a *Operator) parseStrategiesAndUpdateStatus(csv *v1alpha1.ClusterServiceVersion) (install.StrategyInstaller, install.Strategy, install.Strategy) { + strategy, err := a.resolver.UnmarshalStrategy(csv.Spec.InstallStrategy) + if err != nil { + csv.SetPhase(v1alpha1.CSVPhaseFailed, v1alpha1.CSVReasonInvalidStrategy, fmt.Sprintf("install strategy invalid: %s", err)) + return nil, nil, nil + } + + previousCSV := a.isReplacing(csv) + var previousStrategy install.Strategy + if previousCSV != nil { + a.requeueCSV(previousCSV.Name, previousCSV.Namespace) + previousStrategy, err = a.resolver.UnmarshalStrategy(previousCSV.Spec.InstallStrategy) + if err != nil { + previousStrategy = nil + } + } + + strName := strategy.GetStrategyName() + installer := a.resolver.InstallerForStrategy(strName, a.OpClient, csv, previousStrategy) + return installer, strategy, previousStrategy +} + +func (a *Operator) requirementStatus(csv *v1alpha1.ClusterServiceVersion) (met bool, statuses []v1alpha1.RequirementStatus) { + met = true + for _, r := range csv.GetAllCRDDescriptions() { + status := v1alpha1.RequirementStatus{ + Group: "apiextensions.k8s.io", + Version: "v1beta1", + Kind: "CustomResourceDefinition", + Name: r.Name, + } + crd, err := a.OpClient.ApiextensionsV1beta1Interface().ApiextensionsV1beta1().CustomResourceDefinitions().Get(r.Name, metav1.GetOptions{}) + if err != nil { + status.Status = "NotPresent" + met = false + } else { + status.Status = "Present" + status.UUID = string(crd.GetUID()) + } + statuses = append(statuses, status) + } + return +} + +func (a *Operator) crdOwnerConflicts(in *v1alpha1.ClusterServiceVersion, csvsInNamespace map[string]*v1alpha1.ClusterServiceVersion) error { + owned := false + for _, crd := range in.Spec.CustomResourceDefinitions.Owned { + for csvName, csv := range csvsInNamespace { + if csvName == in.GetName() { + continue + } + if csv.OwnsCRD(crd.Name) { + owned = true + } + if owned && in.Spec.Replaces == csvName { + return nil + } + } + } + if owned { + return ErrCRDOwnerConflict + } + return nil +} + +// annotateNamespace is the method that gets called when we see a namespace event in the cluster +func (a *Operator) annotateNamespace(obj interface{}) (syncError error) { + namespace, ok := obj.(*corev1.Namespace) + if !ok { + log.Debugf("wrong type: %#v", obj) + return fmt.Errorf("casting Namespace failed") + } + + log.Infof("syncing Namespace: %s", namespace.GetName()) + if err := a.annotator.AnnotateNamespace(namespace); err != nil { + log.Infof("error annotating namespace '%s'", namespace.GetName()) + return err + } + return nil +} + +func (a *Operator) isBeingReplaced(in *v1alpha1.ClusterServiceVersion, csvsInNamespace map[string]*v1alpha1.ClusterServiceVersion) (replacedBy *v1alpha1.ClusterServiceVersion) { + for _, csv := range csvsInNamespace { + log.Infof("checking %s", csv.GetName()) + if csv.Spec.Replaces == in.GetName() { + log.Infof("%s replaced by %s", in.GetName(), csv.GetName()) + replacedBy = csv.DeepCopy() + return + } + } + return +} + +func (a *Operator) isReplacing(in *v1alpha1.ClusterServiceVersion) *v1alpha1.ClusterServiceVersion { + log.Debugf("checking if csv is replacing an older version") + if in.Spec.Replaces == "" { + return nil + } + previous, err := a.client.OperatorsV1alpha1().ClusterServiceVersions(in.GetNamespace()).Get(in.Spec.Replaces, metav1.GetOptions{}) + if err != nil { + log.Debugf("unable to get previous csv: %s", err.Error()) + return nil + } + return previous +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/configmap_loader.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/configmap_loader.go new file mode 100644 index 00000000..209cbaa8 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/configmap_loader.go @@ -0,0 +1,123 @@ +package registry + +import ( + "encoding/json" + "fmt" + + "github.com/ghodss/yaml" + log "github.com/sirupsen/logrus" + "k8s.io/api/core/v1" + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient" +) + +const ( + ConfigMapCRDName = "customResourceDefinitions" + ConfigMapCSVName = "clusterServiceVersions" + ConfigMapPackageName = "packages" +) + +// ConfigMapCatalogResourceLoader loads a ConfigMap of resources into the in-memory catalog +type ConfigMapCatalogResourceLoader struct { + namespace string + opClient operatorclient.ClientInterface +} + +func NewConfigMapCatalogResourceLoader(namespace string, opClient operatorclient.ClientInterface) ConfigMapCatalogResourceLoader { + return ConfigMapCatalogResourceLoader{ + namespace: namespace, + opClient: opClient, + } +} + +func (d *ConfigMapCatalogResourceLoader) LoadCatalogResources(catalog *InMem, configMapName string) error { + log.Debugf("Load ConfigMap -- BEGIN %s", configMapName) + + cm, err := d.opClient.KubernetesInterface().CoreV1().ConfigMaps(d.namespace).Get(configMapName, metav1.GetOptions{}) + if err != nil { + log.Debugf("Load ConfigMap -- ERROR %s : error=%s", configMapName, err) + return fmt.Errorf("error loading catalog from ConfigMap %s: %s", configMapName, err) + } + return d.LoadCatalogResourcesFromConfigMap(catalog, cm) +} + +func (d *ConfigMapCatalogResourceLoader) LoadCatalogResourcesFromConfigMap(catalog *InMem, cm *v1.ConfigMap) error { + configMapName := cm.GetName() + found := false + crdListYaml, ok := cm.Data[ConfigMapCRDName] + if ok { + crdListJson, err := yaml.YAMLToJSON([]byte(crdListYaml)) + if err != nil { + log.Debugf("Load ConfigMap -- ERROR %s : error=%s", configMapName, err) + return fmt.Errorf("error loading CRD list yaml from ConfigMap %s: %s", configMapName, err) + } + + var parsedCRDList []v1beta1.CustomResourceDefinition + err = json.Unmarshal([]byte(crdListJson), &parsedCRDList) + if err != nil { + log.Debugf("Load ConfigMap -- ERROR %s : error=%s", configMapName, err) + return fmt.Errorf("error parsing CRD list (json) from ConfigMap %s: %s", configMapName, err) + } + + for _, crd := range parsedCRDList { + found = true + catalog.SetCRDDefinition(crd) + } + } + + csvListYaml, ok := cm.Data[ConfigMapCSVName] + if ok { + csvListJson, err := yaml.YAMLToJSON([]byte(csvListYaml)) + if err != nil { + log.Debugf("Load ConfigMap -- ERROR %s : error=%s", configMapName, err) + return fmt.Errorf("error loading CSV list yaml from ConfigMap %s: %s", configMapName, err) + } + + var parsedCSVList []v1alpha1.ClusterServiceVersion + err = json.Unmarshal([]byte(csvListJson), &parsedCSVList) + if err != nil { + log.Debugf("Load ConfigMap -- ERROR %s : error=%s", configMapName, err) + return fmt.Errorf("error parsing CSV list (json) from ConfigMap %s: %s", configMapName, err) + } + + for _, csv := range parsedCSVList { + found = true + catalog.setCSVDefinition(csv) + } + } + + packageListYaml, ok := cm.Data[ConfigMapPackageName] + if ok { + log.Debug("Load ConfigMap -- ConfigMap contains packages") + packageListJson, err := yaml.YAMLToJSON([]byte(packageListYaml)) + if err != nil { + log.Debugf("Load ConfigMap -- ERROR %s : error=%s", configMapName, err) + return fmt.Errorf("error loading package list yaml from ConfigMap %s: %s", configMapName, err) + } + + var parsedPackageManifests []PackageManifest + err = json.Unmarshal([]byte(packageListJson), &parsedPackageManifests) + if err != nil { + log.Debugf("Load ConfigMap -- ERROR %s : error=%s", configMapName, err) + return fmt.Errorf("error parsing package list (json) from ConfigMap %s: %s", configMapName, err) + } + for _, packageManifest := range parsedPackageManifests { + found = true + if err := catalog.AddPackageManifest(packageManifest); err != nil { + return err + } + } + log.Debugf("Load ConfigMap -- Found packages: %v", catalog.packages) + } + + if !found { + log.Debugf("Load ConfigMap -- ERROR %s : no resources found", configMapName) + return fmt.Errorf("error parsing ConfigMap %s: no valid resources found", configMapName) + } + + log.Debugf("Load ConfigMap -- OK %s", configMapName) + return nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/directory_loader.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/directory_loader.go new file mode 100644 index 00000000..e032263f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/directory_loader.go @@ -0,0 +1,120 @@ +package registry + +import ( + "fmt" + "os" + "path/filepath" + "strings" + + log "github.com/sirupsen/logrus" +) + +// DirectoryCatalogResourceLoader loads a directory of resources into the in-memory catalog +// files ending in `.crd.yaml` will be parsed as CRDs +// files ending in`.clusterserviceversion.yaml` will be parsed as CRDs +type DirectoryCatalogResourceLoader struct { + Catalog *InMem +} + +func (d *DirectoryCatalogResourceLoader) LoadCatalogResources(directory string) error { + log.Debugf("Load Dir -- BEGIN %s", directory) + if err := filepath.Walk(directory, d.LoadCRDsWalkFunc); err != nil { + log.Debugf("Load Dir -- ERROR %s : CRD error=%s", directory, err) + return fmt.Errorf("error loading CRDs from directory %s: %s", directory, err) + } + if err := filepath.Walk(directory, d.LoadCSVsWalkFunc); err != nil { + log.Debugf("Load Dir -- ERROR %s : CSV error=%s", directory, err) + return fmt.Errorf("error loading CSVs from directory %s: %s", directory, err) + } + if err := filepath.Walk(directory, d.LoadPackagesWalkFunc); err != nil { + log.Debugf("Load Dir -- ERROR %s : PKG error=%s", directory, err) + return fmt.Errorf("error loading Packages from directory %s: %s", directory, err) + } + log.Debugf("Load Dir -- OK %s", directory) + return nil +} + +func (d *DirectoryCatalogResourceLoader) LoadCRDsWalkFunc(path string, f os.FileInfo, err error) error { + log.Debugf("Load CRD -- BEGIN %s", path) + if f == nil { + return fmt.Errorf("Not a valid file") + } + if f.IsDir() { + log.Debugf("Load CRD -- ISDIR %s", path) + if strings.HasPrefix(f.Name(), ".") { + log.Debugf("Load CRD -- SKIPHIDDEN %s", path) + return filepath.SkipDir + } + return nil + } + if strings.HasPrefix(f.Name(), ".") { + log.Debugf("Load CRD -- SKIPHIDDEN %s", path) + return nil + } + if strings.HasSuffix(path, ".crd.yaml") { + crd, err := LoadCRDFromFile(d.Catalog, path) + if err != nil { + log.Debugf("Load CRD -- ERROR %s", path) + return err + } + log.Debugf("Load CRD -- OK %s", crd.Name) + } + log.Debugf("Load CRD -- NO OP %s", path) + return nil +} + +func (d *DirectoryCatalogResourceLoader) LoadCSVsWalkFunc(path string, f os.FileInfo, err error) error { + log.Debugf("Load CSV -- BEGIN %s", path) + if f == nil { + return fmt.Errorf("Not a valid file") + } + if f.IsDir() { + if strings.HasPrefix(f.Name(), ".") { + log.Debugf("Load CSV -- SKIPHIDDEN %s", path) + return filepath.SkipDir + } + log.Debugf("Load CSV -- ISDIR %s", path) + return nil + } + if strings.HasPrefix(f.Name(), ".") { + log.Debugf("Load CSV -- SKIPHIDDEN %s", path) + return nil + } + if strings.HasSuffix(path, ".clusterserviceversion.yaml") { + csv, err := LoadCSVFromFile(d.Catalog, path) + if err != nil { + log.Debugf("Load CSV -- ERROR %s", path) + return err + } + log.Debugf("Load CSV -- OK %s", csv.Name) + } + return nil +} + +func (d *DirectoryCatalogResourceLoader) LoadPackagesWalkFunc(path string, f os.FileInfo, err error) error { + log.Debugf("Load Package -- BEGIN %s", path) + if f == nil { + return fmt.Errorf("Not a valid file") + } + if f.IsDir() { + if strings.HasPrefix(f.Name(), ".") { + log.Debugf("Load Package -- SKIPHIDDEN %s", path) + return filepath.SkipDir + } + log.Debugf("Load Package -- ISDIR %s", path) + return nil + } + if strings.HasPrefix(f.Name(), ".") { + log.Debugf("Load Package -- SKIPHIDDEN %s", path) + return nil + } + if strings.HasSuffix(path, ".package.yaml") { + pkg, err := LoadPackageFromFile(d.Catalog, path) + if err != nil { + log.Debugf("Load Package -- ERROR %s", path) + return err + } + log.Debugf("Load Package -- OK %s", pkg.PackageName) + } + return nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/manifest.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/manifest.go new file mode 100644 index 00000000..29187fc9 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/manifest.go @@ -0,0 +1,68 @@ +package registry + +import ( + "fmt" + "io/ioutil" + + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + "k8s.io/client-go/kubernetes/scheme" + + "encoding/json" + + "github.com/ghodss/yaml" + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" +) + +// LoadCRDFromFile is a utility function for loading the CRD schemas. +func LoadCRDFromFile(m *InMem, filepath string) (*v1beta1.CustomResourceDefinition, error) { + data, err := ioutil.ReadFile(filepath) + if err != nil { + return nil, fmt.Errorf("unable to load CRD from file %s: %v", filepath, err) + } + crd := v1beta1.CustomResourceDefinition{} + if _, _, err = scheme.Codecs.UniversalDecoder().Decode(data, nil, &crd); err != nil { + return nil, fmt.Errorf("could not decode contents of file %s into CRD: %v", filepath, err) + } + if err = m.SetCRDDefinition(crd); err != nil { + return nil, fmt.Errorf("unable to set CRD found in catalog: %v", err) + } + return &crd, nil +} + +// LoadCSVFromFile is a utility function for loading CSV definitions +func LoadCSVFromFile(m *InMem, filepath string) (*v1alpha1.ClusterServiceVersion, error) { + data, err := ioutil.ReadFile(filepath) + if err != nil { + return nil, fmt.Errorf("unable to load CSV from file %s: %v", filepath, err) + } + csv := v1alpha1.ClusterServiceVersion{} + if _, _, err = scheme.Codecs.UniversalDecoder().Decode(data, nil, &csv); err != nil { + return nil, fmt.Errorf("could not decode contents of file %s into CSV: %v", filepath, err) + } + if err = m.setCSVDefinition(csv); err != nil { + return nil, fmt.Errorf("unable to set CSV found in catalog: %v", err) + } + return &csv, nil +} + +// LoadPackageFromFile is a utility function for loading Package definitions +func LoadPackageFromFile(m *InMem, filepath string) (*PackageManifest, error) { + data, err := ioutil.ReadFile(filepath) + if err != nil { + return nil, fmt.Errorf("unable to load package from file %s: %v", filepath, err) + } + pkg := PackageManifest{} + + packageJson, err := yaml.YAMLToJSON(data) + + if err != nil { + return nil, fmt.Errorf("error loading package yaml: %s", err) + } + + err = json.Unmarshal([]byte(packageJson), &pkg) + + if err = m.AddPackageManifest(pkg); err != nil { + return nil, fmt.Errorf("unable to set package found in catalog: %v", err) + } + return &pkg, nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/mem.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/mem.go new file mode 100644 index 00000000..41f624dd --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/mem.go @@ -0,0 +1,435 @@ +package registry + +import ( + "fmt" + + log "github.com/sirupsen/logrus" + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + "k8s.io/apimachinery/pkg/api/equality" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient" +) + +// InMem - catalog source implementation that stores the data in memory in golang maps +var _ Source = &InMem{} + +type InMem struct { + // map ClusterServiceVersion name to their resource definition + clusterservices map[string]v1alpha1.ClusterServiceVersion + + // map ClusterServiceVersions by name to metadata for the CSV that replaces it + replaces map[string][]CSVMetadata + + // map CRD to their full definition + crds map[CRDKey]v1beta1.CustomResourceDefinition + + // map CRD to the names of the CSVs that own them + crdOwners map[CRDKey][]string + + // map package name to their full manifest + packages map[string]PackageManifest + + // map from CSV name to the package channel(s) that contain it. + csvPackageChannels map[string][]packageAndChannel +} + +type packageAndChannel struct { + packageRef PackageManifest + channelRef PackageChannel +} + +func NewInMemoryFromDirectory(directory string) (*InMem, error) { + log.Infof("loading catalog from directory: %s", directory) + loader := DirectoryCatalogResourceLoader{NewInMem()} + if err := loader.LoadCatalogResources(directory); err != nil { + return nil, err + } + return loader.Catalog, nil +} + +func NewInMemoryFromConfigMap(cmClient operatorclient.ClientInterface, namespace, cmName string) (*InMem, error) { + log.Infof("loading catalog from a configmap: %s", cmName) + loader := ConfigMapCatalogResourceLoader{namespace, cmClient} + catalog := NewInMem() + if err := loader.LoadCatalogResources(catalog, cmName); err != nil { + return nil, err + } + return catalog, nil +} + +// NewInMem returns a ptr to a new InMem instance +func NewInMem() *InMem { + return &InMem{ + clusterservices: map[string]v1alpha1.ClusterServiceVersion{}, + replaces: map[string][]CSVMetadata{}, + crds: map[CRDKey]v1beta1.CustomResourceDefinition{}, + crdOwners: map[CRDKey][]string{}, + packages: map[string]PackageManifest{}, + csvPackageChannels: map[string][]packageAndChannel{}, + } +} + +// SetCRDDefinition sets the full resource definition of a CRD in the stored map +// only sets a new definition if one is not already set +func (m *InMem) SetCRDDefinition(crd v1beta1.CustomResourceDefinition) error { + key := CRDKey{ + Kind: crd.Spec.Names.Kind, + Name: crd.GetName(), + Version: crd.Spec.Version, + } + if old, exists := m.crds[key]; exists && !equality.Semantic.DeepEqual(crd, old) { + return fmt.Errorf("invalid CRD : definition for CRD %s already set", crd.GetName()) + } + m.crds[key] = crd + return nil +} + +// FindReplacementCSVForPackageNameUnderChannel returns the CSV that replaces the CSV with the +// matching CSV name, within the package and channel specified. +func (m *InMem) FindReplacementCSVForPackageNameUnderChannel(packageName string, channelName string, csvName string) (*v1alpha1.ClusterServiceVersion, error) { + latestCSV, err := m.FindCSVForPackageNameUnderChannel(packageName, channelName) + if err != nil { + return nil, err + } + + if latestCSV.GetName() == csvName { + return nil, fmt.Errorf("Channel is already up-to-date") + } + + // Walk backwards over the `replaces` field until we find the CSV with the specified name. + var currentCSV = latestCSV + var nextCSV *v1alpha1.ClusterServiceVersion = nil + for currentCSV != nil { + if currentCSV.GetName() == csvName { + return nextCSV, nil + } + + nextCSV = currentCSV + replacesName := currentCSV.Spec.Replaces + currentCSV = nil + + if replacesName != "" { + replacesCSV, err := m.FindCSVByName(replacesName) + if err != nil { + return nil, err + } + + currentCSV = replacesCSV + } + } + + return nil, fmt.Errorf("Could not find matching replacement for CSV `%s` in package `%s` for channel `%s`", csvName, packageName, channelName) +} + +// FindCSVForPackageNameUnderChannel finds the CSV referenced by the specified channel under the +// package with the specified name. +func (m *InMem) FindCSVForPackageNameUnderChannel(packageName string, channelName string) (*v1alpha1.ClusterServiceVersion, error) { + packageManifest, ok := m.packages[packageName] + if !ok { + return nil, fmt.Errorf("Unknown package %s", packageName) + } + + for _, channel := range packageManifest.Channels { + if channel.Name == channelName { + return m.FindCSVByName(channel.CurrentCSVName) + } + } + + return nil, fmt.Errorf("Unknown channel %s in package %s", channelName, packageName) +} + +// addPackageManifest adds a new package manifest to the in memory catalog. +func (m *InMem) AddPackageManifest(pkg PackageManifest) error { + if len(pkg.PackageName) == 0 { + return fmt.Errorf("Empty package name") + } + + // Make sure that each channel name is unique and that the referenced CSV exists. + channelMap := make(map[string]bool, len(pkg.Channels)) + for _, channel := range pkg.Channels { + if _, exists := channelMap[channel.Name]; exists { + return fmt.Errorf("Channel %s declared twice in package manifest", channel.Name) + } + + channelMap[channel.Name] = true + + currentCSV, err := m.FindCSVByName(channel.CurrentCSVName) + if err != nil { + return fmt.Errorf("Missing CSV with name %s", channel.CurrentCSVName) + } + + // For each of the CSVs in the full replacement chain, add an entry to the package map. + csvChain, err := m.fullCSVReplacesHistory(currentCSV) + if err != nil { + return err + } + + for _, csv := range csvChain { + if _, ok := m.csvPackageChannels[csv.GetName()]; !ok { + m.csvPackageChannels[csv.GetName()] = []packageAndChannel{} + } + + m.csvPackageChannels[csv.GetName()] = append(m.csvPackageChannels[csv.GetName()], packageAndChannel{ + packageRef: pkg, + channelRef: channel, + }) + } + } + + // Make sure the default channel name matches a real channel, if given. + if pkg.DefaultChannelName != "" { + if _, exists := channelMap[pkg.DefaultChannelName]; !exists { + return fmt.Errorf("Invalid default channel %s", pkg.DefaultChannelName) + } + } + + m.packages[pkg.PackageName] = pkg + return nil +} + +// fullCSVHistory returns the full set of CSVs in the `replaces` history, starting at the given CSV. +func (m *InMem) fullCSVReplacesHistory(csv *v1alpha1.ClusterServiceVersion) ([]v1alpha1.ClusterServiceVersion, error) { + if csv.Spec.Replaces == "" { + return []v1alpha1.ClusterServiceVersion{*csv}, nil + } + + replaced, err := m.FindCSVByName(csv.Spec.Replaces) + if err != nil { + return []v1alpha1.ClusterServiceVersion{}, err + } + + replacedChain, err := m.fullCSVReplacesHistory(replaced) + if err != nil { + return []v1alpha1.ClusterServiceVersion{}, err + } + + return append(replacedChain, *csv), nil +} + +// setOrReplaceCRDDefinition overwrites any existing definition with the same name +func (m *InMem) setOrReplaceCRDDefinition(crd v1beta1.CustomResourceDefinition) { + m.crds[CRDKey{ + Kind: crd.Spec.Names.Kind, + Name: crd.GetName(), + Version: crd.Spec.Version, + }] = crd +} + +// findServiceConflicts collates a list of errors from conflicting catalog entries +func (m *InMem) findServiceConflicts(csv v1alpha1.ClusterServiceVersion) []error { + errs := []error{} + + // validate owned CRDs + for _, crdReq := range csv.Spec.CustomResourceDefinitions.Owned { + key := CRDKey{ + Kind: crdReq.Kind, + Name: crdReq.Name, + Version: crdReq.Version, + } + // validate crds have definitions stored + if _, ok := m.crds[key]; !ok { + errs = append(errs, fmt.Errorf("missing definition for owned CRD %v", key)) + } + } + return errs +} + +// addService is a helper fn to register a new service into the catalog +// will error if `safe` is true and conflicts are found +func (m *InMem) addService(csv v1alpha1.ClusterServiceVersion, safe bool) error { + name := csv.GetName() + + // find and log any conflicts; return with error if in `safe` mode + if conflicts := m.findServiceConflicts(csv); len(conflicts) > 0 { + log.Debugf("found conflicts for CSV %s: %v", name, conflicts) + if safe { + return fmt.Errorf("cannot add CSV %s safely: %v", name, conflicts) + } + } + + // add service + m.clusterservices[name] = csv + + // register it as replacing CSV from its spec, if any + if csv.Spec.Replaces != "" { + if _, ok := m.replaces[csv.Spec.Replaces]; !ok { + m.replaces[csv.Spec.Replaces] = []CSVMetadata{} + } + + m.replaces[csv.Spec.Replaces] = append(m.replaces[csv.Spec.Replaces], CSVMetadata{ + Name: name, + Version: csv.Spec.Version.String(), + }) + } + + // register its crds + for _, crd := range csv.Spec.CustomResourceDefinitions.Owned { + key := CRDKey{ + Name: crd.Name, + Version: crd.Version, + Kind: crd.Kind, + } + + if m.crdOwners[key] == nil { + m.crdOwners[key] = []string{} + } + + m.crdOwners[key] = append(m.crdOwners[key], name) + } + return nil +} + +// setCSVDefinition registers a new service into the catalog +// will return error if any conflicts exist +func (m *InMem) setCSVDefinition(csv v1alpha1.ClusterServiceVersion) error { + return m.addService(csv, true) +} + +// AddOrReplaceService registers service into the catalog, overwriting any existing values +func (m *InMem) AddOrReplaceService(csv v1alpha1.ClusterServiceVersion) { + _ = m.addService(csv, false) +} + +// removeService is a helper fn to delete a service from the catalog +func (m *InMem) removeService(name string) error { + csv, exists := m.clusterservices[name] + if !exists { + return fmt.Errorf("not found: ClusterServiceVersion %s", name) + } + + delete(m.clusterservices, name) + if csv.Spec.Replaces != "" { + delete(m.replaces, csv.Spec.Replaces) + } + + return nil +} + +// FindCSVByName looks up the CSV with the given name. +func (m *InMem) FindCSVByName(name string) (*v1alpha1.ClusterServiceVersion, error) { + csv, exists := m.clusterservices[name] + if !exists { + return nil, fmt.Errorf("not found: ClusterServiceVersion %s", name) + } + + return &csv, nil +} + +// FindReplacementCSVForName looks up any CSV in the catalog that replaces the given CSV, if any. +func (m *InMem) FindReplacementCSVForName(name string) (*v1alpha1.ClusterServiceVersion, error) { + csvMetadata, ok := m.replaces[name] + if !ok { + return nil, fmt.Errorf("not found: ClusterServiceVersion that replaces %s", name) + } + + if len(csvMetadata) < 1 { + return nil, fmt.Errorf("not found: ClusterServiceVersion that replaces %s", name) + } + + return m.FindCSVByName(csvMetadata[0].Name) +} + +// AllPackages returns all package manifests in the catalog +func (m *InMem) AllPackages() map[string]PackageManifest { + return m.packages +} + +// ListServices lists all versions of the service in the catalog +func (m *InMem) ListServices() ([]v1alpha1.ClusterServiceVersion, error) { + services := []v1alpha1.ClusterServiceVersion{} + for _, csv := range m.clusterservices { + services = append(services, csv) + } + return services, nil +} + +// ListLatestCSVsForCRD lists the latests versions of the service that manages the given CRD. +func (m *InMem) ListLatestCSVsForCRD(key CRDKey) ([]CSVAndChannelInfo, error) { + // Find the names of the CSVs that own the CRD. + ownerCSVNames, ok := m.crdOwners[key] + if !ok { + return nil, fmt.Errorf("not found: CRD %s", key) + } + + // For each of the CSVs found, lookup the package channels that create that CSV somewhere along + // the way. For each, we then filter to the latest CSV that creates the CRD, and return that. + // This allows the caller to find the *latest* version of each channel, that will successfully + // instantiate the require CRD. + channelInfo := make([]CSVAndChannelInfo, 0, len(ownerCSVNames)) + added := map[string]bool{} + + for _, ownerCSVName := range ownerCSVNames { + packageChannels, ok := m.csvPackageChannels[ownerCSVName] + if !ok { + // Note: legacy handling. To be removed once all CSVs are part of packages. + latestCSV, err := m.findLatestCSVThatOwns(ownerCSVName, key) + if err != nil { + return nil, err + } + + channelInfo = append(channelInfo, CSVAndChannelInfo{ + CSV: latestCSV, + Channel: PackageChannel{}, + IsDefaultChannel: false, + }) + continue + } + + for _, packageChannel := range packageChannels { + // Find the latest CSV in the channel that owns the CRD. + latestCSV, err := m.findLatestCSVThatOwns(packageChannel.channelRef.CurrentCSVName, key) + if err != nil { + return nil, err + } + + key := fmt.Sprintf("%s::%s", latestCSV.GetName(), packageChannel.channelRef.Name) + if _, ok := added[key]; ok { + continue + } + + channelInfo = append(channelInfo, CSVAndChannelInfo{ + CSV: latestCSV, + Channel: packageChannel.channelRef, + IsDefaultChannel: packageChannel.channelRef.IsDefaultChannel(packageChannel.packageRef), + }) + added[key] = true + } + } + + return channelInfo, nil +} + +// findLatestCSVThatOwns returns the latest CSV in the chain of CSVs, starting at the CSV with the +// specified name, that owns the referenced CRD. For example, if given CSV `foobar-v1.2.0` in the +// a chain of foobar-v1.2.0 --(replaces)--> foobar-v1.1.0 --(replaces)--> foobar-v1.0.0 and +// `foobar-v1.1.0` is the latest that owns the CRD, it will be returned. +func (m *InMem) findLatestCSVThatOwns(csvName string, key CRDKey) (*v1alpha1.ClusterServiceVersion, error) { + csv, err := m.FindCSVByName(csvName) + if err != nil { + return nil, err + } + + // Check if the CSV owns the CRD. + for _, crdReq := range csv.Spec.CustomResourceDefinitions.Owned { + if crdReq.Name == key.Name { + return csv, nil + } + } + + // Otherwise, check the CSV this CSV replaces. + if csv.Spec.Replaces == "" { + return nil, fmt.Errorf("Could not find owner for CRD %s", key.Name) + } + + return m.findLatestCSVThatOwns(csv.Spec.Replaces, key) +} + +// FindCRDByName looks up the full CustomResourceDefinition for the resource with the given name +func (m *InMem) FindCRDByKey(key CRDKey) (*v1beta1.CustomResourceDefinition, error) { + crd, ok := m.crds[key] + if !ok { + return nil, fmt.Errorf("not found: CRD %s", key) + } + return &crd, nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver/resolver.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver/resolver.go new file mode 100644 index 00000000..636cc479 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver/resolver.go @@ -0,0 +1,247 @@ +package resolver + +import ( + "fmt" + + olmerrors "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/errors" + log "github.com/sirupsen/logrus" + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry" +) + +// DependencyResolver defines how a something that resolves dependencies (CSVs, CRDs, etc...) +// should behave +type DependencyResolver interface { + ResolveInstallPlan(sourceRefs []registry.SourceRef, existingCRDOwners map[string][]string, catalogLabelKey string, plan *v1alpha1.InstallPlan) ([]v1alpha1.Step, []registry.ResourceKey, error) +} + +// MultiSourceResolver resolves resolves dependencies from multiple CatalogSources +type MultiSourceResolver struct{} + +// ResolveInstallPlan resolves the given InstallPlan with all available sources +func (resolver *MultiSourceResolver) ResolveInstallPlan(sourceRefs []registry.SourceRef, existingCRDOwners map[string][]string, catalogLabelKey string, plan *v1alpha1.InstallPlan) ([]v1alpha1.Step, []registry.ResourceKey, error) { + srm := make(stepResourceMap) + var usedSourceKeys []registry.ResourceKey + + for _, csvName := range plan.Spec.ClusterServiceVersionNames { + csvSRM, used, err := resolver.resolveCSV(sourceRefs, existingCRDOwners, catalogLabelKey, plan.Namespace, csvName) + if err != nil { + // Could not resolve CSV in any source + return nil, nil, err + } + + srm.Combine(csvSRM) + usedSourceKeys = append(used, usedSourceKeys...) + } + + return srm.Plan(), usedSourceKeys, nil +} + +func (resolver *MultiSourceResolver) resolveCSV(sourceRefs []registry.SourceRef, existingCRDOwners map[string][]string, catalogLabelKey, planNamespace, csvName string) (stepResourceMap, []registry.ResourceKey, error) { + log.Debugf("resolving CSV with name: %s", csvName) + + steps := make(stepResourceMap) + csvNamesToBeResolved := []string{csvName} + var usedSourceKeys []registry.ResourceKey + + for len(csvNamesToBeResolved) != 0 { + // Pop off a CSV name. + currentName := csvNamesToBeResolved[0] + csvNamesToBeResolved = csvNamesToBeResolved[1:] + + // If this CSV is already resolved, continue. + if _, exists := steps[currentName]; exists { + continue + } + + var csvSourceKey registry.ResourceKey + var csv *v1alpha1.ClusterServiceVersion + var err error + + // Attempt to Get the full CSV object for the name from any + for _, ref := range sourceRefs { + csv, err = ref.Source.FindCSVByName(currentName) + + if err == nil { + // Found CSV + csvSourceKey = ref.SourceKey + break + } + + } + + if err != nil { + // Couldn't find CSV in any CatalogSource + return nil, nil, err + } + + log.Debugf("found %s", csv.GetName()) + usedSourceKeys = append(usedSourceKeys, csvSourceKey) + + // Resolve each owned or required CRD for the CSV. + for _, crdDesc := range csv.GetAllCRDDescriptions() { + // Attempt to get CRD from same catalog source CSV was found in + crdSteps, owner, err := resolver.resolveCRDDescription(sourceRefs, existingCRDOwners, catalogLabelKey, planNamespace, crdDesc, csv.OwnsCRD(crdDesc.Name)) + if err != nil { + return nil, nil, err + } + + // If a different owner was resolved, add it to the list. + if owner != "" && owner != currentName { + csvNamesToBeResolved = append(csvNamesToBeResolved, owner) + } else { + // Add the resolved steps to the plan. + steps[currentName] = append(steps[currentName], crdSteps...) + } + + } + + // Manually override the namespace and create the final step for the CSV, + // which is for the CSV itself. + csv.SetNamespace(planNamespace) + + // Add the sourcename as a label on the CSV, so that we know where it came from + labels := csv.GetLabels() + if labels == nil { + labels = map[string]string{} + } + labels[catalogLabelKey] = csvSourceKey.Name + csv.SetLabels(labels) + + step, err := v1alpha1.NewStepResourceFromCSV(csv) + if err != nil { + return nil, nil, err + } + + // Set the catalog source name and namespace + step.CatalogSource = csvSourceKey.Name + step.CatalogSourceNamespace = csvSourceKey.Namespace + + // Add the final step for the CSV to the plan. + log.Infof("finished step: %s", step.Name) + steps[currentName] = append(steps[currentName], step) + } + + return steps, usedSourceKeys, nil +} + +func (resolver *MultiSourceResolver) resolveCRDDescription(sourceRefs []registry.SourceRef, existingCRDOwners map[string][]string, catalogLabelKey, planNamespace string, crdDesc v1alpha1.CRDDescription, owned bool) ([]v1alpha1.StepResource, string, error) { + log.Debugf("resolving %#v", crdDesc) + var steps []v1alpha1.StepResource + + crdKey := registry.CRDKey{ + Kind: crdDesc.Kind, + Name: crdDesc.Name, + Version: crdDesc.Version, + } + + var crdSourceKey registry.ResourceKey + var crd *v1beta1.CustomResourceDefinition + var source registry.Source + var err error + + // Attempt to find the CRD in any other source if the CRD is not owned + for _, ref := range sourceRefs { + source = ref.Source + crd, err = source.FindCRDByKey(crdKey) + + if err == nil { + // Found the CRD + crdSourceKey = ref.SourceKey + break + } + } + + if err != nil { + return nil, "", err + } + + if owned { + // Label CRD with catalog source + labels := crd.GetLabels() + if labels == nil { + labels = map[string]string{} + } + labels[catalogLabelKey] = crdSourceKey.Name + crd.SetLabels(labels) + + // Add CRD Step + crdSteps, err := v1alpha1.NewStepResourcesFromCRD(crd) + if err != nil { + return nil, "", err + } + + // Set the catalog source name and namespace + for _, s := range crdSteps { + s.CatalogSource = crdSourceKey.Name + s.CatalogSourceNamespace = crdSourceKey.Namespace + steps = append(steps, s) + } + return steps, "", nil + } + + csvs, err := source.ListLatestCSVsForCRD(crdKey) + if err != nil { + return nil, "", err + } + if len(csvs) == 0 { + return nil, "", fmt.Errorf("Unknown CRD %s", crdKey) + } + + var ownerName string + owners := existingCRDOwners[crdKey.Name] + switch len(owners) { + case 0: + // No pre-existing owner found + for _, csv := range csvs { + // Check for the default channel + if csv.IsDefaultChannel { + ownerName = csv.CSV.Name + break + } + } + case 1: + ownerName = owners[0] + default: + return nil, "", olmerrors.NewMultipleExistingCRDOwnersError(owners, crdKey.Name, planNamespace) + } + + // Check empty name + if ownerName == "" { + log.Infof("No preexisting CSV or default channel found for owners of CRD %v", crdKey) + ownerName = csvs[0].CSV.Name + } + + log.Infof("Found %v owner %s", crdKey, ownerName) + return nil, ownerName, nil +} + +type stepResourceMap map[string][]v1alpha1.StepResource + +func (srm stepResourceMap) Plan() []v1alpha1.Step { + steps := make([]v1alpha1.Step, 0) + for csvName, stepResSlice := range srm { + for _, stepRes := range stepResSlice { + steps = append(steps, v1alpha1.Step{ + Resolving: csvName, + Resource: stepRes, + Status: v1alpha1.StepStatusUnknown, + }) + } + } + + return steps +} + +func (srm stepResourceMap) Combine(y stepResourceMap) { + for csvName, stepResSlice := range y { + // Skip any redundant steps. + if _, alreadyExists := srm[csvName]; alreadyExists { + continue + } + + srm[csvName] = stepResSlice + } +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/types.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/types.go new file mode 100644 index 00000000..c79da441 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/types.go @@ -0,0 +1,122 @@ +//go:generate counterfeiter -o ../../fakes/fake_registry_source.go types.go Source + +package registry + +import ( + "fmt" + + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" +) + +// Catalog Source +// - Map name to ClusterServiceVersion +// - Map CRD to CRD definition +// - Map CRD to ClusterServiceVersion that manages it + +type Source interface { + FindCSVForPackageNameUnderChannel(packageName string, channelName string) (*v1alpha1.ClusterServiceVersion, error) + FindReplacementCSVForPackageNameUnderChannel(packageName string, channelName string, csvName string) (*v1alpha1.ClusterServiceVersion, error) + AllPackages() map[string]PackageManifest + + // Deprecated: Switch to FindReplacementCSVForPackageNameUnderChannel when the caller has package and channel + // information. + FindReplacementCSVForName(name string) (*v1alpha1.ClusterServiceVersion, error) + + FindCSVByName(name string) (*v1alpha1.ClusterServiceVersion, error) + ListServices() ([]v1alpha1.ClusterServiceVersion, error) + + FindCRDByKey(key CRDKey) (*v1beta1.CustomResourceDefinition, error) + ListLatestCSVsForCRD(key CRDKey) ([]CSVAndChannelInfo, error) +} + +// ResourceKey contains metadata to uniquely identify a resource +type ResourceKey struct { + Name string + Kind string + Namespace string +} + +// SourceRef associates a Source with it's SourceKey +type SourceRef struct { + SourceKey ResourceKey + Source Source +} + +// CRDKey contains metadata needed to uniquely identify a CRD +type CRDKey struct { + Kind string + Name string + Version string +} + +func (k CRDKey) String() string { + return fmt.Sprintf("%s/%s/%s", k.Kind, k.Name, k.Version) +} + +// CSVAndChannelInfo holds information about a CSV and the channel in which it lives. +type CSVAndChannelInfo struct { + // CSV is the CSV found. + CSV *v1alpha1.ClusterServiceVersion + + // Channel is the channel that "contains" this CSV, as it is declared as part of the channel. + Channel PackageChannel + + // IsDefaultChannel returns true iff the channel is the default channel for the package. + IsDefaultChannel bool +} + +// CSVMetadata holds the necessary information to locate a particular CSV in the catalog +type CSVMetadata struct { + Name string + Version string +} + +// 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 +} + +type SubscriptionKey struct { + Name string + Namespace string +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_deployment_install_client.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_deployment_install_client.go new file mode 100644 index 00000000..23dca08d --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_deployment_install_client.go @@ -0,0 +1,571 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package fakes + +import ( + "sync" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/wrappers" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil" + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + v1beta1rbac "k8s.io/api/rbac/v1beta1" +) + +type FakeInstallStrategyDeploymentInterface struct { + CreateRoleStub func(role *v1beta1rbac.Role) (*v1beta1rbac.Role, error) + createRoleMutex sync.RWMutex + createRoleArgsForCall []struct { + role *v1beta1rbac.Role + } + createRoleReturns struct { + result1 *v1beta1rbac.Role + result2 error + } + createRoleReturnsOnCall map[int]struct { + result1 *v1beta1rbac.Role + result2 error + } + CreateRoleBindingStub func(roleBinding *v1beta1rbac.RoleBinding) (*v1beta1rbac.RoleBinding, error) + createRoleBindingMutex sync.RWMutex + createRoleBindingArgsForCall []struct { + roleBinding *v1beta1rbac.RoleBinding + } + createRoleBindingReturns struct { + result1 *v1beta1rbac.RoleBinding + result2 error + } + createRoleBindingReturnsOnCall map[int]struct { + result1 *v1beta1rbac.RoleBinding + result2 error + } + EnsureServiceAccountStub func(serviceAccount *corev1.ServiceAccount, owner ownerutil.Owner) (*corev1.ServiceAccount, error) + ensureServiceAccountMutex sync.RWMutex + ensureServiceAccountArgsForCall []struct { + serviceAccount *corev1.ServiceAccount + owner ownerutil.Owner + } + ensureServiceAccountReturns struct { + result1 *corev1.ServiceAccount + result2 error + } + ensureServiceAccountReturnsOnCall map[int]struct { + result1 *corev1.ServiceAccount + result2 error + } + CreateDeploymentStub func(deployment *appsv1.Deployment) (*appsv1.Deployment, error) + createDeploymentMutex sync.RWMutex + createDeploymentArgsForCall []struct { + deployment *appsv1.Deployment + } + createDeploymentReturns struct { + result1 *appsv1.Deployment + result2 error + } + createDeploymentReturnsOnCall map[int]struct { + result1 *appsv1.Deployment + result2 error + } + CreateOrUpdateDeploymentStub func(deployment *appsv1.Deployment) (*appsv1.Deployment, error) + createOrUpdateDeploymentMutex sync.RWMutex + createOrUpdateDeploymentArgsForCall []struct { + deployment *appsv1.Deployment + } + createOrUpdateDeploymentReturns struct { + result1 *appsv1.Deployment + result2 error + } + createOrUpdateDeploymentReturnsOnCall map[int]struct { + result1 *appsv1.Deployment + result2 error + } + DeleteDeploymentStub func(name string) error + deleteDeploymentMutex sync.RWMutex + deleteDeploymentArgsForCall []struct { + name string + } + deleteDeploymentReturns struct { + result1 error + } + deleteDeploymentReturnsOnCall map[int]struct { + result1 error + } + GetServiceAccountByNameStub func(serviceAccountName string) (*corev1.ServiceAccount, error) + getServiceAccountByNameMutex sync.RWMutex + getServiceAccountByNameArgsForCall []struct { + serviceAccountName string + } + getServiceAccountByNameReturns struct { + result1 *corev1.ServiceAccount + result2 error + } + getServiceAccountByNameReturnsOnCall map[int]struct { + result1 *corev1.ServiceAccount + result2 error + } + FindAnyDeploymentsMatchingNamesStub func(depNames []string) ([]*appsv1.Deployment, error) + findAnyDeploymentsMatchingNamesMutex sync.RWMutex + findAnyDeploymentsMatchingNamesArgsForCall []struct { + depNames []string + } + findAnyDeploymentsMatchingNamesReturns struct { + result1 []*appsv1.Deployment + result2 error + } + findAnyDeploymentsMatchingNamesReturnsOnCall map[int]struct { + result1 []*appsv1.Deployment + result2 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRole(role *v1beta1rbac.Role) (*v1beta1rbac.Role, error) { + fake.createRoleMutex.Lock() + ret, specificReturn := fake.createRoleReturnsOnCall[len(fake.createRoleArgsForCall)] + fake.createRoleArgsForCall = append(fake.createRoleArgsForCall, struct { + role *v1beta1rbac.Role + }{role}) + fake.recordInvocation("CreateRole", []interface{}{role}) + fake.createRoleMutex.Unlock() + if fake.CreateRoleStub != nil { + return fake.CreateRoleStub(role) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.createRoleReturns.result1, fake.createRoleReturns.result2 +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleCallCount() int { + fake.createRoleMutex.RLock() + defer fake.createRoleMutex.RUnlock() + return len(fake.createRoleArgsForCall) +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleArgsForCall(i int) *v1beta1rbac.Role { + fake.createRoleMutex.RLock() + defer fake.createRoleMutex.RUnlock() + return fake.createRoleArgsForCall[i].role +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleReturns(result1 *v1beta1rbac.Role, result2 error) { + fake.CreateRoleStub = nil + fake.createRoleReturns = struct { + result1 *v1beta1rbac.Role + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleReturnsOnCall(i int, result1 *v1beta1rbac.Role, result2 error) { + fake.CreateRoleStub = nil + if fake.createRoleReturnsOnCall == nil { + fake.createRoleReturnsOnCall = make(map[int]struct { + result1 *v1beta1rbac.Role + result2 error + }) + } + fake.createRoleReturnsOnCall[i] = struct { + result1 *v1beta1rbac.Role + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBinding(roleBinding *v1beta1rbac.RoleBinding) (*v1beta1rbac.RoleBinding, error) { + fake.createRoleBindingMutex.Lock() + ret, specificReturn := fake.createRoleBindingReturnsOnCall[len(fake.createRoleBindingArgsForCall)] + fake.createRoleBindingArgsForCall = append(fake.createRoleBindingArgsForCall, struct { + roleBinding *v1beta1rbac.RoleBinding + }{roleBinding}) + fake.recordInvocation("CreateRoleBinding", []interface{}{roleBinding}) + fake.createRoleBindingMutex.Unlock() + if fake.CreateRoleBindingStub != nil { + return fake.CreateRoleBindingStub(roleBinding) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.createRoleBindingReturns.result1, fake.createRoleBindingReturns.result2 +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingCallCount() int { + fake.createRoleBindingMutex.RLock() + defer fake.createRoleBindingMutex.RUnlock() + return len(fake.createRoleBindingArgsForCall) +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingArgsForCall(i int) *v1beta1rbac.RoleBinding { + fake.createRoleBindingMutex.RLock() + defer fake.createRoleBindingMutex.RUnlock() + return fake.createRoleBindingArgsForCall[i].roleBinding +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingReturns(result1 *v1beta1rbac.RoleBinding, result2 error) { + fake.CreateRoleBindingStub = nil + fake.createRoleBindingReturns = struct { + result1 *v1beta1rbac.RoleBinding + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateRoleBindingReturnsOnCall(i int, result1 *v1beta1rbac.RoleBinding, result2 error) { + fake.CreateRoleBindingStub = nil + if fake.createRoleBindingReturnsOnCall == nil { + fake.createRoleBindingReturnsOnCall = make(map[int]struct { + result1 *v1beta1rbac.RoleBinding + result2 error + }) + } + fake.createRoleBindingReturnsOnCall[i] = struct { + result1 *v1beta1rbac.RoleBinding + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccount(serviceAccount *corev1.ServiceAccount, owner ownerutil.Owner) (*corev1.ServiceAccount, error) { + fake.ensureServiceAccountMutex.Lock() + ret, specificReturn := fake.ensureServiceAccountReturnsOnCall[len(fake.ensureServiceAccountArgsForCall)] + fake.ensureServiceAccountArgsForCall = append(fake.ensureServiceAccountArgsForCall, struct { + serviceAccount *corev1.ServiceAccount + owner ownerutil.Owner + }{serviceAccount, owner}) + fake.recordInvocation("EnsureServiceAccount", []interface{}{serviceAccount, owner}) + fake.ensureServiceAccountMutex.Unlock() + if fake.EnsureServiceAccountStub != nil { + return fake.EnsureServiceAccountStub(serviceAccount, owner) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.ensureServiceAccountReturns.result1, fake.ensureServiceAccountReturns.result2 +} + +func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountCallCount() int { + fake.ensureServiceAccountMutex.RLock() + defer fake.ensureServiceAccountMutex.RUnlock() + return len(fake.ensureServiceAccountArgsForCall) +} + +func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountArgsForCall(i int) (*corev1.ServiceAccount, ownerutil.Owner) { + fake.ensureServiceAccountMutex.RLock() + defer fake.ensureServiceAccountMutex.RUnlock() + return fake.ensureServiceAccountArgsForCall[i].serviceAccount, fake.ensureServiceAccountArgsForCall[i].owner +} + +func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountReturns(result1 *corev1.ServiceAccount, result2 error) { + fake.EnsureServiceAccountStub = nil + fake.ensureServiceAccountReturns = struct { + result1 *corev1.ServiceAccount + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) EnsureServiceAccountReturnsOnCall(i int, result1 *corev1.ServiceAccount, result2 error) { + fake.EnsureServiceAccountStub = nil + if fake.ensureServiceAccountReturnsOnCall == nil { + fake.ensureServiceAccountReturnsOnCall = make(map[int]struct { + result1 *corev1.ServiceAccount + result2 error + }) + } + fake.ensureServiceAccountReturnsOnCall[i] = struct { + result1 *corev1.ServiceAccount + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateDeployment(deployment *appsv1.Deployment) (*appsv1.Deployment, error) { + fake.createDeploymentMutex.Lock() + ret, specificReturn := fake.createDeploymentReturnsOnCall[len(fake.createDeploymentArgsForCall)] + fake.createDeploymentArgsForCall = append(fake.createDeploymentArgsForCall, struct { + deployment *appsv1.Deployment + }{deployment}) + fake.recordInvocation("CreateDeployment", []interface{}{deployment}) + fake.createDeploymentMutex.Unlock() + if fake.CreateDeploymentStub != nil { + return fake.CreateDeploymentStub(deployment) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.createDeploymentReturns.result1, fake.createDeploymentReturns.result2 +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateDeploymentCallCount() int { + fake.createDeploymentMutex.RLock() + defer fake.createDeploymentMutex.RUnlock() + return len(fake.createDeploymentArgsForCall) +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateDeploymentArgsForCall(i int) *appsv1.Deployment { + fake.createDeploymentMutex.RLock() + defer fake.createDeploymentMutex.RUnlock() + return fake.createDeploymentArgsForCall[i].deployment +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateDeploymentReturns(result1 *appsv1.Deployment, result2 error) { + fake.CreateDeploymentStub = nil + fake.createDeploymentReturns = struct { + result1 *appsv1.Deployment + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateDeploymentReturnsOnCall(i int, result1 *appsv1.Deployment, result2 error) { + fake.CreateDeploymentStub = nil + if fake.createDeploymentReturnsOnCall == nil { + fake.createDeploymentReturnsOnCall = make(map[int]struct { + result1 *appsv1.Deployment + result2 error + }) + } + fake.createDeploymentReturnsOnCall[i] = struct { + result1 *appsv1.Deployment + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateOrUpdateDeployment(deployment *appsv1.Deployment) (*appsv1.Deployment, error) { + fake.createOrUpdateDeploymentMutex.Lock() + ret, specificReturn := fake.createOrUpdateDeploymentReturnsOnCall[len(fake.createOrUpdateDeploymentArgsForCall)] + fake.createOrUpdateDeploymentArgsForCall = append(fake.createOrUpdateDeploymentArgsForCall, struct { + deployment *appsv1.Deployment + }{deployment}) + fake.recordInvocation("CreateOrUpdateDeployment", []interface{}{deployment}) + fake.createOrUpdateDeploymentMutex.Unlock() + if fake.CreateOrUpdateDeploymentStub != nil { + return fake.CreateOrUpdateDeploymentStub(deployment) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.createOrUpdateDeploymentReturns.result1, fake.createOrUpdateDeploymentReturns.result2 +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateOrUpdateDeploymentCallCount() int { + fake.createOrUpdateDeploymentMutex.RLock() + defer fake.createOrUpdateDeploymentMutex.RUnlock() + return len(fake.createOrUpdateDeploymentArgsForCall) +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateOrUpdateDeploymentArgsForCall(i int) *appsv1.Deployment { + fake.createOrUpdateDeploymentMutex.RLock() + defer fake.createOrUpdateDeploymentMutex.RUnlock() + return fake.createOrUpdateDeploymentArgsForCall[i].deployment +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateOrUpdateDeploymentReturns(result1 *appsv1.Deployment, result2 error) { + fake.CreateOrUpdateDeploymentStub = nil + fake.createOrUpdateDeploymentReturns = struct { + result1 *appsv1.Deployment + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) CreateOrUpdateDeploymentReturnsOnCall(i int, result1 *appsv1.Deployment, result2 error) { + fake.CreateOrUpdateDeploymentStub = nil + if fake.createOrUpdateDeploymentReturnsOnCall == nil { + fake.createOrUpdateDeploymentReturnsOnCall = make(map[int]struct { + result1 *appsv1.Deployment + result2 error + }) + } + fake.createOrUpdateDeploymentReturnsOnCall[i] = struct { + result1 *appsv1.Deployment + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) DeleteDeployment(name string) error { + fake.deleteDeploymentMutex.Lock() + ret, specificReturn := fake.deleteDeploymentReturnsOnCall[len(fake.deleteDeploymentArgsForCall)] + fake.deleteDeploymentArgsForCall = append(fake.deleteDeploymentArgsForCall, struct { + name string + }{name}) + fake.recordInvocation("DeleteDeployment", []interface{}{name}) + fake.deleteDeploymentMutex.Unlock() + if fake.DeleteDeploymentStub != nil { + return fake.DeleteDeploymentStub(name) + } + if specificReturn { + return ret.result1 + } + return fake.deleteDeploymentReturns.result1 +} + +func (fake *FakeInstallStrategyDeploymentInterface) DeleteDeploymentCallCount() int { + fake.deleteDeploymentMutex.RLock() + defer fake.deleteDeploymentMutex.RUnlock() + return len(fake.deleteDeploymentArgsForCall) +} + +func (fake *FakeInstallStrategyDeploymentInterface) DeleteDeploymentArgsForCall(i int) string { + fake.deleteDeploymentMutex.RLock() + defer fake.deleteDeploymentMutex.RUnlock() + return fake.deleteDeploymentArgsForCall[i].name +} + +func (fake *FakeInstallStrategyDeploymentInterface) DeleteDeploymentReturns(result1 error) { + fake.DeleteDeploymentStub = nil + fake.deleteDeploymentReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeInstallStrategyDeploymentInterface) DeleteDeploymentReturnsOnCall(i int, result1 error) { + fake.DeleteDeploymentStub = nil + if fake.deleteDeploymentReturnsOnCall == nil { + fake.deleteDeploymentReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.deleteDeploymentReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByName(serviceAccountName string) (*corev1.ServiceAccount, error) { + fake.getServiceAccountByNameMutex.Lock() + ret, specificReturn := fake.getServiceAccountByNameReturnsOnCall[len(fake.getServiceAccountByNameArgsForCall)] + fake.getServiceAccountByNameArgsForCall = append(fake.getServiceAccountByNameArgsForCall, struct { + serviceAccountName string + }{serviceAccountName}) + fake.recordInvocation("GetServiceAccountByName", []interface{}{serviceAccountName}) + fake.getServiceAccountByNameMutex.Unlock() + if fake.GetServiceAccountByNameStub != nil { + return fake.GetServiceAccountByNameStub(serviceAccountName) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.getServiceAccountByNameReturns.result1, fake.getServiceAccountByNameReturns.result2 +} + +func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByNameCallCount() int { + fake.getServiceAccountByNameMutex.RLock() + defer fake.getServiceAccountByNameMutex.RUnlock() + return len(fake.getServiceAccountByNameArgsForCall) +} + +func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByNameArgsForCall(i int) string { + fake.getServiceAccountByNameMutex.RLock() + defer fake.getServiceAccountByNameMutex.RUnlock() + return fake.getServiceAccountByNameArgsForCall[i].serviceAccountName +} + +func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByNameReturns(result1 *corev1.ServiceAccount, result2 error) { + fake.GetServiceAccountByNameStub = nil + fake.getServiceAccountByNameReturns = struct { + result1 *corev1.ServiceAccount + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) GetServiceAccountByNameReturnsOnCall(i int, result1 *corev1.ServiceAccount, result2 error) { + fake.GetServiceAccountByNameStub = nil + if fake.getServiceAccountByNameReturnsOnCall == nil { + fake.getServiceAccountByNameReturnsOnCall = make(map[int]struct { + result1 *corev1.ServiceAccount + result2 error + }) + } + fake.getServiceAccountByNameReturnsOnCall[i] = struct { + result1 *corev1.ServiceAccount + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) FindAnyDeploymentsMatchingNames(depNames []string) ([]*appsv1.Deployment, error) { + var depNamesCopy []string + if depNames != nil { + depNamesCopy = make([]string, len(depNames)) + copy(depNamesCopy, depNames) + } + fake.findAnyDeploymentsMatchingNamesMutex.Lock() + ret, specificReturn := fake.findAnyDeploymentsMatchingNamesReturnsOnCall[len(fake.findAnyDeploymentsMatchingNamesArgsForCall)] + fake.findAnyDeploymentsMatchingNamesArgsForCall = append(fake.findAnyDeploymentsMatchingNamesArgsForCall, struct { + depNames []string + }{depNamesCopy}) + fake.recordInvocation("FindAnyDeploymentsMatchingNames", []interface{}{depNamesCopy}) + fake.findAnyDeploymentsMatchingNamesMutex.Unlock() + if fake.FindAnyDeploymentsMatchingNamesStub != nil { + return fake.FindAnyDeploymentsMatchingNamesStub(depNames) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.findAnyDeploymentsMatchingNamesReturns.result1, fake.findAnyDeploymentsMatchingNamesReturns.result2 +} + +func (fake *FakeInstallStrategyDeploymentInterface) FindAnyDeploymentsMatchingNamesCallCount() int { + fake.findAnyDeploymentsMatchingNamesMutex.RLock() + defer fake.findAnyDeploymentsMatchingNamesMutex.RUnlock() + return len(fake.findAnyDeploymentsMatchingNamesArgsForCall) +} + +func (fake *FakeInstallStrategyDeploymentInterface) FindAnyDeploymentsMatchingNamesArgsForCall(i int) []string { + fake.findAnyDeploymentsMatchingNamesMutex.RLock() + defer fake.findAnyDeploymentsMatchingNamesMutex.RUnlock() + return fake.findAnyDeploymentsMatchingNamesArgsForCall[i].depNames +} + +func (fake *FakeInstallStrategyDeploymentInterface) FindAnyDeploymentsMatchingNamesReturns(result1 []*appsv1.Deployment, result2 error) { + fake.FindAnyDeploymentsMatchingNamesStub = nil + fake.findAnyDeploymentsMatchingNamesReturns = struct { + result1 []*appsv1.Deployment + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) FindAnyDeploymentsMatchingNamesReturnsOnCall(i int, result1 []*appsv1.Deployment, result2 error) { + fake.FindAnyDeploymentsMatchingNamesStub = nil + if fake.findAnyDeploymentsMatchingNamesReturnsOnCall == nil { + fake.findAnyDeploymentsMatchingNamesReturnsOnCall = make(map[int]struct { + result1 []*appsv1.Deployment + result2 error + }) + } + fake.findAnyDeploymentsMatchingNamesReturnsOnCall[i] = struct { + result1 []*appsv1.Deployment + result2 error + }{result1, result2} +} + +func (fake *FakeInstallStrategyDeploymentInterface) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.createRoleMutex.RLock() + defer fake.createRoleMutex.RUnlock() + fake.createRoleBindingMutex.RLock() + defer fake.createRoleBindingMutex.RUnlock() + fake.ensureServiceAccountMutex.RLock() + defer fake.ensureServiceAccountMutex.RUnlock() + fake.createDeploymentMutex.RLock() + defer fake.createDeploymentMutex.RUnlock() + fake.createOrUpdateDeploymentMutex.RLock() + defer fake.createOrUpdateDeploymentMutex.RUnlock() + fake.deleteDeploymentMutex.RLock() + defer fake.deleteDeploymentMutex.RUnlock() + fake.getServiceAccountByNameMutex.RLock() + defer fake.getServiceAccountByNameMutex.RUnlock() + fake.findAnyDeploymentsMatchingNamesMutex.RLock() + defer fake.findAnyDeploymentsMatchingNamesMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *FakeInstallStrategyDeploymentInterface) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} + +var _ wrappers.InstallStrategyDeploymentInterface = new(FakeInstallStrategyDeploymentInterface) diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_registry_source.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_registry_source.go new file mode 100644 index 00000000..28c13439 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_registry_source.go @@ -0,0 +1,548 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package fakes + +import ( + "sync" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry" + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" +) + +type FakeSource struct { + FindCSVForPackageNameUnderChannelStub func(packageName string, channelName string) (*v1alpha1.ClusterServiceVersion, error) + findCSVForPackageNameUnderChannelMutex sync.RWMutex + findCSVForPackageNameUnderChannelArgsForCall []struct { + packageName string + channelName string + } + findCSVForPackageNameUnderChannelReturns struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + } + findCSVForPackageNameUnderChannelReturnsOnCall map[int]struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + } + FindReplacementCSVForPackageNameUnderChannelStub func(packageName string, channelName string, csvName string) (*v1alpha1.ClusterServiceVersion, error) + findReplacementCSVForPackageNameUnderChannelMutex sync.RWMutex + findReplacementCSVForPackageNameUnderChannelArgsForCall []struct { + packageName string + channelName string + csvName string + } + findReplacementCSVForPackageNameUnderChannelReturns struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + } + findReplacementCSVForPackageNameUnderChannelReturnsOnCall map[int]struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + } + AllPackagesStub func() map[string]registry.PackageManifest + allPackagesMutex sync.RWMutex + allPackagesArgsForCall []struct{} + allPackagesReturns struct { + result1 map[string]registry.PackageManifest + } + allPackagesReturnsOnCall map[int]struct { + result1 map[string]registry.PackageManifest + } + FindReplacementCSVForNameStub func(name string) (*v1alpha1.ClusterServiceVersion, error) + findReplacementCSVForNameMutex sync.RWMutex + findReplacementCSVForNameArgsForCall []struct { + name string + } + findReplacementCSVForNameReturns struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + } + findReplacementCSVForNameReturnsOnCall map[int]struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + } + FindCSVByNameStub func(name string) (*v1alpha1.ClusterServiceVersion, error) + findCSVByNameMutex sync.RWMutex + findCSVByNameArgsForCall []struct { + name string + } + findCSVByNameReturns struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + } + findCSVByNameReturnsOnCall map[int]struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + } + ListServicesStub func() ([]v1alpha1.ClusterServiceVersion, error) + listServicesMutex sync.RWMutex + listServicesArgsForCall []struct{} + listServicesReturns struct { + result1 []v1alpha1.ClusterServiceVersion + result2 error + } + listServicesReturnsOnCall map[int]struct { + result1 []v1alpha1.ClusterServiceVersion + result2 error + } + FindCRDByKeyStub func(key registry.CRDKey) (*v1beta1.CustomResourceDefinition, error) + findCRDByKeyMutex sync.RWMutex + findCRDByKeyArgsForCall []struct { + key registry.CRDKey + } + findCRDByKeyReturns struct { + result1 *v1beta1.CustomResourceDefinition + result2 error + } + findCRDByKeyReturnsOnCall map[int]struct { + result1 *v1beta1.CustomResourceDefinition + result2 error + } + ListLatestCSVsForCRDStub func(key registry.CRDKey) ([]registry.CSVAndChannelInfo, error) + listLatestCSVsForCRDMutex sync.RWMutex + listLatestCSVsForCRDArgsForCall []struct { + key registry.CRDKey + } + listLatestCSVsForCRDReturns struct { + result1 []registry.CSVAndChannelInfo + result2 error + } + listLatestCSVsForCRDReturnsOnCall map[int]struct { + result1 []registry.CSVAndChannelInfo + result2 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *FakeSource) FindCSVForPackageNameUnderChannel(packageName string, channelName string) (*v1alpha1.ClusterServiceVersion, error) { + fake.findCSVForPackageNameUnderChannelMutex.Lock() + ret, specificReturn := fake.findCSVForPackageNameUnderChannelReturnsOnCall[len(fake.findCSVForPackageNameUnderChannelArgsForCall)] + fake.findCSVForPackageNameUnderChannelArgsForCall = append(fake.findCSVForPackageNameUnderChannelArgsForCall, struct { + packageName string + channelName string + }{packageName, channelName}) + fake.recordInvocation("FindCSVForPackageNameUnderChannel", []interface{}{packageName, channelName}) + fake.findCSVForPackageNameUnderChannelMutex.Unlock() + if fake.FindCSVForPackageNameUnderChannelStub != nil { + return fake.FindCSVForPackageNameUnderChannelStub(packageName, channelName) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.findCSVForPackageNameUnderChannelReturns.result1, fake.findCSVForPackageNameUnderChannelReturns.result2 +} + +func (fake *FakeSource) FindCSVForPackageNameUnderChannelCallCount() int { + fake.findCSVForPackageNameUnderChannelMutex.RLock() + defer fake.findCSVForPackageNameUnderChannelMutex.RUnlock() + return len(fake.findCSVForPackageNameUnderChannelArgsForCall) +} + +func (fake *FakeSource) FindCSVForPackageNameUnderChannelArgsForCall(i int) (string, string) { + fake.findCSVForPackageNameUnderChannelMutex.RLock() + defer fake.findCSVForPackageNameUnderChannelMutex.RUnlock() + return fake.findCSVForPackageNameUnderChannelArgsForCall[i].packageName, fake.findCSVForPackageNameUnderChannelArgsForCall[i].channelName +} + +func (fake *FakeSource) FindCSVForPackageNameUnderChannelReturns(result1 *v1alpha1.ClusterServiceVersion, result2 error) { + fake.FindCSVForPackageNameUnderChannelStub = nil + fake.findCSVForPackageNameUnderChannelReturns = struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + }{result1, result2} +} + +func (fake *FakeSource) FindCSVForPackageNameUnderChannelReturnsOnCall(i int, result1 *v1alpha1.ClusterServiceVersion, result2 error) { + fake.FindCSVForPackageNameUnderChannelStub = nil + if fake.findCSVForPackageNameUnderChannelReturnsOnCall == nil { + fake.findCSVForPackageNameUnderChannelReturnsOnCall = make(map[int]struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + }) + } + fake.findCSVForPackageNameUnderChannelReturnsOnCall[i] = struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + }{result1, result2} +} + +func (fake *FakeSource) FindReplacementCSVForPackageNameUnderChannel(packageName string, channelName string, csvName string) (*v1alpha1.ClusterServiceVersion, error) { + fake.findReplacementCSVForPackageNameUnderChannelMutex.Lock() + ret, specificReturn := fake.findReplacementCSVForPackageNameUnderChannelReturnsOnCall[len(fake.findReplacementCSVForPackageNameUnderChannelArgsForCall)] + fake.findReplacementCSVForPackageNameUnderChannelArgsForCall = append(fake.findReplacementCSVForPackageNameUnderChannelArgsForCall, struct { + packageName string + channelName string + csvName string + }{packageName, channelName, csvName}) + fake.recordInvocation("FindReplacementCSVForPackageNameUnderChannel", []interface{}{packageName, channelName, csvName}) + fake.findReplacementCSVForPackageNameUnderChannelMutex.Unlock() + if fake.FindReplacementCSVForPackageNameUnderChannelStub != nil { + return fake.FindReplacementCSVForPackageNameUnderChannelStub(packageName, channelName, csvName) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.findReplacementCSVForPackageNameUnderChannelReturns.result1, fake.findReplacementCSVForPackageNameUnderChannelReturns.result2 +} + +func (fake *FakeSource) FindReplacementCSVForPackageNameUnderChannelCallCount() int { + fake.findReplacementCSVForPackageNameUnderChannelMutex.RLock() + defer fake.findReplacementCSVForPackageNameUnderChannelMutex.RUnlock() + return len(fake.findReplacementCSVForPackageNameUnderChannelArgsForCall) +} + +func (fake *FakeSource) FindReplacementCSVForPackageNameUnderChannelArgsForCall(i int) (string, string, string) { + fake.findReplacementCSVForPackageNameUnderChannelMutex.RLock() + defer fake.findReplacementCSVForPackageNameUnderChannelMutex.RUnlock() + return fake.findReplacementCSVForPackageNameUnderChannelArgsForCall[i].packageName, fake.findReplacementCSVForPackageNameUnderChannelArgsForCall[i].channelName, fake.findReplacementCSVForPackageNameUnderChannelArgsForCall[i].csvName +} + +func (fake *FakeSource) FindReplacementCSVForPackageNameUnderChannelReturns(result1 *v1alpha1.ClusterServiceVersion, result2 error) { + fake.FindReplacementCSVForPackageNameUnderChannelStub = nil + fake.findReplacementCSVForPackageNameUnderChannelReturns = struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + }{result1, result2} +} + +func (fake *FakeSource) FindReplacementCSVForPackageNameUnderChannelReturnsOnCall(i int, result1 *v1alpha1.ClusterServiceVersion, result2 error) { + fake.FindReplacementCSVForPackageNameUnderChannelStub = nil + if fake.findReplacementCSVForPackageNameUnderChannelReturnsOnCall == nil { + fake.findReplacementCSVForPackageNameUnderChannelReturnsOnCall = make(map[int]struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + }) + } + fake.findReplacementCSVForPackageNameUnderChannelReturnsOnCall[i] = struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + }{result1, result2} +} + +func (fake *FakeSource) AllPackages() map[string]registry.PackageManifest { + fake.allPackagesMutex.Lock() + ret, specificReturn := fake.allPackagesReturnsOnCall[len(fake.allPackagesArgsForCall)] + fake.allPackagesArgsForCall = append(fake.allPackagesArgsForCall, struct{}{}) + fake.recordInvocation("AllPackages", []interface{}{}) + fake.allPackagesMutex.Unlock() + if fake.AllPackagesStub != nil { + return fake.AllPackagesStub() + } + if specificReturn { + return ret.result1 + } + return fake.allPackagesReturns.result1 +} + +func (fake *FakeSource) AllPackagesCallCount() int { + fake.allPackagesMutex.RLock() + defer fake.allPackagesMutex.RUnlock() + return len(fake.allPackagesArgsForCall) +} + +func (fake *FakeSource) AllPackagesReturns(result1 map[string]registry.PackageManifest) { + fake.AllPackagesStub = nil + fake.allPackagesReturns = struct { + result1 map[string]registry.PackageManifest + }{result1} +} + +func (fake *FakeSource) AllPackagesReturnsOnCall(i int, result1 map[string]registry.PackageManifest) { + fake.AllPackagesStub = nil + if fake.allPackagesReturnsOnCall == nil { + fake.allPackagesReturnsOnCall = make(map[int]struct { + result1 map[string]registry.PackageManifest + }) + } + fake.allPackagesReturnsOnCall[i] = struct { + result1 map[string]registry.PackageManifest + }{result1} +} + +func (fake *FakeSource) FindReplacementCSVForName(name string) (*v1alpha1.ClusterServiceVersion, error) { + fake.findReplacementCSVForNameMutex.Lock() + ret, specificReturn := fake.findReplacementCSVForNameReturnsOnCall[len(fake.findReplacementCSVForNameArgsForCall)] + fake.findReplacementCSVForNameArgsForCall = append(fake.findReplacementCSVForNameArgsForCall, struct { + name string + }{name}) + fake.recordInvocation("FindReplacementCSVForName", []interface{}{name}) + fake.findReplacementCSVForNameMutex.Unlock() + if fake.FindReplacementCSVForNameStub != nil { + return fake.FindReplacementCSVForNameStub(name) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.findReplacementCSVForNameReturns.result1, fake.findReplacementCSVForNameReturns.result2 +} + +func (fake *FakeSource) FindReplacementCSVForNameCallCount() int { + fake.findReplacementCSVForNameMutex.RLock() + defer fake.findReplacementCSVForNameMutex.RUnlock() + return len(fake.findReplacementCSVForNameArgsForCall) +} + +func (fake *FakeSource) FindReplacementCSVForNameArgsForCall(i int) string { + fake.findReplacementCSVForNameMutex.RLock() + defer fake.findReplacementCSVForNameMutex.RUnlock() + return fake.findReplacementCSVForNameArgsForCall[i].name +} + +func (fake *FakeSource) FindReplacementCSVForNameReturns(result1 *v1alpha1.ClusterServiceVersion, result2 error) { + fake.FindReplacementCSVForNameStub = nil + fake.findReplacementCSVForNameReturns = struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + }{result1, result2} +} + +func (fake *FakeSource) FindReplacementCSVForNameReturnsOnCall(i int, result1 *v1alpha1.ClusterServiceVersion, result2 error) { + fake.FindReplacementCSVForNameStub = nil + if fake.findReplacementCSVForNameReturnsOnCall == nil { + fake.findReplacementCSVForNameReturnsOnCall = make(map[int]struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + }) + } + fake.findReplacementCSVForNameReturnsOnCall[i] = struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + }{result1, result2} +} + +func (fake *FakeSource) FindCSVByName(name string) (*v1alpha1.ClusterServiceVersion, error) { + fake.findCSVByNameMutex.Lock() + ret, specificReturn := fake.findCSVByNameReturnsOnCall[len(fake.findCSVByNameArgsForCall)] + fake.findCSVByNameArgsForCall = append(fake.findCSVByNameArgsForCall, struct { + name string + }{name}) + fake.recordInvocation("FindCSVByName", []interface{}{name}) + fake.findCSVByNameMutex.Unlock() + if fake.FindCSVByNameStub != nil { + return fake.FindCSVByNameStub(name) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.findCSVByNameReturns.result1, fake.findCSVByNameReturns.result2 +} + +func (fake *FakeSource) FindCSVByNameCallCount() int { + fake.findCSVByNameMutex.RLock() + defer fake.findCSVByNameMutex.RUnlock() + return len(fake.findCSVByNameArgsForCall) +} + +func (fake *FakeSource) FindCSVByNameArgsForCall(i int) string { + fake.findCSVByNameMutex.RLock() + defer fake.findCSVByNameMutex.RUnlock() + return fake.findCSVByNameArgsForCall[i].name +} + +func (fake *FakeSource) FindCSVByNameReturns(result1 *v1alpha1.ClusterServiceVersion, result2 error) { + fake.FindCSVByNameStub = nil + fake.findCSVByNameReturns = struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + }{result1, result2} +} + +func (fake *FakeSource) FindCSVByNameReturnsOnCall(i int, result1 *v1alpha1.ClusterServiceVersion, result2 error) { + fake.FindCSVByNameStub = nil + if fake.findCSVByNameReturnsOnCall == nil { + fake.findCSVByNameReturnsOnCall = make(map[int]struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + }) + } + fake.findCSVByNameReturnsOnCall[i] = struct { + result1 *v1alpha1.ClusterServiceVersion + result2 error + }{result1, result2} +} + +func (fake *FakeSource) ListServices() ([]v1alpha1.ClusterServiceVersion, error) { + fake.listServicesMutex.Lock() + ret, specificReturn := fake.listServicesReturnsOnCall[len(fake.listServicesArgsForCall)] + fake.listServicesArgsForCall = append(fake.listServicesArgsForCall, struct{}{}) + fake.recordInvocation("ListServices", []interface{}{}) + fake.listServicesMutex.Unlock() + if fake.ListServicesStub != nil { + return fake.ListServicesStub() + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.listServicesReturns.result1, fake.listServicesReturns.result2 +} + +func (fake *FakeSource) ListServicesCallCount() int { + fake.listServicesMutex.RLock() + defer fake.listServicesMutex.RUnlock() + return len(fake.listServicesArgsForCall) +} + +func (fake *FakeSource) ListServicesReturns(result1 []v1alpha1.ClusterServiceVersion, result2 error) { + fake.ListServicesStub = nil + fake.listServicesReturns = struct { + result1 []v1alpha1.ClusterServiceVersion + result2 error + }{result1, result2} +} + +func (fake *FakeSource) ListServicesReturnsOnCall(i int, result1 []v1alpha1.ClusterServiceVersion, result2 error) { + fake.ListServicesStub = nil + if fake.listServicesReturnsOnCall == nil { + fake.listServicesReturnsOnCall = make(map[int]struct { + result1 []v1alpha1.ClusterServiceVersion + result2 error + }) + } + fake.listServicesReturnsOnCall[i] = struct { + result1 []v1alpha1.ClusterServiceVersion + result2 error + }{result1, result2} +} + +func (fake *FakeSource) FindCRDByKey(key registry.CRDKey) (*v1beta1.CustomResourceDefinition, error) { + fake.findCRDByKeyMutex.Lock() + ret, specificReturn := fake.findCRDByKeyReturnsOnCall[len(fake.findCRDByKeyArgsForCall)] + fake.findCRDByKeyArgsForCall = append(fake.findCRDByKeyArgsForCall, struct { + key registry.CRDKey + }{key}) + fake.recordInvocation("FindCRDByKey", []interface{}{key}) + fake.findCRDByKeyMutex.Unlock() + if fake.FindCRDByKeyStub != nil { + return fake.FindCRDByKeyStub(key) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.findCRDByKeyReturns.result1, fake.findCRDByKeyReturns.result2 +} + +func (fake *FakeSource) FindCRDByKeyCallCount() int { + fake.findCRDByKeyMutex.RLock() + defer fake.findCRDByKeyMutex.RUnlock() + return len(fake.findCRDByKeyArgsForCall) +} + +func (fake *FakeSource) FindCRDByKeyArgsForCall(i int) registry.CRDKey { + fake.findCRDByKeyMutex.RLock() + defer fake.findCRDByKeyMutex.RUnlock() + return fake.findCRDByKeyArgsForCall[i].key +} + +func (fake *FakeSource) FindCRDByKeyReturns(result1 *v1beta1.CustomResourceDefinition, result2 error) { + fake.FindCRDByKeyStub = nil + fake.findCRDByKeyReturns = struct { + result1 *v1beta1.CustomResourceDefinition + result2 error + }{result1, result2} +} + +func (fake *FakeSource) FindCRDByKeyReturnsOnCall(i int, result1 *v1beta1.CustomResourceDefinition, result2 error) { + fake.FindCRDByKeyStub = nil + if fake.findCRDByKeyReturnsOnCall == nil { + fake.findCRDByKeyReturnsOnCall = make(map[int]struct { + result1 *v1beta1.CustomResourceDefinition + result2 error + }) + } + fake.findCRDByKeyReturnsOnCall[i] = struct { + result1 *v1beta1.CustomResourceDefinition + result2 error + }{result1, result2} +} + +func (fake *FakeSource) ListLatestCSVsForCRD(key registry.CRDKey) ([]registry.CSVAndChannelInfo, error) { + fake.listLatestCSVsForCRDMutex.Lock() + ret, specificReturn := fake.listLatestCSVsForCRDReturnsOnCall[len(fake.listLatestCSVsForCRDArgsForCall)] + fake.listLatestCSVsForCRDArgsForCall = append(fake.listLatestCSVsForCRDArgsForCall, struct { + key registry.CRDKey + }{key}) + fake.recordInvocation("ListLatestCSVsForCRD", []interface{}{key}) + fake.listLatestCSVsForCRDMutex.Unlock() + if fake.ListLatestCSVsForCRDStub != nil { + return fake.ListLatestCSVsForCRDStub(key) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.listLatestCSVsForCRDReturns.result1, fake.listLatestCSVsForCRDReturns.result2 +} + +func (fake *FakeSource) ListLatestCSVsForCRDCallCount() int { + fake.listLatestCSVsForCRDMutex.RLock() + defer fake.listLatestCSVsForCRDMutex.RUnlock() + return len(fake.listLatestCSVsForCRDArgsForCall) +} + +func (fake *FakeSource) ListLatestCSVsForCRDArgsForCall(i int) registry.CRDKey { + fake.listLatestCSVsForCRDMutex.RLock() + defer fake.listLatestCSVsForCRDMutex.RUnlock() + return fake.listLatestCSVsForCRDArgsForCall[i].key +} + +func (fake *FakeSource) ListLatestCSVsForCRDReturns(result1 []registry.CSVAndChannelInfo, result2 error) { + fake.ListLatestCSVsForCRDStub = nil + fake.listLatestCSVsForCRDReturns = struct { + result1 []registry.CSVAndChannelInfo + result2 error + }{result1, result2} +} + +func (fake *FakeSource) ListLatestCSVsForCRDReturnsOnCall(i int, result1 []registry.CSVAndChannelInfo, result2 error) { + fake.ListLatestCSVsForCRDStub = nil + if fake.listLatestCSVsForCRDReturnsOnCall == nil { + fake.listLatestCSVsForCRDReturnsOnCall = make(map[int]struct { + result1 []registry.CSVAndChannelInfo + result2 error + }) + } + fake.listLatestCSVsForCRDReturnsOnCall[i] = struct { + result1 []registry.CSVAndChannelInfo + result2 error + }{result1, result2} +} + +func (fake *FakeSource) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.findCSVForPackageNameUnderChannelMutex.RLock() + defer fake.findCSVForPackageNameUnderChannelMutex.RUnlock() + fake.findReplacementCSVForPackageNameUnderChannelMutex.RLock() + defer fake.findReplacementCSVForPackageNameUnderChannelMutex.RUnlock() + fake.allPackagesMutex.RLock() + defer fake.allPackagesMutex.RUnlock() + fake.findReplacementCSVForNameMutex.RLock() + defer fake.findReplacementCSVForNameMutex.RUnlock() + fake.findCSVByNameMutex.RLock() + defer fake.findCSVByNameMutex.RUnlock() + fake.listServicesMutex.RLock() + defer fake.listServicesMutex.RUnlock() + fake.findCRDByKeyMutex.RLock() + defer fake.findCRDByKeyMutex.RUnlock() + fake.listLatestCSVsForCRDMutex.RLock() + defer fake.listLatestCSVsForCRDMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *FakeSource) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} + +var _ registry.Source = new(FakeSource) diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_resources.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_resources.go new file mode 100644 index 00000000..685b50a9 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_resources.go @@ -0,0 +1,71 @@ +package fakes + +import ( + yaml "gopkg.in/yaml.v2" + + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" +) + +func FakeConfigMapData() map[string]string { + data := make(map[string]string) + yaml, err := yaml.Marshal([]v1beta1.CustomResourceDefinition{FakeCRD("fake-crd")}) + if err != nil { + return data + } + + data["customResourceDefinitions"] = string(yaml) + return data +} + +func FakeInstallPlan(names ...string) v1alpha1.InstallPlan { + return v1alpha1.InstallPlan{ + Spec: v1alpha1.InstallPlanSpec{ + ClusterServiceVersionNames: names, + }, + Status: v1alpha1.InstallPlanStatus{ + Plan: []v1alpha1.Step{}, + }, + } +} + +func FakeCSV(name string, owned, required []string) v1alpha1.ClusterServiceVersion { + requiredCRDDescs := make([]v1alpha1.CRDDescription, 0) + for _, name := range required { + requiredCRDDescs = append(requiredCRDDescs, v1alpha1.CRDDescription{Name: name, Version: "v1", Kind: name}) + } + + ownedCRDDescs := make([]v1alpha1.CRDDescription, 0) + for _, name := range owned { + ownedCRDDescs = append(ownedCRDDescs, v1alpha1.CRDDescription{Name: name, Version: "v1", Kind: name}) + } + + return v1alpha1.ClusterServiceVersion{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + }, + Spec: v1alpha1.ClusterServiceVersionSpec{ + CustomResourceDefinitions: v1alpha1.CustomResourceDefinitions{ + Owned: ownedCRDDescs, + Required: requiredCRDDescs, + }, + }, + } +} + +func FakeCRD(name string) v1beta1.CustomResourceDefinition { + return v1beta1.CustomResourceDefinition{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + }, + Spec: v1beta1.CustomResourceDefinitionSpec{ + Group: name + "group", + Version: "v1", + Names: v1beta1.CustomResourceDefinitionNames{ + Kind: name, + }, + }, + } +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_strategy.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_strategy.go new file mode 100644 index 00000000..aad453f2 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_strategy.go @@ -0,0 +1,88 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package fakes + +import ( + "sync" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install" +) + +type FakeStrategy struct { + GetStrategyNameStub func() string + getStrategyNameMutex sync.RWMutex + getStrategyNameArgsForCall []struct{} + getStrategyNameReturns struct { + result1 string + } + getStrategyNameReturnsOnCall map[int]struct { + result1 string + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *FakeStrategy) GetStrategyName() string { + fake.getStrategyNameMutex.Lock() + ret, specificReturn := fake.getStrategyNameReturnsOnCall[len(fake.getStrategyNameArgsForCall)] + fake.getStrategyNameArgsForCall = append(fake.getStrategyNameArgsForCall, struct{}{}) + fake.recordInvocation("GetStrategyName", []interface{}{}) + fake.getStrategyNameMutex.Unlock() + if fake.GetStrategyNameStub != nil { + return fake.GetStrategyNameStub() + } + if specificReturn { + return ret.result1 + } + return fake.getStrategyNameReturns.result1 +} + +func (fake *FakeStrategy) GetStrategyNameCallCount() int { + fake.getStrategyNameMutex.RLock() + defer fake.getStrategyNameMutex.RUnlock() + return len(fake.getStrategyNameArgsForCall) +} + +func (fake *FakeStrategy) GetStrategyNameReturns(result1 string) { + fake.GetStrategyNameStub = nil + fake.getStrategyNameReturns = struct { + result1 string + }{result1} +} + +func (fake *FakeStrategy) GetStrategyNameReturnsOnCall(i int, result1 string) { + fake.GetStrategyNameStub = nil + if fake.getStrategyNameReturnsOnCall == nil { + fake.getStrategyNameReturnsOnCall = make(map[int]struct { + result1 string + }) + } + fake.getStrategyNameReturnsOnCall[i] = struct { + result1 string + }{result1} +} + +func (fake *FakeStrategy) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.getStrategyNameMutex.RLock() + defer fake.getStrategyNameMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *FakeStrategy) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} + +var _ install.Strategy = new(FakeStrategy) diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_strategy_installer.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_strategy_installer.go new file mode 100644 index 00000000..76bbd91c --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_strategy_installer.go @@ -0,0 +1,164 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package fakes + +import ( + "sync" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install" +) + +type FakeStrategyInstaller struct { + InstallStub func(strategy install.Strategy) error + installMutex sync.RWMutex + installArgsForCall []struct { + strategy install.Strategy + } + installReturns struct { + result1 error + } + installReturnsOnCall map[int]struct { + result1 error + } + CheckInstalledStub func(strategy install.Strategy) (bool, error) + checkInstalledMutex sync.RWMutex + checkInstalledArgsForCall []struct { + strategy install.Strategy + } + checkInstalledReturns struct { + result1 bool + result2 error + } + checkInstalledReturnsOnCall map[int]struct { + result1 bool + result2 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *FakeStrategyInstaller) Install(strategy install.Strategy) error { + fake.installMutex.Lock() + ret, specificReturn := fake.installReturnsOnCall[len(fake.installArgsForCall)] + fake.installArgsForCall = append(fake.installArgsForCall, struct { + strategy install.Strategy + }{strategy}) + fake.recordInvocation("Install", []interface{}{strategy}) + fake.installMutex.Unlock() + if fake.InstallStub != nil { + return fake.InstallStub(strategy) + } + if specificReturn { + return ret.result1 + } + return fake.installReturns.result1 +} + +func (fake *FakeStrategyInstaller) InstallCallCount() int { + fake.installMutex.RLock() + defer fake.installMutex.RUnlock() + return len(fake.installArgsForCall) +} + +func (fake *FakeStrategyInstaller) InstallArgsForCall(i int) install.Strategy { + fake.installMutex.RLock() + defer fake.installMutex.RUnlock() + return fake.installArgsForCall[i].strategy +} + +func (fake *FakeStrategyInstaller) InstallReturns(result1 error) { + fake.InstallStub = nil + fake.installReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeStrategyInstaller) InstallReturnsOnCall(i int, result1 error) { + fake.InstallStub = nil + if fake.installReturnsOnCall == nil { + fake.installReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.installReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeStrategyInstaller) CheckInstalled(strategy install.Strategy) (bool, error) { + fake.checkInstalledMutex.Lock() + ret, specificReturn := fake.checkInstalledReturnsOnCall[len(fake.checkInstalledArgsForCall)] + fake.checkInstalledArgsForCall = append(fake.checkInstalledArgsForCall, struct { + strategy install.Strategy + }{strategy}) + fake.recordInvocation("CheckInstalled", []interface{}{strategy}) + fake.checkInstalledMutex.Unlock() + if fake.CheckInstalledStub != nil { + return fake.CheckInstalledStub(strategy) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.checkInstalledReturns.result1, fake.checkInstalledReturns.result2 +} + +func (fake *FakeStrategyInstaller) CheckInstalledCallCount() int { + fake.checkInstalledMutex.RLock() + defer fake.checkInstalledMutex.RUnlock() + return len(fake.checkInstalledArgsForCall) +} + +func (fake *FakeStrategyInstaller) CheckInstalledArgsForCall(i int) install.Strategy { + fake.checkInstalledMutex.RLock() + defer fake.checkInstalledMutex.RUnlock() + return fake.checkInstalledArgsForCall[i].strategy +} + +func (fake *FakeStrategyInstaller) CheckInstalledReturns(result1 bool, result2 error) { + fake.CheckInstalledStub = nil + fake.checkInstalledReturns = struct { + result1 bool + result2 error + }{result1, result2} +} + +func (fake *FakeStrategyInstaller) CheckInstalledReturnsOnCall(i int, result1 bool, result2 error) { + fake.CheckInstalledStub = nil + if fake.checkInstalledReturnsOnCall == nil { + fake.checkInstalledReturnsOnCall = make(map[int]struct { + result1 bool + result2 error + }) + } + fake.checkInstalledReturnsOnCall[i] = struct { + result1 bool + result2 error + }{result1, result2} +} + +func (fake *FakeStrategyInstaller) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.installMutex.RLock() + defer fake.installMutex.RUnlock() + fake.checkInstalledMutex.RLock() + defer fake.checkInstalledMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *FakeStrategyInstaller) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} + +var _ install.StrategyInstaller = new(FakeStrategyInstaller) diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_strategy_resolver.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_strategy_resolver.go new file mode 100644 index 00000000..c40f559d --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/fakes/fake_strategy_resolver.go @@ -0,0 +1,173 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package fakes + +import ( + "sync" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil" +) + +type FakeStrategyResolverInterface struct { + UnmarshalStrategyStub func(s v1alpha1.NamedInstallStrategy) (strategy install.Strategy, err error) + unmarshalStrategyMutex sync.RWMutex + unmarshalStrategyArgsForCall []struct { + s v1alpha1.NamedInstallStrategy + } + unmarshalStrategyReturns struct { + result1 install.Strategy + result2 error + } + unmarshalStrategyReturnsOnCall map[int]struct { + result1 install.Strategy + result2 error + } + InstallerForStrategyStub func(strategyName string, opClient operatorclient.ClientInterface, owner ownerutil.Owner, previousStrategy install.Strategy) install.StrategyInstaller + installerForStrategyMutex sync.RWMutex + installerForStrategyArgsForCall []struct { + strategyName string + opClient operatorclient.ClientInterface + owner ownerutil.Owner + previousStrategy install.Strategy + } + installerForStrategyReturns struct { + result1 install.StrategyInstaller + } + installerForStrategyReturnsOnCall map[int]struct { + result1 install.StrategyInstaller + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *FakeStrategyResolverInterface) UnmarshalStrategy(s v1alpha1.NamedInstallStrategy) (strategy install.Strategy, err error) { + fake.unmarshalStrategyMutex.Lock() + ret, specificReturn := fake.unmarshalStrategyReturnsOnCall[len(fake.unmarshalStrategyArgsForCall)] + fake.unmarshalStrategyArgsForCall = append(fake.unmarshalStrategyArgsForCall, struct { + s v1alpha1.NamedInstallStrategy + }{s}) + fake.recordInvocation("UnmarshalStrategy", []interface{}{s}) + fake.unmarshalStrategyMutex.Unlock() + if fake.UnmarshalStrategyStub != nil { + return fake.UnmarshalStrategyStub(s) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.unmarshalStrategyReturns.result1, fake.unmarshalStrategyReturns.result2 +} + +func (fake *FakeStrategyResolverInterface) UnmarshalStrategyCallCount() int { + fake.unmarshalStrategyMutex.RLock() + defer fake.unmarshalStrategyMutex.RUnlock() + return len(fake.unmarshalStrategyArgsForCall) +} + +func (fake *FakeStrategyResolverInterface) UnmarshalStrategyArgsForCall(i int) v1alpha1.NamedInstallStrategy { + fake.unmarshalStrategyMutex.RLock() + defer fake.unmarshalStrategyMutex.RUnlock() + return fake.unmarshalStrategyArgsForCall[i].s +} + +func (fake *FakeStrategyResolverInterface) UnmarshalStrategyReturns(result1 install.Strategy, result2 error) { + fake.UnmarshalStrategyStub = nil + fake.unmarshalStrategyReturns = struct { + result1 install.Strategy + result2 error + }{result1, result2} +} + +func (fake *FakeStrategyResolverInterface) UnmarshalStrategyReturnsOnCall(i int, result1 install.Strategy, result2 error) { + fake.UnmarshalStrategyStub = nil + if fake.unmarshalStrategyReturnsOnCall == nil { + fake.unmarshalStrategyReturnsOnCall = make(map[int]struct { + result1 install.Strategy + result2 error + }) + } + fake.unmarshalStrategyReturnsOnCall[i] = struct { + result1 install.Strategy + result2 error + }{result1, result2} +} + +func (fake *FakeStrategyResolverInterface) InstallerForStrategy(strategyName string, opClient operatorclient.ClientInterface, owner ownerutil.Owner, previousStrategy install.Strategy) install.StrategyInstaller { + fake.installerForStrategyMutex.Lock() + ret, specificReturn := fake.installerForStrategyReturnsOnCall[len(fake.installerForStrategyArgsForCall)] + fake.installerForStrategyArgsForCall = append(fake.installerForStrategyArgsForCall, struct { + strategyName string + opClient operatorclient.ClientInterface + owner ownerutil.Owner + previousStrategy install.Strategy + }{strategyName, opClient, owner, previousStrategy}) + fake.recordInvocation("InstallerForStrategy", []interface{}{strategyName, opClient, owner, previousStrategy}) + fake.installerForStrategyMutex.Unlock() + if fake.InstallerForStrategyStub != nil { + return fake.InstallerForStrategyStub(strategyName, opClient, owner, previousStrategy) + } + if specificReturn { + return ret.result1 + } + return fake.installerForStrategyReturns.result1 +} + +func (fake *FakeStrategyResolverInterface) InstallerForStrategyCallCount() int { + fake.installerForStrategyMutex.RLock() + defer fake.installerForStrategyMutex.RUnlock() + return len(fake.installerForStrategyArgsForCall) +} + +func (fake *FakeStrategyResolverInterface) InstallerForStrategyArgsForCall(i int) (string, operatorclient.ClientInterface, ownerutil.Owner, install.Strategy) { + fake.installerForStrategyMutex.RLock() + defer fake.installerForStrategyMutex.RUnlock() + return fake.installerForStrategyArgsForCall[i].strategyName, fake.installerForStrategyArgsForCall[i].opClient, fake.installerForStrategyArgsForCall[i].owner, fake.installerForStrategyArgsForCall[i].previousStrategy +} + +func (fake *FakeStrategyResolverInterface) InstallerForStrategyReturns(result1 install.StrategyInstaller) { + fake.InstallerForStrategyStub = nil + fake.installerForStrategyReturns = struct { + result1 install.StrategyInstaller + }{result1} +} + +func (fake *FakeStrategyResolverInterface) InstallerForStrategyReturnsOnCall(i int, result1 install.StrategyInstaller) { + fake.InstallerForStrategyStub = nil + if fake.installerForStrategyReturnsOnCall == nil { + fake.installerForStrategyReturnsOnCall = make(map[int]struct { + result1 install.StrategyInstaller + }) + } + fake.installerForStrategyReturnsOnCall[i] = struct { + result1 install.StrategyInstaller + }{result1} +} + +func (fake *FakeStrategyResolverInterface) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.unmarshalStrategyMutex.RLock() + defer fake.unmarshalStrategyMutex.RUnlock() + fake.installerForStrategyMutex.RLock() + defer fake.installerForStrategyMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *FakeStrategyResolverInterface) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} + +var _ install.StrategyResolverInterface = new(FakeStrategyResolverInterface) diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/client.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/client.go new file mode 100644 index 00000000..6897d542 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/client.go @@ -0,0 +1,104 @@ +package operatorclient + +import ( + log "github.com/sirupsen/logrus" + appsv1 "k8s.io/api/apps/v1" + "k8s.io/api/core/v1" + apiextensions "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/clientcmd" +) + +type ClientInterface interface { + KubernetesInterface() kubernetes.Interface + ApiextensionsV1beta1Interface() apiextensions.Interface + CustomResourceClient + ServiceAccountClient + DeploymentClient +} + +// CustomResourceClient contains methods for the Custom Resource. +type CustomResourceClient interface { + GetCustomResource(apiGroup, version, namespace, resourceKind, resourceName string) (*unstructured.Unstructured, error) + GetCustomResourceRaw(apiGroup, version, namespace, resourceKind, resourceName string) ([]byte, error) + CreateCustomResource(item *unstructured.Unstructured) error + CreateCustomResourceRaw(apiGroup, version, namespace, kind string, data []byte) error + CreateCustomResourceRawIfNotFound(apiGroup, version, namespace, kind, name string, data []byte) (bool, error) + UpdateCustomResource(item *unstructured.Unstructured) error + UpdateCustomResourceRaw(apiGroup, version, namespace, resourceKind, resourceName string, data []byte) error + CreateOrUpdateCustomeResourceRaw(apiGroup, version, namespace, resourceKind, resourceName string, data []byte) error + DeleteCustomResource(apiGroup, version, namespace, resourceKind, resourceName string) error + AtomicModifyCustomResource(apiGroup, version, namespace, resourceKind, resourceName string, f CustomResourceModifier, data interface{}) error + ListCustomResource(apiGroup, version, namespace, resourceKind string) (*CustomResourceList, error) +} + +// ServiceAccountClient contains methods for manipulating ServiceAccount. +type ServiceAccountClient interface { + CreateServiceAccount(*v1.ServiceAccount) (*v1.ServiceAccount, error) + GetServiceAccount(namespace, name string) (*v1.ServiceAccount, error) + UpdateServiceAccount(modified *v1.ServiceAccount) (*v1.ServiceAccount, error) + DeleteServiceAccount(namespace, name string, options *metav1.DeleteOptions) error +} + +// DeploymentClient contains methods for the Deployment resource. +type DeploymentClient interface { + GetDeployment(namespace, name string) (*appsv1.Deployment, error) + CreateDeployment(*appsv1.Deployment) (*appsv1.Deployment, error) + DeleteDeployment(namespace, name string, options *metav1.DeleteOptions) error + UpdateDeployment(*appsv1.Deployment) (*appsv1.Deployment, bool, error) + PatchDeployment(*appsv1.Deployment, *appsv1.Deployment) (*appsv1.Deployment, bool, error) + RollingUpdateDeployment(*appsv1.Deployment) (*appsv1.Deployment, bool, error) + RollingPatchDeployment(*appsv1.Deployment, *appsv1.Deployment) (*appsv1.Deployment, bool, error) + RollingUpdateDeploymentMigrations(namespace, name string, f UpdateFunction) (*appsv1.Deployment, bool, error) + RollingPatchDeploymentMigrations(namespace, name string, f PatchFunction) (*appsv1.Deployment, bool, error) + CreateOrRollingUpdateDeployment(*appsv1.Deployment) (*appsv1.Deployment, bool, error) + ListDeploymentsWithLabels(namespace string, labels labels.Set) (*appsv1.DeploymentList, error) +} + +// Interface assertion. +var _ ClientInterface = &Client{} + +// Client is a kubernetes client that can talk to the API server. +type Client struct { + kubernetes.Interface + extInterface apiextensions.Interface +} + +// NewClient creates a kubernetes client or bails out on on failures. +func NewClientFromConfig(kubeconfig string) ClientInterface { + var config *rest.Config + var err error + + if kubeconfig != "" { + log.Infof("Loading kube client config from path %q", kubeconfig) + config, err = clientcmd.BuildConfigFromFlags("", kubeconfig) + } else { + log.Infof("Using in-cluster kube client config") + config, err = rest.InClusterConfig() + } + + if err != nil { + log.Fatalf("Cannot load config for REST client: %v", err) + } + + return &Client{kubernetes.NewForConfigOrDie(config), apiextensions.NewForConfigOrDie(config)} +} + +// NewClient creates a kubernetes client +func NewClient(k8sClient kubernetes.Interface, extclient apiextensions.Interface) ClientInterface { + return &Client{k8sClient, extclient} +} + +// KubernetesInterface returns the Kubernetes interface. +func (c *Client) KubernetesInterface() kubernetes.Interface { + return c.Interface +} + +// ApiextensionsV1beta1Interface returns the API extention interface. +func (c *Client) ApiextensionsV1beta1Interface() apiextensions.Interface { + return c.extInterface +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/customresources.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/customresources.go new file mode 100644 index 00000000..d393f806 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/customresources.go @@ -0,0 +1,313 @@ +package operatorclient + +import ( + "encoding/json" + "fmt" + "path" + "strings" + "time" + + "github.com/golang/glog" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/util/wait" +) + +// CustomResourceList represents a list of custom resource objects that will +// be returned from a List() operation. +type CustomResourceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Items []*unstructured.Unstructured `json:"items"` +} + +// GetCustomResource returns the custom resource as *unstructured.Unstructured by the given name. +func (c *Client) GetCustomResource(apiGroup, version, namespace, resourceKind, resourceName string) (*unstructured.Unstructured, error) { + glog.V(4).Infof("[GET CUSTOM RESOURCE]: %s:%s", namespace, resourceName) + var object unstructured.Unstructured + + b, err := c.GetCustomResourceRaw(apiGroup, version, namespace, resourceKind, resourceName) + if err != nil { + return nil, err + } + + if err := json.Unmarshal(b, &object); err != nil { + return nil, fmt.Errorf("failed to unmarshal CUSTOM RESOURCE: %v", err) + } + return &object, nil +} + +// GetCustomResourceRaw returns the custom resource's raw body data by the given name. +func (c *Client) GetCustomResourceRaw(apiGroup, version, namespace, resourceKind, resourceName string) ([]byte, error) { + glog.V(4).Infof("[GET CUSTOM RESOURCE RAW]: %s:%s", namespace, resourceName) + httpRestClient := c.extInterface.ApiextensionsV1beta1().RESTClient() + uri := customResourceURI(apiGroup, version, namespace, resourceKind, resourceName) + glog.V(4).Infof("[GET]: %s", uri) + + return httpRestClient.Get().RequestURI(uri).DoRaw() +} + +// CreateCustomResource creates the custom resource. +func (c *Client) CreateCustomResource(item *unstructured.Unstructured) error { + glog.V(4).Infof("[CREATE CUSTOM RESOURCE]: %s:%s", item.GetNamespace(), item.GetName()) + kind := item.GetKind() + namespace := item.GetNamespace() + apiVersion := item.GetAPIVersion() + apiGroup, version, err := parseAPIVersion(apiVersion) + if err != nil { + return err + } + + data, err := json.Marshal(item) + if err != nil { + return err + } + + return c.CreateCustomResourceRaw(apiGroup, version, namespace, kind, data) +} + +// CreateCustomResourceRaw creates the raw bytes of the custom resource. +func (c *Client) CreateCustomResourceRaw(apiGroup, version, namespace, kind string, data []byte) error { + glog.V(4).Infof("[CREATE CUSTOM RESOURCE RAW]: %s:%s", namespace, kind) + var statusCode int + + httpRestClient := c.extInterface.ApiextensionsV1beta1().RESTClient() + uri := customResourceDefinitionURI(apiGroup, version, namespace, kind) + glog.V(4).Infof("[POST]: %s", uri) + result := httpRestClient.Post().RequestURI(uri).Body(data).Do() + + if result.Error() != nil { + return result.Error() + } + + result.StatusCode(&statusCode) + glog.V(4).Infof("Written %s, status: %d", uri, statusCode) + + if statusCode != 201 { + return fmt.Errorf("unexpected status code %d, expecting 201", statusCode) + } + return nil +} + +// CreateCustomResourceRawIfNotFound creates the raw bytes of the custom resource if it doesn't exist. +// It also returns a boolean to indicate whether a new custom resource is created. +func (c *Client) CreateCustomResourceRawIfNotFound(apiGroup, version, namespace, kind, name string, data []byte) (bool, error) { + glog.V(4).Infof("[CREATE CUSTOM RESOURCE RAW if not found]: %s:%s", namespace, name) + _, err := c.GetCustomResource(apiGroup, version, namespace, kind, name) + if err == nil { + return false, nil + } + if !errors.IsNotFound(err) { + return false, err + } + err = c.CreateCustomResourceRaw(apiGroup, version, namespace, kind, data) + if err != nil { + return false, err + } + return true, nil +} + +// UpdateCustomResource updates the custom resource. +// To do an atomic update, use AtomicModifyCustomResource(). +func (c *Client) UpdateCustomResource(item *unstructured.Unstructured) error { + glog.V(4).Infof("[UPDATE CUSTOM RESOURCE]: %s:%s", item.GetNamespace(), item.GetName()) + kind := item.GetKind() + name := item.GetName() + namespace := item.GetNamespace() + apiVersion := item.GetAPIVersion() + apiGroup, version, err := parseAPIVersion(apiVersion) + if err != nil { + return err + } + + data, err := json.Marshal(item) + if err != nil { + return err + } + + return c.UpdateCustomResourceRaw(apiGroup, version, namespace, kind, name, data) +} + +// UpdateCustomResourceRaw updates the thirdparty resource with the raw data. +func (c *Client) UpdateCustomResourceRaw(apiGroup, version, namespace, resourceKind, resourceName string, data []byte) error { + glog.V(4).Infof("[UPDATE CUSTOM RESOURCE RAW]: %s:%s", namespace, resourceName) + var statusCode int + + httpRestClient := c.extInterface.ApiextensionsV1beta1().RESTClient() + uri := customResourceURI(apiGroup, version, namespace, resourceKind, resourceName) + glog.V(4).Infof("[PUT]: %s", uri) + result := httpRestClient.Put().RequestURI(uri).Body(data).Do() + + if result.Error() != nil { + return result.Error() + } + + result.StatusCode(&statusCode) + glog.V(4).Infof("Updated %s, status: %d", uri, statusCode) + + if statusCode != 200 { + return fmt.Errorf("unexpected status code %d, expecting 200", statusCode) + } + return nil +} + +// CreateOrUpdateCustomeResourceRaw creates the custom resource if it doesn't exist. +// If the custom resource exists, it updates the existing one. +func (c *Client) CreateOrUpdateCustomeResourceRaw(apiGroup, version, namespace, resourceKind, resourceName string, data []byte) error { + glog.V(4).Infof("[CREATE OR UPDATE UPDATE CUSTOM RESOURCE RAW]: %s:%s", namespace, resourceName) + old, err := c.GetCustomResourceRaw(apiGroup, version, namespace, resourceKind, resourceName) + if err != nil { + if !errors.IsNotFound(err) { + return err + } + return c.CreateCustomResourceRaw(apiGroup, version, namespace, resourceKind, data) + } + + var oldSpec, newSpec unstructured.Unstructured + if err := json.Unmarshal(old, &oldSpec); err != nil { + return err + } + if err := json.Unmarshal(data, &newSpec); err != nil { + return err + } + + // Set the resource version. + newSpec.SetResourceVersion(oldSpec.GetResourceVersion()) + + data, err = json.Marshal(&newSpec) + if err != nil { + return err + } + + return c.UpdateCustomResourceRaw(apiGroup, version, namespace, resourceKind, resourceName, data) +} + +// DeleteCustomResource deletes the with the given name. +func (c *Client) DeleteCustomResource(apiGroup, version, namespace, resourceKind, resourceName string) error { + glog.V(4).Infof("[DELETE CUSTOM RESOURCE]: %s:%s", namespace, resourceName) + httpRestClient := c.extInterface.ApiextensionsV1beta1().RESTClient() + uri := customResourceURI(apiGroup, version, namespace, resourceKind, resourceName) + + glog.V(4).Infof("[DELETE]: %s", uri) + _, err := httpRestClient.Delete().RequestURI(uri).DoRaw() + return err +} + +// CustomResourceModifier takes the custom resource object, and modifies it in-place. +type CustomResourceModifier func(*unstructured.Unstructured, interface{}) error + +// AtomicModifyCustomResource gets the custom resource, modifies it and writes it back. +// If it's modified by other writers, we will retry until it succeeds. +func (c *Client) AtomicModifyCustomResource(apiGroup, version, namespace, resourceKind, resourceName string, f CustomResourceModifier, data interface{}) error { + glog.V(4).Infof("[ATOMIC MODIFY CUSTOM RESOURCE]: %s:%s", namespace, resourceName) + return wait.PollInfinite(time.Second, func() (bool, error) { + var customResource unstructured.Unstructured + b, err := c.GetCustomResourceRaw(apiGroup, version, namespace, resourceKind, resourceName) + if err != nil { + glog.Errorf("Failed to get CUSTOM RESOURCE %q, kind:%q: %v", resourceName, resourceKind, err) + return false, err + } + + if err := json.Unmarshal(b, &customResource); err != nil { + glog.Errorf("Failed to unmarshal CUSTOM RESOURCE %q, kind:%q: %v", resourceName, resourceKind, err) + return false, err + } + + if err := f(&customResource, data); err != nil { + glog.Errorf("Failed to modify the CUSTOM RESOURCE %q, kind:%q: %v", resourceName, resourceKind, err) + return false, err + } + + if err := c.UpdateCustomResource(&customResource); err != nil { + if errors.IsConflict(err) { + glog.Errorf("Failed to update CUSTOM RESOURCE %q, kind:%q: %v, will retry", resourceName, resourceKind, err) + return false, nil + } + glog.Errorf("Failed to update CUSTOM RESOURCE %q, kind:%q: %v", resourceName, resourceKind, err) + return false, err + } + + return true, nil + }) +} + +// customResourceURI returns the URI for the thirdparty resource. +// +// Example of apiGroup: "tco.coreos.com" +// Example of version: "v1" +// Example of namespace: "default" +// Example of resourceKind: "ChannelOperatorConfig" +// Example of resourceName: "test-config" +func customResourceURI(apiGroup, version, namespace, resourceKind, resourceName string) string { + if namespace == "" { + namespace = metav1.NamespaceDefault + } + plural, _ := meta.UnsafeGuessKindToResource(schema.GroupVersionKind{ + Group: apiGroup, + Version: version, + Kind: resourceKind, + }) + return fmt.Sprintf("/apis/%s/%s/namespaces/%s/%s/%s", + strings.ToLower(apiGroup), + strings.ToLower(version), + strings.ToLower(namespace), + strings.ToLower(plural.Resource), + strings.ToLower(resourceName)) +} + +// customResourceDefinitionURI returns the URI for the CRD. +// +// Example of apiGroup: "tco.coreos.com" +// Example of version: "v1" +// Example of namespace: "default" +// Example of resourceKind: "ChannelOperatorConfig" +func customResourceDefinitionURI(apiGroup, version, namespace, resourceKind string) string { + if namespace == "" { + namespace = metav1.NamespaceDefault + } + plural, _ := meta.UnsafeGuessKindToResource(schema.GroupVersionKind{ + Group: apiGroup, + Version: version, + Kind: resourceKind, + }) + return fmt.Sprintf("/apis/%s/%s/namespaces/%s/%s", + strings.ToLower(apiGroup), + strings.ToLower(version), + strings.ToLower(namespace), + strings.ToLower(plural.Resource)) +} + +// ListCustomResource lists all custom resources for the given namespace. +func (c *Client) ListCustomResource(apiGroup, version, namespace, resourceKind string) (*CustomResourceList, error) { + glog.V(4).Infof("LIST CUSTOM RESOURCE]: %s", resourceKind) + + var crList CustomResourceList + + httpRestClient := c.extInterface.ApiextensionsV1beta1().RESTClient() + uri := customResourceDefinitionURI(apiGroup, version, namespace, resourceKind) + glog.V(4).Infof("[GET]: %s", uri) + bytes, err := httpRestClient.Get().RequestURI(uri).DoRaw() + if err != nil { + return nil, fmt.Errorf("failed to get custom resource list: %v", err) + } + + if err := json.Unmarshal(bytes, &crList); err != nil { + return nil, err + } + + return &crList, nil +} + +// parseAPIVersion splits "coreos.com/v1" into +// "coreos.com" and "v1". +func parseAPIVersion(apiVersion string) (apiGroup, version string, err error) { + parts := strings.Split(apiVersion, "/") + if len(parts) < 2 { + return "", "", fmt.Errorf("invalid format of api version %q, expecting APIGroup/Version", apiVersion) + } + return path.Join(parts[:len(parts)-1]...), parts[len(parts)-1], nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/deployment.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/deployment.go new file mode 100644 index 00000000..6a62ca38 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/deployment.go @@ -0,0 +1,203 @@ +package operatorclient + +import ( + "errors" + "fmt" + "time" + + "github.com/golang/glog" + appsv1 "k8s.io/api/apps/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/wait" +) + +const ( + deploymentRolloutPollInterval = time.Second +) + +// GetDeployment returns the Deployment object for the given namespace and name. +func (c *Client) GetDeployment(namespace, name string) (*appsv1.Deployment, error) { + glog.V(4).Infof("[GET Deployment]: %s:%s", namespace, name) + return c.AppsV1().Deployments(namespace).Get(name, metav1.GetOptions{}) +} + +// CreateDeployment creates the Deployment object. +func (c *Client) CreateDeployment(dep *appsv1.Deployment) (*appsv1.Deployment, error) { + glog.V(4).Infof("[CREATE Deployment]: %s:%s", dep.Namespace, dep.Name) + return c.AppsV1().Deployments(dep.Namespace).Create(dep) +} + +// DeleteDeployment deletes the Deployment object. +func (c *Client) DeleteDeployment(namespace, name string, options *metav1.DeleteOptions) error { + glog.V(4).Infof("[DELETE Deployment]: %s:%s", namespace, name) + return c.AppsV1().Deployments(namespace).Delete(name, options) +} + +// UpdateDeployment updates a Deployment object by performing a 2-way patch between the existing +// Deployment and the result of the UpdateFunction. +// +// Returns the latest Deployment and true if it was updated, or an error. +func (c *Client) UpdateDeployment(dep *appsv1.Deployment) (*appsv1.Deployment, bool, error) { + return c.PatchDeployment(nil, dep) +} + +// PatchDeployment updates a Deployment object by performing a 3-way patch merge between the existing +// Deployment and `original` and `modified` manifests. +// +// Returns the latest Deployment and true if it was updated, or an error. +func (c *Client) PatchDeployment(original, modified *appsv1.Deployment) (*appsv1.Deployment, bool, error) { + namespace, name := modified.Namespace, modified.Name + glog.V(4).Infof("[PATCH Deployment]: %s:%s", namespace, name) + + current, err := c.AppsV1().Deployments(namespace).Get(name, metav1.GetOptions{}) + if err != nil { + return nil, false, err + } + if modified == nil { + return nil, false, errors.New("modified cannot be nil") + } + if original == nil { + original = current // Emulate 2-way merge. + } + current.TypeMeta = modified.TypeMeta // make sure the type metas won't conflict. + patchBytes, err := createThreeWayMergePatchPreservingCommands(original, modified, current) + if err != nil { + return nil, false, err + } + updated, err := c.AppsV1().Deployments(namespace).Patch(name, types.StrategicMergePatchType, patchBytes) + if err != nil { + return nil, false, err + } + return updated, current.GetResourceVersion() != updated.GetResourceVersion(), nil +} + +// RollingUpdateDeployment performs a rolling update on the given Deployment. It requires that the +// Deployment uses the RollingUpdateDeploymentStrategyType update strategy. +func (c *Client) RollingUpdateDeployment(dep *appsv1.Deployment) (*appsv1.Deployment, bool, error) { + return c.RollingUpdateDeploymentMigrations(dep.Namespace, dep.Name, Update(dep)) +} + +// RollingUpdateDeploymentMigrations performs a rolling update on the given Deployment. It +// requires that the Deployment uses the RollingUpdateDeploymentStrategyType update strategy. +// +// RollingUpdateDeploymentMigrations will run any before / during / after migrations that have been +// specified in the upgrade options. +func (c *Client) RollingUpdateDeploymentMigrations(namespace, name string, f UpdateFunction) (*appsv1.Deployment, bool, error) { + glog.V(4).Infof("[ROLLING UPDATE Deployment]: %s:%s", namespace, name) + return c.RollingPatchDeploymentMigrations(namespace, name, updateToPatch(f)) +} + +// RollingPatchDeployment performs a 3-way patch merge followed by rolling update on the given +// Deployment. It requires that the Deployment uses the RollingUpdateDeploymentStrategyType update +// strategy. +// +// RollingPatchDeployment will run any before / after migrations that have been specified in the +// upgrade options. +func (c *Client) RollingPatchDeployment(original, modified *appsv1.Deployment) (*appsv1.Deployment, bool, error) { + return c.RollingPatchDeploymentMigrations(modified.Namespace, modified.Name, Patch(original, modified)) +} + +// RollingPatchDeploymentMigrations performs a 3-way patch merge followed by rolling update on +// the given Deployment. It requires that the Deployment uses the RollingUpdateDeploymentStrategyType +// update strategy. +// +// RollingPatchDeploymentMigrations will run any before / after migrations that have been specified +// in the upgrade options. +func (c *Client) RollingPatchDeploymentMigrations(namespace, name string, f PatchFunction) (*appsv1.Deployment, bool, error) { + glog.V(4).Infof("[ROLLING PATCH Deployment]: %s:%s", namespace, name) + + current, err := c.AppsV1().Deployments(namespace).Get(name, metav1.GetOptions{}) + if err != nil { + return nil, false, err + } + if err := checkDeploymentRollingUpdateEnabled(current); err != nil { + return nil, false, err + } + + originalObj, modifiedObj, err := f(current.DeepCopy()) + if err != nil { + return nil, false, err + } + // Check for nil interfaces. + if modifiedObj == nil { + return nil, false, errors.New("modified cannot be nil") + } + if originalObj == nil { + originalObj = current // Emulate 2-way merge. + } + original, modified := originalObj.(*appsv1.Deployment), modifiedObj.(*appsv1.Deployment) + // Check for nil pointers. + if modified == nil { + return nil, false, errors.New("modified cannot be nil") + } + if original == nil { + original = current // Emulate 2-way merge. + } + current.TypeMeta = modified.TypeMeta // make sure the type metas won't conflict. + patchBytes, err := createThreeWayMergePatchPreservingCommands(original, modified, current) + if err != nil { + return nil, false, err + } + updated, err := c.AppsV1().Deployments(namespace).Patch(name, types.StrategicMergePatchType, patchBytes) + if err != nil { + return nil, false, err + } + + return updated, current.GetResourceVersion() != updated.GetResourceVersion(), nil +} + +func checkDeploymentRollingUpdateEnabled(dep *appsv1.Deployment) error { + enabled := dep.Spec.Strategy.Type == appsv1.RollingUpdateDeploymentStrategyType || dep.Spec.Strategy.Type == "" // Deployments rolling update by default + if !enabled { + return fmt.Errorf("Deployment %s/%s does not have rolling update strategy enabled", dep.GetNamespace(), dep.GetName()) + } + return nil +} + +func (c *Client) waitForDeploymentRollout(dep *appsv1.Deployment) error { + return wait.PollInfinite(deploymentRolloutPollInterval, func() (bool, error) { + d, err := c.GetDeployment(dep.Namespace, dep.Name) + if err != nil { + // Do not return error here, as we could be updating the API Server itself, in which case we + // want to continue waiting. + glog.Errorf("error getting Deployment %s during rollout: %v", dep.Name, err) + return false, nil + } + if d.Generation <= d.Status.ObservedGeneration && d.Status.UpdatedReplicas == d.Status.Replicas && d.Status.UnavailableReplicas == 0 { + return true, nil + } + return false, nil + }) +} + +// CreateOrRollingUpdateDeployment creates the Deployment if it doesn't exist. If the Deployment +// already exists, it will update the Deployment and wait for it to rollout. Returns true if the +// Deployment was created or updated, false if there was no update. +func (c *Client) CreateOrRollingUpdateDeployment(dep *appsv1.Deployment) (*appsv1.Deployment, bool, error) { + glog.V(4).Infof("[CREATE OR ROLLING UPDATE Deployment]: %s:%s", dep.Namespace, dep.Name) + + _, err := c.GetDeployment(dep.Namespace, dep.Name) + if err != nil { + if !apierrors.IsNotFound(err) { + return nil, false, err + } + created, err := c.CreateDeployment(dep) + if err != nil { + return nil, false, err + } + return created, true, err + } + return c.RollingUpdateDeployment(dep) +} + +// ListDeploymentsWithLabels returns a list of deployments that matches the label selector. +// An empty list will be returned if no such deployments is found. +func (c *Client) ListDeploymentsWithLabels(namespace string, labels labels.Set) (*appsv1.DeploymentList, error) { + glog.V(4).Infof("[LIST Deployments] in %s, labels: %v", namespace, labels) + + opts := metav1.ListOptions{LabelSelector: labels.String()} + return c.AppsV1().Deployments(namespace).List(opts) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/mock_client.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/mock_client.go new file mode 100644 index 00000000..2eabf328 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/mock_client.go @@ -0,0 +1,805 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./pkg/lib/operatorclient/client.go + +// Package operatorclient is a generated GoMock package. +package operatorclient + +import ( + gomock "github.com/golang/mock/gomock" + v1 "k8s.io/api/apps/v1" + v10 "k8s.io/api/core/v1" + clientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" + v11 "k8s.io/apimachinery/pkg/apis/meta/v1" + unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + labels "k8s.io/apimachinery/pkg/labels" + kubernetes "k8s.io/client-go/kubernetes" + reflect "reflect" +) + +// MockClientInterface is a mock of ClientInterface interface +type MockClientInterface struct { + ctrl *gomock.Controller + recorder *MockClientInterfaceMockRecorder +} + +// MockClientInterfaceMockRecorder is the mock recorder for MockClientInterface +type MockClientInterfaceMockRecorder struct { + mock *MockClientInterface +} + +// NewMockClientInterface creates a new mock instance +func NewMockClientInterface(ctrl *gomock.Controller) *MockClientInterface { + mock := &MockClientInterface{ctrl: ctrl} + mock.recorder = &MockClientInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockClientInterface) EXPECT() *MockClientInterfaceMockRecorder { + return m.recorder +} + +// KubernetesInterface mocks base method +func (m *MockClientInterface) KubernetesInterface() kubernetes.Interface { + ret := m.ctrl.Call(m, "KubernetesInterface") + ret0, _ := ret[0].(kubernetes.Interface) + return ret0 +} + +// KubernetesInterface indicates an expected call of KubernetesInterface +func (mr *MockClientInterfaceMockRecorder) KubernetesInterface() *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KubernetesInterface", reflect.TypeOf((*MockClientInterface)(nil).KubernetesInterface)) +} + +// ApiextensionsV1beta1Interface mocks base method +func (m *MockClientInterface) ApiextensionsV1beta1Interface() clientset.Interface { + ret := m.ctrl.Call(m, "ApiextensionsV1beta1Interface") + ret0, _ := ret[0].(clientset.Interface) + return ret0 +} + +// ApiextensionsV1beta1Interface indicates an expected call of ApiextensionsV1beta1Interface +func (mr *MockClientInterfaceMockRecorder) ApiextensionsV1beta1Interface() *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ApiextensionsV1beta1Interface", reflect.TypeOf((*MockClientInterface)(nil).ApiextensionsV1beta1Interface)) +} + +// GetCustomResource mocks base method +func (m *MockClientInterface) GetCustomResource(apiGroup, version, namespace, resourceKind, resourceName string) (*unstructured.Unstructured, error) { + ret := m.ctrl.Call(m, "GetCustomResource", apiGroup, version, namespace, resourceKind, resourceName) + ret0, _ := ret[0].(*unstructured.Unstructured) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetCustomResource indicates an expected call of GetCustomResource +func (mr *MockClientInterfaceMockRecorder) GetCustomResource(apiGroup, version, namespace, resourceKind, resourceName interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCustomResource", reflect.TypeOf((*MockClientInterface)(nil).GetCustomResource), apiGroup, version, namespace, resourceKind, resourceName) +} + +// GetCustomResourceRaw mocks base method +func (m *MockClientInterface) GetCustomResourceRaw(apiGroup, version, namespace, resourceKind, resourceName string) ([]byte, error) { + ret := m.ctrl.Call(m, "GetCustomResourceRaw", apiGroup, version, namespace, resourceKind, resourceName) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetCustomResourceRaw indicates an expected call of GetCustomResourceRaw +func (mr *MockClientInterfaceMockRecorder) GetCustomResourceRaw(apiGroup, version, namespace, resourceKind, resourceName interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCustomResourceRaw", reflect.TypeOf((*MockClientInterface)(nil).GetCustomResourceRaw), apiGroup, version, namespace, resourceKind, resourceName) +} + +// CreateCustomResource mocks base method +func (m *MockClientInterface) CreateCustomResource(item *unstructured.Unstructured) error { + ret := m.ctrl.Call(m, "CreateCustomResource", item) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateCustomResource indicates an expected call of CreateCustomResource +func (mr *MockClientInterfaceMockRecorder) CreateCustomResource(item interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCustomResource", reflect.TypeOf((*MockClientInterface)(nil).CreateCustomResource), item) +} + +// CreateCustomResourceRaw mocks base method +func (m *MockClientInterface) CreateCustomResourceRaw(apiGroup, version, namespace, kind string, data []byte) error { + ret := m.ctrl.Call(m, "CreateCustomResourceRaw", apiGroup, version, namespace, kind, data) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateCustomResourceRaw indicates an expected call of CreateCustomResourceRaw +func (mr *MockClientInterfaceMockRecorder) CreateCustomResourceRaw(apiGroup, version, namespace, kind, data interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCustomResourceRaw", reflect.TypeOf((*MockClientInterface)(nil).CreateCustomResourceRaw), apiGroup, version, namespace, kind, data) +} + +// CreateCustomResourceRawIfNotFound mocks base method +func (m *MockClientInterface) CreateCustomResourceRawIfNotFound(apiGroup, version, namespace, kind, name string, data []byte) (bool, error) { + ret := m.ctrl.Call(m, "CreateCustomResourceRawIfNotFound", apiGroup, version, namespace, kind, name, data) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateCustomResourceRawIfNotFound indicates an expected call of CreateCustomResourceRawIfNotFound +func (mr *MockClientInterfaceMockRecorder) CreateCustomResourceRawIfNotFound(apiGroup, version, namespace, kind, name, data interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCustomResourceRawIfNotFound", reflect.TypeOf((*MockClientInterface)(nil).CreateCustomResourceRawIfNotFound), apiGroup, version, namespace, kind, name, data) +} + +// UpdateCustomResource mocks base method +func (m *MockClientInterface) UpdateCustomResource(item *unstructured.Unstructured) error { + ret := m.ctrl.Call(m, "UpdateCustomResource", item) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateCustomResource indicates an expected call of UpdateCustomResource +func (mr *MockClientInterfaceMockRecorder) UpdateCustomResource(item interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateCustomResource", reflect.TypeOf((*MockClientInterface)(nil).UpdateCustomResource), item) +} + +// UpdateCustomResourceRaw mocks base method +func (m *MockClientInterface) UpdateCustomResourceRaw(apiGroup, version, namespace, resourceKind, resourceName string, data []byte) error { + ret := m.ctrl.Call(m, "UpdateCustomResourceRaw", apiGroup, version, namespace, resourceKind, resourceName, data) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateCustomResourceRaw indicates an expected call of UpdateCustomResourceRaw +func (mr *MockClientInterfaceMockRecorder) UpdateCustomResourceRaw(apiGroup, version, namespace, resourceKind, resourceName, data interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateCustomResourceRaw", reflect.TypeOf((*MockClientInterface)(nil).UpdateCustomResourceRaw), apiGroup, version, namespace, resourceKind, resourceName, data) +} + +// CreateOrUpdateCustomeResourceRaw mocks base method +func (m *MockClientInterface) CreateOrUpdateCustomeResourceRaw(apiGroup, version, namespace, resourceKind, resourceName string, data []byte) error { + ret := m.ctrl.Call(m, "CreateOrUpdateCustomeResourceRaw", apiGroup, version, namespace, resourceKind, resourceName, data) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateOrUpdateCustomeResourceRaw indicates an expected call of CreateOrUpdateCustomeResourceRaw +func (mr *MockClientInterfaceMockRecorder) CreateOrUpdateCustomeResourceRaw(apiGroup, version, namespace, resourceKind, resourceName, data interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdateCustomeResourceRaw", reflect.TypeOf((*MockClientInterface)(nil).CreateOrUpdateCustomeResourceRaw), apiGroup, version, namespace, resourceKind, resourceName, data) +} + +// DeleteCustomResource mocks base method +func (m *MockClientInterface) DeleteCustomResource(apiGroup, version, namespace, resourceKind, resourceName string) error { + ret := m.ctrl.Call(m, "DeleteCustomResource", apiGroup, version, namespace, resourceKind, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteCustomResource indicates an expected call of DeleteCustomResource +func (mr *MockClientInterfaceMockRecorder) DeleteCustomResource(apiGroup, version, namespace, resourceKind, resourceName interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteCustomResource", reflect.TypeOf((*MockClientInterface)(nil).DeleteCustomResource), apiGroup, version, namespace, resourceKind, resourceName) +} + +// AtomicModifyCustomResource mocks base method +func (m *MockClientInterface) AtomicModifyCustomResource(apiGroup, version, namespace, resourceKind, resourceName string, f CustomResourceModifier, data interface{}) error { + ret := m.ctrl.Call(m, "AtomicModifyCustomResource", apiGroup, version, namespace, resourceKind, resourceName, f, data) + ret0, _ := ret[0].(error) + return ret0 +} + +// AtomicModifyCustomResource indicates an expected call of AtomicModifyCustomResource +func (mr *MockClientInterfaceMockRecorder) AtomicModifyCustomResource(apiGroup, version, namespace, resourceKind, resourceName, f, data interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AtomicModifyCustomResource", reflect.TypeOf((*MockClientInterface)(nil).AtomicModifyCustomResource), apiGroup, version, namespace, resourceKind, resourceName, f, data) +} + +// ListCustomResource mocks base method +func (m *MockClientInterface) ListCustomResource(apiGroup, version, namespace, resourceKind string) (*CustomResourceList, error) { + ret := m.ctrl.Call(m, "ListCustomResource", apiGroup, version, namespace, resourceKind) + ret0, _ := ret[0].(*CustomResourceList) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListCustomResource indicates an expected call of ListCustomResource +func (mr *MockClientInterfaceMockRecorder) ListCustomResource(apiGroup, version, namespace, resourceKind interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListCustomResource", reflect.TypeOf((*MockClientInterface)(nil).ListCustomResource), apiGroup, version, namespace, resourceKind) +} + +// CreateServiceAccount mocks base method +func (m *MockClientInterface) CreateServiceAccount(arg0 *v10.ServiceAccount) (*v10.ServiceAccount, error) { + ret := m.ctrl.Call(m, "CreateServiceAccount", arg0) + ret0, _ := ret[0].(*v10.ServiceAccount) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateServiceAccount indicates an expected call of CreateServiceAccount +func (mr *MockClientInterfaceMockRecorder) CreateServiceAccount(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateServiceAccount", reflect.TypeOf((*MockClientInterface)(nil).CreateServiceAccount), arg0) +} + +// GetServiceAccount mocks base method +func (m *MockClientInterface) GetServiceAccount(namespace, name string) (*v10.ServiceAccount, error) { + ret := m.ctrl.Call(m, "GetServiceAccount", namespace, name) + ret0, _ := ret[0].(*v10.ServiceAccount) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetServiceAccount indicates an expected call of GetServiceAccount +func (mr *MockClientInterfaceMockRecorder) GetServiceAccount(namespace, name interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServiceAccount", reflect.TypeOf((*MockClientInterface)(nil).GetServiceAccount), namespace, name) +} + +// UpdateServiceAccount mocks base method +func (m *MockClientInterface) UpdateServiceAccount(modified *v10.ServiceAccount) (*v10.ServiceAccount, error) { + ret := m.ctrl.Call(m, "UpdateServiceAccount", modified) + ret0, _ := ret[0].(*v10.ServiceAccount) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateServiceAccount indicates an expected call of UpdateServiceAccount +func (mr *MockClientInterfaceMockRecorder) UpdateServiceAccount(modified interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateServiceAccount", reflect.TypeOf((*MockClientInterface)(nil).UpdateServiceAccount), modified) +} + +// DeleteServiceAccount mocks base method +func (m *MockClientInterface) DeleteServiceAccount(namespace, name string, options *v11.DeleteOptions) error { + ret := m.ctrl.Call(m, "DeleteServiceAccount", namespace, name, options) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteServiceAccount indicates an expected call of DeleteServiceAccount +func (mr *MockClientInterfaceMockRecorder) DeleteServiceAccount(namespace, name, options interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteServiceAccount", reflect.TypeOf((*MockClientInterface)(nil).DeleteServiceAccount), namespace, name, options) +} + +// GetDeployment mocks base method +func (m *MockClientInterface) GetDeployment(namespace, name string) (*v1.Deployment, error) { + ret := m.ctrl.Call(m, "GetDeployment", namespace, name) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetDeployment indicates an expected call of GetDeployment +func (mr *MockClientInterfaceMockRecorder) GetDeployment(namespace, name interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDeployment", reflect.TypeOf((*MockClientInterface)(nil).GetDeployment), namespace, name) +} + +// CreateDeployment mocks base method +func (m *MockClientInterface) CreateDeployment(arg0 *v1.Deployment) (*v1.Deployment, error) { + ret := m.ctrl.Call(m, "CreateDeployment", arg0) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateDeployment indicates an expected call of CreateDeployment +func (mr *MockClientInterfaceMockRecorder) CreateDeployment(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateDeployment", reflect.TypeOf((*MockClientInterface)(nil).CreateDeployment), arg0) +} + +// DeleteDeployment mocks base method +func (m *MockClientInterface) DeleteDeployment(namespace, name string, options *v11.DeleteOptions) error { + ret := m.ctrl.Call(m, "DeleteDeployment", namespace, name, options) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteDeployment indicates an expected call of DeleteDeployment +func (mr *MockClientInterfaceMockRecorder) DeleteDeployment(namespace, name, options interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteDeployment", reflect.TypeOf((*MockClientInterface)(nil).DeleteDeployment), namespace, name, options) +} + +// UpdateDeployment mocks base method +func (m *MockClientInterface) UpdateDeployment(arg0 *v1.Deployment) (*v1.Deployment, bool, error) { + ret := m.ctrl.Call(m, "UpdateDeployment", arg0) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// UpdateDeployment indicates an expected call of UpdateDeployment +func (mr *MockClientInterfaceMockRecorder) UpdateDeployment(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateDeployment", reflect.TypeOf((*MockClientInterface)(nil).UpdateDeployment), arg0) +} + +// PatchDeployment mocks base method +func (m *MockClientInterface) PatchDeployment(arg0, arg1 *v1.Deployment) (*v1.Deployment, bool, error) { + ret := m.ctrl.Call(m, "PatchDeployment", arg0, arg1) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// PatchDeployment indicates an expected call of PatchDeployment +func (mr *MockClientInterfaceMockRecorder) PatchDeployment(arg0, arg1 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PatchDeployment", reflect.TypeOf((*MockClientInterface)(nil).PatchDeployment), arg0, arg1) +} + +// RollingUpdateDeployment mocks base method +func (m *MockClientInterface) RollingUpdateDeployment(arg0 *v1.Deployment) (*v1.Deployment, bool, error) { + ret := m.ctrl.Call(m, "RollingUpdateDeployment", arg0) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// RollingUpdateDeployment indicates an expected call of RollingUpdateDeployment +func (mr *MockClientInterfaceMockRecorder) RollingUpdateDeployment(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RollingUpdateDeployment", reflect.TypeOf((*MockClientInterface)(nil).RollingUpdateDeployment), arg0) +} + +// RollingPatchDeployment mocks base method +func (m *MockClientInterface) RollingPatchDeployment(arg0, arg1 *v1.Deployment) (*v1.Deployment, bool, error) { + ret := m.ctrl.Call(m, "RollingPatchDeployment", arg0, arg1) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// RollingPatchDeployment indicates an expected call of RollingPatchDeployment +func (mr *MockClientInterfaceMockRecorder) RollingPatchDeployment(arg0, arg1 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RollingPatchDeployment", reflect.TypeOf((*MockClientInterface)(nil).RollingPatchDeployment), arg0, arg1) +} + +// RollingUpdateDeploymentMigrations mocks base method +func (m *MockClientInterface) RollingUpdateDeploymentMigrations(namespace, name string, f UpdateFunction) (*v1.Deployment, bool, error) { + ret := m.ctrl.Call(m, "RollingUpdateDeploymentMigrations", namespace, name, f) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// RollingUpdateDeploymentMigrations indicates an expected call of RollingUpdateDeploymentMigrations +func (mr *MockClientInterfaceMockRecorder) RollingUpdateDeploymentMigrations(namespace, name, f interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RollingUpdateDeploymentMigrations", reflect.TypeOf((*MockClientInterface)(nil).RollingUpdateDeploymentMigrations), namespace, name, f) +} + +// RollingPatchDeploymentMigrations mocks base method +func (m *MockClientInterface) RollingPatchDeploymentMigrations(namespace, name string, f PatchFunction) (*v1.Deployment, bool, error) { + ret := m.ctrl.Call(m, "RollingPatchDeploymentMigrations", namespace, name, f) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// RollingPatchDeploymentMigrations indicates an expected call of RollingPatchDeploymentMigrations +func (mr *MockClientInterfaceMockRecorder) RollingPatchDeploymentMigrations(namespace, name, f interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RollingPatchDeploymentMigrations", reflect.TypeOf((*MockClientInterface)(nil).RollingPatchDeploymentMigrations), namespace, name, f) +} + +// CreateOrRollingUpdateDeployment mocks base method +func (m *MockClientInterface) CreateOrRollingUpdateDeployment(arg0 *v1.Deployment) (*v1.Deployment, bool, error) { + ret := m.ctrl.Call(m, "CreateOrRollingUpdateDeployment", arg0) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateOrRollingUpdateDeployment indicates an expected call of CreateOrRollingUpdateDeployment +func (mr *MockClientInterfaceMockRecorder) CreateOrRollingUpdateDeployment(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrRollingUpdateDeployment", reflect.TypeOf((*MockClientInterface)(nil).CreateOrRollingUpdateDeployment), arg0) +} + +// ListDeploymentsWithLabels mocks base method +func (m *MockClientInterface) ListDeploymentsWithLabels(namespace string, labels labels.Set) (*v1.DeploymentList, error) { + ret := m.ctrl.Call(m, "ListDeploymentsWithLabels", namespace, labels) + ret0, _ := ret[0].(*v1.DeploymentList) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListDeploymentsWithLabels indicates an expected call of ListDeploymentsWithLabels +func (mr *MockClientInterfaceMockRecorder) ListDeploymentsWithLabels(namespace, labels interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListDeploymentsWithLabels", reflect.TypeOf((*MockClientInterface)(nil).ListDeploymentsWithLabels), namespace, labels) +} + +// MockCustomResourceClient is a mock of CustomResourceClient interface +type MockCustomResourceClient struct { + ctrl *gomock.Controller + recorder *MockCustomResourceClientMockRecorder +} + +// MockCustomResourceClientMockRecorder is the mock recorder for MockCustomResourceClient +type MockCustomResourceClientMockRecorder struct { + mock *MockCustomResourceClient +} + +// NewMockCustomResourceClient creates a new mock instance +func NewMockCustomResourceClient(ctrl *gomock.Controller) *MockCustomResourceClient { + mock := &MockCustomResourceClient{ctrl: ctrl} + mock.recorder = &MockCustomResourceClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockCustomResourceClient) EXPECT() *MockCustomResourceClientMockRecorder { + return m.recorder +} + +// GetCustomResource mocks base method +func (m *MockCustomResourceClient) GetCustomResource(apiGroup, version, namespace, resourceKind, resourceName string) (*unstructured.Unstructured, error) { + ret := m.ctrl.Call(m, "GetCustomResource", apiGroup, version, namespace, resourceKind, resourceName) + ret0, _ := ret[0].(*unstructured.Unstructured) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetCustomResource indicates an expected call of GetCustomResource +func (mr *MockCustomResourceClientMockRecorder) GetCustomResource(apiGroup, version, namespace, resourceKind, resourceName interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCustomResource", reflect.TypeOf((*MockCustomResourceClient)(nil).GetCustomResource), apiGroup, version, namespace, resourceKind, resourceName) +} + +// GetCustomResourceRaw mocks base method +func (m *MockCustomResourceClient) GetCustomResourceRaw(apiGroup, version, namespace, resourceKind, resourceName string) ([]byte, error) { + ret := m.ctrl.Call(m, "GetCustomResourceRaw", apiGroup, version, namespace, resourceKind, resourceName) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetCustomResourceRaw indicates an expected call of GetCustomResourceRaw +func (mr *MockCustomResourceClientMockRecorder) GetCustomResourceRaw(apiGroup, version, namespace, resourceKind, resourceName interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCustomResourceRaw", reflect.TypeOf((*MockCustomResourceClient)(nil).GetCustomResourceRaw), apiGroup, version, namespace, resourceKind, resourceName) +} + +// CreateCustomResource mocks base method +func (m *MockCustomResourceClient) CreateCustomResource(item *unstructured.Unstructured) error { + ret := m.ctrl.Call(m, "CreateCustomResource", item) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateCustomResource indicates an expected call of CreateCustomResource +func (mr *MockCustomResourceClientMockRecorder) CreateCustomResource(item interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCustomResource", reflect.TypeOf((*MockCustomResourceClient)(nil).CreateCustomResource), item) +} + +// CreateCustomResourceRaw mocks base method +func (m *MockCustomResourceClient) CreateCustomResourceRaw(apiGroup, version, namespace, kind string, data []byte) error { + ret := m.ctrl.Call(m, "CreateCustomResourceRaw", apiGroup, version, namespace, kind, data) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateCustomResourceRaw indicates an expected call of CreateCustomResourceRaw +func (mr *MockCustomResourceClientMockRecorder) CreateCustomResourceRaw(apiGroup, version, namespace, kind, data interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCustomResourceRaw", reflect.TypeOf((*MockCustomResourceClient)(nil).CreateCustomResourceRaw), apiGroup, version, namespace, kind, data) +} + +// CreateCustomResourceRawIfNotFound mocks base method +func (m *MockCustomResourceClient) CreateCustomResourceRawIfNotFound(apiGroup, version, namespace, kind, name string, data []byte) (bool, error) { + ret := m.ctrl.Call(m, "CreateCustomResourceRawIfNotFound", apiGroup, version, namespace, kind, name, data) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateCustomResourceRawIfNotFound indicates an expected call of CreateCustomResourceRawIfNotFound +func (mr *MockCustomResourceClientMockRecorder) CreateCustomResourceRawIfNotFound(apiGroup, version, namespace, kind, name, data interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCustomResourceRawIfNotFound", reflect.TypeOf((*MockCustomResourceClient)(nil).CreateCustomResourceRawIfNotFound), apiGroup, version, namespace, kind, name, data) +} + +// UpdateCustomResource mocks base method +func (m *MockCustomResourceClient) UpdateCustomResource(item *unstructured.Unstructured) error { + ret := m.ctrl.Call(m, "UpdateCustomResource", item) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateCustomResource indicates an expected call of UpdateCustomResource +func (mr *MockCustomResourceClientMockRecorder) UpdateCustomResource(item interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateCustomResource", reflect.TypeOf((*MockCustomResourceClient)(nil).UpdateCustomResource), item) +} + +// UpdateCustomResourceRaw mocks base method +func (m *MockCustomResourceClient) UpdateCustomResourceRaw(apiGroup, version, namespace, resourceKind, resourceName string, data []byte) error { + ret := m.ctrl.Call(m, "UpdateCustomResourceRaw", apiGroup, version, namespace, resourceKind, resourceName, data) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateCustomResourceRaw indicates an expected call of UpdateCustomResourceRaw +func (mr *MockCustomResourceClientMockRecorder) UpdateCustomResourceRaw(apiGroup, version, namespace, resourceKind, resourceName, data interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateCustomResourceRaw", reflect.TypeOf((*MockCustomResourceClient)(nil).UpdateCustomResourceRaw), apiGroup, version, namespace, resourceKind, resourceName, data) +} + +// CreateOrUpdateCustomeResourceRaw mocks base method +func (m *MockCustomResourceClient) CreateOrUpdateCustomeResourceRaw(apiGroup, version, namespace, resourceKind, resourceName string, data []byte) error { + ret := m.ctrl.Call(m, "CreateOrUpdateCustomeResourceRaw", apiGroup, version, namespace, resourceKind, resourceName, data) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateOrUpdateCustomeResourceRaw indicates an expected call of CreateOrUpdateCustomeResourceRaw +func (mr *MockCustomResourceClientMockRecorder) CreateOrUpdateCustomeResourceRaw(apiGroup, version, namespace, resourceKind, resourceName, data interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdateCustomeResourceRaw", reflect.TypeOf((*MockCustomResourceClient)(nil).CreateOrUpdateCustomeResourceRaw), apiGroup, version, namespace, resourceKind, resourceName, data) +} + +// DeleteCustomResource mocks base method +func (m *MockCustomResourceClient) DeleteCustomResource(apiGroup, version, namespace, resourceKind, resourceName string) error { + ret := m.ctrl.Call(m, "DeleteCustomResource", apiGroup, version, namespace, resourceKind, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteCustomResource indicates an expected call of DeleteCustomResource +func (mr *MockCustomResourceClientMockRecorder) DeleteCustomResource(apiGroup, version, namespace, resourceKind, resourceName interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteCustomResource", reflect.TypeOf((*MockCustomResourceClient)(nil).DeleteCustomResource), apiGroup, version, namespace, resourceKind, resourceName) +} + +// AtomicModifyCustomResource mocks base method +func (m *MockCustomResourceClient) AtomicModifyCustomResource(apiGroup, version, namespace, resourceKind, resourceName string, f CustomResourceModifier, data interface{}) error { + ret := m.ctrl.Call(m, "AtomicModifyCustomResource", apiGroup, version, namespace, resourceKind, resourceName, f, data) + ret0, _ := ret[0].(error) + return ret0 +} + +// AtomicModifyCustomResource indicates an expected call of AtomicModifyCustomResource +func (mr *MockCustomResourceClientMockRecorder) AtomicModifyCustomResource(apiGroup, version, namespace, resourceKind, resourceName, f, data interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AtomicModifyCustomResource", reflect.TypeOf((*MockCustomResourceClient)(nil).AtomicModifyCustomResource), apiGroup, version, namespace, resourceKind, resourceName, f, data) +} + +// ListCustomResource mocks base method +func (m *MockCustomResourceClient) ListCustomResource(apiGroup, version, namespace, resourceKind string) (*CustomResourceList, error) { + ret := m.ctrl.Call(m, "ListCustomResource", apiGroup, version, namespace, resourceKind) + ret0, _ := ret[0].(*CustomResourceList) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListCustomResource indicates an expected call of ListCustomResource +func (mr *MockCustomResourceClientMockRecorder) ListCustomResource(apiGroup, version, namespace, resourceKind interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListCustomResource", reflect.TypeOf((*MockCustomResourceClient)(nil).ListCustomResource), apiGroup, version, namespace, resourceKind) +} + +// MockServiceAccountClient is a mock of ServiceAccountClient interface +type MockServiceAccountClient struct { + ctrl *gomock.Controller + recorder *MockServiceAccountClientMockRecorder +} + +// MockServiceAccountClientMockRecorder is the mock recorder for MockServiceAccountClient +type MockServiceAccountClientMockRecorder struct { + mock *MockServiceAccountClient +} + +// NewMockServiceAccountClient creates a new mock instance +func NewMockServiceAccountClient(ctrl *gomock.Controller) *MockServiceAccountClient { + mock := &MockServiceAccountClient{ctrl: ctrl} + mock.recorder = &MockServiceAccountClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockServiceAccountClient) EXPECT() *MockServiceAccountClientMockRecorder { + return m.recorder +} + +// CreateServiceAccount mocks base method +func (m *MockServiceAccountClient) CreateServiceAccount(arg0 *v10.ServiceAccount) (*v10.ServiceAccount, error) { + ret := m.ctrl.Call(m, "CreateServiceAccount", arg0) + ret0, _ := ret[0].(*v10.ServiceAccount) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateServiceAccount indicates an expected call of CreateServiceAccount +func (mr *MockServiceAccountClientMockRecorder) CreateServiceAccount(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateServiceAccount", reflect.TypeOf((*MockServiceAccountClient)(nil).CreateServiceAccount), arg0) +} + +// GetServiceAccount mocks base method +func (m *MockServiceAccountClient) GetServiceAccount(namespace, name string) (*v10.ServiceAccount, error) { + ret := m.ctrl.Call(m, "GetServiceAccount", namespace, name) + ret0, _ := ret[0].(*v10.ServiceAccount) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetServiceAccount indicates an expected call of GetServiceAccount +func (mr *MockServiceAccountClientMockRecorder) GetServiceAccount(namespace, name interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServiceAccount", reflect.TypeOf((*MockServiceAccountClient)(nil).GetServiceAccount), namespace, name) +} + +// UpdateServiceAccount mocks base method +func (m *MockServiceAccountClient) UpdateServiceAccount(modified *v10.ServiceAccount) (*v10.ServiceAccount, error) { + ret := m.ctrl.Call(m, "UpdateServiceAccount", modified) + ret0, _ := ret[0].(*v10.ServiceAccount) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateServiceAccount indicates an expected call of UpdateServiceAccount +func (mr *MockServiceAccountClientMockRecorder) UpdateServiceAccount(modified interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateServiceAccount", reflect.TypeOf((*MockServiceAccountClient)(nil).UpdateServiceAccount), modified) +} + +// DeleteServiceAccount mocks base method +func (m *MockServiceAccountClient) DeleteServiceAccount(namespace, name string, options *v11.DeleteOptions) error { + ret := m.ctrl.Call(m, "DeleteServiceAccount", namespace, name, options) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteServiceAccount indicates an expected call of DeleteServiceAccount +func (mr *MockServiceAccountClientMockRecorder) DeleteServiceAccount(namespace, name, options interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteServiceAccount", reflect.TypeOf((*MockServiceAccountClient)(nil).DeleteServiceAccount), namespace, name, options) +} + +// MockDeploymentClient is a mock of DeploymentClient interface +type MockDeploymentClient struct { + ctrl *gomock.Controller + recorder *MockDeploymentClientMockRecorder +} + +// MockDeploymentClientMockRecorder is the mock recorder for MockDeploymentClient +type MockDeploymentClientMockRecorder struct { + mock *MockDeploymentClient +} + +// NewMockDeploymentClient creates a new mock instance +func NewMockDeploymentClient(ctrl *gomock.Controller) *MockDeploymentClient { + mock := &MockDeploymentClient{ctrl: ctrl} + mock.recorder = &MockDeploymentClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockDeploymentClient) EXPECT() *MockDeploymentClientMockRecorder { + return m.recorder +} + +// GetDeployment mocks base method +func (m *MockDeploymentClient) GetDeployment(namespace, name string) (*v1.Deployment, error) { + ret := m.ctrl.Call(m, "GetDeployment", namespace, name) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetDeployment indicates an expected call of GetDeployment +func (mr *MockDeploymentClientMockRecorder) GetDeployment(namespace, name interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDeployment", reflect.TypeOf((*MockDeploymentClient)(nil).GetDeployment), namespace, name) +} + +// CreateDeployment mocks base method +func (m *MockDeploymentClient) CreateDeployment(arg0 *v1.Deployment) (*v1.Deployment, error) { + ret := m.ctrl.Call(m, "CreateDeployment", arg0) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateDeployment indicates an expected call of CreateDeployment +func (mr *MockDeploymentClientMockRecorder) CreateDeployment(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateDeployment", reflect.TypeOf((*MockDeploymentClient)(nil).CreateDeployment), arg0) +} + +// DeleteDeployment mocks base method +func (m *MockDeploymentClient) DeleteDeployment(namespace, name string, options *v11.DeleteOptions) error { + ret := m.ctrl.Call(m, "DeleteDeployment", namespace, name, options) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteDeployment indicates an expected call of DeleteDeployment +func (mr *MockDeploymentClientMockRecorder) DeleteDeployment(namespace, name, options interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteDeployment", reflect.TypeOf((*MockDeploymentClient)(nil).DeleteDeployment), namespace, name, options) +} + +// UpdateDeployment mocks base method +func (m *MockDeploymentClient) UpdateDeployment(arg0 *v1.Deployment) (*v1.Deployment, bool, error) { + ret := m.ctrl.Call(m, "UpdateDeployment", arg0) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// UpdateDeployment indicates an expected call of UpdateDeployment +func (mr *MockDeploymentClientMockRecorder) UpdateDeployment(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateDeployment", reflect.TypeOf((*MockDeploymentClient)(nil).UpdateDeployment), arg0) +} + +// PatchDeployment mocks base method +func (m *MockDeploymentClient) PatchDeployment(arg0, arg1 *v1.Deployment) (*v1.Deployment, bool, error) { + ret := m.ctrl.Call(m, "PatchDeployment", arg0, arg1) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// PatchDeployment indicates an expected call of PatchDeployment +func (mr *MockDeploymentClientMockRecorder) PatchDeployment(arg0, arg1 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PatchDeployment", reflect.TypeOf((*MockDeploymentClient)(nil).PatchDeployment), arg0, arg1) +} + +// RollingUpdateDeployment mocks base method +func (m *MockDeploymentClient) RollingUpdateDeployment(arg0 *v1.Deployment) (*v1.Deployment, bool, error) { + ret := m.ctrl.Call(m, "RollingUpdateDeployment", arg0) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// RollingUpdateDeployment indicates an expected call of RollingUpdateDeployment +func (mr *MockDeploymentClientMockRecorder) RollingUpdateDeployment(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RollingUpdateDeployment", reflect.TypeOf((*MockDeploymentClient)(nil).RollingUpdateDeployment), arg0) +} + +// RollingPatchDeployment mocks base method +func (m *MockDeploymentClient) RollingPatchDeployment(arg0, arg1 *v1.Deployment) (*v1.Deployment, bool, error) { + ret := m.ctrl.Call(m, "RollingPatchDeployment", arg0, arg1) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// RollingPatchDeployment indicates an expected call of RollingPatchDeployment +func (mr *MockDeploymentClientMockRecorder) RollingPatchDeployment(arg0, arg1 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RollingPatchDeployment", reflect.TypeOf((*MockDeploymentClient)(nil).RollingPatchDeployment), arg0, arg1) +} + +// RollingUpdateDeploymentMigrations mocks base method +func (m *MockDeploymentClient) RollingUpdateDeploymentMigrations(namespace, name string, f UpdateFunction) (*v1.Deployment, bool, error) { + ret := m.ctrl.Call(m, "RollingUpdateDeploymentMigrations", namespace, name, f) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// RollingUpdateDeploymentMigrations indicates an expected call of RollingUpdateDeploymentMigrations +func (mr *MockDeploymentClientMockRecorder) RollingUpdateDeploymentMigrations(namespace, name, f interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RollingUpdateDeploymentMigrations", reflect.TypeOf((*MockDeploymentClient)(nil).RollingUpdateDeploymentMigrations), namespace, name, f) +} + +// RollingPatchDeploymentMigrations mocks base method +func (m *MockDeploymentClient) RollingPatchDeploymentMigrations(namespace, name string, f PatchFunction) (*v1.Deployment, bool, error) { + ret := m.ctrl.Call(m, "RollingPatchDeploymentMigrations", namespace, name, f) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// RollingPatchDeploymentMigrations indicates an expected call of RollingPatchDeploymentMigrations +func (mr *MockDeploymentClientMockRecorder) RollingPatchDeploymentMigrations(namespace, name, f interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RollingPatchDeploymentMigrations", reflect.TypeOf((*MockDeploymentClient)(nil).RollingPatchDeploymentMigrations), namespace, name, f) +} + +// CreateOrRollingUpdateDeployment mocks base method +func (m *MockDeploymentClient) CreateOrRollingUpdateDeployment(arg0 *v1.Deployment) (*v1.Deployment, bool, error) { + ret := m.ctrl.Call(m, "CreateOrRollingUpdateDeployment", arg0) + ret0, _ := ret[0].(*v1.Deployment) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateOrRollingUpdateDeployment indicates an expected call of CreateOrRollingUpdateDeployment +func (mr *MockDeploymentClientMockRecorder) CreateOrRollingUpdateDeployment(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrRollingUpdateDeployment", reflect.TypeOf((*MockDeploymentClient)(nil).CreateOrRollingUpdateDeployment), arg0) +} + +// ListDeploymentsWithLabels mocks base method +func (m *MockDeploymentClient) ListDeploymentsWithLabels(namespace string, labels labels.Set) (*v1.DeploymentList, error) { + ret := m.ctrl.Call(m, "ListDeploymentsWithLabels", namespace, labels) + ret0, _ := ret[0].(*v1.DeploymentList) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListDeploymentsWithLabels indicates an expected call of ListDeploymentsWithLabels +func (mr *MockDeploymentClientMockRecorder) ListDeploymentsWithLabels(namespace, labels interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListDeploymentsWithLabels", reflect.TypeOf((*MockDeploymentClient)(nil).ListDeploymentsWithLabels), namespace, labels) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/patch.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/patch.go new file mode 100644 index 00000000..57122fea --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/patch.go @@ -0,0 +1,367 @@ +package operatorclient + +import ( + "encoding/json" + "fmt" + + appsv1 "k8s.io/api/apps/v1" + "k8s.io/api/core/v1" + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1beta1ext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/strategicpatch" +) + +// UpdateFunction defines a function that updates an object in an Update* function. The function +// provides the current instance of the object retrieved from the apiserver. The function should +// return the updated object to be applied. +type UpdateFunction func(current metav1.Object) (metav1.Object, error) + +// Update returns a default UpdateFunction implementation that passes its argument through to the +// Update* function directly, ignoring the current object. +// +// Example usage: +// +// client.UpdateDaemonSet(namespace, name, types.Update(obj)) +func Update(obj metav1.Object) UpdateFunction { + return func(_ metav1.Object) (metav1.Object, error) { + return obj, nil + } +} + +// PatchFunction defines a function that is used to provide patch objects for a 3-way merge. The +// function provides the current instance of the object retrieved from the apiserver. The function +// should return the "original" and "modified" objects (in that order) for 3-way patch computation. +type PatchFunction func(current metav1.Object) (metav1.Object, metav1.Object, error) + +// Patch returns a default PatchFunction implementation that passes its arguments through to the +// patcher directly, ignoring the current object. +// +// Example usage: +// +// client.PatchDaemonSet(namespace, name, types.Patch(original, current)) +func Patch(original metav1.Object, modified metav1.Object) PatchFunction { + return func(_ metav1.Object) (metav1.Object, metav1.Object, error) { + return original, modified, nil + } +} + +// updateToPatch wraps an UpdateFunction as a PatchFunction. +func updateToPatch(f UpdateFunction) PatchFunction { + return func(obj metav1.Object) (metav1.Object, metav1.Object, error) { + obj, err := f(obj) + return nil, obj, err + } +} + +func createPatch(original, modified runtime.Object) ([]byte, error) { + originalData, err := json.Marshal(original) + if err != nil { + return nil, err + } + modifiedData, err := json.Marshal(modified) + if err != nil { + return nil, err + } + return strategicpatch.CreateTwoWayMergePatch(originalData, modifiedData, original) +} + +func createThreeWayMergePatchPreservingCommands(original, modified, current runtime.Object) ([]byte, error) { + var datastruct runtime.Object + switch { + case original != nil: + datastruct = original + case modified != nil: + datastruct = modified + case current != nil: + datastruct = current + default: + return nil, nil // A 3-way merge of `nil`s is `nil`. + } + patchMeta, err := strategicpatch.NewPatchMetaFromStruct(datastruct) + if err != nil { + return nil, err + } + + // Create normalized clones of objects. + original, err = cloneAndNormalizeObject(original) + if err != nil { + return nil, err + } + modified, err = cloneAndNormalizeObject(modified) + if err != nil { + return nil, err + } + current, err = cloneAndNormalizeObject(current) + if err != nil { + return nil, err + } + // Perform 3-way merge of annotations and labels. + if err := mergeAnnotationsAndLabels(original, modified, current); err != nil { + return nil, err + } + // Construct 3-way JSON merge patch. + originalData, err := json.Marshal(original) + if err != nil { + return nil, err + } + modifiedData, err := json.Marshal(modified) + if err != nil { + return nil, err + } + currentData, err := json.Marshal(current) + if err != nil { + return nil, err + } + return strategicpatch.CreateThreeWayMergePatch(originalData, modifiedData, currentData, patchMeta, false /* overwrite */) +} + +func cloneAndNormalizeObject(obj runtime.Object) (runtime.Object, error) { + if obj == nil { + return obj, nil + } + + // Clone the object since it will be modified. + obj = obj.DeepCopyObject() + switch obj := obj.(type) { + case *appsv1.DaemonSet: + if obj != nil { + // These are only extracted from current; should not be considered for diffs. + obj.ObjectMeta.ResourceVersion = "" + obj.ObjectMeta.CreationTimestamp = metav1.Time{} + obj.Status = appsv1.DaemonSetStatus{} + } + case *appsv1.Deployment: + if obj != nil { + // These are only extracted from current; should not be considered for diffs. + obj.ObjectMeta.ResourceVersion = "" + obj.ObjectMeta.CreationTimestamp = metav1.Time{} + obj.Status = appsv1.DeploymentStatus{} + } + case *v1.Service: + if obj != nil { + // These are only extracted from current; should not be considered for diffs. + obj.ObjectMeta.ResourceVersion = "" + obj.ObjectMeta.CreationTimestamp = metav1.Time{} + obj.Status = v1.ServiceStatus{} + // ClusterIP for service is immutable, so cannot patch. + obj.Spec.ClusterIP = "" + } + case *extensionsv1beta1.Ingress: + if obj != nil { + // These are only extracted from current; should not be considered for diffs. + obj.ObjectMeta.ResourceVersion = "" + obj.ObjectMeta.CreationTimestamp = metav1.Time{} + obj.Status = extensionsv1beta1.IngressStatus{} + } + case *v1beta1ext.CustomResourceDefinition: + if obj != nil { + // These are only extracted from current; should not be considered for diffs. + obj.ObjectMeta.ResourceVersion = "" + obj.ObjectMeta.CreationTimestamp = metav1.Time{} + obj.ObjectMeta.SelfLink = "" + obj.ObjectMeta.UID = "" + obj.Status = v1beta1ext.CustomResourceDefinitionStatus{} + } + default: + return nil, fmt.Errorf("unhandled type: %T", obj) + } + return obj, nil +} + +// mergeAnnotationsAndLabels performs a 3-way merge of all annotations and labels using custom +// 3-way merge logic defined in mergeMaps() below. +func mergeAnnotationsAndLabels(original, modified, current runtime.Object) error { + if original == nil || modified == nil || current == nil { + return nil + } + + accessor := meta.NewAccessor() + if err := mergeMaps(original, modified, current, accessor.Annotations, accessor.SetAnnotations); err != nil { + return err + } + if err := mergeMaps(original, modified, current, accessor.Labels, accessor.SetLabels); err != nil { + return err + } + + switch current := current.(type) { + case *appsv1.DaemonSet: + getter := func(obj runtime.Object) (map[string]string, error) { + return obj.(*appsv1.DaemonSet).Spec.Template.Annotations, nil + } + setter := func(obj runtime.Object, val map[string]string) error { + obj.(*appsv1.DaemonSet).Spec.Template.Annotations = val + return nil + } + if err := mergeMaps(original, modified, current, getter, setter); err != nil { + return err + } + getter = func(obj runtime.Object) (map[string]string, error) { + return obj.(*appsv1.DaemonSet).Spec.Template.Labels, nil + } + setter = func(obj runtime.Object, val map[string]string) error { + obj.(*appsv1.DaemonSet).Spec.Template.Labels = val + return nil + } + if err := mergeMaps(original, modified, current, getter, setter); err != nil { + return err + } + case *appsv1.Deployment: + getter := func(obj runtime.Object) (map[string]string, error) { + return obj.(*appsv1.Deployment).Spec.Template.Annotations, nil + } + setter := func(obj runtime.Object, val map[string]string) error { + obj.(*appsv1.Deployment).Spec.Template.Annotations = val + return nil + } + if err := mergeMaps(original, modified, current, getter, setter); err != nil { + return err + } + getter = func(obj runtime.Object) (map[string]string, error) { + return obj.(*appsv1.Deployment).Spec.Template.Labels, nil + } + setter = func(obj runtime.Object, val map[string]string) error { + obj.(*appsv1.Deployment).Spec.Template.Labels = val + return nil + } + if err := mergeMaps(original, modified, current, getter, setter); err != nil { + return err + } + } + return nil +} + +// mergeMaps creates a patch using createThreeWayMapPatch and if the patch is non-empty applies +// the patch to the input. The getter and setter are used to access the map inside the given +// objects. +func mergeMaps(original, modified, current runtime.Object, getter func(runtime.Object) (map[string]string, error), setter func(runtime.Object, map[string]string) error) error { + originalMap, err := getter(original) + if err != nil { + return err + } + modifiedMap, err := getter(modified) + if err != nil { + return err + } + currentMap, err := getter(current) + if err != nil { + return err + } + + patch, err := createThreeWayMapPatch(originalMap, modifiedMap, currentMap) + if err != nil { + return err + } + if len(patch) == 0 { + return nil // nothing to apply. + } + modifiedMap = applyMapPatch(originalMap, currentMap, patch) + + if err := setter(original, originalMap); err != nil { + return err + } + if err := setter(modified, modifiedMap); err != nil { + return err + } + return setter(current, currentMap) +} + +// applyMapPatch creates a copy of current and applies the three-way map patch to it. +func applyMapPatch(original, current map[string]string, patch map[string]interface{}) map[string]string { + merged := make(map[string]string, len(current)) + for k, v := range current { + merged[k] = v + } + for k, v := range patch { + if v == nil { + delete(merged, k) + } else { + merged[k] = v.(string) + if _, ok := current[k]; !ok { + // If we are re-adding something that may have already been in original then ensure it is + // removed from `original` to avoid a conflict in upstream patch code. + delete(original, k) + } + } + } + return merged +} + +// createThreeWayMapPatch constructs a 3-way patch between original, modified, and current. The +// patch contains only keys that are added, keys that are removed (with their values set to nil) or +// keys whose values are modified. Returns an error if there is a conflict for any key. +// +// The behavior is defined as follows: +// +// - If an item is present in modified, ensure it exists in current. +// - If an item is present in original and removed in modified, remove it from current. +// - If an item is present only in current, leave it as-is. +// +// This effectively "enforces" that all items present in modified are present in current, and all +// items deleted from original => modified are deleted in current. +// +// The following will cause a conflict: +// +// (1) An item was deleted from original => modified but modified from original => current. +// (2) An item was modified differently from original => modified and original => current. +func createThreeWayMapPatch(original, modified, current map[string]string) (map[string]interface{}, error) { + // Create union of keys. + keys := make(map[string]struct{}) + for k := range original { + keys[k] = struct{}{} + } + for k := range modified { + keys[k] = struct{}{} + } + for k := range current { + keys[k] = struct{}{} + } + + // Create patch according to rules. + patch := make(map[string]interface{}) + for k := range keys { + oVal, oOk := original[k] + mVal, mOk := modified[k] + cVal, cOk := current[k] + + switch { + case oOk && mOk && cOk: + // present in all three. + if mVal != cVal { + if oVal != cVal { + // conflict type 2: changed to different values in modified and current. + return nil, fmt.Errorf("conflict at key %v: original = %v, modified = %v, current = %v", k, oVal, mVal, cVal) + } + patch[k] = mVal + } + case !oOk && mOk && cOk: + // added in modified and current. + if mVal != cVal { + // conflict type 2: added different values in modified and current. + return nil, fmt.Errorf("conflict at key %v: original = , modified = %v, current = %v", k, mVal, cVal) + } + case oOk && !mOk && cOk: + // deleted in modified. + if oVal != cVal { + // conflict type 1: changed from original to current, removed in modified. + return nil, fmt.Errorf("conflict at key %v, original = %v, modified = , current = %v", k, oVal, cVal) + } + patch[k] = nil + case oOk && mOk && !cOk: + // deleted in current. + patch[k] = mVal + case !oOk && !mOk && cOk: + // only exists in current. + case !oOk && mOk && !cOk: + // added in modified. + patch[k] = mVal + case oOk && !mOk && !cOk: + // deleted in both modified and current. + case !oOk && !mOk && !cOk: + // unreachable. + } + } + return patch, nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/serviceaccount.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/serviceaccount.go new file mode 100644 index 00000000..b1575965 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient/serviceaccount.go @@ -0,0 +1,39 @@ +package operatorclient + +import ( + "fmt" + + "github.com/golang/glog" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +// CreateServiceAccount creates the serviceAccount. +func (c *Client) CreateServiceAccount(ig *v1.ServiceAccount) (*v1.ServiceAccount, error) { + return c.CoreV1().ServiceAccounts(ig.GetNamespace()).Create(ig) +} + +// GetServiceAccount returns the existing serviceAccount. +func (c *Client) GetServiceAccount(namespace, name string) (*v1.ServiceAccount, error) { + return c.CoreV1().ServiceAccounts(namespace).Get(name, metav1.GetOptions{}) +} + +// DeleteServiceAccount deletes the serviceAccount. +func (c *Client) DeleteServiceAccount(namespace, name string, options *metav1.DeleteOptions) error { + return c.CoreV1().ServiceAccounts(namespace).Delete(name, options) +} + +// UpdateServiceAccount will update the given ServiceAccount resource. +func (c *Client) UpdateServiceAccount(sa *v1.ServiceAccount) (*v1.ServiceAccount, error) { + glog.V(4).Infof("[UPDATE ServiceAccount]: %s", sa.GetName()) + oldSa, err := c.GetServiceAccount(sa.GetNamespace(), sa.GetName()) + if err != nil { + return nil, err + } + patchBytes, err := createPatch(oldSa, sa) + if err != nil { + return nil, fmt.Errorf("error creating patch for ServiceAccount: %v", err) + } + return c.Core().ServiceAccounts(sa.GetNamespace()).Patch(sa.GetName(), types.StrategicMergePatchType, patchBytes) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil/util.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil/util.go new file mode 100644 index 00000000..63e403c2 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil/util.go @@ -0,0 +1,105 @@ +package ownerutil + +import ( + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + log "github.com/sirupsen/logrus" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// Owner is used to build an OwnerReference, and we need type and object metadata +type Owner interface { + metav1.Object + schema.ObjectKind +} + +func IsOwnedBy(object metav1.Object, owner Owner) bool { + for _, oref := range object.GetOwnerReferences() { + if oref.UID == owner.GetUID() { + return true + } + } + return false +} + +func IsOwnedByKind(object metav1.Object, ownerKind string) bool { + for _, oref := range object.GetOwnerReferences() { + if oref.Kind == ownerKind { + return true + } + } + return false +} + +func GetOwnerByKind(object metav1.Object, ownerKind string) metav1.OwnerReference { + for _, oref := range object.GetOwnerReferences() { + if oref.Kind == ownerKind { + return oref + } + } + return metav1.OwnerReference{} +} + +// AddNonBlockingOwner adds a nonblocking owner to the ownerref list. +func AddNonBlockingOwner(object metav1.Object, owner Owner) { + // Most of the time we won't have TypeMeta on the object, so we infer it for types we know about + inferGroupVersionKind(owner) + blockOwnerDeletion := false + isController := false + + ownerRefs := object.GetOwnerReferences() + if ownerRefs == nil { + ownerRefs = []metav1.OwnerReference{} + } + gvk := owner.GroupVersionKind() + apiVersion, kind := gvk.ToAPIVersionAndKind() + ownerRefs = append(ownerRefs, metav1.OwnerReference{ + APIVersion: apiVersion, + Kind: kind, + Name: owner.GetName(), + UID: owner.GetUID(), + BlockOwnerDeletion: &blockOwnerDeletion, + Controller: &isController, + }) + object.SetOwnerReferences(ownerRefs) +} + +// inferGroupVersionKind adds TypeMeta to an owner so that it can be written to an ownerref. +// TypeMeta is generally only known at serialization time, so we often won't know what GVK an owner has. +// For the types we know about, we can add the GVK of the apis that we're using the interact with the object. +func inferGroupVersionKind(owner Owner) { + if !owner.GroupVersionKind().Empty() { + // owner already has TypeMeta, no inference needed + return + } + + switch v := owner.(type) { + case *v1alpha1.ClusterServiceVersion: + owner.SetGroupVersionKind(schema.GroupVersionKind{ + Group: v1alpha1.GroupName, + Version: v1alpha1.GroupVersion, + Kind: v1alpha1.ClusterServiceVersionKind, + }) + case *v1alpha1.InstallPlan: + owner.SetGroupVersionKind(schema.GroupVersionKind{ + Group: v1alpha1.GroupName, + Version: v1alpha1.GroupVersion, + Kind: v1alpha1.InstallPlanKind, + }) + case *v1alpha1.Subscription: + owner.SetGroupVersionKind(schema.GroupVersionKind{ + Group: v1alpha1.GroupName, + Version: v1alpha1.GroupVersion, + Kind: v1alpha1.SubscriptionKind, + }) + case *v1alpha1.CatalogSource: + owner.SetGroupVersionKind(schema.GroupVersionKind{ + Group: v1alpha1.GroupName, + Version: v1alpha1.GroupVersion, + Kind: v1alpha1.CatalogSourceKind, + }) + default: + log.Warnf("could not infer GVK for object: %#v, %#v", v, owner) + } + return +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer/queueinformer.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer/queueinformer.go new file mode 100644 index 00000000..504b53da --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer/queueinformer.go @@ -0,0 +1,112 @@ +package queueinformer + +import ( + log "github.com/sirupsen/logrus" + "k8s.io/client-go/tools/cache" + "k8s.io/client-go/util/workqueue" +) + +// SyncHandler is the function that reconciles the controlled object when seen +type SyncHandler func(obj interface{}) error + +// QueueInformer ties an informer to a queue in order to process events from the informer +// the informer watches objects of interest and adds objects to the queue for processing +// the syncHandler is called for all objects on the queue +type QueueInformer struct { + queue workqueue.RateLimitingInterface + informer cache.SharedIndexInformer + syncHandler SyncHandler + resourceEventHandlerFuncs *cache.ResourceEventHandlerFuncs + name string +} + +// enqueue adds a key to the queue. If obj is a key already it gets added directly. +// Otherwise, the key is extracted via keyFunc. +func (q *QueueInformer) enqueue(obj interface{}) { + if obj == nil { + return + } + + key, ok := obj.(string) + if !ok { + key, ok = q.keyFunc(obj) + if !ok { + return + } + } + + q.queue.Add(key) +} + +// keyFunc turns an object into a key for the queue. In the future will use a (name, namespace) struct as key +func (q *QueueInformer) keyFunc(obj interface{}) (string, bool) { + k, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj) + if err != nil { + log.Infof("creating key failed: %s", err) + return k, false + } + + return k, true +} + +// defaultResourceEventhandlerFuncs provides the default implementation for responding to events +// these simply log the event and add the object's key to the queue for later processing +func (q *QueueInformer) defaultResourceEventHandlerFuncs() *cache.ResourceEventHandlerFuncs { + return &cache.ResourceEventHandlerFuncs{ + AddFunc: func(obj interface{}) { + key, ok := q.keyFunc(obj) + if !ok { + return + } + + log.Infof("%s added", key) + q.enqueue(key) + }, + DeleteFunc: func(obj interface{}) { + key, ok := q.keyFunc(obj) + if !ok { + return + } + + log.Infof("%s deleted", key) + q.queue.Forget(key) + }, + UpdateFunc: func(oldObj, newObj interface{}) { + key, ok := q.keyFunc(newObj) + if !ok { + return + } + + log.Infof("%s updated", key) + q.enqueue(key) + }, + } +} + +// New creates a set of new queueinformers given a name, a set of informers, and a sync handler to handle the objects +// that the operator is managing. Optionally, custom event handler funcs can be passed in (defaults will be provided) +func New(queue workqueue.RateLimitingInterface, informers []cache.SharedIndexInformer, handler SyncHandler, funcs *cache.ResourceEventHandlerFuncs, name string) []*QueueInformer { + queueInformers := []*QueueInformer{} + for _, informer := range informers { + queueInformers = append(queueInformers, NewInformer(queue, informer, handler, funcs, name)) + } + return queueInformers +} + +// NewInformer creates a new queueinformer given a name, an informer, and a sync handler to handle the objects +// that the operator is managing. Optionally, custom event handler funcs can be passed in (defaults will be provided) +func NewInformer(queue workqueue.RateLimitingInterface, informer cache.SharedIndexInformer, handler SyncHandler, funcs *cache.ResourceEventHandlerFuncs, name string) *QueueInformer { + queueInformer := &QueueInformer{ + queue: queue, + informer: informer, + syncHandler: handler, + name: name, + } + if funcs == nil { + queueInformer.resourceEventHandlerFuncs = queueInformer.defaultResourceEventHandlerFuncs() + } else { + queueInformer.resourceEventHandlerFuncs = funcs + } + queueInformer.informer.AddEventHandler(queueInformer.resourceEventHandlerFuncs) + return queueInformer +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer/queueinformer_operator.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer/queueinformer_operator.go new file mode 100644 index 00000000..fa08ba7e --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer/queueinformer_operator.go @@ -0,0 +1,144 @@ +package queueinformer + +import ( + "fmt" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient" + "github.com/pkg/errors" + log "github.com/sirupsen/logrus" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/client-go/tools/cache" +) + +// An Operator is a collection of QueueInformers +// OpClient is used to establish the connection to kubernetes +type Operator struct { + queueInformers []*QueueInformer + OpClient operatorclient.ClientInterface +} + +// NewOperator creates a new Operator configured to manage the cluster defined in kubeconfig. +func NewOperator(kubeconfig string, queueInformers ...*QueueInformer) (*Operator, error) { + opClient := operatorclient.NewClientFromConfig(kubeconfig) + if queueInformers == nil { + queueInformers = []*QueueInformer{} + } + operator := &Operator{ + OpClient: opClient, + queueInformers: queueInformers, + } + return operator, nil +} + +func NewOperatorFromClient(opClient operatorclient.ClientInterface, queueInformers ...*QueueInformer) (*Operator, error) { + if queueInformers == nil { + queueInformers = []*QueueInformer{} + } + operator := &Operator{ + OpClient: opClient, + queueInformers: queueInformers, + } + return operator, nil +} + +// RegisterQueueInformer adds a QueueInformer to this operator +func (o *Operator) RegisterQueueInformer(queueInformer *QueueInformer) { + if o.queueInformers == nil { + o.queueInformers = []*QueueInformer{} + } + o.queueInformers = append(o.queueInformers, queueInformer) +} + +// Run starts the operator's control loops +func (o *Operator) Run(stopc <-chan struct{}) error { + for _, queueInformer := range o.queueInformers { + defer queueInformer.queue.ShutDown() + } + + errChan := make(chan error) + go func() { + v, err := o.OpClient.KubernetesInterface().Discovery().ServerVersion() + if err != nil { + errChan <- errors.Wrap(err, "communicating with server failed") + return + } + log.Infof("connection established. cluster-version: %v", v) + errChan <- nil + }() + + var hasSyncedCheckFns []cache.InformerSynced + for _, queueInformer := range o.queueInformers { + hasSyncedCheckFns = append(hasSyncedCheckFns, queueInformer.informer.HasSynced) + } + + select { + case err := <-errChan: + if err != nil { + return err + } + log.Info("Operator ready") + case <-stopc: + return nil + } + + log.Info("starting informers...") + for _, queueInformer := range o.queueInformers { + go queueInformer.informer.Run(stopc) + } + + log.Info("waiting for caches to sync...") + if ok := cache.WaitForCacheSync(stopc, hasSyncedCheckFns...); !ok { + return fmt.Errorf("failed to wait for caches to sync") + } + + log.Info("starting workers...") + for _, queueInformer := range o.queueInformers { + go o.worker(queueInformer) + } + <-stopc + return nil +} + +// worker runs a worker thread that just dequeues items, processes them, and marks them done. +// It enforces that the syncHandler is never invoked concurrently with the same key. +func (o *Operator) worker(loop *QueueInformer) { + for o.processNextWorkItem(loop) { + } +} + +func (o *Operator) processNextWorkItem(loop *QueueInformer) bool { + queue := loop.queue + key, quit := queue.Get() + + if quit { + return false + } + defer queue.Done(key) + + // requeue five times on error + if err := o.sync(loop, key.(string)); err != nil && queue.NumRequeues(key.(string)) < 5 { + log.Infof("retrying %s", key) + utilruntime.HandleError(errors.Wrap(err, fmt.Sprintf("Sync %q failed", key))) + queue.AddRateLimited(key) + return true + } + queue.Forget(key) + return true +} + +func (o *Operator) sync(loop *QueueInformer, key string) error { + logger := log.WithField("queue", loop.name).WithField("key", key) + logger.Info("getting from queue") + obj, exists, err := loop.informer.GetIndexer().GetByKey(key) + if err != nil { + return err + } + + if !exists { + // For now, we ignore the case where an object used to exist but no longer does + logger.Info("couldn't get from queue") + logger.Debugf("have keys: %v", loop.informer.GetIndexer().ListKeys()) + return nil + } + return loop.syncHandler(obj) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/schema/schema.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/schema/schema.go new file mode 100644 index 00000000..b4df500b --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/schema/schema.go @@ -0,0 +1,319 @@ +package schema + +import ( + "bufio" + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "strings" + + "github.com/ghodss/yaml" + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/validation" + apiservervalidation "k8s.io/apiextensions-apiserver/pkg/apiserver/validation" + apiValidation "k8s.io/apimachinery/pkg/api/validation" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry" + "k8s.io/apimachinery/pkg/conversion" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +func readPragmas(fileBytes []byte) (pragmas []string, err error) { + fileReader := bytes.NewReader(fileBytes) + fileBufReader := bufio.NewReader(fileReader) + for { + maybePragma, err := fileBufReader.ReadString('\n') + if err != nil { + return nil, err + } + if strings.HasPrefix(maybePragma, "#!") { + pragmas = append(pragmas, strings.TrimSpace(strings.TrimPrefix(maybePragma, "#!"))) + } else { + // pragmas must be defined at the top of the file, stop when we don't see a line with the pragma mark + break + } + } + return +} + +type Meta struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` +} + +func (m *Meta) GetObjectKind() schema.ObjectKind { + return m +} +func (in *Meta) DeepCopyInto(out *Meta) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + return +} + +func (in *Meta) DeepCopy() *Meta { + if in == nil { + return nil + } + out := new(Meta) + in.DeepCopyInto(out) + return out +} + +func (in *Meta) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +func validateKubectlable(fileBytes []byte) error { + exampleFileBytesJson, err := yaml.YAMLToJSON(fileBytes) + if err != nil { + return err + } + parsedMeta := &Meta{} + err = json.Unmarshal(exampleFileBytesJson, parsedMeta) + if err != nil { + return err + } + requiresNamespace := parsedMeta.Kind != "CustomResourceDefinition" + errs := apiValidation.ValidateObjectMeta( + &parsedMeta.ObjectMeta, + requiresNamespace, + func(s string, prefix bool) []string { + return nil + }, + field.NewPath("metadata"), + ) + + if len(errs) > 0 { + return fmt.Errorf("error validating object metadata: %s. %v. %s", errs, parsedMeta, string(exampleFileBytesJson)) + } + return nil +} + +func validateUsingPragma(pragma string, fileBytes []byte) (bool, error) { + const validateCRDPrefix = "validate-crd:" + const ParseAsKindPrefix = "parse-kind:" + const PackageManifest = "package-manifest:" + + switch { + case strings.HasPrefix(pragma, validateCRDPrefix): + return true, validateCRD(strings.TrimSpace(strings.TrimPrefix(pragma, validateCRDPrefix)), fileBytes) + case strings.HasPrefix(pragma, ParseAsKindPrefix): + return true, validateKind(strings.TrimSpace(strings.TrimPrefix(pragma, ParseAsKindPrefix)), fileBytes) + case strings.HasPrefix(pragma, PackageManifest): + csvFilenames := strings.Split(strings.TrimSpace(strings.TrimPrefix(pragma, PackageManifest)), ",") + return false, validatePackageManifest(fileBytes, csvFilenames) + } + return false, nil +} + +func validatePackageManifest(fileBytes []byte, csvFilenames []string) error { + manifestBytesJson, err := yaml.YAMLToJSON(fileBytes) + if err != nil { + return err + } + + var packageManifest registry.PackageManifest + err = json.Unmarshal(manifestBytesJson, &packageManifest) + if err != nil { + return err + } + + if len(packageManifest.Channels) < 1 { + return fmt.Errorf("Package manifest validation failure for package %s: Missing channels", packageManifest.PackageName) + } + + // Collect the defined CSV names. + csvNames := map[string]bool{} + for _, csvFilename := range csvFilenames { + csvBytes, err := ioutil.ReadFile(csvFilename) + if err != nil { + return err + } + + csvBytesJson, err := yaml.YAMLToJSON(csvBytes) + if err != nil { + return err + } + + csv := v1alpha1.ClusterServiceVersion{} + err = json.Unmarshal(csvBytesJson, &csv) + if err != nil { + return err + } + + csvNames[csv.Name] = true + } + + if len(packageManifest.PackageName) == 0 { + return fmt.Errorf("Empty package name") + } + + // Make sure that each channel name is unique and that the referenced CSV exists. + channelMap := make(map[string]bool, len(packageManifest.Channels)) + for _, channel := range packageManifest.Channels { + if _, exists := channelMap[channel.Name]; exists { + return fmt.Errorf("Channel %s declared twice in package manifest", channel.Name) + } + + if _, ok := csvNames[channel.CurrentCSVName]; !ok { + return fmt.Errorf("Missing CSV with name %s", channel.CurrentCSVName) + } + + channelMap[channel.Name] = true + } + + return nil +} + +func validateCRD(schemaFileName string, fileBytes []byte) error { + schemaBytes, err := ioutil.ReadFile(schemaFileName) + if err != nil { + return err + } + schemaBytesJson, err := yaml.YAMLToJSON(schemaBytes) + if err != nil { + return err + } + + crd := v1beta1.CustomResourceDefinition{} + json.Unmarshal(schemaBytesJson, &crd) + + exampleFileBytesJson, err := yaml.YAMLToJSON(fileBytes) + if err != nil { + return err + } + unstructured := unstructured.Unstructured{} + err = json.Unmarshal(exampleFileBytesJson, &unstructured) + if err != nil { + return err + } + + // Validate CRD definition statically + scheme := runtime.NewScheme() + err = apiextensions.AddToScheme(scheme) + if err != nil { + return err + } + err = v1beta1.AddToScheme(scheme) + if err != nil { + return err + } + + unversionedCRD := apiextensions.CustomResourceDefinition{} + scheme.Converter().Convert(&crd, &unversionedCRD, conversion.SourceToDest, nil) + errList := validation.ValidateCustomResourceDefinition(&unversionedCRD) + if len(errList) > 0 { + for _, ferr := range errList { + fmt.Println(ferr) + } + return fmt.Errorf("CRD failed validation: %s. Errors: %s", schemaFileName, errList) + } + + // Validate CR against CRD schema + validator, _, err := apiservervalidation.NewSchemaValidator(unversionedCRD.Spec.Validation) + return apiservervalidation.ValidateCustomResource(unstructured.UnstructuredContent(), validator) +} + +func validateKind(kind string, fileBytes []byte) error { + exampleFileBytesJson, err := yaml.YAMLToJSON(fileBytes) + if err != nil { + return err + } + + switch kind { + case "ClusterServiceVersion": + csv := v1alpha1.ClusterServiceVersion{} + err = json.Unmarshal(exampleFileBytesJson, &csv) + if err != nil { + return err + } + return err + case "CatalogSource": + cs := v1alpha1.CatalogSource{} + err = json.Unmarshal(exampleFileBytesJson, &cs) + if err != nil { + return err + } + return err + default: + return fmt.Errorf("didn't recognize validate-kind directive: %s", kind) + } +} + +func validateResource(path string, f os.FileInfo, err error) error { + if err != nil { + return err + } + + exampleFileReader, err := os.Open(path) + if err != nil { + return err + } + defer exampleFileReader.Close() + + fileReader := bufio.NewReader(exampleFileReader) + fileBytes, err := ioutil.ReadAll(fileReader) + if err != nil { + return err + } + pragmas, err := readPragmas(fileBytes) + if err != nil { + return err + } + + isKubResource := false + for _, pragma := range pragmas { + fileReader.Reset(exampleFileReader) + isKub, err := validateUsingPragma(pragma, fileBytes) + if err != nil { + return fmt.Errorf("validating %s: %v", path, err) + } + isKubResource = isKubResource || isKub + } + + if isKubResource { + err = validateKubectlable(fileBytes) + if err != nil { + return fmt.Errorf("validating %s: %v", path, err) + } + } + return nil +} + +func validateResources(directory string) error { + err := filepath.Walk(directory, func(path string, f os.FileInfo, err error) error { + if f.IsDir() { + return nil + } + + if !strings.HasSuffix(path, ".yaml") { + return nil + } + + fmt.Printf("validate %s\n", path) + if validateResource(path, f, err) != nil { + return err + } + + return nil + }) + return err +} + +func CheckCatalogResources(manifestDir string) error { + return validateResources(manifestDir) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/schema/upgrade_path.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/schema/upgrade_path.go new file mode 100644 index 00000000..d766b45e --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/schema/upgrade_path.go @@ -0,0 +1,66 @@ +package schema + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "path/filepath" + + "github.com/ghodss/yaml" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" +) + +// Files is a map of files. +type Files map[string][]byte + +// Glob searches the `/manifests` directory for files matching the pattern and returns them. +func Glob(pattern string) (Files, error) { + matching := map[string][]byte{} + files, err := filepath.Glob(pattern) + if err != nil { + return nil, err + } + + for _, name := range files { + bytes, err := ioutil.ReadFile(name) + if err != nil { + return nil, err + } + matching[name] = bytes + } + + return matching, nil +} + +// CheckUpgradePath checks that every ClusterServiceVersion in a package directory has a valid `spec.replaces` field. +func CheckUpgradePath(packageDir string) error { + replaces := map[string]string{} + csvFiles, err := Glob(filepath.Join(packageDir, "**.clusterserviceversion.yaml")) + if err != nil { + return err + } + + for _, bytes := range csvFiles { + jsonBytes, err := yaml.YAMLToJSON(bytes) + if err != nil { + return err + } + var csv v1alpha1.ClusterServiceVersion + err = json.Unmarshal(jsonBytes, &csv) + if err != nil { + return err + } + replaces[csv.ObjectMeta.Name] = csv.Spec.Replaces + } + + for replacing, replaced := range replaces { + fmt.Printf("%s -> %s\n", replaced, replacing) + + if _, ok := replaces[replaced]; replaced != "" && !ok { + err := fmt.Errorf("%s should replace %s, which does not exist", replacing, replaced) + return err + } + } + return nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/signals/signals.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/signals/signals.go new file mode 100644 index 00000000..4ea708a7 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/signals/signals.go @@ -0,0 +1,29 @@ +package signals + +import ( + "os" + "os/signal" + "syscall" +) + +var shutdownSignals = []os.Signal{os.Interrupt, syscall.SIGTERM} +var onlyOneSignalHandler = make(chan struct{}) + +// SetupSignalHandler registered for SIGTERM and SIGINT. A stop channel is returned +// which is closed on one of these signals. If a second signal is caught, the program +// is terminated with exit code 1. +func SetupSignalHandler() (stopCh <-chan struct{}) { + close(onlyOneSignalHandler) // panics when called twice + + stop := make(chan struct{}) + c := make(chan os.Signal, 2) + signal.Notify(c, shutdownSignals...) + go func() { + <-c + close(stop) + <-c + os.Exit(1) // second signal. Exit directly. + }() + + return stop +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/install/install.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/install/install.go new file mode 100644 index 00000000..839181f1 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/install/install.go @@ -0,0 +1,11 @@ +package install + +import ( + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1" + "k8s.io/apimachinery/pkg/runtime" +) + +// Install registers the API group and adds types to a scheme +func Install(scheme *runtime.Scheme) { + v1alpha1.AddToScheme(scheme) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/doc.go new file mode 100644 index 00000000..c2479791 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/doc.go @@ -0,0 +1,3 @@ +// +k8s:deepcopy-gen=package +// +k8s:openapi-gen=true +package v1alpha1 diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/packagemanifest.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/packagemanifest.go new file mode 100644 index 00000000..d9278b5d --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/packagemanifest.go @@ -0,0 +1,29 @@ +package v1alpha1 + +import operatorsv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + +// CreateCSVDescription creates a CSVDescription from a given CSV +func CreateCSVDescription(csv *operatorsv1alpha1.ClusterServiceVersion) CSVDescription { + desc := CSVDescription{ + DisplayName: csv.Spec.DisplayName, + Version: csv.Spec.Version, + Provider: AppLink{ + Name: csv.Spec.Provider.Name, + URL: csv.Spec.Provider.URL, + }, + } + + icons := make([]Icon, len(csv.Spec.Icon)) + for i, icon := range csv.Spec.Icon { + icons[i] = Icon{ + Data: icon.Data, + MediaType: icon.MediaType, + } + } + + if len(icons) > 0 { + desc.Icon = icons + } + + return desc +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/packagemanifest_types.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/packagemanifest_types.go new file mode 100644 index 00000000..c7830ddd --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/packagemanifest_types.go @@ -0,0 +1,112 @@ +package v1alpha1 + +import ( + "github.com/coreos/go-semver/semver" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PackageManifestList is a list of PackageManifest objects. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type PackageManifestList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []PackageManifest `json:"items"` +} + +// PackageManifest holds information about a package, which is a reference to one (or more) +// channels under a single package. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type PackageManifest struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec PackageManifestSpec `json:"spec,omitempty"` + Status PackageManifestStatus `json:"status,omitempty"` +} + +// PackageManifestSpec defines the desired state of PackageManifest +type PackageManifestSpec struct{} + +// PackageManifestStatus represents the current status of the PackageManifest +type PackageManifestStatus struct { + // CatalogSourceName is the name of the CatalogSource this package belongs to + CatalogSourceName string `json:"catalogSource"` + + // CatalogSourceNamespace is the namespace of the owning CatalogSource + CatalogSourceNamespace string `json:"catalogSourceNamespace"` + + // Provider is the provider of the PackageManifest's default CSV + Provider AppLink `json:"provider,omitempty"` + + // 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.Status.DefaultChannelName != "" { + return m.Status.DefaultChannelName + } + if len(m.Status.Channels) == 1 { + return m.Status.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"` + + // CurrentCSVSpec holds the spec of the current CSV + CurrentCSVDesc CSVDescription `json:"currentCSVDesc,omitempty"` +} + +// CSVDescription defines a description of a CSV +type CSVDescription struct { + // DisplayName is the CSV's display name + DisplayName string `json:"displayName,omitempty"` + + // Icon is the CSV's base64 encoded icon + Icon []Icon `json:"icon,omitempty"` + + // Version is the CSV's semantic version + // +k8s:openapi-gen=false + Version semver.Version `json:"version,omitempty"` + + // Provider is the CSV's provider + Provider AppLink `json:"provider,omitempty"` +} + +// AppLink defines a link to an application +type AppLink struct { + Name string `json:"name,omitempty"` + URL string `json:"url,omitempty"` +} + +// Icon defines a base64 encoded icon and media type +type Icon struct { + Data string `json:"base64data,omitempty"` + MediaType string `json:"mediatype,omitempty"` +} + +// IsDefaultChannel returns true if the PackageChannel is the default for the PackageManifest +func (pc PackageChannel) IsDefaultChannel(pm PackageManifest) bool { + return pc.Name == pm.Status.DefaultChannelName || len(pm.Status.Channels) == 1 +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/register.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/register.go new file mode 100644 index 00000000..58fa2ad1 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/register.go @@ -0,0 +1,42 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +const ( + Group = "packages.apps.redhat.com" + Version = "v1alpha1" + PackageManifestKind = "PackageManifest" + PackageManifestListKind = "PackageManifestList" +) + +// SchemeGroupVersion is the group version used to register these objects. +var SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} + +// Resource takes an unqualified resource and returns a Group-qualified GroupResource. +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +// addKnownTypes adds the set of types defined in this package to the supplied scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypeWithName( + SchemeGroupVersion.WithKind(PackageManifestKind), + &PackageManifest{}, + ) + scheme.AddKnownTypeWithName( + SchemeGroupVersion.WithKind(PackageManifestListKind), + &PackageManifestList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + + return nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 00000000..aba59fda --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,198 @@ +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AppLink) DeepCopyInto(out *AppLink) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppLink. +func (in *AppLink) DeepCopy() *AppLink { + if in == nil { + return nil + } + out := new(AppLink) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CSVDescription) DeepCopyInto(out *CSVDescription) { + *out = *in + if in.Icon != nil { + in, out := &in.Icon, &out.Icon + *out = make([]Icon, len(*in)) + copy(*out, *in) + } + out.Version = in.Version + out.Provider = in.Provider + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CSVDescription. +func (in *CSVDescription) DeepCopy() *CSVDescription { + if in == nil { + return nil + } + out := new(CSVDescription) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Icon) DeepCopyInto(out *Icon) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Icon. +func (in *Icon) DeepCopy() *Icon { + if in == nil { + return nil + } + out := new(Icon) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PackageChannel) DeepCopyInto(out *PackageChannel) { + *out = *in + in.CurrentCSVDesc.DeepCopyInto(&out.CurrentCSVDesc) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PackageChannel. +func (in *PackageChannel) DeepCopy() *PackageChannel { + if in == nil { + return nil + } + out := new(PackageChannel) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PackageManifest) DeepCopyInto(out *PackageManifest) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PackageManifest. +func (in *PackageManifest) DeepCopy() *PackageManifest { + if in == nil { + return nil + } + out := new(PackageManifest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PackageManifest) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PackageManifestList) DeepCopyInto(out *PackageManifestList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]PackageManifest, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PackageManifestList. +func (in *PackageManifestList) DeepCopy() *PackageManifestList { + if in == nil { + return nil + } + out := new(PackageManifestList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PackageManifestList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PackageManifestSpec) DeepCopyInto(out *PackageManifestSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PackageManifestSpec. +func (in *PackageManifestSpec) DeepCopy() *PackageManifestSpec { + if in == nil { + return nil + } + out := new(PackageManifestSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PackageManifestStatus) DeepCopyInto(out *PackageManifestStatus) { + *out = *in + out.Provider = in.Provider + if in.Channels != nil { + in, out := &in.Channels, &out.Channels + *out = make([]PackageChannel, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PackageManifestStatus. +func (in *PackageManifestStatus) DeepCopy() *PackageManifestStatus { + if in == nil { + return nil + } + out := new(PackageManifestStatus) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apiserver/config.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apiserver/config.go new file mode 100644 index 00000000..17dc4fd9 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apiserver/config.go @@ -0,0 +1,102 @@ +// Copyright 2018 The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package apiserver + +import ( + "strings" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/runtime/serializer" + openapinamer "k8s.io/apiserver/pkg/endpoints/openapi" + genericapiserver "k8s.io/apiserver/pkg/server" + "k8s.io/client-go/informers" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/install" + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apiserver/generic" + generatedopenapi "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/generated/openapi" + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/version" +) + +var ( + Scheme = runtime.NewScheme() + Codecs = serializer.NewCodecFactory(Scheme) +) + +func init() { + install.Install(Scheme) + + // we need to add the options to empty v1 + // TODO fix the server code to avoid this + metav1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + + // TODO: keep the generic API server from wanting this + unversioned := schema.GroupVersion{Group: "", Version: "v1"} + Scheme.AddUnversionedTypes(unversioned, + &metav1.Status{}, + &metav1.APIVersions{}, + &metav1.APIGroupList{}, + &metav1.APIGroup{}, + &metav1.APIResourceList{}, + ) +} + +// Config contains configuration for launching an instance of metrics-server. +type Config struct { + GenericConfig *genericapiserver.Config + ProviderConfig generic.ProviderConfig +} + +type completedConfig struct { + genericapiserver.CompletedConfig + ProviderConfig *generic.ProviderConfig +} + +// Complete fills in any fields not set that are required to have valid data. It's mutating the receiver. +func (c *Config) Complete(informers informers.SharedInformerFactory) completedConfig { + c.GenericConfig.Version = version.VersionInfo() + + // enable OpenAPI schemas + c.GenericConfig.OpenAPIConfig = genericapiserver.DefaultOpenAPIConfig(generatedopenapi.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(generic.Scheme)) + c.GenericConfig.OpenAPIConfig.Info.Title = "Package API server" + c.GenericConfig.OpenAPIConfig.Info.Version = strings.Split(c.GenericConfig.Version.String(), "-")[0] + c.GenericConfig.SwaggerConfig = genericapiserver.DefaultSwaggerConfig() + + return completedConfig{ + CompletedConfig: c.GenericConfig.Complete(informers), + ProviderConfig: &c.ProviderConfig, + } +} + +type PackageManifestServer struct { + *genericapiserver.GenericAPIServer +} + +// New returns a new instance of MetricsServer from the given config. +func (c completedConfig) New() (*PackageManifestServer, error) { + genericServer, err := c.CompletedConfig.New("packagemanifest-server", genericapiserver.NewEmptyDelegate()) // completion is done in Complete, no need for a second time + if err != nil { + return nil, err + } + + if err := generic.InstallStorage(c.ProviderConfig, genericServer); err != nil { + return nil, err + } + + return &PackageManifestServer{ + GenericAPIServer: genericServer, + }, nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apiserver/generic/storage.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apiserver/generic/storage.go new file mode 100644 index 00000000..0a9fa8e6 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apiserver/generic/storage.go @@ -0,0 +1,66 @@ +// Copyright 2018 The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package generic + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/runtime/serializer" + "k8s.io/apiserver/pkg/registry/rest" + genericapiserver "k8s.io/apiserver/pkg/server" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/install" + packagemanifest "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1" + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/provider" + packagemanifeststorage "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/storage/packagemanifest" +) + +var ( + // Scheme contains the types needed by the resource metrics API. + Scheme = runtime.NewScheme() + // Codecs is a codec factory for serving the resource metrics API. + Codecs = serializer.NewCodecFactory(Scheme) +) + +func init() { + install.Install(Scheme) + metav1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) +} + +// ProviderConfig holds the providers for node and pod metrics +// for serving the resource metrics API. +type ProviderConfig struct { + Provider provider.PackageManifestProvider +} + +// BuildStorage constructs APIGroupInfo the metrics.k8s.io API group using the given providers. +func BuildStorage(providers *ProviderConfig) genericapiserver.APIGroupInfo { + apiGroupInfo := genericapiserver.NewDefaultAPIGroupInfo(packagemanifest.Group, Scheme, metav1.ParameterCodec, Codecs) + + packageManifestStorage := packagemanifeststorage.NewStorage(packagemanifest.Resource("packagemanifests"), providers.Provider) + packageManifestResources := map[string]rest.Storage{ + "packagemanifests": packageManifestStorage, + } + apiGroupInfo.VersionedResourcesStorageMap[packagemanifest.Version] = packageManifestResources + + return apiGroupInfo +} + +// InstallStorage builds the storage for the metrics.k8s.io API, and then installs it into the given API server. +func InstallStorage(providers *ProviderConfig, server *genericapiserver.GenericAPIServer) error { + info := BuildStorage(providers) + return server.InstallAPIGroup(&info) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/client.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/client.go new file mode 100644 index 00000000..fb7455ae --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/client.go @@ -0,0 +1,16 @@ +package client + +import ( + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned" + "k8s.io/client-go/rest" +) + +// NewClient creates a client that can interact with the ALM resources in k8s api +func NewClient(kubeconfig string) (client versioned.Interface, err error) { + var config *rest.Config + config, err = getConfig(kubeconfig) + if err != nil { + return + } + return versioned.NewForConfig(config) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/clientset.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/clientset.go new file mode 100644 index 00000000..601d23f0 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/clientset.go @@ -0,0 +1,98 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package versioned + +import ( + packagemanifestv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + PackagemanifestV1alpha1() packagemanifestv1alpha1.PackagemanifestV1alpha1Interface + // Deprecated: please explicitly pick a version if possible. + Packagemanifest() packagemanifestv1alpha1.PackagemanifestV1alpha1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + packagemanifestV1alpha1 *packagemanifestv1alpha1.PackagemanifestV1alpha1Client +} + +// PackagemanifestV1alpha1 retrieves the PackagemanifestV1alpha1Client +func (c *Clientset) PackagemanifestV1alpha1() packagemanifestv1alpha1.PackagemanifestV1alpha1Interface { + return c.packagemanifestV1alpha1 +} + +// Deprecated: Packagemanifest retrieves the default version of PackagemanifestClient. +// Please explicitly pick a version. +func (c *Clientset) Packagemanifest() packagemanifestv1alpha1.PackagemanifestV1alpha1Interface { + return c.packagemanifestV1alpha1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.packagemanifestV1alpha1, err = packagemanifestv1alpha1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.packagemanifestV1alpha1 = packagemanifestv1alpha1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.packagemanifestV1alpha1 = packagemanifestv1alpha1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/doc.go new file mode 100644 index 00000000..41721ca5 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated clientset. +package versioned diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/fake/clientset_generated.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 00000000..67c32d5a --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,82 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + clientset "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned" + packagemanifestv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1" + fakepackagemanifestv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// PackagemanifestV1alpha1 retrieves the PackagemanifestV1alpha1Client +func (c *Clientset) PackagemanifestV1alpha1() packagemanifestv1alpha1.PackagemanifestV1alpha1Interface { + return &fakepackagemanifestv1alpha1.FakePackagemanifestV1alpha1{Fake: &c.Fake} +} + +// Packagemanifest retrieves the PackagemanifestV1alpha1Client +func (c *Clientset) Packagemanifest() packagemanifestv1alpha1.PackagemanifestV1alpha1Interface { + return &fakepackagemanifestv1alpha1.FakePackagemanifestV1alpha1{Fake: &c.Fake} +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/fake/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/fake/doc.go new file mode 100644 index 00000000..9b99e716 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/fake/register.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/fake/register.go new file mode 100644 index 00000000..fc306e47 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/fake/register.go @@ -0,0 +1,54 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + packagemanifestv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + packagemanifestv1alpha1.AddToScheme(scheme) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/scheme/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/scheme/doc.go new file mode 100644 index 00000000..7dc37561 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/scheme/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/scheme/register.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/scheme/register.go new file mode 100644 index 00000000..3d72f09f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/scheme/register.go @@ -0,0 +1,54 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + packagemanifestv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + packagemanifestv1alpha1.AddToScheme(scheme) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/doc.go new file mode 100644 index 00000000..df51baa4 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/fake/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/fake/doc.go new file mode 100644 index 00000000..16f44399 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/fake/fake_packagemanifest.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/fake/fake_packagemanifest.go new file mode 100644 index 00000000..a61c3409 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/fake/fake_packagemanifest.go @@ -0,0 +1,140 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePackageManifests implements PackageManifestInterface +type FakePackageManifests struct { + Fake *FakePackagemanifestV1alpha1 + ns string +} + +var packagemanifestsResource = schema.GroupVersionResource{Group: "packagemanifest", Version: "v1alpha1", Resource: "packagemanifests"} + +var packagemanifestsKind = schema.GroupVersionKind{Group: "packagemanifest", Version: "v1alpha1", Kind: "PackageManifest"} + +// Get takes name of the packageManifest, and returns the corresponding packageManifest object, and an error if there is any. +func (c *FakePackageManifests) Get(name string, options v1.GetOptions) (result *v1alpha1.PackageManifest, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(packagemanifestsResource, c.ns, name), &v1alpha1.PackageManifest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.PackageManifest), err +} + +// List takes label and field selectors, and returns the list of PackageManifests that match those selectors. +func (c *FakePackageManifests) List(opts v1.ListOptions) (result *v1alpha1.PackageManifestList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(packagemanifestsResource, packagemanifestsKind, c.ns, opts), &v1alpha1.PackageManifestList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.PackageManifestList{ListMeta: obj.(*v1alpha1.PackageManifestList).ListMeta} + for _, item := range obj.(*v1alpha1.PackageManifestList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested packageManifests. +func (c *FakePackageManifests) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(packagemanifestsResource, c.ns, opts)) + +} + +// Create takes the representation of a packageManifest and creates it. Returns the server's representation of the packageManifest, and an error, if there is any. +func (c *FakePackageManifests) Create(packageManifest *v1alpha1.PackageManifest) (result *v1alpha1.PackageManifest, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(packagemanifestsResource, c.ns, packageManifest), &v1alpha1.PackageManifest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.PackageManifest), err +} + +// Update takes the representation of a packageManifest and updates it. Returns the server's representation of the packageManifest, and an error, if there is any. +func (c *FakePackageManifests) Update(packageManifest *v1alpha1.PackageManifest) (result *v1alpha1.PackageManifest, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(packagemanifestsResource, c.ns, packageManifest), &v1alpha1.PackageManifest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.PackageManifest), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakePackageManifests) UpdateStatus(packageManifest *v1alpha1.PackageManifest) (*v1alpha1.PackageManifest, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(packagemanifestsResource, "status", c.ns, packageManifest), &v1alpha1.PackageManifest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.PackageManifest), err +} + +// Delete takes name of the packageManifest and deletes it. Returns an error if one occurs. +func (c *FakePackageManifests) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(packagemanifestsResource, c.ns, name), &v1alpha1.PackageManifest{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePackageManifests) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(packagemanifestsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.PackageManifestList{}) + return err +} + +// Patch applies the patch and returns the patched packageManifest. +func (c *FakePackageManifests) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.PackageManifest, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(packagemanifestsResource, c.ns, name, data, subresources...), &v1alpha1.PackageManifest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.PackageManifest), err +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/fake/fake_packagemanifest_client.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/fake/fake_packagemanifest_client.go new file mode 100644 index 00000000..d7ccfcba --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/fake/fake_packagemanifest_client.go @@ -0,0 +1,40 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakePackagemanifestV1alpha1 struct { + *testing.Fake +} + +func (c *FakePackagemanifestV1alpha1) PackageManifests(namespace string) v1alpha1.PackageManifestInterface { + return &FakePackageManifests{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakePackagemanifestV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/generated_expansion.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/generated_expansion.go new file mode 100644 index 00000000..cb6e88be --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/generated_expansion.go @@ -0,0 +1,21 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +type PackageManifestExpansion interface{} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/packagemanifest.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/packagemanifest.go new file mode 100644 index 00000000..1314efee --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/packagemanifest.go @@ -0,0 +1,174 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1" + scheme "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PackageManifestsGetter has a method to return a PackageManifestInterface. +// A group's client should implement this interface. +type PackageManifestsGetter interface { + PackageManifests(namespace string) PackageManifestInterface +} + +// PackageManifestInterface has methods to work with PackageManifest resources. +type PackageManifestInterface interface { + Create(*v1alpha1.PackageManifest) (*v1alpha1.PackageManifest, error) + Update(*v1alpha1.PackageManifest) (*v1alpha1.PackageManifest, error) + UpdateStatus(*v1alpha1.PackageManifest) (*v1alpha1.PackageManifest, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.PackageManifest, error) + List(opts v1.ListOptions) (*v1alpha1.PackageManifestList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.PackageManifest, err error) + PackageManifestExpansion +} + +// packageManifests implements PackageManifestInterface +type packageManifests struct { + client rest.Interface + ns string +} + +// newPackageManifests returns a PackageManifests +func newPackageManifests(c *PackagemanifestV1alpha1Client, namespace string) *packageManifests { + return &packageManifests{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the packageManifest, and returns the corresponding packageManifest object, and an error if there is any. +func (c *packageManifests) Get(name string, options v1.GetOptions) (result *v1alpha1.PackageManifest, err error) { + result = &v1alpha1.PackageManifest{} + err = c.client.Get(). + Namespace(c.ns). + Resource("packagemanifests"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PackageManifests that match those selectors. +func (c *packageManifests) List(opts v1.ListOptions) (result *v1alpha1.PackageManifestList, err error) { + result = &v1alpha1.PackageManifestList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("packagemanifests"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested packageManifests. +func (c *packageManifests) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("packagemanifests"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a packageManifest and creates it. Returns the server's representation of the packageManifest, and an error, if there is any. +func (c *packageManifests) Create(packageManifest *v1alpha1.PackageManifest) (result *v1alpha1.PackageManifest, err error) { + result = &v1alpha1.PackageManifest{} + err = c.client.Post(). + Namespace(c.ns). + Resource("packagemanifests"). + Body(packageManifest). + Do(). + Into(result) + return +} + +// Update takes the representation of a packageManifest and updates it. Returns the server's representation of the packageManifest, and an error, if there is any. +func (c *packageManifests) Update(packageManifest *v1alpha1.PackageManifest) (result *v1alpha1.PackageManifest, err error) { + result = &v1alpha1.PackageManifest{} + err = c.client.Put(). + Namespace(c.ns). + Resource("packagemanifests"). + Name(packageManifest.Name). + Body(packageManifest). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *packageManifests) UpdateStatus(packageManifest *v1alpha1.PackageManifest) (result *v1alpha1.PackageManifest, err error) { + result = &v1alpha1.PackageManifest{} + err = c.client.Put(). + Namespace(c.ns). + Resource("packagemanifests"). + Name(packageManifest.Name). + SubResource("status"). + Body(packageManifest). + Do(). + Into(result) + return +} + +// Delete takes name of the packageManifest and deletes it. Returns an error if one occurs. +func (c *packageManifests) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("packagemanifests"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *packageManifests) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("packagemanifests"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched packageManifest. +func (c *packageManifests) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.PackageManifest, err error) { + result = &v1alpha1.PackageManifest{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("packagemanifests"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/packagemanifest_client.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/packagemanifest_client.go new file mode 100644 index 00000000..2effee5f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/typed/packagemanifest/v1alpha1/packagemanifest_client.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1" + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type PackagemanifestV1alpha1Interface interface { + RESTClient() rest.Interface + PackageManifestsGetter +} + +// PackagemanifestV1alpha1Client is used to interact with features provided by the packagemanifest group. +type PackagemanifestV1alpha1Client struct { + restClient rest.Interface +} + +func (c *PackagemanifestV1alpha1Client) PackageManifests(namespace string) PackageManifestInterface { + return newPackageManifests(c, namespace) +} + +// NewForConfig creates a new PackagemanifestV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*PackagemanifestV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &PackagemanifestV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new PackagemanifestV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *PackagemanifestV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new PackagemanifestV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *PackagemanifestV1alpha1Client { + return &PackagemanifestV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *PackagemanifestV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/factory.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/factory.go new file mode 100644 index 00000000..dedf3fd9 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/factory.go @@ -0,0 +1,180 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + reflect "reflect" + sync "sync" + time "time" + + versioned "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned" + internalinterfaces "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/internalinterfaces" + packagemanifest "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/packagemanifest" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Packagemanifest() packagemanifest.Interface +} + +func (f *sharedInformerFactory) Packagemanifest() packagemanifest.Interface { + return packagemanifest.New(f, f.namespace, f.tweakListOptions) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/generic.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/generic.go new file mode 100644 index 00000000..20e4b637 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/generic.go @@ -0,0 +1,62 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + "fmt" + + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=packagemanifest, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("packagemanifests"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Packagemanifest().V1alpha1().PackageManifests().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 00000000..16b17cc7 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,38 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + versioned "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/packagemanifest/interface.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/packagemanifest/interface.go new file mode 100644 index 00000000..7215af74 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/packagemanifest/interface.go @@ -0,0 +1,46 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package packagemanifest + +import ( + internalinterfaces "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/packagemanifest/v1alpha1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/packagemanifest/v1alpha1/interface.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/packagemanifest/v1alpha1/interface.go new file mode 100644 index 00000000..9a93e462 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/packagemanifest/v1alpha1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // PackageManifests returns a PackageManifestInformer. + PackageManifests() PackageManifestInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PackageManifests returns a PackageManifestInformer. +func (v *version) PackageManifests() PackageManifestInformer { + return &packageManifestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/packagemanifest/v1alpha1/packagemanifest.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/packagemanifest/v1alpha1/packagemanifest.go new file mode 100644 index 00000000..86b05f0b --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/packagemanifest/v1alpha1/packagemanifest.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + packagemanifest_v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1" + versioned "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/clientset/versioned" + internalinterfaces "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/listers/packagemanifest/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// PackageManifestInformer provides access to a shared informer and lister for +// PackageManifests. +type PackageManifestInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.PackageManifestLister +} + +type packageManifestInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPackageManifestInformer constructs a new informer for PackageManifest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPackageManifestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPackageManifestInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPackageManifestInformer constructs a new informer for PackageManifest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPackageManifestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PackagemanifestV1alpha1().PackageManifests(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PackagemanifestV1alpha1().PackageManifests(namespace).Watch(options) + }, + }, + &packagemanifest_v1alpha1.PackageManifest{}, + resyncPeriod, + indexers, + ) +} + +func (f *packageManifestInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPackageManifestInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *packageManifestInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&packagemanifest_v1alpha1.PackageManifest{}, f.defaultInformer) +} + +func (f *packageManifestInformer) Lister() v1alpha1.PackageManifestLister { + return v1alpha1.NewPackageManifestLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/listers/packagemanifest/v1alpha1/expansion_generated.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/listers/packagemanifest/v1alpha1/expansion_generated.go new file mode 100644 index 00000000..c6cd3e85 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/listers/packagemanifest/v1alpha1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// PackageManifestListerExpansion allows custom methods to be added to +// PackageManifestLister. +type PackageManifestListerExpansion interface{} + +// PackageManifestNamespaceListerExpansion allows custom methods to be added to +// PackageManifestNamespaceLister. +type PackageManifestNamespaceListerExpansion interface{} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/listers/packagemanifest/v1alpha1/packagemanifest.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/listers/packagemanifest/v1alpha1/packagemanifest.go new file mode 100644 index 00000000..54222df0 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/listers/packagemanifest/v1alpha1/packagemanifest.go @@ -0,0 +1,94 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PackageManifestLister helps list PackageManifests. +type PackageManifestLister interface { + // List lists all PackageManifests in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.PackageManifest, err error) + // PackageManifests returns an object that can list and get PackageManifests. + PackageManifests(namespace string) PackageManifestNamespaceLister + PackageManifestListerExpansion +} + +// packageManifestLister implements the PackageManifestLister interface. +type packageManifestLister struct { + indexer cache.Indexer +} + +// NewPackageManifestLister returns a new PackageManifestLister. +func NewPackageManifestLister(indexer cache.Indexer) PackageManifestLister { + return &packageManifestLister{indexer: indexer} +} + +// List lists all PackageManifests in the indexer. +func (s *packageManifestLister) List(selector labels.Selector) (ret []*v1alpha1.PackageManifest, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.PackageManifest)) + }) + return ret, err +} + +// PackageManifests returns an object that can list and get PackageManifests. +func (s *packageManifestLister) PackageManifests(namespace string) PackageManifestNamespaceLister { + return packageManifestNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PackageManifestNamespaceLister helps list and get PackageManifests. +type PackageManifestNamespaceLister interface { + // List lists all PackageManifests in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.PackageManifest, err error) + // Get retrieves the PackageManifest from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.PackageManifest, error) + PackageManifestNamespaceListerExpansion +} + +// packageManifestNamespaceLister implements the PackageManifestNamespaceLister +// interface. +type packageManifestNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PackageManifests in the indexer for a given namespace. +func (s packageManifestNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.PackageManifest, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.PackageManifest)) + }) + return ret, err +} + +// Get retrieves the PackageManifest from the indexer for a given namespace and name. +func (s packageManifestNamespaceLister) Get(name string) (*v1alpha1.PackageManifest, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("packagemanifest"), name) + } + return obj.(*v1alpha1.PackageManifest), nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/util.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/util.go new file mode 100644 index 00000000..60bfa220 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/client/util.go @@ -0,0 +1,36 @@ +package client + +import ( + "net" + "os" + + log "github.com/sirupsen/logrus" + _ "k8s.io/client-go/plugin/pkg/client/auth/oidc" + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/clientcmd" +) + +// getConfig returns a kubernetes config for configuring a client from a kubeconfig string +func getConfig(kubeconfig string) (*rest.Config, error) { + if len(kubeconfig) == 0 { + // Work around https://github.com/kubernetes/kubernetes/issues/40973 + // See https://github.com/coreos/etcd-operator/issues/731#issuecomment-283804819 + if len(os.Getenv("KUBERNETES_SERVICE_HOST")) == 0 { + addrs, err := net.LookupHost("kubernetes.default.svc") + if err != nil { + return nil, err + } + + os.Setenv("KUBERNETES_SERVICE_HOST", addrs[0]) + } + + if len(os.Getenv("KUBERNETES_SERVICE_PORT")) == 0 { + os.Setenv("KUBERNETES_SERVICE_PORT", "443") + } + + log.Infof("Using in-cluster kube client config") + return rest.InClusterConfig() + } + log.Infof("Loading kube client config from path %q", kubeconfig) + return clientcmd.BuildConfigFromFlags("", kubeconfig) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/generated/openapi/zz_generated.openapi.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/generated/openapi/zz_generated.openapi.go new file mode 100644 index 00000000..c6b5d298 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/generated/openapi/zz_generated.openapi.go @@ -0,0 +1,1994 @@ +// +build !ignore_autogenerated + +/* +Copyright 2018 CoreOS, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by openapi-gen. DO NOT EDIT. + +// This file was autogenerated by openapi-gen. Do not edit it manually! + +package openapi + +import ( + spec "github.com/go-openapi/spec" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + common "k8s.io/kube-openapi/pkg/common" +) + +func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { + return map[string]common.OpenAPIDefinition{ + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.AppLink": schema_package_server_apis_packagemanifest_v1alpha1_AppLink(ref), + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.CSVDescription": schema_package_server_apis_packagemanifest_v1alpha1_CSVDescription(ref), + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.Icon": schema_package_server_apis_packagemanifest_v1alpha1_Icon(ref), + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.PackageChannel": schema_package_server_apis_packagemanifest_v1alpha1_PackageChannel(ref), + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.PackageManifest": schema_package_server_apis_packagemanifest_v1alpha1_PackageManifest(ref), + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.PackageManifestList": schema_package_server_apis_packagemanifest_v1alpha1_PackageManifestList(ref), + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.PackageManifestSpec": schema_package_server_apis_packagemanifest_v1alpha1_PackageManifestSpec(ref), + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.PackageManifestStatus": schema_package_server_apis_packagemanifest_v1alpha1_PackageManifestStatus(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup": schema_pkg_apis_meta_v1_APIGroup(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroupList": schema_pkg_apis_meta_v1_APIGroupList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource": schema_pkg_apis_meta_v1_APIResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResourceList": schema_pkg_apis_meta_v1_APIResourceList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIVersions": schema_pkg_apis_meta_v1_APIVersions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.DeleteOptions": schema_pkg_apis_meta_v1_DeleteOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration": schema_pkg_apis_meta_v1_Duration(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ExportOptions": schema_pkg_apis_meta_v1_ExportOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GetOptions": schema_pkg_apis_meta_v1_GetOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind": schema_pkg_apis_meta_v1_GroupKind(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupResource": schema_pkg_apis_meta_v1_GroupResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersion": schema_pkg_apis_meta_v1_GroupVersion(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery": schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionKind": schema_pkg_apis_meta_v1_GroupVersionKind(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionResource": schema_pkg_apis_meta_v1_GroupVersionResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Initializer": schema_pkg_apis_meta_v1_Initializer(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Initializers": schema_pkg_apis_meta_v1_Initializers(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.InternalEvent": schema_pkg_apis_meta_v1_InternalEvent(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector": schema_pkg_apis_meta_v1_LabelSelector(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement": schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.List": schema_pkg_apis_meta_v1_List(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta": schema_pkg_apis_meta_v1_ListMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ListOptions": schema_pkg_apis_meta_v1_ListOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime": schema_pkg_apis_meta_v1_MicroTime(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta": schema_pkg_apis_meta_v1_ObjectMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference": schema_pkg_apis_meta_v1_OwnerReference(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Patch": schema_pkg_apis_meta_v1_Patch(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions": schema_pkg_apis_meta_v1_Preconditions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.RootPaths": schema_pkg_apis_meta_v1_RootPaths(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR": schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Status": schema_pkg_apis_meta_v1_Status(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause": schema_pkg_apis_meta_v1_StatusCause(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails": schema_pkg_apis_meta_v1_StatusDetails(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Time": schema_pkg_apis_meta_v1_Time(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Timestamp": schema_pkg_apis_meta_v1_Timestamp(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta": schema_pkg_apis_meta_v1_TypeMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.WatchEvent": schema_pkg_apis_meta_v1_WatchEvent(ref), + "k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref), + } +} + +func schema_package_server_apis_packagemanifest_v1alpha1_AppLink(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AppLink defines a link to an application", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "url": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_package_server_apis_packagemanifest_v1alpha1_CSVDescription(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CSVDescription defines a description of a CSV", + Properties: map[string]spec.Schema{ + "displayName": { + SchemaProps: spec.SchemaProps{ + Description: "DisplayName is the CSV's display name", + Type: []string{"string"}, + Format: "", + }, + }, + "icon": { + SchemaProps: spec.SchemaProps{ + Description: "Icon is the CSV's base64 encoded icon", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.Icon"), + }, + }, + }, + }, + }, + "provider": { + SchemaProps: spec.SchemaProps{ + Description: "Provider is the CSV's provider", + Ref: ref("github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.AppLink"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.AppLink", "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.Icon"}, + } +} + +func schema_package_server_apis_packagemanifest_v1alpha1_Icon(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Icon defines a base64 encoded icon and media type", + Properties: map[string]spec.Schema{ + "base64data": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "mediatype": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_package_server_apis_packagemanifest_v1alpha1_PackageChannel(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PackageChannel defines a single channel under a package, pointing to a version of that package.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name is the name of the channel, e.g. `alpha` or `stable`", + Type: []string{"string"}, + Format: "", + }, + }, + "currentCSV": { + SchemaProps: spec.SchemaProps{ + Description: "CurrentCSVName defines a reference to the CSV holding the version of this package currently for the channel.", + Type: []string{"string"}, + Format: "", + }, + }, + "currentCSVDesc": { + SchemaProps: spec.SchemaProps{ + Description: "CurrentCSVSpec holds the spec of the current CSV", + Ref: ref("github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.CSVDescription"), + }, + }, + }, + Required: []string{"name", "currentCSV"}, + }, + }, + Dependencies: []string{ + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.CSVDescription"}, + } +} + +func schema_package_server_apis_packagemanifest_v1alpha1_PackageManifest(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PackageManifest holds information about a package, which is a reference to one (or more) channels under a single package.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.PackageManifestSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.PackageManifestStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.PackageManifestSpec", "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.PackageManifestStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_package_server_apis_packagemanifest_v1alpha1_PackageManifestList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PackageManifestList is a list of PackageManifest objects.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.PackageManifest"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.PackageManifest", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_package_server_apis_packagemanifest_v1alpha1_PackageManifestSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PackageManifestSpec defines the desired state of PackageManifest", + Properties: map[string]spec.Schema{}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_package_server_apis_packagemanifest_v1alpha1_PackageManifestStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PackageManifestStatus represents the current status of the PackageManifest", + Properties: map[string]spec.Schema{ + "catalogSource": { + SchemaProps: spec.SchemaProps{ + Description: "CatalogSourceName is the name of the CatalogSource this package belongs to", + Type: []string{"string"}, + Format: "", + }, + }, + "catalogSourceNamespace": { + SchemaProps: spec.SchemaProps{ + Description: "\n CatalogSourceNamespace is the namespace of the owning CatalogSource", + Type: []string{"string"}, + Format: "", + }, + }, + "provider": { + SchemaProps: spec.SchemaProps{ + Description: "Provider is the provider of the PackageManifest's default CSV", + Ref: ref("github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.AppLink"), + }, + }, + "packageName": { + SchemaProps: spec.SchemaProps{ + Description: "PackageName is the name of the overall package, ala `etcd`.", + Type: []string{"string"}, + Format: "", + }, + }, + "channels": { + SchemaProps: spec.SchemaProps{ + Description: "Channels are the declared channels for the package, ala `stable` or `alpha`.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.PackageChannel"), + }, + }, + }, + }, + }, + "defaultChannel": { + SchemaProps: spec.SchemaProps{ + Description: "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.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"catalogSource", "catalogSourceNamespace", "packageName", "channels", "defaultChannel"}, + }, + }, + Dependencies: []string{ + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.AppLink", "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.PackageChannel"}, + } +} + +func schema_pkg_apis_meta_v1_APIGroup(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIGroup contains the name, the supported versions, and the preferred version of a group.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is the name of the group.", + Type: []string{"string"}, + Format: "", + }, + }, + "versions": { + SchemaProps: spec.SchemaProps{ + Description: "versions are the versions supported in this group.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery"), + }, + }, + }, + }, + }, + "preferredVersion": { + SchemaProps: spec.SchemaProps{ + Description: "preferredVersion is the version preferred by the API server, which probably is the storage version.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery"), + }, + }, + "serverAddressByClientCIDRs": { + SchemaProps: spec.SchemaProps{ + Description: "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"), + }, + }, + }, + }, + }, + }, + Required: []string{"name", "versions"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery", "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"}, + } +} + +func schema_pkg_apis_meta_v1_APIGroupList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIGroupList is a list of APIGroup, to allow clients to discover the API at /apis.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "groups": { + SchemaProps: spec.SchemaProps{ + Description: "groups is a list of APIGroup.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup"), + }, + }, + }, + }, + }, + }, + Required: []string{"groups"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup"}, + } +} + +func schema_pkg_apis_meta_v1_APIResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIResource specifies the name of a resource and whether it is namespaced.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is the plural name of the resource.", + Type: []string{"string"}, + Format: "", + }, + }, + "singularName": { + SchemaProps: spec.SchemaProps{ + Description: "singularName is the singular name of the resource. This allows clients to handle plural and singular opaquely. The singularName is more correct for reporting status on a single item and both singular and plural are allowed from the kubectl CLI interface.", + Type: []string{"string"}, + Format: "", + }, + }, + "namespaced": { + SchemaProps: spec.SchemaProps{ + Description: "namespaced indicates if a resource is namespaced or not.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "group": { + SchemaProps: spec.SchemaProps{ + Description: "group is the preferred group of the resource. Empty implies the group of the containing resource list. For subresources, this may have a different value, for example: Scale\".", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Description: "version is the preferred version of the resource. Empty implies the version of the containing resource list For subresources, this may have a different value, for example: v1 (while inside a v1beta1 version of the core resource's group)\".", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo')", + Type: []string{"string"}, + Format: "", + }, + }, + "verbs": { + SchemaProps: spec.SchemaProps{ + Description: "verbs is a list of supported kube verbs (this includes get, list, watch, create, update, patch, delete, deletecollection, and proxy)", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "shortNames": { + SchemaProps: spec.SchemaProps{ + Description: "shortNames is a list of suggested short names of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "categories": { + SchemaProps: spec.SchemaProps{ + Description: "categories is a list of the grouped resources this resource belongs to (e.g. 'all')", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"name", "singularName", "namespaced", "kind", "verbs"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_APIResourceList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIResourceList is a list of APIResource, it is used to expose the name of the resources supported in a specific group and version, and if the resource is namespaced.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "groupVersion": { + SchemaProps: spec.SchemaProps{ + Description: "groupVersion is the group and version this APIResourceList is for.", + Type: []string{"string"}, + Format: "", + }, + }, + "resources": { + SchemaProps: spec.SchemaProps{ + Description: "resources contains the name of the resources and if they are namespaced.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.APIResource"), + }, + }, + }, + }, + }, + }, + Required: []string{"groupVersion", "resources"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource"}, + } +} + +func schema_pkg_apis_meta_v1_APIVersions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIVersions lists the versions that are available, to allow clients to discover the API at /api, which is the root path of the legacy v1 API.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "versions": { + SchemaProps: spec.SchemaProps{ + Description: "versions are the api versions that are available.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "serverAddressByClientCIDRs": { + SchemaProps: spec.SchemaProps{ + Description: "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"), + }, + }, + }, + }, + }, + }, + Required: []string{"versions", "serverAddressByClientCIDRs"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"}, + } +} + +func schema_pkg_apis_meta_v1_DeleteOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "DeleteOptions may be provided when deleting an API object.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "gracePeriodSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "preconditions": { + SchemaProps: spec.SchemaProps{ + Description: "Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions"), + }, + }, + "orphanDependents": { + SchemaProps: spec.SchemaProps{ + Description: "Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "propagationPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions"}, + } +} + +func schema_pkg_apis_meta_v1_Duration(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Duration is a wrapper around time.Duration which supports correct marshaling to YAML and JSON. In particular, it marshals into strings, which can be used as map keys in json.", + Properties: map[string]spec.Schema{ + "Duration": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + Required: []string{"Duration"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_ExportOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ExportOptions is the query options to the standard REST get call.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "export": { + SchemaProps: spec.SchemaProps{ + Description: "Should this value be exported. Export strips fields that a user can not specify.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "exact": { + SchemaProps: spec.SchemaProps{ + Description: "Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"export", "exact"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_GetOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GetOptions is the standard query options to the standard REST get call.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "When specified: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.", + Type: []string{"string"}, + Format: "", + }, + }, + "includeUninitialized": { + SchemaProps: spec.SchemaProps{ + Description: "If true, partially initialized resources are included in the response.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_GroupKind(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupKind specifies a Group and a Kind, but does not force a version. This is useful for identifying concepts during lookup stages without having partially valid types", + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "kind"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_GroupResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupResource specifies a Group and a Resource, but does not force a version. This is useful for identifying concepts during lookup stages without having partially valid types", + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "resource": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "resource"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_GroupVersion(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersion contains the \"group\" and the \"version\", which uniquely identifies the API.", + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "version"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersion contains the \"group/version\" and \"version\" string of a version. It is made a struct to keep extensibility.", + Properties: map[string]spec.Schema{ + "groupVersion": { + SchemaProps: spec.SchemaProps{ + Description: "groupVersion specifies the API group and version in the form \"group/version\"", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Description: "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"groupVersion", "version"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_GroupVersionKind(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersionKind unambiguously identifies a kind. It doesn't anonymously include GroupVersion to avoid automatic coersion. It doesn't use a GroupVersion to avoid custom marshalling", + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "version", "kind"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_GroupVersionResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion to avoid automatic coersion. It doesn't use a GroupVersion to avoid custom marshalling", + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "resource": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "version", "resource"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_Initializer(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Initializer is information about an initializer that has not yet completed.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name of the process that is responsible for initializing this object.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_Initializers(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Initializers tracks the progress of initialization.", + Properties: map[string]spec.Schema{ + "pending": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Initializer"), + }, + }, + }, + }, + }, + "result": { + SchemaProps: spec.SchemaProps{ + Description: "If result is set with the Failure field, the object will be persisted to storage and then deleted, ensuring that other clients can observe the deletion.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Status"), + }, + }, + }, + Required: []string{"pending"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Initializer", "k8s.io/apimachinery/pkg/apis/meta/v1.Status"}, + } +} + +func schema_pkg_apis_meta_v1_InternalEvent(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "InternalEvent makes watch.Event versioned", + Properties: map[string]spec.Schema{ + "Type": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "Object": { + SchemaProps: spec.SchemaProps{ + Description: "Object is:\n * If Type is Added or Modified: the new state of the object.\n * If Type is Deleted: the state of the object immediately before deletion.\n * If Type is Error: *api.Status is recommended; other types may make sense\n depending on context.", + Ref: ref("k8s.io/apimachinery/pkg/runtime.Object"), + }, + }, + }, + Required: []string{"Type", "Object"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.Object"}, + } +} + +func schema_pkg_apis_meta_v1_LabelSelector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.", + Properties: map[string]spec.Schema{ + "matchLabels": { + SchemaProps: spec.SchemaProps{ + Description: "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "matchExpressions": { + SchemaProps: spec.SchemaProps{ + Description: "matchExpressions is a list of label selector requirements. The requirements are ANDed.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement"}, + } +} + +func schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + Properties: map[string]spec.Schema{ + "key": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "key", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "key is the label key that the selector applies to.", + Type: []string{"string"}, + Format: "", + }, + }, + "operator": { + SchemaProps: spec.SchemaProps{ + Description: "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + SchemaProps: spec.SchemaProps{ + Description: "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"key", "operator"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_List(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "List holds a list of objects, which may not be known by the server.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of objects", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_pkg_apis_meta_v1_ListMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.", + Properties: map[string]spec.Schema{ + "selfLink": { + SchemaProps: spec.SchemaProps{ + Description: "selfLink is a URL representing this object. Populated by the system. Read-only.", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency", + Type: []string{"string"}, + Format: "", + }, + }, + "continue": { + SchemaProps: spec.SchemaProps{ + Description: "continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_ListOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ListOptions is the query options to a standard REST list call.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "labelSelector": { + SchemaProps: spec.SchemaProps{ + Description: "A selector to restrict the list of returned objects by their labels. Defaults to everything.", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldSelector": { + SchemaProps: spec.SchemaProps{ + Description: "A selector to restrict the list of returned objects by their fields. Defaults to everything.", + Type: []string{"string"}, + Format: "", + }, + }, + "includeUninitialized": { + SchemaProps: spec.SchemaProps{ + Description: "If true, partially initialized resources are included in the response.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "watch": { + SchemaProps: spec.SchemaProps{ + Description: "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.", + Type: []string{"string"}, + Format: "", + }, + }, + "timeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "limit": { + SchemaProps: spec.SchemaProps{ + Description: "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "continue": { + SchemaProps: spec.SchemaProps{ + Description: "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server the server will respond with a 410 ResourceExpired error indicating the client must restart their list without the continue field. This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_MicroTime(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MicroTime is version of Time with microsecond level precision.", + Type: v1.MicroTime{}.OpenAPISchemaType(), + Format: v1.MicroTime{}.OpenAPISchemaFormat(), + }, + }, + } +} + +func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names", + Type: []string{"string"}, + Format: "", + }, + }, + "generateName": { + SchemaProps: spec.SchemaProps{ + Description: "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency", + Type: []string{"string"}, + Format: "", + }, + }, + "namespace": { + SchemaProps: spec.SchemaProps{ + Description: "Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces", + Type: []string{"string"}, + Format: "", + }, + }, + "selfLink": { + SchemaProps: spec.SchemaProps{ + Description: "SelfLink is a URL representing this object. Populated by the system. Read-only.", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency", + Type: []string{"string"}, + Format: "", + }, + }, + "generation": { + SchemaProps: spec.SchemaProps{ + Description: "A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "creationTimestamp": { + SchemaProps: spec.SchemaProps{ + Description: "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "deletionTimestamp": { + SchemaProps: spec.SchemaProps{ + Description: "DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.\n\nPopulated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "deletionGracePeriodSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "annotations": { + SchemaProps: spec.SchemaProps{ + Description: "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "ownerReferences": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "uid", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference"), + }, + }, + }, + }, + }, + "initializers": { + SchemaProps: spec.SchemaProps{ + Description: "An initializer is a controller which enforces some system invariant at object creation time. This field is a list of initializers that have not yet acted on this object. If nil or empty, this object has been completely initialized. Otherwise, the object is considered uninitialized and is hidden (in list/watch and get calls) from clients that haven't explicitly asked to observe uninitialized objects.\n\nWhen an object is created, the system will populate this list with the current set of initializers. Only privileged users may set or modify this list. Once it is empty, it may not be modified further by any user.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Initializers"), + }, + }, + "finalizers": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "clusterName": { + SchemaProps: spec.SchemaProps{ + Description: "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Initializers", "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_pkg_apis_meta_v1_OwnerReference(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.", + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "API version of the referent.", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids", + Type: []string{"string"}, + Format: "", + }, + }, + "controller": { + SchemaProps: spec.SchemaProps{ + Description: "If true, this reference points to the managing controller.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "blockOwnerDeletion": { + SchemaProps: spec.SchemaProps{ + Description: "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"apiVersion", "kind", "name", "uid"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_Patch(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.", + Properties: map[string]spec.Schema{}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_Preconditions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.", + Properties: map[string]spec.Schema{ + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the target UID.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_RootPaths(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RootPaths lists the paths available at root. For example: \"/healthz\", \"/apis\".", + Properties: map[string]spec.Schema{ + "paths": { + SchemaProps: spec.SchemaProps{ + Description: "paths are the paths available at root.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"paths"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.", + Properties: map[string]spec.Schema{ + "clientCIDR": { + SchemaProps: spec.SchemaProps{ + Description: "The CIDR with which clients can match their IP to figure out the server address that they should use.", + Type: []string{"string"}, + Format: "", + }, + }, + "serverAddress": { + SchemaProps: spec.SchemaProps{ + Description: "Address of this server, suitable for a client that matches the above CIDR. This can be a hostname, hostname:port, IP or IP:port.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"clientCIDR", "serverAddress"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_Status(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Status is a return value for calls that don't return other objects.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of this operation.", + Type: []string{"string"}, + Format: "", + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.", + Type: []string{"string"}, + Format: "", + }, + }, + "details": { + SchemaProps: spec.SchemaProps{ + Description: "Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails"), + }, + }, + "code": { + SchemaProps: spec.SchemaProps{ + Description: "Suggested HTTP return code for this status, 0 if not set.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails"}, + } +} + +func schema_pkg_apis_meta_v1_StatusCause(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.", + Properties: map[string]spec.Schema{ + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "A machine-readable description of the cause of the error. If this value is empty there is no information available.", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the cause of the error. This field may be presented as-is to a reader.", + Type: []string{"string"}, + Format: "", + }, + }, + "field": { + SchemaProps: spec.SchemaProps{ + Description: "The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_StatusDetails(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).", + Type: []string{"string"}, + Format: "", + }, + }, + "group": { + SchemaProps: spec.SchemaProps{ + Description: "The group attribute of the resource associated with the status StatusReason.", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids", + Type: []string{"string"}, + Format: "", + }, + }, + "causes": { + SchemaProps: spec.SchemaProps{ + Description: "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause"), + }, + }, + }, + }, + }, + "retryAfterSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause"}, + } +} + +func schema_pkg_apis_meta_v1_Time(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.", + Type: v1.Time{}.OpenAPISchemaType(), + Format: v1.Time{}.OpenAPISchemaFormat(), + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Timestamp(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Timestamp is a struct that is equivalent to Time, but intended for protobuf marshalling/unmarshalling. It is generated into a serialization that matches Time. Do not use in Go structs.", + Properties: map[string]spec.Schema{ + "seconds": { + SchemaProps: spec.SchemaProps{ + Description: "Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "nanos": { + SchemaProps: spec.SchemaProps{ + Description: "Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. This field may be limited in precision depending on context.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"seconds", "nanos"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_TypeMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TypeMeta describes an individual object in an API response or request with strings representing the type of the object and its API schema version. Structures that are versioned or persisted should inline TypeMeta.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_WatchEvent(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Event represents a single event to a watched resource.", + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "object": { + SchemaProps: spec.SchemaProps{ + Description: "Object is:\n * If Type is Added or Modified: the new state of the object.\n * If Type is Deleted: the state of the object immediately before deletion.\n * If Type is Error: *Status is recommended; other types may make sense\n depending on context.", + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + Required: []string{"type", "object"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_k8sio_apimachinery_pkg_version_Info(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Info contains versioning information. how we'll want to distribute that information.", + Properties: map[string]spec.Schema{ + "major": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "minor": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "gitVersion": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "gitCommit": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "gitTreeState": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "buildDate": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "goVersion": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "compiler": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "platform": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"major", "minor", "gitVersion", "gitCommit", "gitTreeState", "buildDate", "goVersion", "compiler", "platform"}, + }, + }, + Dependencies: []string{}, + } +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/provider/inmem.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/provider/inmem.go new file mode 100644 index 00000000..6156f577 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/provider/inmem.go @@ -0,0 +1,263 @@ +package provider + +import ( + "encoding/json" + "fmt" + "sync" + "time" + + "github.com/ghodss/yaml" + log "github.com/sirupsen/logrus" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/cache" + "k8s.io/client-go/util/workqueue" + + operatorsv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer" + packagev1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1" +) + +const ( + // ConfigMapPackageName is the key for package ConfigMap data + ConfigMapPackageName = "packages" + + // ConfigMapCSVName is the key for CSV ConfigMap data + ConfigMapCSVName = "clusterServiceVersions" +) + +type packageKey struct { + catalogSourceName string + catalogSourceNamespace string + packageName string +} + +// InMemoryProvider syncs and provides PackageManifests from the cluster in an in-memory cache +type InMemoryProvider struct { + *queueinformer.Operator + + mu sync.RWMutex + manifests map[packageKey]packagev1alpha1.PackageManifest +} + +// NewInMemoryProvider returns a pointer to a new InMemoryProvider instance +func NewInMemoryProvider(informers []cache.SharedIndexInformer, queueOperator *queueinformer.Operator) *InMemoryProvider { + // instantiate the in-mem provider + prov := &InMemoryProvider{ + Operator: queueOperator, + manifests: make(map[packageKey]packagev1alpha1.PackageManifest), + } + + // register CatalogSource informers. + queue := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "catalogsources") + queueInformers := queueinformer.New( + queue, + informers, + prov.syncCatalogSource, + nil, + "catsrc", + ) + for _, informer := range queueInformers { + prov.RegisterQueueInformer(informer) + } + + return prov +} + +// parsePackageManifestsFromConfigMap returns a list of PackageManifests from a given ConfigMap +func parsePackageManifestsFromConfigMap(cm *corev1.ConfigMap, catalogSourceName, catalogSourceNamespace string) ([]packagev1alpha1.PackageManifest, error) { + cmName := cm.GetName() + logger := log.WithFields(log.Fields{ + "Action": "Load ConfigMap", + "name": cmName, + }) + + found := false + csvs := make(map[string]operatorsv1alpha1.ClusterServiceVersion) + csvListYaml, ok := cm.Data[ConfigMapCSVName] + if ok { + logger.Debug("ConfigMap contains CSVsf") + csvListJSON, err := yaml.YAMLToJSON([]byte(csvListYaml)) + if err != nil { + log.Debugf("Load ConfigMap -- ERROR %s : error=%s", cmName, err) + return nil, fmt.Errorf("error loading CSV list yaml from ConfigMap %s: %s", cmName, err) + } + + var parsedCSVList []operatorsv1alpha1.ClusterServiceVersion + err = json.Unmarshal([]byte(csvListJSON), &parsedCSVList) + if err != nil { + log.Debugf("Load ConfigMap -- ERROR %s : error=%s", cmName, err) + return nil, fmt.Errorf("error parsing CSV list (json) from ConfigMap %s: %s", cmName, err) + } + + for _, csv := range parsedCSVList { + found = true + + // TODO: add check for invalid CSV definitions + log.Debugf("found csv %s", csv.GetName()) + csvs[csv.GetName()] = csv + } + } + + manifests := []packagev1alpha1.PackageManifest{} + packageListYaml, ok := cm.Data[ConfigMapPackageName] + if ok { + logger.Debug("ConfigMap contains packages") + packageListJSON, err := yaml.YAMLToJSON([]byte(packageListYaml)) + if err != nil { + logger.Debugf("ERROR: %s", err) + return nil, fmt.Errorf("error loading package list yaml from ConfigMap %s: %s", cmName, err) + } + + var parsedStatuses []packagev1alpha1.PackageManifestStatus + err = json.Unmarshal([]byte(packageListJSON), &parsedStatuses) + if err != nil { + logger.Debugf("ERROR: %s", err) + return nil, fmt.Errorf("error parsing package list (json) from ConfigMap %s: %s", cmName, err) + } + + for _, status := range parsedStatuses { + found = true + + // add the name and namespace of the CatalogSource + manifest := packagev1alpha1.PackageManifest{ + ObjectMeta: metav1.ObjectMeta{ + Name: status.PackageName, + Namespace: cm.GetNamespace(), + Labels: map[string]string{}, + }, + Status: status, + } + + manifest.Status.CatalogSourceName = catalogSourceName + manifest.Status.CatalogSourceNamespace = catalogSourceNamespace + + // add all PackageChannel CSVDescriptions + for i, channel := range manifest.Status.Channels { + csv, ok := csvs[channel.CurrentCSVName] + if !ok { + return nil, fmt.Errorf("packagemanifest %s references non-existent csv %s", manifest.Status.PackageName, channel.CurrentCSVName) + } + + manifest.Status.Channels[i].CurrentCSVDesc = packagev1alpha1.CreateCSVDescription(&csv) + + // set the Provider + if manifest.Status.DefaultChannelName != "" && csv.GetName() == manifest.Status.DefaultChannelName || i == 0 { + manifest.Status.Provider = packagev1alpha1.AppLink{ + Name: csv.Spec.Provider.Name, + URL: csv.Spec.Provider.URL, + } + + // add Provider as a label + manifest.ObjectMeta.Labels["provider"] = manifest.Status.Provider.Name + manifest.ObjectMeta.Labels["provider-url"] = manifest.Status.Provider.URL + } + } + + // set CatalogSource labels + manifest.ObjectMeta.Labels["catalog"] = manifest.Status.CatalogSourceName + manifest.ObjectMeta.Labels["catalog-namespace"] = manifest.Status.CatalogSourceNamespace + + log.Debugf("retrieved packagemanifest %s", manifest.GetName()) + manifests = append(manifests, manifest) + } + } + + if !found { + logger.Debug("ERROR: No valid resource found") + return nil, fmt.Errorf("error parsing ConfigMap %s: no valid resources found", cmName) + } + + return manifests, nil +} + +func (m *InMemoryProvider) syncCatalogSource(obj interface{}) error { + // assert as CatalogSource + catsrc, ok := obj.(*operatorsv1alpha1.CatalogSource) + if !ok { + log.Debugf("wrong type: %#v", obj) + return fmt.Errorf("casting catalog source failed") + } + + var manifests []packagev1alpha1.PackageManifest + + // handle by sourceType + switch catsrc.Spec.SourceType { + case "internal": + // get the CatalogSource's ConfigMap + cm, err := m.OpClient.KubernetesInterface().CoreV1().ConfigMaps(catsrc.GetNamespace()).Get(catsrc.Spec.ConfigMap, metav1.GetOptions{}) + if err != nil { + return fmt.Errorf("failed to get catalog config map %s when updating status: %s", catsrc.Spec.ConfigMap, err) + } + + // parse PackageManifest from ConfigMap + manifests, err = parsePackageManifestsFromConfigMap(cm, catsrc.GetName(), catsrc.GetNamespace()) + if err != nil { + return fmt.Errorf("failed to load package manifest from config map %s", cm.GetName()) + } + + default: + return fmt.Errorf("catalog source %s in namespace %s source type %s not recognized", catsrc.GetName(), catsrc.GetNamespace(), catsrc.Spec.SourceType) + } + + // update manifests + m.mu.Lock() + defer m.mu.Unlock() + for _, manifest := range manifests { + key := packageKey{ + catalogSourceName: manifest.Status.CatalogSourceName, + catalogSourceNamespace: manifest.Status.CatalogSourceNamespace, + packageName: manifest.GetName(), + } + + if pm, ok := m.manifests[key]; ok { + // use existing CreationTimestamp + manifest.CreationTimestamp = pm.ObjectMeta.CreationTimestamp + } else { + // set CreationTimestamp if first time seeing the PackageManifest + manifest.CreationTimestamp = metav1.NewTime(time.Now()) + } + + log.Debugf("storing packagemanifest at %+v", key) + m.manifests[key] = manifest + } + + return nil +} + +// ListPackageManifests implements PackageManifestProvider.ListPackageManifests() +func (m *InMemoryProvider) ListPackageManifests(namespace string) (*packagev1alpha1.PackageManifestList, error) { + manifestList := &packagev1alpha1.PackageManifestList{} + + m.mu.RLock() + defer m.mu.RUnlock() + + if len(m.manifests) > 0 { + var matching []packagev1alpha1.PackageManifest + for _, manifest := range m.manifests { + if manifest.GetNamespace() == namespace { + // tack on the csv spec for each channel + matching = append(matching, manifest) + } + } + + manifestList.Items = matching + } + + return manifestList, nil +} + +// GetPackageManifest implements PackageManifestProvider.GetPackageManifest(...) +func (m *InMemoryProvider) GetPackageManifest(namespace, name string) (*packagev1alpha1.PackageManifest, error) { + m.mu.RLock() + defer m.mu.RUnlock() + + var manifest packagev1alpha1.PackageManifest + for key, pm := range m.manifests { + if key.packageName == name && key.catalogSourceNamespace == namespace { + manifest = pm + } + } + + return &manifest, nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/provider/interfaces.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/provider/interfaces.go new file mode 100644 index 00000000..3a107b01 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/provider/interfaces.go @@ -0,0 +1,10 @@ +package provider + +import ( + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1" +) + +type PackageManifestProvider interface { + ListPackageManifests(namespace string) (*v1alpha1.PackageManifestList, error) + GetPackageManifest(namespace, name string) (*v1alpha1.PackageManifest, error) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/server/server.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/server/server.go new file mode 100644 index 00000000..e33555b1 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/server/server.go @@ -0,0 +1,206 @@ +package server + +import ( + "fmt" + "io" + "net" + "time" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/provider" + + "github.com/spf13/cobra" + + log "github.com/sirupsen/logrus" + genericapiserver "k8s.io/apiserver/pkg/server" + genericoptions "k8s.io/apiserver/pkg/server/options" + "k8s.io/client-go/informers" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/cache" + "k8s.io/client-go/tools/clientcmd" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client" + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions" + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer" + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apiserver" + genericpackagemanifests "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apiserver/generic" +) + +// NewCommandStartPackageServer provides a CLI handler for 'start master' command +// with a default PackageServerOptions. +func NewCommandStartPackageServer(defaults *PackageServerOptions, stopCh <-chan struct{}) *cobra.Command { + cmd := &cobra.Command{ + Short: "Launch a package API server", + Long: "Launch a package API server", + RunE: func(c *cobra.Command, args []string) error { + if err := defaults.Run(stopCh); err != nil { + return err + } + return nil + }, + } + + flags := cmd.Flags() + + // flags.BoolVar(&defaults.InsecureKubeletTLS, "kubelet-insecure-tls", defaults.InsecureKubeletTLS, "Do not verify CA of serving certificates presented by Kubelets. For testing purposes only.") + flags.DurationVar(&defaults.WakeupInterval, "interval", defaults.WakeupInterval, "interval at which to re-sync CatalogSources") + flags.StringSliceVar(&defaults.WatchedNamespaces, "watched-namespaces", defaults.WatchedNamespaces, "list of namespaces the package-server will watch watch for CatalogSources") + flags.StringVar(&defaults.Kubeconfig, "kubeconfig", defaults.Kubeconfig, "path to the kubeconfig used to connect to the Kubernetes API server and the Kubelets (defaults to in-cluster config)") + flags.BoolVar(&defaults.Debug, "debug", defaults.Debug, "use debug log level") + + defaults.SecureServing.AddFlags(flags) + defaults.Authentication.AddFlags(flags) + defaults.Authorization.AddFlags(flags) + defaults.Features.AddFlags(flags) + + return cmd +} + +type PackageServerOptions struct { + // RecommendedOptions *genericoptions.RecommendedOptions + SecureServing *genericoptions.SecureServingOptionsWithLoopback + Authentication *genericoptions.DelegatingAuthenticationOptions + Authorization *genericoptions.DelegatingAuthorizationOptions + Features *genericoptions.FeatureOptions + + WakeupInterval time.Duration + WatchedNamespaces []string + + Kubeconfig string + + // Only to be used to for testing + DisableAuthForTesting bool + + // Enable debug log level + Debug bool + + SharedInformerFactory informers.SharedInformerFactory + StdOut io.Writer + StdErr io.Writer +} + +func NewPackageServerOptions(out, errOut io.Writer) *PackageServerOptions { + o := &PackageServerOptions{ + + SecureServing: genericoptions.WithLoopback(genericoptions.NewSecureServingOptions()), + Authentication: genericoptions.NewDelegatingAuthenticationOptions(), + Authorization: genericoptions.NewDelegatingAuthorizationOptions(), + Features: genericoptions.NewFeatureOptions(), + + WatchedNamespaces: []string{"local"}, + WakeupInterval: 5 * time.Minute, + + Debug: false, + + StdOut: out, + StdErr: errOut, + } + + return o +} + +func (o *PackageServerOptions) Complete() error { + return nil +} + +func (o *PackageServerOptions) Config() (*apiserver.Config, error) { + if err := o.SecureServing.MaybeDefaultWithSelfSignedCerts("localhost", nil, []net.IP{net.ParseIP("127.0.0.1")}); err != nil { + return nil, fmt.Errorf("error creating self-signed certificates: %v", err) + } + + serverConfig := genericapiserver.NewConfig(genericpackagemanifests.Codecs) + if err := o.SecureServing.ApplyTo(serverConfig); err != nil { + return nil, err + } + + if !o.DisableAuthForTesting { + if err := o.Authentication.ApplyTo(&serverConfig.Authentication, serverConfig.SecureServing, nil); err != nil { + return nil, err + } + if err := o.Authorization.ApplyTo(&serverConfig.Authorization); err != nil { + return nil, err + } + } + + return &apiserver.Config{ + GenericConfig: serverConfig, + ProviderConfig: genericpackagemanifests.ProviderConfig{}, + }, nil +} + +func (o *PackageServerOptions) Run(stopCh <-chan struct{}) error { + // set debug log level if enabled + if o.Debug { + log.SetLevel(log.DebugLevel) + } + + // grab the config for the API server + config, err := o.Config() + if err != nil { + return err + } + config.GenericConfig.EnableMetrics = true + + // set up the client config + var clientConfig *rest.Config + if len(o.Kubeconfig) > 0 { + loadingRules := &clientcmd.ClientConfigLoadingRules{ExplicitPath: o.Kubeconfig} + loader := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, &clientcmd.ConfigOverrides{}) + + clientConfig, err = loader.ClientConfig() + } else { + clientConfig, err = rest.InClusterConfig() + } + if err != nil { + return fmt.Errorf("unable to construct lister client config: %v", err) + } + + // set up the informers + kubeClient, err := kubernetes.NewForConfig(clientConfig) + if err != nil { + return fmt.Errorf("unable to construct lister client: %v", err) + } + + // create a new client for OLM types (CRs) + crClient, err := client.NewClient(o.Kubeconfig) + if err != nil { + return err + } + + log.Infof("package-server configured to watch namespaces %v", o.WatchedNamespaces) + + // Create an informer for each catalog namespace + catsrcSharedIndexInformers := []cache.SharedIndexInformer{} + for _, namespace := range o.WatchedNamespaces { + nsInformerFactory := externalversions.NewSharedInformerFactoryWithOptions(crClient, o.WakeupInterval, externalversions.WithNamespace(namespace)) + catsrcSharedIndexInformers = append(catsrcSharedIndexInformers, nsInformerFactory.Operators().V1alpha1().CatalogSources().Informer()) + } + + // Create a new queueinformer-based operator. + queueOperator, err := queueinformer.NewOperator(o.Kubeconfig) + if err != nil { + return err + } + + sourceProvider := provider.NewInMemoryProvider(catsrcSharedIndexInformers, queueOperator) + + // inject the providers into the config + config.ProviderConfig.Provider = sourceProvider + + // we should never need to resync, since we're not worried about missing events, + // and resync is actually for regular interval-based reconciliation these days, + // so set the default resync interval to 0 + informerFactory := informers.NewSharedInformerFactory(kubeClient, 0) + + // complete the config to get an API server + server, err := config.Complete(informerFactory).New() + if err != nil { + return err + } + + // run the source provider's informers + go sourceProvider.Run(stopCh) + + // run the apiserver + return server.GenericAPIServer.PrepareRun().Run(stopCh) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/storage/packagemanifest/reststorage.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/storage/packagemanifest/reststorage.go new file mode 100644 index 00000000..05decca2 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/storage/packagemanifest/reststorage.go @@ -0,0 +1,102 @@ +package packagemanifest + +import ( + "context" + + k8serrors "k8s.io/apimachinery/pkg/api/errors" + metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1" + "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/provider" +) + +type PackageManifestStorage struct { + groupResource schema.GroupResource + prov provider.PackageManifestProvider +} + +var _ rest.KindProvider = &PackageManifestStorage{} +var _ rest.Storage = &PackageManifestStorage{} +var _ rest.Getter = &PackageManifestStorage{} +var _ rest.Lister = &PackageManifestStorage{} +var _ rest.Scoper = &PackageManifestStorage{} + +// NewStorage returns an in-memory implementation of storage.Interface. +func NewStorage(groupResource schema.GroupResource, prov provider.PackageManifestProvider) *PackageManifestStorage { + return &PackageManifestStorage{ + groupResource: groupResource, + prov: prov, + } +} + +// Storage interface +func (m *PackageManifestStorage) New() runtime.Object { + return &v1alpha1.PackageManifest{} +} + +// KindProvider interface +func (m *PackageManifestStorage) Kind() string { + return "PackageManifest" +} + +// Lister interface +func (m *PackageManifestStorage) NewList() runtime.Object { + return &v1alpha1.PackageManifestList{} +} + +// Lister interface +func (m *PackageManifestStorage) List(ctx context.Context, options *metainternalversion.ListOptions) (runtime.Object, error) { + // get namespace + namespace := genericapirequest.NamespaceValue(ctx) + + // get selectors + labelSelector := labels.Everything() + if options != nil && options.LabelSelector != nil { + labelSelector = options.LabelSelector + } + + res, err := m.prov.ListPackageManifests(namespace) + if err != nil { + return &v1alpha1.PackageManifestList{}, err + } + + // filter results by label + filtered := []v1alpha1.PackageManifest{} + for _, manifest := range res.Items { + if labelSelector.Matches(labels.Set(manifest.GetLabels())) { + filtered = append(filtered, manifest) + } + } + + res.Items = filtered + return res, nil +} + +// Getter interface +func (m *PackageManifestStorage) Get(ctx context.Context, name string, opts *metav1.GetOptions) (runtime.Object, error) { + namespace := genericapirequest.NamespaceValue(ctx) + manifest := v1alpha1.PackageManifest{} + + pm, err := m.prov.GetPackageManifest(namespace, name) + if err != nil { + return nil, err + } + if pm != nil { + manifest = *pm + } else { + return nil, k8serrors.NewNotFound(m.groupResource, name) + } + + return &manifest, nil +} + +// Scoper interface +func (m *PackageManifestStorage) NamespaceScoped() bool { + return true +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/version/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/version/doc.go new file mode 100644 index 00000000..f29bc704 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/version/doc.go @@ -0,0 +1,2 @@ +// Package version supplies the type for version information collected at build time. +package version diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/version/version.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/version/version.go new file mode 100644 index 00000000..72dd1cac --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/version/version.go @@ -0,0 +1,43 @@ +// Copyright 2018 The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package version + +import ( + "fmt" + "runtime" + + genericversion "k8s.io/apimachinery/pkg/version" +) + +// these come from ldflags +var ( + gitVersion = "v0.0.0-master+$Format:%h$" + gitCommit = "$Format:%H$" // sha1 from git, output of $(git rev-parse HEAD) + gitTreeState = "" // state of git tree, either "clean" or "dirty" + buildDate = "1970-01-01T00:00:00Z" // build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ') +) + +// VersionInfo returns the version information for metrics-server. +func VersionInfo() *genericversion.Info { + return &genericversion.Info{ + GitVersion: gitVersion, + GitCommit: gitCommit, + GitTreeState: gitTreeState, + BuildDate: buildDate, + GoVersion: runtime.Version(), + Compiler: runtime.Compiler, + Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH), + } +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/version/version.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/version/version.go new file mode 100644 index 00000000..b330d47a --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/version/version.go @@ -0,0 +1,14 @@ +package version + +import "fmt" + +// OLMVersion indicates what version of OLM the binary belongs to +var OLMVersion string + +// GitCommit indicates which git commit the binary was built from +var GitCommit string + +// String returns a pretty string concatenation of OLMVersion and GitCommit +func String() string { + return fmt.Sprintf("OLM version: %s\ngit commit: %s\n", OLMVersion, GitCommit) +}