forked from apache/incubator-kie-kogito-serverless-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KOGITO-1606: Add install option in makefile (apache#249)
- Loading branch information
1 parent
0b828f4
commit 22e96a0
Showing
3 changed files
with
98 additions
and
34 deletions.
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/sh | ||
# Copyright 2020 Red Hat, Inc. and/or its affiliates | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Script with utils for CRDs resources. | ||
|
||
# Apply CRDs by replacing existing resources or applying if they didn't exist previously. | ||
# Example: apply_crds my_path | ||
function apply_crds(){ | ||
deploy_folder=${1} | ||
files=($deploy_folder/crds/*_crd.yaml) | ||
for file in ${files[@]} | ||
do | ||
echo "Replace crds file ${file}" | ||
oc replace -f ${file} | ||
if [ "$?" != 0 ]; then | ||
echo "crd from file '${file}' may not exist yet in cluster, try to simply apply it" | ||
oc apply -f ${file} | ||
fi | ||
done | ||
} | ||
|
||
# Download CRDs from a URL into a folder. | ||
# Example: download_remote_crds my_path https://path/to/crds. | ||
function download_remote_crds(){ | ||
deploy_folder=${1} | ||
url=${2} | ||
echo "Download crd files into '${deploy_folder}' from ${url}" | ||
|
||
mkdir -p "${deploy_folder}/crds" | ||
files=(deploy/crds/*_crd.yaml) | ||
for file in ${files[@]} | ||
do | ||
filename=${file##*/} | ||
curl -k -o "${deploy_folder}/crds/${filename}" "${url}/crds/${filename}" | ||
done | ||
} |
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,49 @@ | ||
#!/bin/sh | ||
# Copyright 2020 Red Hat, Inc. and/or its affiliates | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
# build and deploy the operator into Openshift using our quay account | ||
# 0. Deploy CRDs | ||
# 1. Deploy Roles and Service Account | ||
# 2. Deploy the operator on Openshift | ||
|
||
SCRIPT_DIR=`dirname $0` | ||
IMAGE=$1 | ||
OPERATOR_NAME=kogito-operator | ||
TMP_FOLDER=tmp | ||
|
||
mkdir -p $TMP_FOLDER | ||
rm -rf $TMP_FOLDER/* | ||
|
||
echo "Deploying Operator $OPERATOR_NAME" | ||
|
||
# CRDs | ||
source $SCRIPT_DIR/crds-utils.sh | ||
apply_crds "deploy" | ||
|
||
# Service Account | ||
oc create -f deploy/service_account.yaml | ||
|
||
# Roles | ||
oc create -f deploy/role.yaml | ||
oc create -f deploy/role_binding.yaml | ||
|
||
# Operator | ||
sed "s/name: kogito-operator/name: $OPERATOR_NAME/g" deploy/operator.yaml > $TMP_FOLDER/operator.yaml | ||
sed "s|image: quay.io/kiegroup/.*|image: $IMAGE|g" $TMP_FOLDER/operator.yaml > $TMP_FOLDER/operator-tmp.yaml | ||
oc create -f $TMP_FOLDER/operator-tmp.yaml | ||
|
||
# Clean Up | ||
rm -rf $TMP_FOLDER/* |
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