From 82c8167526cb568570821653459dd753195d6abf Mon Sep 17 00:00:00 2001 From: annastopel Date: Sun, 19 May 2019 11:03:33 +0300 Subject: [PATCH] OLM - ci -test. Create cdi-olm-catalog to be able to deploy cdi via olm in ci. This is due to okd 4.1. * Add make tagret docker-olm-catalog * Add build-olm-catalog script that builds tree expected by operator-registry. * add catalogsource manifest to deploy operator registry per provider * os * k8s * update olm documentation with opertor-registry deployment --- Makefile | 11 +- cluster-sync/ephemeral_provider.sh | 20 ++- cluster-sync/external/provider.sh | 24 +++- cluster-sync/k8s-1.13.3/provider.sh | 6 + cluster-sync/okd-4.1.0/provider.sh | 12 ++ cluster-sync/os-3.11.0-crio/provider.sh | 6 + cluster-sync/sync.sh | 10 +- doc/cdi-operator-olm.md | 130 +++++++++++++++++- hack/README.md | 3 +- hack/build/build-cdi-olm-catalog.sh | 82 +++++++++++ hack/build/config.sh | 3 +- hack/build/docker/cdi-olm-catalog/Dockerfile | 12 ++ .../k8s/cdi-catalogsource-registry.yaml.in | 13 ++ .../olm/os/cdi-catalogsource-registry.yaml.in | 14 ++ .../release/olm/os/cdi-subscription.yaml.in | 1 - 15 files changed, 335 insertions(+), 12 deletions(-) create mode 100755 hack/build/build-cdi-olm-catalog.sh create mode 100644 hack/build/docker/cdi-olm-catalog/Dockerfile create mode 100644 manifests/templates/release/olm/k8s/cdi-catalogsource-registry.yaml.in create mode 100644 manifests/templates/release/olm/os/cdi-catalogsource-registry.yaml.in diff --git a/Makefile b/Makefile index 083ed14041..cd20936e32 100644 --- a/Makefile +++ b/Makefile @@ -16,11 +16,13 @@ docker docker-controller docker-cloner docker-importer docker-apiserver docker-uploadproxy docker-uploadserver docker-operator docker-functest-image-init docker-functest-image-http docker-functest-registry-populate docker-functest-registry docker-functest-registry-init docker-functest-block-device \ cluster-up cluster-down cluster-sync cluster-sync-controller cluster-sync-cloner cluster-sync-importer cluster-sync-apiserver cluster-sync-uploadproxy cluster-sync-uploadserver \ olm-verify olm-push \ + manifests \ + docker docker-controller docker-cloner docker-importer docker-apiserver docker-uploadproxy docker-uploadserver docker-operator docker-functest-image-init docker-functest-image-http docker-functest-registry-populate docker-functest-registry docker-functest-registry-init docker-functest-block-device docker-olm-catalog \ + cluster-sync cluster-sync-controller cluster-sync-cloner cluster-sync-importer cluster-sync-apiserver cluster-sync-uploadproxy cluster-sync-uploadserver \ test test-functional test-unit test-lint \ publish \ vet \ format \ - manifests \ goveralls \ release-description @@ -49,7 +51,7 @@ apidocs: ${DO} "./hack/update-codegen.sh && ./hack/gen-swagger-doc/gen-swagger-docs.sh v1alpha1 html" build: - ${DO} "./hack/build/build-go.sh clean && ./hack/build/build-go.sh build ${WHAT} && ./hack/build/build-cdi-func-test-file-host.sh && ./hack/build/build-cdi-func-test-registry-host.sh && ./hack/build/build-cdi-func-test-block-device.sh && DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} VERBOSITY=${VERBOSITY} PULL_POLICY=${PULL_POLICY} QUAY_NAMESPACE=${QUAY_NAMESPACE} QUAY_REPOSITORY=${QUAY_REPOSITORY} CSV_VERSION=${CSV_VERSION} ./hack/build/build-manifests.sh ${WHAT} && ./hack/build/build-copy-artifacts.sh ${WHAT}" + ${DO} "DOCKER_REPO=${DOCKER_REPO} DOCKER_TAG=${DOCKER_TAG} VERBOSITY=${VERBOSITY} PULL_POLICY=${PULL_POLICY} QUAY_NAMESPACE=${QUAY_NAMESPACE} QUAY_REPOSITORY=${QUAY_REPOSITORY} CSV_VERSION=${CSV_VERSION} ./hack/build/build-go.sh clean && ./hack/build/build-go.sh build ${WHAT} && ./hack/build/build-cdi-func-test-file-host.sh && ./hack/build/build-cdi-func-test-registry-host.sh && ./hack/build/build-cdi-func-test-block-device.sh && ./hack/build/build-cdi-olm-catalog.sh && ./hack/build/build-copy-artifacts.sh ${WHAT}" build-controller: WHAT = cmd/cdi-controller build-controller: build @@ -106,7 +108,10 @@ docker-uploadserver: WHAT = cmd/cdi-uploadserver docker-uploadserver: docker docker-operator: WHAT = cmd/cdi-operator docker-operator: docker -docker-functest-images: docker-functest-image-http docker-functest-image-init docker-functest-registry-init docker-functest-registry-populate docker-functest-registry docker-functest-block-device +docker-olm-catalog: WHAT = tools/cdi-olm-catalog +docker-olm-catalog: + ${DO} ./hack/build/build-cdi-olm-catalog.sh && ./hack/build/build-docker.sh build ${WHAT} +docker-functest-images: docker-functest-image-http docker-functest-image-init docker-functest-registry-init docker-functest-registry-populate docker-functest-registry docker-functest-block-device docker-olm-catalog docker-functest-image-init: WHAT = tools/cdi-func-test-file-host-init docker-functest-image-init: docker docker-functest-image-http: WHAT = tools/cdi-func-test-file-host-http diff --git a/cluster-sync/ephemeral_provider.sh b/cluster-sync/ephemeral_provider.sh index dc79811c4c..43f7b4f056 100644 --- a/cluster-sync/ephemeral_provider.sh +++ b/cluster-sync/ephemeral_provider.sh @@ -30,4 +30,22 @@ function verify() { function configure_local_storage() { echo "Local storage already configured ..." -} \ No newline at end of file +} + +function wait_cdi_crd_installed { + timeout=$1 + crd_defined=0 + while [ $crd_defined -eq 0 ] && [ $timeout > 0 ]; do + crd_defined=$(kubectl get customresourcedefinition| grep cdis.cdi.kubevirt.io | wc -l) + sleep 1 + timeout=timeout-1 + done + + #In case CDI crd is not defined after 120s - throw error + if [ $timeout \< 1 ]; then + echo "ERROR - CDI CRD is not defined after timeout" + exit 1 + fi + +} + diff --git a/cluster-sync/external/provider.sh b/cluster-sync/external/provider.sh index 4d93d8bf8e..03597ad808 100644 --- a/cluster-sync/external/provider.sh +++ b/cluster-sync/external/provider.sh @@ -19,4 +19,26 @@ function up() { function configure_local_storage() { echo "Local storage not needed for external provider..." -} \ No newline at end of file +} + +function install_cdi { + _kubectl apply -f "./_out/manifests/release/cdi-operator.yaml" +} + +function wait_cdi_crd_installed { + timeout=$1 + crd_defined=0 + while [ $crd_defined -eq 0 ] && [ $timeout > 0 ]; do + crd_defined=$(kubectl get customresourcedefinition| grep cdis.cdi.kubevirt.io | wc -l) + sleep 1 + timeout=timeout-1 + done + + #In case CDI crd is not defined after 120s - throw error + if [ $timeout \< 1 ]; then + echo "ERROR - CDI CRD is not defined after timeout" + exit 1 + fi + +} + diff --git a/cluster-sync/k8s-1.13.3/provider.sh b/cluster-sync/k8s-1.13.3/provider.sh index dd1f3f7604..e2149b309d 100644 --- a/cluster-sync/k8s-1.13.3/provider.sh +++ b/cluster-sync/k8s-1.13.3/provider.sh @@ -9,3 +9,9 @@ re='^-?[0-9]+$' if ! [[ $num_nodes =~ $re ]] || [[ $num_nodes -lt 1 ]] ; then num_nodes=1 fi + +function install_cdi { + + _kubectl apply -f "./_out/manifests/release/cdi-operator.yaml" +} + diff --git a/cluster-sync/okd-4.1.0/provider.sh b/cluster-sync/okd-4.1.0/provider.sh index fae96cfeaf..9f77f883bd 100644 --- a/cluster-sync/okd-4.1.0/provider.sh +++ b/cluster-sync/okd-4.1.0/provider.sh @@ -44,3 +44,15 @@ function configure_local_storage() { set -e fi } + + +function install_cdi { + #Install CDI via OLM + _kubectl create ns cdi + _kubectl apply -f _out/manifests/release/olm/operatorgroup.yaml + _kubectl apply -f _out/manifests/release/olm/k8s/cdi-catalogsource-registry.yaml + _kubectl apply -f _out/manifests/release/olm/k8s/cdi-subscription.yaml +} + + + diff --git a/cluster-sync/os-3.11.0-crio/provider.sh b/cluster-sync/os-3.11.0-crio/provider.sh index dd1f3f7604..af3ce441bd 100644 --- a/cluster-sync/os-3.11.0-crio/provider.sh +++ b/cluster-sync/os-3.11.0-crio/provider.sh @@ -9,3 +9,9 @@ re='^-?[0-9]+$' if ! [[ $num_nodes =~ $re ]] || [[ $num_nodes -lt 1 ]] ; then num_nodes=1 fi + +function install_cdi { + _kubectl apply -f "./_out/manifests/release/cdi-operator.yaml" +} + + diff --git a/cluster-sync/sync.sh b/cluster-sync/sync.sh index 2b52d99635..13b37e5764 100755 --- a/cluster-sync/sync.sh +++ b/cluster-sync/sync.sh @@ -28,21 +28,27 @@ if [ "${KUBEVIRT_PROVIDER}" != "external" ]; then registry=${IMAGE_REGISTRY:-localhost:$(_port registry)} DOCKER_PREFIX=${registry} MANIFEST_REGISTRY="registry:5000" + QUAY_NAMESPACE="none" fi # Need to set the DOCKER_PREFIX appropriately in the call to `make docker push`, otherwise make will just pass in the default `kubevirt` +QUAY_NAMESPACE=$QUAY_NAMESPACE DOCKER_PREFIX=$MANIFEST_REGISTRY PULL_POLICY=$(getTestPullPolicy) make manifests DOCKER_PREFIX=$DOCKER_PREFIX make docker push -DOCKER_PREFIX=$MANIFEST_REGISTRY PULL_POLICY=$(getTestPullPolicy) make manifests seed_images configure_local_storage # Install CDI -_kubectl apply -f "./_out/manifests/release/cdi-operator.yaml" +install_cdi + +#wait cdi crd is installed with 120s timeout +wait_cdi_crd_installed 120 + _kubectl apply -f "./_out/manifests/release/cdi-cr.yaml" _kubectl wait cdis.cdi.kubevirt.io/cdi --for=condition=running --timeout=120s + # Start functional test HTTP server. # We skip the functional test additions for external provider for now, as they're specific if [ "${KUBEVIRT_PROVIDER}" != "external" ]; then diff --git a/doc/cdi-operator-olm.md b/doc/cdi-operator-olm.md index 7b00438d7a..5301a4ae60 100644 --- a/doc/cdi-operator-olm.md +++ b/doc/cdi-operator-olm.md @@ -17,6 +17,7 @@ https://github.com/kubevirt/kubevirt/blob/master/docs/devel/olm-integration.md | ------------- |:-------------|:--------------| | _OperatorSource_ | Is used to define the external datastore we are using to store operator bundles |https://github.com/operator-framework/operator-marketplace/blob/master/README.md| | _CatalogSourceConfig_ | Is used to enable an operator present in the _OperatorSource_ to your cluster. Behind the scenes, it will configure an OLM CatalogSource so that the operator can then be managed by OLM. | https://github.com/operator-framework/operator-marketplace/blob/master/README.md| +| _operator-registry_ | Operator Registry runs in a Kubernetes or OpenShift cluster to provide operator catalog data to Operator Lifecycle Manager. | https://github.com/operator-framework/operator-registry| | _Subscription_ | Monitors CatalogSource for updates | https://github.com/operator-framework/operator-lifecycle-manager/tree/274df58592c2ffd1d8ea56156c73c7746f57efc0#discovery-catalogs-and-automated-upgrades | | _OperatorGroup_ | An OperatorGroup is an OLM resource that provides rudimentary multitenant configuration to OLM installed operators. | https://github.com/operator-framework/operator-lifecycle-manager/blob/master/Documentation/design/operatorgroups.md| @@ -114,7 +115,7 @@ cluster/kubectl.sh apply -f _out/manifests/release/cdi-cr.yaml Now CDI deployment should finish its deployment successfully #### k8s cluster -- Install CDI operatorsource manifest that specifies the location of CDI OLM bundle in quay +- Install CDI operatorsource manifest that specifies the location of CDI OLM bundle in quay. **Vocabulary**: _OperatorSource_ is used to define the external datastore we are using to store operator bundles ```bash kubectl apply -f _out/manifests/release/olm/k8s/cdi-operatorsource.yaml @@ -127,7 +128,7 @@ kubectl create ns cdi ```bash kubectl apply -f _out/manifests/release/olm/operatorgroup.yaml ``` -- Install CatalogSourceConfig resource +- Install CatalogSourceConfig resource. **Vocabulary**: _CatalogSourceConfig_ is used to enable an operator present in the _OperatorSource_ to your cluster. Behind the scenes, it will configure an OLM CatalogSource so that the operator can then be managed by OLM. ```bash kubectl create --save-config -f _out/manifests/release/olm/k8s/cdi-catalogsource.yaml @@ -152,6 +153,129 @@ cluster/kubectl.sh apply -f _out/manifests/release/cdi-cr.yaml ``` Now the operator should finish its deployment successfully + +### CDI Installation via OLM with operator-registry +It is possible to deploy operator via OLM without marketplace operator. Marketplace operator is required in order to fetch OLM bundle from the specified quay repo. Operator framework provides a way to create _CatalogSource_ with manifests without hosting them in quay. This functionlaity is introduced in operator-registry https://github.com/operator-framework/operator-registry + +In order to deploy operator-registry a _CatalogSource_ manifest has to reference a container image that is based on _quay.io/openshift/origin-operator-registry_ and has operator OLM manifests under /registry directory. + +#####Example of Dockerfile +``` +> cat Dockerfile +FROM quay.io/openshift/origin-operator-registry + +COPY olm-catalog /registry + +# Initialize the database +RUN initializer --manifests /registry --output bundles.db + +# There are multiple binaries in the origin-operator-registry +# We want the registry-server +ENTRYPOINT ["registry-server"] +CMD ["--database", "bundles.db"] + +``` +#####Example of CatalogSource +``` +apiVersion: operators.coreos.com/v1alpha1 +kind: CatalogSource +metadata: + name: cdi-operatorhub + namespace: cdi +spec: + sourceType: grpc + image: docker.io/kubevirt/cdi-olm-catalog:latest + displayName: KubeVirt CDI + publisher: Red Hat + +``` + +Once such _CatalogSource_ is deployed, it provides operartor's OLM manifests via grpc interface and can be consumed by OLM subscription mechanism. + +#### OKD4.x cluster +- Generate CDI OLM manifests +- Create operator-registry container image +``` +CSV_VERSION= DOCKER_REPO= DOCKER_TAG= make docker-olm-catalog +``` +- Push operator-registry container image to dockerhub +``` +docker push DOCKER_REPO/cdi-olm-catalog:DOCKER_TAG +``` +- Create CDI namespace +```bash +kubectl create ns cdi +``` +- Configure namespace to be allowed to create operators there +```bash +kubectl apply -f _out/manifests/release/olm/operatorgroup.yaml +``` +- Install catalogsourceconfig that refers to the created operator-registry container image +```bash +kubectl apply -f _out/manifests/release/olm/os/cdi-catalogsource-registry.yaml +``` +- Install subscription that will point from which channel the app is downloaded +```bash +kubectl apply -f _out/manifests/release/olm/os/cdi-subscription.yaml +``` +- Verify CDI installation plan was created +```bash +kubectl get operatorsource,catalogsourceconfig,catalogsource,subscription,installplan -n cdi +NAME PACKAGE SOURCE CHANNEL +subscription.operators.coreos.com/cdi cdi cdi beta + +NAME CSV SOURCE APPROVAL APPROVED +installplan.operators.coreos.com/install-995l9 cdioperator.0.0.0 Automatic true + +``` +- Now cdi-operator starts running but in to install CDI we need to deploy cdi cr +```bash +cluster/kubectl.sh apply -f _out/manifests/release/cdi-cr.yaml +``` +Now CDI deployment should finish its deployment successfully + +#### k8s cluster +- Generate CDI OLM manifests +- Create operator-registry container image +``` +CSV_VERSION= DOCKER_REPO= DOCKER_TAG= make docker-olm-catalog +``` +- Push operator-registry container image to dockerhub +``` +docker push DOCKER_REPO/cdi-olm-catalog:DOCKER_TAG +``` +- Create CDI namespace +```bash +kubectl create ns cdi +``` +- Configure namespace to be allowed to create operators there +```bash +kubectl apply -f _out/manifests/release/olm/operatorgroup.yaml +``` +- Install _CatalogSource_ that refers to the created operator-registry container image +```bash +kubectl apply -f _out/manifests/release/olm/k8s/cdi-catalogsource-registry.yaml +``` +- Install subscription that will point from which channel the app is downloaded +```bash +kubectl apply -f _out/manifests/release/olm/k8s/cdi-subscription.yaml +``` +- Verify CDI installation plan was created +```bash +kubectl get operatorsource,catalogsourceconfig,catalogsource,subscription,installplan -n cdi +NAME PACKAGE SOURCE CHANNEL +subscription.operators.coreos.com/cdi cdi cdi beta + +NAME CSV SOURCE APPROVAL APPROVED +installplan.operators.coreos.com/install-995l9 cdioperator.0.0.0 Automatic true + +``` +- Now cdi-operator starts running but in order for it to succeed we need to deploy cdi cr +```bash +cluster/kubectl.sh apply -f _out/manifests/release/cdi-cr.yaml +``` +Now the operator should finish its deployment successfully + ### CDI OLM update OLM mechanism supports operator update via subscription mechanism. Once subscription manifest is installed on cluster, it monitors the catalog source. CatalogSource in its turn monitors the location in quay and when new OLM bundle appears, OLM can trigger update of the operator. @@ -172,6 +296,8 @@ DOCKER_REPO= DOCKER_TAG= PULL_POLICY= VERBOSITY=< ```bash QUAY_NAMESPACE= QUAY_REPOSITORY= QUAY_USERNAME= QUAY_PASSWORD= CSV_VERSION= make olm-push ``` + + ### OKD UI - Grant cluster-admin permissions to kube-system:default diff --git a/hack/README.md b/hack/README.md index e362cc6579..f8bcf69906 100644 --- a/hack/README.md +++ b/hack/README.md @@ -71,7 +71,8 @@ The standard workflow is performed inside a helper container to normalize the bu - `docker-uploadproxy`: compile cdi-uploadproxy and build cdi-uploadproxy image - `docker-uploadserver`: compile cdi-uploadserver and build cdi-uploadserver image - `docker-operator`: compile cdi-operator and build cdi-operator image - - `docker-registry-cleanup`: remove all images of specifed repo from local docker registry. if not specified removes from localhost repo of current cluster instance. Accepts [make variables](#make-variables) DOCKER_PREFIX. + - `docker-olm-catalog`: pack OLM bundles in dedicated directories under olm-catalog and build olm-catalog-registry container image. Accepts [make variables](#make-variables) QUAY_NAMESPACE, QUAY_REPOSITORY, CSV_VERSION. + - `docker-registry-cleanup`: remove all images of specifed repo from local docker registry. if not specified removes from localhost repo of current cluster instance. Accepts [make variables](#make-variables) DOCKER_REPO. - `docker-functest-images`: compile and build the file host and docker registry images for functional tests - `docker-functest-image-init`: compile and build the file host init image for functional tests - `docker-functest-image-http`: only build the file host http container for functional tests diff --git a/hack/build/build-cdi-olm-catalog.sh b/hack/build/build-cdi-olm-catalog.sh new file mode 100755 index 0000000000..bb1cfdbb50 --- /dev/null +++ b/hack/build/build-cdi-olm-catalog.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash + +#Copyright 2018 The CDI Authors. +# +#Licensed under the Apache License, Version 2.0 (the "License"); +#you may not use this file except in compliance with the License. +#You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +#Unless required by applicable law or agreed to in writing, software +#distributed under the License is distributed on an "AS IS" BASIS, +#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +#See the License for the specific language governing permissions and +#limitations under the License. + +set -euo pipefail + +script_dir="$(readlink -f $(dirname $0))" +source "${script_dir}"/common.sh +source "${script_dir}"/config.sh + + +OUT_PATH="${OUT_DIR}" +OLM_CATALOG_INIT_PATH="tools/${CDI_OLM_CATALOG}" +OLM_CATALOG_OUT_PATH=${OUT_PATH}/${OLM_CATALOG_INIT_PATH} +OLM_MANIFESTS_SRC_PATH=${OUT_PATH}/manifests/release/olm/bundle +OLM_MANIFESTS_DIR=olm-catalog +OLM_PACKAGE=${QUAY_REPOSITORY} + +#create directory for olm catalog container +mkdir -p "${OLM_CATALOG_OUT_PATH}" + + +#copy OLM manifests of a provided csv version to a dedicated directory +function packBundle { + csv=$1 + mkdir -p ${OLM_CATALOG_OUT_PATH}/${OLM_MANIFESTS_DIR}/${OLM_PACKAGE=}/${csv} + cp ${OLM_MANIFESTS_SRC_PATH}/${csv} ${OLM_CATALOG_OUT_PATH}/${OLM_MANIFESTS_DIR}/${OLM_PACKAGE}/${csv} + cp ${OLM_MANIFESTS_SRC_PATH}/*crd* ${OLM_CATALOG_OUT_PATH}/${OLM_MANIFESTS_DIR}/${OLM_PACKAGE}/${csv} +} + +#iterate over all OLM bundles and for each one build a dedicated directory +function packBundles { + csvs=$1 + for csv in $(ls -1 $csvs); do + if [[ $csv =~ "csv" ]]; then + echo "pack bundle for CSV "${csv} + packBundle $csv + fi + done +} + +${BUILD_DIR}/build-copy-artifacts.sh "${OLM_CATALOG_INIT_PATH}" + +#copy Dockerfile +cp ${BUILD_DIR}/docker/${CDI_OLM_CATALOG}/* ${OLM_CATALOG_OUT_PATH}/ + +#Build directory structure expected by olm-catalog-registry +# olm-catalog--- +# | +# ---cdi-- +# | +# package manifest +# ${CSV_VERSION} directory -- +# | +# crd manifests +# csv manifests +# +# +mkdir -p ${OLM_CATALOG_OUT_PATH}/${OLM_MANIFESTS_DIR} +mkdir -p ${OLM_CATALOG_OUT_PATH}/${OLM_MANIFESTS_DIR}/${OLM_PACKAGE} +cp ${OLM_MANIFESTS_SRC_PATH}/*package* ${OLM_CATALOG_OUT_PATH}/${OLM_MANIFESTS_DIR}/${OLM_PACKAGE}/ + +packBundles ${OLM_MANIFESTS_SRC_PATH} + + + + + + + diff --git a/hack/build/config.sh b/hack/build/config.sh index 0402d34c63..2653f10542 100755 --- a/hack/build/config.sh +++ b/hack/build/config.sh @@ -19,6 +19,7 @@ APISERVER="cdi-apiserver" UPLOADPROXY="cdi-uploadproxy" UPLOADSERVER="cdi-uploadserver" OPERATOR="cdi-operator" +CDI_OLM_CATALOG="cdi-olm-catalog" FUNC_TEST_INIT="cdi-func-test-file-host-init" FUNC_TEST_HTTP="cdi-func-test-file-host-http" FUNC_TEST_REGISTRY="cdi-func-test-registry" @@ -37,7 +38,7 @@ APISERVER_MAIN="cmd/${APISERVER}" UPLOADPROXY_MAIN="cmd/${UPLOADPROXY}" UPLOADSERVER_MAIN="cmd/${UPLOADSERVER}" -DOCKER_IMAGES="cmd/${OPERATOR} cmd/${CONTROLLER} cmd/${IMPORTER} cmd/${CLONER} cmd/${APISERVER} cmd/${UPLOADPROXY} cmd/${UPLOADSERVER} cmd/${OPERATOR} tools/${FUNC_TEST_INIT} tools/${FUNC_TEST_HTTP} tools/${FUNC_TEST_REGISTRY} tools/${FUNC_TEST_REGISTRY_POPULATE} tools/${FUNC_TEST_REGISTRY_INIT} tools/${FUNC_TEST_BLOCK_DEVICE}" +DOCKER_IMAGES="cmd/${OPERATOR} cmd/${CONTROLLER} cmd/${IMPORTER} cmd/${CLONER} cmd/${APISERVER} cmd/${UPLOADPROXY} cmd/${UPLOADSERVER} cmd/${OPERATOR} tools/${FUNC_TEST_INIT} tools/${FUNC_TEST_HTTP} tools/${FUNC_TEST_REGISTRY} tools/${FUNC_TEST_REGISTRY_POPULATE} tools/${FUNC_TEST_REGISTRY_INIT} tools/${FUNC_TEST_BLOCK_DEVICE} tools/${CDI_OLM_CATALOG}" DOCKER_PREFIX=${DOCKER_PREFIX:-kubevirt} CONTROLLER_IMAGE_NAME=${CONTROLLER_IMAGE_NAME:-cdi-controller} IMPORTER_IMAGE_NAME=${IMPORTER_IMAGE_NAME:-cdi-importer} diff --git a/hack/build/docker/cdi-olm-catalog/Dockerfile b/hack/build/docker/cdi-olm-catalog/Dockerfile new file mode 100644 index 0000000000..9eae71abc5 --- /dev/null +++ b/hack/build/docker/cdi-olm-catalog/Dockerfile @@ -0,0 +1,12 @@ +FROM quay.io/openshift/origin-operator-registry + +COPY olm-catalog /registry + +# Initialize the database +RUN initializer --manifests /registry --output bundles.db + +# There are multiple binaries in the origin-operator-registry +# We want the registry-server +ENTRYPOINT ["registry-server"] +CMD ["--database", "bundles.db"] + diff --git a/manifests/templates/release/olm/k8s/cdi-catalogsource-registry.yaml.in b/manifests/templates/release/olm/k8s/cdi-catalogsource-registry.yaml.in new file mode 100644 index 0000000000..6fa039ae49 --- /dev/null +++ b/manifests/templates/release/olm/k8s/cdi-catalogsource-registry.yaml.in @@ -0,0 +1,13 @@ +apiVersion: operators.coreos.com/v1alpha1 +kind: CatalogSource +metadata: + name: {{.QuayRepository}} + namespace: {{.Namespace}} +spec: + sourceType: grpc + image: {{ .DockerRepo }}/cdi-olm-catalog:{{ .DockerTag }} + displayName: KubeVirt CDI + publisher: Red Hat + + + diff --git a/manifests/templates/release/olm/os/cdi-catalogsource-registry.yaml.in b/manifests/templates/release/olm/os/cdi-catalogsource-registry.yaml.in new file mode 100644 index 0000000000..f5a854f7bf --- /dev/null +++ b/manifests/templates/release/olm/os/cdi-catalogsource-registry.yaml.in @@ -0,0 +1,14 @@ +apiVersion: operators.coreos.com/v1alpha1 +kind: CatalogSource +metadata: + name: cdi-operatorhub + namespace: {{.Namespace}} +spec: + sourceType: grpc + image: {{ .DockerRepo }}/cdi-olm-catalog:{{ .DockerTag }} + displayName: KubeVirt CDI + publisher: Red Hat + + + + diff --git a/manifests/templates/release/olm/os/cdi-subscription.yaml.in b/manifests/templates/release/olm/os/cdi-subscription.yaml.in index 869e6e2567..d35f206845 100644 --- a/manifests/templates/release/olm/os/cdi-subscription.yaml.in +++ b/manifests/templates/release/olm/os/cdi-subscription.yaml.in @@ -9,4 +9,3 @@ spec: source: {{.QuayRepository}} sourceNamespace: {{.Namespace}} -