Skip to content

Commit

Permalink
Avoid CatalogSourceConfig (#553)
Browse files Browse the repository at this point in the history
CatalogSourceConfig has been removed (not deprecated) on
OLM side with
operator-framework/operator-marketplace#302
Avoid using it and use only OperatorSource in all the
marketplace based deployment scripts.
The OperatorSource will implicitly trigger the creation of
a CatalogSource with the same name.

Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
  • Loading branch information
tiraboschi committed May 5, 2020
1 parent f7c9970 commit 2293a1a
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 66 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ Make the unreleased bundles available in Marketplace by adding the app registry:
```bash
# Remove the hco-bundle from the community-operators sources
$ kubectl get operatorsource -n openshift-marketplace community-operators -o yaml | sed "s/hco-operatorhub,//" | kubectl apply -f -
$ kubectl get catalogsourceconfig -n openshift-marketplace community-operators -o yaml | sed "s/hco-operatorhub,//" | sed "s/hco-operatorhub\:*,//" | kubectl apply -f -

# Add the unreleases bundle source
$ curl https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/master/tools/quay-registry.sh | bash -s $QUAY_USERNAME $QUAY_PASSWORD
Expand Down
1 change: 0 additions & 1 deletion deploy/cleanup_marketplace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ TARGET_NAMESPACE="${TARGET_NAMESPACE:-kubevirt-hyperconverged}"
APP_REGISTRY="${APP_REGISTRY:-kubevirt-hyperconverged}"
HCO_VERSION="${HCO_VERSION:-1.0.0}"

oc delete csc hco-catalogsource-config -n $MARKETPLACE
oc delete catalogsource $APP_REGISTRY -n $MARKETPLACE
oc delete operatorsource $APP_REGISTRY -n $MARKETPLACE
oc delete hco kubevirt-hyperconverged -n $TARGET_NAMESPACE
Expand Down
24 changes: 4 additions & 20 deletions deploy/deploy_marketplace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ echo "Global Namespace: ${globalNamespace}"

APP_REGISTRY="${APP_REGISTRY:-kubevirt-hyperconverged}"
PACKAGE="${PACKAGE:-kubevirt-hyperconverged}"
CSC_SOURCE="${CSC_SOURCE:-hco-catalogsource-config}"
TARGET_NAMESPACE="${TARGET_NAMESPACE:-kubevirt-hyperconverged}"
CLUSTER="${CLUSTER:-OPENSHIFT}"
MARKETPLACE_NAMESPACE="${MARKETPLACE_NAMESPACE:-openshift-marketplace}"
Expand Down Expand Up @@ -112,26 +111,11 @@ ${AUTH_TOKEN}
EOF
fi

echo "Give the cluster 30 seconds to create the catalogSourceConfig..."
echo "Give the cluster 30 seconds to create the catalogSource..."
sleep 30
echo "Wait for the catalogSource to be available"
oc wait deploy "${APP_REGISTRY}" --for condition=available -n $MARKETPLACE_NAMESPACE --timeout="360s"

cat <<EOF | oc apply -f -
apiVersion: operators.coreos.com/v1
kind: CatalogSourceConfig
metadata:
name: "${CSC_SOURCE}"
namespace: "${MARKETPLACE_NAMESPACE}"
spec:
source: "${APP_REGISTRY}"
targetNamespace: "${GLOBAL_NAMESPACE}"
packages: "${PACKAGE}"
csDisplayName: "HCO Operator"
csPublisher: "Red Hat"
EOF

echo "Give the cluster 30 seconds to process catalogSourceConfig..."
sleep 30
oc wait deploy $CSC_SOURCE --for condition=available -n $MARKETPLACE_NAMESPACE --timeout="360s"

for i in $(seq 1 $RETRIES); do
echo "Waiting for packagemanifest '${PACKAGE}' to be created in namespace '${TARGET_NAMESPACE}'..."
Expand Down Expand Up @@ -182,7 +166,7 @@ metadata:
name: hco-operatorhub
namespace: "${TARGET_NAMESPACE}"
spec:
source: "${CSC_SOURCE}"
source: "${APP_REGISTRY}"
sourceNamespace: "${GLOBAL_NAMESPACE}"
name: kubevirt-hyperconverged
startingCSV: "kubevirt-hyperconverged-operator.v${HCO_VERSION}"
Expand Down
13 changes: 0 additions & 13 deletions deploy/hco.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,6 @@ apiVersion: v1
kind: Namespace
metadata:
name: kubevirt-hyperconverged

---
apiVersion: operators.coreos.com/v1
kind: CatalogSourceConfig
metadata:
name: installed-community-kubevirt-hyperconverged
namespace: openshift-marketplace
spec:
csDisplayName: Community Operators
csPublisher: Community
packages: hco-operatorhub
targetNamespace: kubevirt-hyperconverged

---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
Expand Down
4 changes: 2 additions & 2 deletions deploy/kustomize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The directory tree consists of kustomize-based manifests with default values, su
There are two distinct options to deliver HCO operator to OLM - Marketplace and Image Registry.

### Marketplace
This method is taking advantage of CatalogSourceConfig, pointing to an OperatorSource, which makes the operator available on OLM OperatorHub.
This method is taking advantage of OperatorSource, which makes the operator available on OLM OperatorHub (implicitly creating a CatalogSource with the same name).
To manually deliver HCO using marketplace, edit `spec.registryNamespace` of `marketplace/operator_source.yaml` to the desired value (default is "kubevirt-hyperconverged"), and run:
```
oc apply -k marketplace
Expand Down Expand Up @@ -126,4 +126,4 @@ spec:

#### Deploy
When customizations are ready, run `./deploy_kustomize.sh`.
The script will prepare and submit kustimized manifests directories to the cluster. It will also check whenever deployment is complete (HCO CR reports Condition "Available" True), and finish successfully.
The script will prepare and submit kustomize manifests to the cluster. It will also check whenever deployment is complete (HCO CR reports Condition "Available" True), and finish successfully.
2 changes: 1 addition & 1 deletion deploy/kustomize/base/subscription.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: hco-operatorhub
namespace: kubevirt-hyperconverged
spec:
source: hco-catalogsource-config
source: kubevirt-hyperconverged
sourceNamespace: openshift-marketplace
name: kubevirt-hyperconverged
startingCSV: kubevirt-hyperconverged-operator.v1.1.0
Expand Down
11 changes: 0 additions & 11 deletions deploy/kustomize/marketplace/catalog_source_config.yaml

This file was deleted.

1 change: 0 additions & 1 deletion deploy/kustomize/marketplace/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- catalog_source_config.yaml
- operator_source.yaml
16 changes: 0 additions & 16 deletions tools/quay-registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,3 @@ spec:
authorizationToken:
secretName: "quay-registry-${APP_REGISTRY_NAMESPACE}"
EOF

cat <<EOF | oc create -f -
apiVersion: operators.coreos.com/v1
kind: CatalogSourceConfig
metadata:
name: hco-catalogsource-config
namespace: "${MARKETPLACE_NAMESPACE}"
spec:
source: "${APP_REGISTRY_NAMESPACE}"
targetNamespace: "${TARGET_NAMESPACE}"
packages: "${PACKAGE}"
csDisplayName: "CNV Operators"
csPublisher: "Red Hat"
packageRepositioryVersions:
kubevirt-hyperconverged: "${PACKAGE_VERSION}"
EOF

0 comments on commit 2293a1a

Please sign in to comment.