diff --git a/.gitignore b/.gitignore index f690474226..6a8783696d 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,7 @@ bin catalog/ocs-bundle.yaml catalog/noobaa-bundle.yaml catalog/rook-ceph-bundle.yaml +catalog/ocs-client-bundle.yaml tools/csv-merger/csv-merger tools/csv-checksum/csv-checksum diff --git a/Makefile b/Makefile index e3b9fe45fd..94de7b73a6 100644 --- a/Makefile +++ b/Makefile @@ -188,6 +188,10 @@ install-ocs: operator-sdk @echo "Installing ocs operator" hack/install-ocs.sh +install-ocs-client: operator-sdk + @echo "Installing ocs-client operator" + hack/install-ocs-client.sh + install-rook: operator-sdk @echo "Installing rook-ceph operator" hack/install-rook.sh diff --git a/catalog/index.yaml b/catalog/index.yaml index b46613ac0d..dd857f155d 100644 --- a/catalog/index.yaml +++ b/catalog/index.yaml @@ -9,6 +9,17 @@ name: alpha entries: - name: ocs-operator.v4.15.0 +--- +defaultChannel: alpha +name: ocs-client-operator +schema: olm.package +--- +schema: olm.channel +package: ocs-client-operator +name: alpha +entries: + - name: ocs-client-operator.v4.15.0 + --- defaultChannel: alpha name: rook-ceph-operator diff --git a/deploy/deploy-with-olm.yaml b/deploy/deploy-with-olm.yaml index 620d13cc35..c9a8640d97 100644 --- a/deploy/deploy-with-olm.yaml +++ b/deploy/deploy-with-olm.yaml @@ -43,6 +43,17 @@ spec: --- apiVersion: operators.coreos.com/v1alpha1 kind: Subscription +metadata: + name: ocs-client-subscription + namespace: openshift-storage +spec: + channel: alpha + name: ocs-client-operator + source: ocs-catalogsource + sourceNamespace: openshift-marketplace +--- +apiVersion: operators.coreos.com/v1alpha1 +kind: Subscription metadata: name: rook-subscription namespace: openshift-storage diff --git a/hack/build-operator-catalog.sh b/hack/build-operator-catalog.sh index 3b6c1c5841..3a535a9b95 100755 --- a/hack/build-operator-catalog.sh +++ b/hack/build-operator-catalog.sh @@ -11,6 +11,7 @@ echo "Did you push the bundle image? It must be pullable from '$IMAGE_REGISTRY'. echo "Run '${IMAGE_BUILD_CMD} push ${BUNDLE_FULL_IMAGE_NAME}'" echo ${OPM} render --output=yaml "${BUNDLE_FULL_IMAGE_NAME}" > catalog/ocs-bundle.yaml +${OPM} render --output=yaml "${OCS_CLIENT_BUNDLE_FULL_IMAGE_NAME}" > catalog/ocs-client-bundle.yaml ${OPM} render --output=yaml ${NOOBAA_BUNDLE_FULL_IMAGE_NAME} > catalog/noobaa-bundle.yaml ${OPM} render --output=yaml ${ROOK_BUNDLE_FULL_IMAGE_NAME} > catalog/rook-ceph-bundle.yaml ${OPM} validate catalog diff --git a/hack/common.sh b/hack/common.sh index b37e80a526..63fcf9da52 100644 --- a/hack/common.sh +++ b/hack/common.sh @@ -88,6 +88,8 @@ FILE_BASED_CATALOG_FULL_IMAGE_NAME="${FILE_BASED_CATALOG_FULL_IMAGE_NAME:-${DEFA METRICS_EXPORTER_FULL_IMAGE_NAME="${METRICS_EXPORTER_FULL_IMAGE_NAME:-${DEFAULT_METRICS_EXPORTER_FULL_IMAGE_NAME}}" UX_BACKEND_OAUTH_FULL_IMAGE_NAME="${UX_BACKEND_OAUTH_FULL_IMAGE_NAME:-${DEFAULT_UX_BACKEND_OAUTH_FULL_IMAGE_NAME}}" +CSI_ADDONS_CATALOG_FULL_IMAGE_NAME="quay.io/ocs-dev/csi-addons-catalog:v0.7.0" +OCS_CLIENT_BUNDLE_FULL_IMAGE_NAME="quay.io/ocs-dev/ocs-client-operator-bundle:v4.15.0" NOOBAA_BUNDLE_FULL_IMAGE_NAME="quay.io/noobaa/noobaa-operator-bundle:master-20231217" ROOK_BUNDLE_FULL_IMAGE_NAME="quay.io/ocs-dev/rook-ceph-operator-bundle:latest" diff --git a/hack/install-ocs-client.sh b/hack/install-ocs-client.sh new file mode 100755 index 0000000000..d43e044cb0 --- /dev/null +++ b/hack/install-ocs-client.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -o nounset +set -o errexit +set -o pipefail + +source hack/common.sh + +NAMESPACE=$(oc get ns "$INSTALL_NAMESPACE" -o jsonpath="{.metadata.name}" 2>/dev/null || true) +if [[ -n "$NAMESPACE" ]]; then + echo "Namespace \"$NAMESPACE\" exists" +else + echo "Namespace \"$INSTALL_NAMESPACE\" does not exist: creating it" + oc create ns "$INSTALL_NAMESPACE" +fi + +"$OPERATOR_SDK" run bundle "$OCS_CLIENT_BUNDLE_FULL_IMAGE_NAME" --timeout=10m --security-context-config restricted -n "$INSTALL_NAMESPACE" --index-image "$CSI_ADDONS_CATALOG_FULL_IMAGE_NAME" + +oc wait --timeout=5m --for condition=Available -n "$INSTALL_NAMESPACE" deployment ocs-client-operator-controller-manager diff --git a/pkg/deploy-manager/subscription.go b/pkg/deploy-manager/subscription.go index 2cd79bbc81..bc3a9c1923 100644 --- a/pkg/deploy-manager/subscription.go +++ b/pkg/deploy-manager/subscription.go @@ -163,6 +163,20 @@ func (t *DeployManager) generateClusterObjects(ocsCatalogImage string, subscript } ocsSubscription.SetGroupVersionKind(schema.GroupVersionKind{Group: v1alpha1.SchemeGroupVersion.Group, Kind: "Subscription", Version: v1alpha1.SchemeGroupVersion.Version}) + ocsClientSubscription := v1alpha1.Subscription{ + ObjectMeta: metav1.ObjectMeta{ + Name: "ocs-client-subscription", + Namespace: InstallNamespace, + }, + Spec: &v1alpha1.SubscriptionSpec{ + Channel: subscriptionChannel, + Package: "ocs-client-operator", + CatalogSource: "ocs-catalogsource", + CatalogSourceNamespace: marketplaceNamespace, + }, + } + ocsClientSubscription.SetGroupVersionKind(schema.GroupVersionKind{Group: v1alpha1.SchemeGroupVersion.Group, Kind: "Subscription", Version: v1alpha1.SchemeGroupVersion.Version}) + rookSubscription := v1alpha1.Subscription{ ObjectMeta: metav1.ObjectMeta{ Name: "rook-subscription", @@ -191,7 +205,7 @@ func (t *DeployManager) generateClusterObjects(ocsCatalogImage string, subscript } noobaSubscription.SetGroupVersionKind(schema.GroupVersionKind{Group: v1alpha1.SchemeGroupVersion.Group, Kind: "Subscription", Version: v1alpha1.SchemeGroupVersion.Version}) - co.subscriptions = append(co.subscriptions, ocsSubscription, rookSubscription, noobaSubscription) + co.subscriptions = append(co.subscriptions, ocsSubscription, ocsClientSubscription, rookSubscription, noobaSubscription) return co }