Skip to content

Commit

Permalink
Add rook bundle to ocs-operator catalog
Browse files Browse the repository at this point in the history
Add rook bundle to ocs-operator-catalog and update
the relevant script files to inlcude the rook bundle image name
and add rook bundle deployment script

Signed-off-by: Nikhil-Ladha <[email protected]>
  • Loading branch information
Nikhil-Ladha committed Mar 19, 2024
1 parent 2d082fc commit 16e5b94
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ bin

catalog/ocs-bundle.yaml
catalog/noobaa-bundle.yaml
catalog/rook-ceph-bundle.yaml

tools/csv-merger/csv-merger
tools/csv-checksum/csv-checksum
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,7 @@ install-noobaa: operator-sdk
install-ocs: operator-sdk
@echo "Installing ocs operator"
hack/install-ocs.sh

install-rook: operator-sdk
@echo "Installing rook-ceph operator"
hack/install-rook.sh
11 changes: 11 additions & 0 deletions catalog/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ name: alpha
entries:
- name: ocs-operator.v4.15.0

---
defaultChannel: alpha
name: rook-ceph-operator
schema: olm.package
---
schema: olm.channel
package: rook-ceph-operator
name: alpha
entries:
- name: rook-ceph-operator.v4.15.0

---
defaultChannel: alpha
name: noobaa-operator
Expand Down
11 changes: 11 additions & 0 deletions deploy/deploy-with-olm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,14 @@ spec:
name: noobaa-operator
source: ocs-catalogsource
sourceNamespace: openshift-marketplace
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: rook-subscription
namespace: openshift-storage
spec:
channel: alpha
name: rook-ceph-operator
source: ocs-catalogsource
sourceNamespace: openshift-marketplace
1 change: 1 addition & 0 deletions hack/build-operator-catalog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ 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 ${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
${OPM} generate dockerfile catalog

Expand Down
1 change: 1 addition & 0 deletions hack/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ METRICS_EXPORTER_FULL_IMAGE_NAME="${METRICS_EXPORTER_FULL_IMAGE_NAME:-${DEFAULT_
UX_BACKEND_OAUTH_FULL_IMAGE_NAME="${UX_BACKEND_OAUTH_FULL_IMAGE_NAME:-${DEFAULT_UX_BACKEND_OAUTH_FULL_IMAGE_NAME}}"

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"

OCS_OPERATOR_INSTALL="${OCS_OPERATOR_INSTALL:-false}"
OCS_CLUSTER_UNINSTALL="${OCS_CLUSTER_UNINSTALL:-false}"
Expand Down
19 changes: 19 additions & 0 deletions hack/install-rook.sh
Original file line number Diff line number Diff line change
@@ -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 "$ROOK_BUNDLE_FULL_IMAGE_NAME" --timeout=10m --security-context-config restricted -n "$INSTALL_NAMESPACE"

oc wait --timeout=5m --for condition=Available -n "$INSTALL_NAMESPACE" deployment rook-ceph-operator
16 changes: 15 additions & 1 deletion pkg/deploy-manager/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})

rookSubscription := v1alpha1.Subscription{
ObjectMeta: metav1.ObjectMeta{
Name: "rook-subscription",
Namespace: InstallNamespace,
},
Spec: &v1alpha1.SubscriptionSpec{
Channel: subscriptionChannel,
Package: "rook-ceph-operator",
CatalogSource: "ocs-catalogsource",
CatalogSourceNamespace: marketplaceNamespace,
},
}
rookSubscription.SetGroupVersionKind(schema.GroupVersionKind{Group: v1alpha1.SchemeGroupVersion.Group, Kind: "Subscription", Version: v1alpha1.SchemeGroupVersion.Version})

noobaSubscription := v1alpha1.Subscription{
ObjectMeta: metav1.ObjectMeta{
Name: "nooba-subscription",
Expand All @@ -177,7 +191,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, noobaSubscription)
co.subscriptions = append(co.subscriptions, ocsSubscription, rookSubscription, noobaSubscription)

return co
}
Expand Down

0 comments on commit 16e5b94

Please sign in to comment.