Files
odo/scripts/configure-cluster/common/setup-operators.sh
Anand Kumar Singh 39b8c7e4c2 fix flake and use operatorhub to install EDB (#6004)
* fix flake

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* fix flake

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* check if namespace is created

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* check if namespace without sercice is created

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

Signed-off-by: anandrkskd <anandrkskd@gmail.com>
2022-08-29 11:26:57 -04:00

103 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
set -x
install_sourceCatalog(){
$1 create -f - <<EOF
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: operatorhubio-catalog
namespace: openshift-marketplace
spec:
sourceType: grpc
image: quay.io/operatorhubio/catalog:latest
displayName: Community Operators
publisher: OperatorHub.io
updateStrategy:
registryPoll:
interval: 60m
EOF
}
install_postgres_operator(){
$1 create -f - <<EOF
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: my-cloud-native-postgresql
namespace: $2
spec:
channel: stable
name: cloud-native-postgresql
source: $3
sourceNamespace: $4
EOF
}
install_service_binding_operator() {
$1 create -f - <<EOF
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: my-service-binding-operator
namespace: $2
spec:
channel: stable
name: $3
source: $4
sourceNamespace: $5
EOF
}
install_service_binding_operator_master() {
oc create -f - <<EOF
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: service-binding-master
namespace: openshift-marketplace
spec:
displayName: Service Binding Operator build from master
image: quay.io/redhat-developer/servicebinding-operator:index
priority: 500
publisher: Red Hat
sourceType: grpc
updateStrategy:
registryPoll:
interval: 10m0s
EOF
oc create -f - <<EOF
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: service-binding-operator
namespace: openshift-operators
spec:
channel: candidate
installPlanApproval: Automatic
name: service-binding-operator
source: service-binding-master
sourceNamespace: openshift-marketplace
EOF
}
if [ "$NIGHTLY" == "true" ]; then
install_postgres_operator oc openshift-operators certified-operators openshift-marketplace
install_service_binding_operator_master
elif [ "$KUBERNETES" == "true" ]; then
# install "cloud-native-postgresql" using "kubectl" in "operators" namespace; use "operatorhubio-catalog" catalog source from "olm" namespace
install_postgres_operator kubectl operators operatorhubio-catalog olm
# install "service-binding-operator" using "kubectl" in "operators" namespace; use "operatorhubio-catalog" catalog source from "olm" namespace
install_service_binding_operator kubectl operators service-binding-operator operatorhubio-catalog olm
else
#install operatorhub.io sourceCatalog
install_sourceCatalog oc
# install "cloud-native-postgresql" using "oc" in "openshift-operators" namespace; use "certified-operators" catalog source from "openshift-marketplace" namespace
install_postgres_operator oc openshift-operators operatorhubio-catalog openshift-marketplace
# install "rh-service-binding-operator" using "oc" in "openshift-operators" namespace; use "redhat-operators" catalog source from "openshift-marketplace" namespace
install_service_binding_operator oc openshift-operators rh-service-binding-operator redhat-operators openshift-marketplace
fi