2022-04-08 08:22:01 +00:00
|
|
|
#! /bin/bash
|
|
|
|
set -euxo pipefail
|
|
|
|
|
|
|
|
VERSION=$1
|
|
|
|
DOCKER_REGISTRY=$2
|
|
|
|
|
2022-04-12 09:19:24 +00:00
|
|
|
UUID=${3:-""}
|
|
|
|
|
2023-09-19 17:46:37 +00:00
|
|
|
TARGET_NAMESPACES=${4-default}
|
|
|
|
|
2022-04-08 08:22:01 +00:00
|
|
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
|
|
|
|
|
|
rm -rf $SCRIPT_DIR/../olm/testing-resources
|
|
|
|
mkdir -p $SCRIPT_DIR/../olm/testing-resources
|
|
|
|
|
|
|
|
cat << EOF >> $SCRIPT_DIR/../olm/testing-resources/catalog.yaml
|
|
|
|
apiVersion: operators.coreos.com/v1alpha1
|
|
|
|
kind: CatalogSource
|
|
|
|
metadata:
|
|
|
|
name: test-catalog
|
|
|
|
namespace: default
|
|
|
|
spec:
|
|
|
|
sourceType: grpc
|
2022-04-12 09:19:24 +00:00
|
|
|
image: $DOCKER_REGISTRY/${UUID}keycloak-test-catalog:$VERSION
|
2022-04-08 08:22:01 +00:00
|
|
|
displayName: Keycloak Test Catalog
|
|
|
|
publisher: Me
|
|
|
|
updateStrategy:
|
|
|
|
registryPoll:
|
2022-04-19 15:16:39 +00:00
|
|
|
interval: 10m
|
2022-04-08 08:22:01 +00:00
|
|
|
EOF
|
|
|
|
|
2023-09-19 17:46:37 +00:00
|
|
|
|
|
|
|
OPERATOR_GROUP_FILE=$SCRIPT_DIR/../olm/testing-resources/operatorgroup.yaml
|
|
|
|
|
|
|
|
cat << EOF >> $OPERATOR_GROUP_FILE
|
2022-04-08 08:22:01 +00:00
|
|
|
kind: OperatorGroup
|
|
|
|
apiVersion: operators.coreos.com/v1
|
|
|
|
metadata:
|
2023-09-19 17:46:37 +00:00
|
|
|
name: og
|
2022-04-08 08:22:01 +00:00
|
|
|
spec:
|
|
|
|
EOF
|
|
|
|
|
2023-09-19 17:46:37 +00:00
|
|
|
IFS=', ' read -r -a array <<< "$TARGET_NAMESPACES"
|
|
|
|
for element in "${array[@]}"
|
|
|
|
do
|
|
|
|
yq ea -i ".spec.targetNamespaces += [\"$element\"]" $OPERATOR_GROUP_FILE
|
|
|
|
done
|
|
|
|
|
2022-04-08 08:22:01 +00:00
|
|
|
cat << EOF >> $SCRIPT_DIR/../olm/testing-resources/subscription.yaml
|
|
|
|
apiVersion: operators.coreos.com/v1alpha1
|
|
|
|
kind: Subscription
|
|
|
|
metadata:
|
|
|
|
name: keycloak-operator
|
|
|
|
spec:
|
|
|
|
installPlanApproval: Automatic
|
|
|
|
name: keycloak-operator
|
|
|
|
source: test-catalog
|
|
|
|
sourceNamespace: default
|
|
|
|
startingCSV: keycloak-operator.v$VERSION
|
|
|
|
EOF
|