-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
160 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,4 +43,7 @@ nb-configuration.xml | |
/.quarkus/cli/plugins/ | ||
|
||
# kubernetes | ||
kubernetes.json | ||
kubernetes.json | ||
|
||
# buil dprocess | ||
olm/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#! /bin/bash | ||
set -euxo pipefail | ||
|
||
VERSION=$1 | ||
BUNDLE_IMAGE=$2 | ||
|
||
BUNDLE_IMAGE=$BUNDLE_IMAGE:$VERSION | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
BUNDLE_PATH=$SCRIPT_DIR/../olm/$VERSION/ | ||
|
||
docker build -t $BUNDLE_IMAGE -f $BUNDLE_PATH/bundle.Dockerfile $BUNDLE_PATH | ||
docker push $BUNDLE_IMAGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
set -euxo pipefail | ||
|
||
# Ex: 21.0.0 | ||
VERSION=$1 | ||
# Ex: 20.0.0 | ||
# Ex: NONE [if no replaces] | ||
REPLACES_VERSION=$2 | ||
# Ex: keycloak/keycloak-operator:999.0.0-SNAPSHOT | ||
#OPERATOR_DOCKER_IMAGE=$3 | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
{ set +x; } 2>/dev/null | ||
echo "" | ||
echo "Creating OLM bundle for version $VERSION replacing version $REPLACES_VERSION" | ||
echo "" | ||
set -x | ||
|
||
cd "$SCRIPT_DIR" | ||
|
||
rm -rf ../olm/$VERSION | ||
mkdir -p ../olm/$VERSION | ||
|
||
# Extract the files generated by Quarkus during the maven build | ||
cp -r ../target/bundle/debezium-operator/* ../olm/$VERSION | ||
|
||
# Find the CSV YAML | ||
CSV_PATH="$(find "../olm/$VERSION" -type f -name '*.clusterserviceversion.yaml')" | ||
|
||
# Insert operator image coordinate | ||
#yq ea -i ".metadata.annotations.containerImage = \"$OPERATOR_DOCKER_IMAGE:$VERSION\"" "$CSV_PATH" | ||
#yq ea -i ".spec.install.spec.deployments[0].spec.template.spec.containers[0].image = \"$OPERATOR_DOCKER_IMAGE:$VERSION\"" "$CSV_PATH" | ||
|
||
# Edit the CSV version, replaces, etc. | ||
|
||
yq ea -i ".metadata.annotations.createdAt = \"$(date "+%D %T")\"" "$CSV_PATH" | ||
yq ea -i ".spec.version = \"$VERSION\"" "$CSV_PATH" | ||
yq ea -i ".metadata.name = \"debezium-operator.v$VERSION\"" "$CSV_PATH" | ||
# yq ea -i '.metadata.namespace = "placeholder"' "$CSV_PATH" | ||
|
||
if [[ $REPLACES_VERSION = "NONE" ]] | ||
then | ||
yq ea -i "del(.spec.replaces)" "$CSV_PATH" | ||
else | ||
yq ea -i ".spec.replaces = \"keycloak-operator.v$REPLACES_VERSION\"" "$CSV_PATH" | ||
fi | ||
|
||
|
||
yq ea -i '.spec.install.spec.deployments[0].spec.template.spec.containers[0].env += [{"name": "QUARKUS_OPERATOR_SDK_NAMESPACES", "valueFrom": {"fieldRef": {"fieldPath": "metadata.annotations['"'"'olm.targetNamespaces'"'"']"}}}]' "$CSV_PATH" | ||
|
||
{ set +x; } 2>/dev/null | ||
echo "" | ||
echo "Created OLM bundle ok!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#! /bin/bash | ||
set -euxo pipefail | ||
|
||
VERSION=$1 | ||
BUNDLE_IMAGE=$2 | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
rm -rf $SCRIPT_DIR/../olm/catalog | ||
mkdir -p $SCRIPT_DIR/../olm/catalog/test-catalog | ||
|
||
( | ||
cd $SCRIPT_DIR/../olm/catalog | ||
|
||
opm generate dockerfile test-catalog | ||
|
||
opm init debezium-operator \ | ||
--default-channel=alpha \ | ||
--output yaml > test-catalog/operator.yaml | ||
|
||
opm render $BUNDLE_IMAGE:$VERSION \ | ||
--output=yaml >> test-catalog/operator.yaml | ||
|
||
cat << EOF >> test-catalog/operator.yaml | ||
--- | ||
schema: olm.channel | ||
package: debezium-operator | ||
name: alpha | ||
entries: | ||
- name: debezium-operator.v$VERSION | ||
EOF | ||
|
||
opm validate test-catalog | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#! /bin/bash | ||
set -euxo pipefail | ||
|
||
VERSION=$1 | ||
CATALOG_IMAGE=${2:-"quay.io/debezium/operator-catalog:latest"} | ||
|
||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
rm -rf $SCRIPT_DIR/../olm/testing-resources | ||
mkdir -p $SCRIPT_DIR/../olm/testing-resources/own | ||
|
||
cat << EOF >> $SCRIPT_DIR/../olm/testing-resources/catalog.yaml | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: CatalogSource | ||
metadata: | ||
name: debezium-catalog | ||
namespace: olm | ||
spec: | ||
grpcPodConfig: | ||
securityContextConfig: restricted | ||
sourceType: grpc | ||
image: $CATALOG_IMAGE | ||
displayName: Debezium Test Catalog | ||
publisher: Me | ||
updateStrategy: | ||
registryPoll: | ||
interval: 10m | ||
EOF | ||
|
||
|
||
cat << EOF >> $SCRIPT_DIR/../olm/testing-resources/own/operatorgroup.yaml | ||
kind: OperatorGroup | ||
apiVersion: operators.coreos.com/v1 | ||
metadata: | ||
name: og-own | ||
spec: | ||
targetNamespaces: | ||
- debezium | ||
EOF | ||
|
||
cat << EOF >> $SCRIPT_DIR/../olm/testing-resources/subscription.yaml | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: debezium-operator | ||
spec: | ||
installPlanApproval: Automatic | ||
name: debezium-operator | ||
source: debezium-catalog | ||
sourceNamespace: olm | ||
startingCSV: debezium-operator.v$VERSION | ||
EOF | ||
|
||
|
||
|