fix: Fix scripts and che-types to use newer operator-sdk (#533)

* fix: Fix scripts and che-types to use newer operator-sdk

Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
pull/539/head
Oleksandr Andriienko 2020-11-17 11:38:34 +02:00 committed by GitHub
parent 82c0b2bb1d
commit 4c194ddeb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 323 additions and 213 deletions

View File

@ -12,58 +12,35 @@
set -e
# PR_FILES_CHANGED store all Modified/Created files in Pull Request.
export PR_FILES_CHANGED=$(git --no-pager diff --name-only HEAD "$(git merge-base HEAD origin/master)")
echo "========================="
echo "${PR_FILES_CHANGED}"
echo "========================="
# transform_files function transform PR_FILES_CHANGED into a new array => FILES_CHANGED_ARRAY.
function transform_files() {
for files in ${PR_FILES_CHANGED}
do
FILES_CHANGED_ARRAY+=("${files}")
done
}
# check_che_types function check first if pkg/apis/org/v1/che_types.go file suffer modifications and
# in case of modification should exist also modifications in deploy/crds/* folder.
function check_che_types() {
# CHE_TYPES_FILE make reference to generated code by operator-sdk.
local CHE_TYPES_FILE='pkg/apis/org/v1/che_types.go'
# Export variables for cr/crds files.
local CR_CRD_FOLDER="deploy/crds/"
local CR_CRD_REGEX="\S*org_v1_che_crd.yaml"
if [[ " ${FILES_CHANGED_ARRAY[*]} " =~ ${CHE_TYPES_FILE} ]]; then
echo "[INFO] File ${CHE_TYPES_FILE} suffer modifications in PR. Checking if exist modifications for cr/crd files."
# The script should fail if deploy/crds folder didn't suffer any modification.
if [[ " ${FILES_CHANGED_ARRAY[*]} " =~ $CR_CRD_REGEX ]]; then
echo "[INFO] CR/CRD file modified: ${BASH_REMATCH}"
else
echo "[ERROR] Detected modification in ${CHE_TYPES_FILE} file, but cr/crd files didn't suffer any modification."
exit 1
fi
else
echo "[INFO] ${CHE_TYPES_FILE} don't have any modification."
fi
}
set -e
go version
ROOT_PROJECT_DIR="${GITHUB_WORKSPACE}"
if [ -z "${ROOT_PROJECT_DIR}" ]; then
BASE_DIR=$(cd "$(dirname "$0")"; pwd)
ROOT_PROJECT_DIR=$(dirname "$(dirname "${BASE_DIR}")")
fi
export BASE_DIR="${ROOT_PROJECT_DIR}/olm"
# Unfortunately ${GOPATH} is required for an old operator-sdk
if [ -z "${GOPATH}" ]; then
export GOPATH="/home/runner/work/che-operator/go"
echo "[INFO] GOPATH: ${GOPATH}"
fi
# check_che_types function check first if pkg/apis/org/v1/che_types.go file suffer modifications and
# in case of modification should exist also modifications in deploy/crds/* folder.
function check_che_crds() {
cd "${ROOT_PROJECT_DIR}"
# CHE_TYPES_FILE make reference to generated code by operator-sdk.
# Export variables for cr/crds files.
local CR_CRD_FOLDER="deploy/crds"
local CR_CRD_REGEX="${CR_CRD_FOLDER}/org_v1_che_crd.yaml"
# Update crd
source "${ROOT_PROJECT_DIR}/olm/update-crd-files.sh"
IFS=$'\n' read -d '' -r -a changedFiles < <( git ls-files -m ) || true
# Check if there is any difference in the crds. If yes, then fail check.
if [[ " ${changedFiles[*]} " =~ $CR_CRD_REGEX ]]; then
echo "[ERROR] CR/CRD file is up to date: ${BASH_REMATCH}. Use 'che-operator/olm/update-crd-files.sh' script to update it."
exit 1
else
echo "[INFO] cr/crd files are in actual state."
exit 0
fi
}
installYq() {
YQ=$(command -v yq) || true
@ -84,7 +61,7 @@ installOperatorSDK() {
OPERATOR_SDK_TEMP_DIR="$(mktemp -q -d -t "OPERATOR_SDK_XXXXXX" 2>/dev/null || mktemp -q -d)"
pushd "${OPERATOR_SDK_TEMP_DIR}" || exit
echo "[INFO] Downloading 'operator-sdk' cli tool..."
curl -sLo operator-sdk "$(curl -sL https://api.github.com/repos/operator-framework/operator-sdk/releases/tags/v0.15.2 | jq -r '[.assets[] | select(.name == "operator-sdk-v0.15.2-x86_64-linux-gnu")] | first | .browser_download_url')"
curl -sLo operator-sdk "$(curl -sL https://api.github.com/repos/operator-framework/operator-sdk/releases/tags/v0.17.1 | jq -r '[.assets[] | select(.name == "operator-sdk-v0.17.1-x86_64-linux-gnu")] | first | .browser_download_url')"
export OPERATOR_SDK_BINARY="${OPERATOR_SDK_TEMP_DIR}/operator-sdk"
chmod +x "${OPERATOR_SDK_BINARY}"
echo "[INFO] Downloading completed!"
@ -92,10 +69,9 @@ installOperatorSDK() {
popd || exit
fi
}
isActualNightlyOlmBundleCSVFiles() {
cd "${ROOT_PROJECT_DIR}"
export BASE_DIR="${ROOT_PROJECT_DIR}/olm"
export NO_DATE_UPDATE="true"
export NO_INCREMENT="true"
source "${ROOT_PROJECT_DIR}/olm/update-nightly-bundle.sh"
@ -114,10 +90,9 @@ isActualNightlyOlmBundleCSVFiles() {
echo "[INFO] Nightly Olm bundle is in actual state."
}
transform_files
check_che_types
installYq
installOperatorSDK
check_che_crds
isActualNightlyOlmBundleCSVFiles
echo "[INFO] Done."

View File

@ -24,7 +24,7 @@ installOperatorSDK() {
OPERATOR_SDK_TEMP_DIR="$(mktemp -q -d -t "OPERATOR_SDK_XXXXXX" 2>/dev/null || mktemp -q -d)"
pushd "${OPERATOR_SDK_TEMP_DIR}" || exit
echo "[INFO] Downloading 'operator-sdk' cli tool..."
curl -sLo operator-sdk "$(curl -sL https://api.github.com/repos/operator-framework/operator-sdk/releases/tags/v0.15.2| jq -r '[.assets[] | select(.name == "operator-sdk-v0.15.2-x86_64-linux-gnu")] | first | .browser_download_url')"
curl -sLo operator-sdk "$(curl -sL https://api.github.com/repos/operator-framework/operator-sdk/releases/tags/v0.17.1| jq -r '[.assets[] | select(.name == "operator-sdk-v0.17.1-x86_64-linux-gnu")] | first | .browser_download_url')"
export OPERATOR_SDK_BINARY="${OPERATOR_SDK_TEMP_DIR}/operator-sdk"
chmod +x "${OPERATOR_SDK_BINARY}"
echo "[INFO] Downloading completed!"

13
.vscode/tasks.json vendored
View File

@ -14,6 +14,19 @@
},
"group": "build"
},
{
"label": "Update csv bundle files",
"command": "./olm/update-nightly-bundle.sh",
"type": "shell",
"args": [],
"problemMatcher": [
"$go"
],
"presentation": {
"reveal": "always"
},
"group": "build"
},
{
"label": "Build and push custom che-operator image: '${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:nightly'",
"command": "docker build -t ${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:nightly . && docker push ${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:nightly",

View File

@ -8,43 +8,73 @@ metadata:
"apiVersion": "org.eclipse.che/v1",
"kind": "CheCluster",
"metadata": {
"name": "eclipse-che"
"name": "eclipse-che"
},
"spec": {
"auth": {
"externalIdentityProvider": false,
"identityProviderAdminUserName": "",
"identityProviderClientId": "",
"identityProviderImage": "",
"identityProviderPassword": "",
"identityProviderRealm": "",
"identityProviderURL": "",
"oAuthClientName": "",
"oAuthSecret": ""
},
"database": {
"chePostgresDb": "",
"chePostgresHostName": "",
"chePostgresPassword": "",
"chePostgresPort": "",
"chePostgresUser": "",
"externalDb": false,
"postgresImage": ""
},
"k8s": {
"ingressDomain": "",
"tlsSecretName": "che-tls"
},
"server": {
"cheImageTag": "nightly",
"devfileRegistryImage": "quay.io/eclipse/che-devfile-registry:nightly",
"pluginRegistryImage": "quay.io/eclipse/che-plugin-registry:nightly",
"tlsSupport": true,
"selfSignedCert": false
},
"database": {
"externalDb": false,
"chePostgresHostName": "",
"chePostgresPort": "",
"chePostgresUser": "",
"chePostgresPassword": "",
"chePostgresDb": ""
},
"auth": {
"identityProviderImage": "quay.io/eclipse/che-keycloak:nightly",
"externalIdentityProvider": false,
"identityProviderURL": "",
"identityProviderRealm": "",
"identityProviderClientId": ""
},
"storage": {
"pvcStrategy": "per-workspace",
"pvcClaimSize": "1Gi",
"preCreateSubPaths": true
},
"metrics": {
"enable": true
}
"ingressClass": "",
"ingressDomain": "",
"ingressStrategy": "",
"securityContextFsGroup": "",
"securityContextRunAsUser": "",
"singleHostExposureType": "",
"tlsSecretName": "che-tls"
},
"metrics": {
"enable": true
},
"server": {
"allowUserDefinedWorkspaceNamespaces": false,
"cheFlavor": "",
"cheImage": "",
"cheImageTag": "",
"cheWorkspaceClusterRole": "",
"devfileRegistryImage": "",
"gitSelfSignedCert": false,
"nonProxyHosts": "",
"pluginRegistryImage": "",
"proxyPassword": "",
"proxyPort": "",
"proxyURL": "",
"proxyUser": "",
"serverExposureStrategy": "",
"serverMemoryLimit": "",
"serverMemoryRequest": "",
"serverTrustStoreConfigMapName": "",
"singleHostGatewayConfigMapLabels": {},
"singleHostGatewayConfigSidecarImage": "",
"singleHostGatewayImage": "",
"tlsSupport": true,
"workspaceNamespaceDefault": ""
},
"storage": {
"postgresPVCStorageClassName": "",
"preCreateSubPaths": true,
"pvcClaimSize": "1Gi",
"pvcJobsImage": "",
"pvcStrategy": "common",
"workspacePVCStorageClassName": ""
}
}
}
]
@ -52,64 +82,73 @@ metadata:
categories: Developer Tools
certified: "false"
containerImage: quay.io/eclipse/che-operator:nightly
createdAt: "2020-11-12T13:52:16Z"
createdAt: "2020-11-16T13:57:54Z"
description: A Kube-native development solution that delivers portable and collaborative
developer workspaces.
operatorframework.io/suggested-namespace: eclipse-che
repository: https://github.com/eclipse/che-operator
support: Eclipse Foundation
name: eclipse-che-preview-kubernetes.v7.22.0-29.nightly
name: eclipse-che-preview-kubernetes.v7.22.0-31.nightly
namespace: placeholder
spec:
apiservicedefinitions: {}
customresourcedefinitions:
owned:
- description: Eclipse Che cluster with DB and Auth Server
- description: The `CheCluster` custom resource allows defining and managing
a Che server installation
displayName: Eclipse Che Cluster
kind: CheCluster
name: checlusters.org.eclipse.che
specDescriptors:
- description: TLS routes
displayName: TLS Mode
- description: Deprecated. Instructs the operator to deploy Che in TLS mode.
This is enabled by default. Disabling TLS may cause malfunction of some
Che components.
displayName: Tls support
path: server.tlsSupport
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
statusDescriptors:
- description: Ingress to access Eclipse Che
displayName: Eclipse Che URL
path: cheURL
x-descriptors:
- urn:alm:descriptor:org.w3:link
- description: Ingress to access Keycloak Admin Console
displayName: Keycloak Admin Console URL
path: keycloakURL
x-descriptors:
- urn:alm:descriptor:org.w3:link
- description: Eclipse Che server version
displayName: Eclipse Che version
path: cheVersion
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:label
- description: The current status of the application
- description: Status of a Che installation. Can be `Available`, `Unavailable`,
or `Available, Rolling Update in Progress`
displayName: Status
path: cheClusterRunning
x-descriptors:
- urn:alm:descriptor:io.kubernetes.phase
- description: Reason of the current status
displayName: Reason
path: reason
- description: Public URL to the Che server
displayName: Eclipse Che URL
path: cheURL
x-descriptors:
- urn:alm:descriptor:text
- description: Message explaining the current status
displayName: Message
path: message
- urn:alm:descriptor:org.w3:link
- description: Current installed Che version
displayName: 'displayName: Eclipse Che version'
path: cheVersion
x-descriptors:
- urn:alm:descriptor:text
- description: Link providing help related to the current status
- urn:alm:descriptor:org.w3:link
- description: A URL that can point to some URL where to find help related
to the current Operator status.
displayName: Help link
path: helpLink
x-descriptors:
- urn:alm:descriptor:org.w3:link
- description: Public URL to the Identity Provider server (Keycloak / RH
SSO).
displayName: Keycloak Admin Console URL
path: keycloakURL
x-descriptors:
- urn:alm:descriptor:org.w3:link
- description: A human readable message indicating details about why the
pod is in this condition.
displayName: Message
path: message
x-descriptors:
- urn:alm:descriptor:text
- description: A brief CamelCase message indicating details about why the
pod is in this state.
displayName: Reason
path: reason
x-descriptors:
- urn:alm:descriptor:io.kubernetes.phase:reason
- urn:alm:descriptor:text
version: v1
description: |
A collaborative Kubernetes-native development solution that delivers Kubernetes workspaces and in-browser IDE for rapid cloud application development.
@ -422,4 +461,4 @@ spec:
maturity: stable
provider:
name: Eclipse Foundation
version: 7.22.0-29.nightly
version: 7.22.0-31.nightly

View File

@ -8,40 +8,65 @@ metadata:
"apiVersion": "org.eclipse.che/v1",
"kind": "CheCluster",
"metadata": {
"name": "eclipse-che"
"name": "eclipse-che"
},
"spec": {
"server": {
"cheImageTag": "nightly",
"devfileRegistryImage": "quay.io/eclipse/che-devfile-registry:nightly",
"pluginRegistryImage": "quay.io/eclipse/che-plugin-registry:nightly",
"tlsSupport": true,
"selfSignedCert": false
},
"database": {
"externalDb": false,
"chePostgresHostName": "",
"chePostgresPort": "",
"chePostgresUser": "",
"chePostgresPassword": "",
"chePostgresDb": ""
},
"auth": {
"openShiftoAuth": true,
"identityProviderImage": "quay.io/eclipse/che-keycloak:nightly",
"externalIdentityProvider": false,
"identityProviderURL": "",
"identityProviderRealm": "",
"identityProviderClientId": ""
},
"storage": {
"pvcStrategy": "per-workspace",
"pvcClaimSize": "1Gi",
"preCreateSubPaths": true
},
"metrics": {
"enable": true
}
"auth": {
"externalIdentityProvider": false,
"identityProviderAdminUserName": "",
"identityProviderClientId": "",
"identityProviderImage": "",
"identityProviderPassword": "",
"identityProviderRealm": "",
"identityProviderURL": "",
"oAuthClientName": "",
"oAuthSecret": "",
"openShiftoAuth": true
},
"database": {
"chePostgresDb": "",
"chePostgresHostName": "",
"chePostgresPassword": "",
"chePostgresPort": "",
"chePostgresUser": "",
"externalDb": false,
"postgresImage": ""
},
"metrics": {
"enable": true
},
"server": {
"allowUserDefinedWorkspaceNamespaces": false,
"cheFlavor": "",
"cheImage": "",
"cheImageTag": "",
"cheWorkspaceClusterRole": "",
"devfileRegistryImage": "",
"gitSelfSignedCert": false,
"nonProxyHosts": "",
"pluginRegistryImage": "",
"proxyPassword": "",
"proxyPort": "",
"proxyURL": "",
"proxyUser": "",
"serverExposureStrategy": "",
"serverMemoryLimit": "",
"serverMemoryRequest": "",
"serverTrustStoreConfigMapName": "",
"singleHostGatewayConfigMapLabels": {},
"singleHostGatewayConfigSidecarImage": "",
"singleHostGatewayImage": "",
"tlsSupport": true,
"workspaceNamespaceDefault": ""
},
"storage": {
"postgresPVCStorageClassName": "",
"preCreateSubPaths": true,
"pvcClaimSize": "1Gi",
"pvcJobsImage": "",
"pvcStrategy": "common",
"workspacePVCStorageClassName": ""
}
}
}
]
@ -49,69 +74,73 @@ metadata:
categories: Developer Tools, OpenShift Optional
certified: "false"
containerImage: quay.io/eclipse/che-operator:nightly
createdAt: "2020-11-12T13:52:17Z"
createdAt: "2020-11-16T13:58:00Z"
description: A Kube-native development solution that delivers portable and collaborative
developer workspaces in OpenShift.
operatorframework.io/suggested-namespace: eclipse-che
repository: https://github.com/eclipse/che-operator
support: Eclipse Foundation
name: eclipse-che-preview-openshift.v7.22.0-29.nightly
name: eclipse-che-preview-openshift.v7.22.0-31.nightly
namespace: placeholder
spec:
apiservicedefinitions: {}
customresourcedefinitions:
owned:
- description: Eclipse Che cluster with DB and Auth Server
- description: The `CheCluster` custom resource allows defining and managing
a Che server installation
displayName: Eclipse Che Cluster
kind: CheCluster
name: checlusters.org.eclipse.che
specDescriptors:
- description: Log in to Eclipse Che with OpenShift credentials
displayName: OpenShift oAuth
path: auth.openShiftoAuth
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: TLS routes
displayName: TLS Mode
- description: Deprecated. Instructs the operator to deploy Che in TLS mode.
This is enabled by default. Disabling TLS may cause malfunction of some
Che components.
displayName: Tls support
path: server.tlsSupport
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
statusDescriptors:
- description: Route to access Eclipse Che
displayName: Eclipse Che URL
path: cheURL
x-descriptors:
- urn:alm:descriptor:org.w3:link
- description: Route to access Keycloak Admin Console
displayName: Keycloak Admin Console URL
path: keycloakURL
x-descriptors:
- urn:alm:descriptor:org.w3:link
- description: Eclipse Che server version
displayName: Eclipse Che version
path: cheVersion
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:label
- description: The current status of the application
- description: Status of a Che installation. Can be `Available`, `Unavailable`,
or `Available, Rolling Update in Progress`
displayName: Status
path: cheClusterRunning
x-descriptors:
- urn:alm:descriptor:io.kubernetes.phase
- description: Reason of the current status
displayName: Reason
path: reason
- description: Public URL to the Che server
displayName: Eclipse Che URL
path: cheURL
x-descriptors:
- urn:alm:descriptor:text
- description: Message explaining the current status
displayName: Message
path: message
- urn:alm:descriptor:org.w3:link
- description: Current installed Che version
displayName: 'displayName: Eclipse Che version'
path: cheVersion
x-descriptors:
- urn:alm:descriptor:text
- description: Link providing help related to the current status
- urn:alm:descriptor:org.w3:link
- description: A URL that can point to some URL where to find help related
to the current Operator status.
displayName: Help link
path: helpLink
x-descriptors:
- urn:alm:descriptor:org.w3:link
- description: Public URL to the Identity Provider server (Keycloak / RH
SSO).
displayName: Keycloak Admin Console URL
path: keycloakURL
x-descriptors:
- urn:alm:descriptor:org.w3:link
- description: A human readable message indicating details about why the
pod is in this condition.
displayName: Message
path: message
x-descriptors:
- urn:alm:descriptor:text
- description: A brief CamelCase message indicating details about why the
pod is in this state.
displayName: Reason
path: reason
x-descriptors:
- urn:alm:descriptor:io.kubernetes.phase:reason
- urn:alm:descriptor:text
version: v1
description: |
A collaborative Kubernetes-native development solution that delivers OpenShift workspaces and in-browser IDE for rapid cloud application development.
@ -452,4 +481,4 @@ spec:
maturity: stable
provider:
name: Eclipse Foundation
version: 7.22.0-29.nightly
version: 7.22.0-31.nightly

View File

@ -60,4 +60,4 @@ echo "WATCH_NAMESPACE='${CHE_NAMESPACE}'" >> ${ENV_FILE}
echo "[WARN] Make sure that your CR contains valid ingress domain!"
operator-sdk run --local --namespace=${CHE_NAMESPACE} --enable-delve
operator-sdk run --local --watch-namespace=${CHE_NAMESPACE} --enable-delve

View File

@ -45,7 +45,7 @@ init() {
command -v operator-courier >/dev/null 2>&1 || { echo "[ERROR] operator-courier is not installed. Aborting."; exit 1; }
command -v operator-sdk >/dev/null 2>&1 || { echo "[ERROR] operator-sdk is not installed. Aborting."; exit 1; }
command -v skopeo >/dev/null 2>&1 || { echo "[ERROR] skopeo is not installed. Aborting."; exit 1; }
[[ $(operator-sdk version) =~ .*v0.15.2.* ]] || { echo "[ERROR] operator-sdk v0.15.2 is required. Aborting."; exit 1; }
[[ $(operator-sdk version) =~ .*v0.17.1.* ]] || { echo "[ERROR] operator-sdk v0.17.1 is required. Aborting."; exit 1; }
emptyDirs=$(find $RELEASE_DIR/olm/eclipse-che-preview-openshift/deploy/olm-catalog/eclipse-che-preview-openshift/* -maxdepth 0 -empty | wc -l)
[[ $emptyDirs -ne 0 ]] && echo "[ERROR] Found empty directories into eclipse-che-preview-openshift" && exit 1 || true

View File

@ -17,7 +17,7 @@ GIT_ROOT_DIRECTORY=$(git rev-parse --show-toplevel)
IMAGE_NAME="eclipse/che-operator-olm-build"
# Operator SDK
OPERATOR_SDK_VERSION=v0.15.2
OPERATOR_SDK_VERSION=v0.17.1
init() {
BLUE='\033[1;34m'
@ -45,9 +45,9 @@ build() {
if docker build --build-arg OPERATOR_SDK_VERSION=${OPERATOR_SDK_VERSION} -t ${IMAGE_NAME} > docker-build-log 2>&1 -<<EOF
FROM golang:1.13-alpine
ARG OPERATOR_SDK_VERSION
RUN apk add --no-cache --update curl bash py-pip jq && pip install yq
RUN apk add --no-cache --update curl bash py-pip jq skopeo && pip install yq
RUN curl -JL https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk-${OPERATOR_SDK_VERSION}-x86_64-linux-gnu -o /bin/operator-sdk && chmod u+x /bin/operator-sdk
WORKDIR /workdir/olm
WORKDIR /che-operator/olm
EOF
then
printf "%b[OK]%b\n" "${GREEN}" "${NC}"
@ -62,7 +62,7 @@ fi
run() {
printf "%bRunning%b $*\n" "${BOLD}" "${NC}"
if docker run --rm -it -v "${GIT_ROOT_DIRECTORY}":/workdir --entrypoint=/bin/bash ${IMAGE_NAME} "$@"
if docker run --rm -it -v "${GIT_ROOT_DIRECTORY}":/che-operator --entrypoint=/bin/bash ${IMAGE_NAME} "$@"
then
printf "Script execution %b[OK]%b\n" "${GREEN}" "${NC}"
else

View File

@ -16,19 +16,29 @@
set -e
init() {
BASE_DIR=$(cd "$(dirname "$0")"; pwd)
if [ -z "${BASE_DIR}" ]; then
BASE_DIR=$(cd "$(dirname "$0")"; pwd)
fi
}
check() {
local operatorVersion=$(operator-sdk version)
[[ $operatorVersion =~ .*v0.15.2.* ]] || { echo "operator-sdk v0.15.2 is required"; exit 1; }
if [ -z "${OPERATOR_SDK_BINARY}" ]; then
OPERATOR_SDK_BINARY=$(command -v operator-sdk)
if [[ ! -x "${OPERATOR_SDK_BINARY}" ]]; then
echo "[ERROR] operator-sdk is not installed."
exit 1
fi
fi
local operatorVersion=$("${OPERATOR_SDK_BINARY}" version)
[[ $operatorVersion =~ .*v0.17.1.* ]] || { echo "operator-sdk v0.17.1 is required"; exit 1; }
}
updateFiles() {
cd $BASE_DIR/..
operator-sdk generate k8s
operator-sdk generate crds
cd $BASE_DIR
pushd "${BASE_DIR}"/.. || true
"${OPERATOR_SDK_BINARY}" generate k8s
"${OPERATOR_SDK_BINARY}" generate crds
popd
}
removeRequired() {

View File

@ -27,11 +27,11 @@ fi
# Check for compatible version of operator-sdk:
OPERATOR_SDK_VERSION=$(${OPERATOR_SDK_BINARY} version | cut -d, -f1 | cut -d: -f2 | sed 's/[ \"]//g')
case $OPERATOR_SDK_VERSION in
v0.15.*)
v0.17.*)
echo "Operator SDK ${OPERATOR_SDK_VERSION} installed"
;;
*)
echo "This script requires Operator SDK v0.15.x. Please install the correct version to continue"
echo "This script requires Operator SDK v0.17.x. Please install the correct version to continue"
exit 1
;;
esac
@ -89,7 +89,6 @@ do
pushd "${ROOT_PROJECT_DIR}" || true
olmCatalog=${ROOT_PROJECT_DIR}/deploy/olm-catalog
operatorFolder=${olmCatalog}/che-operator
bundleFolder=${olmCatalog}/eclipse-che-preview-${platform}
bundleCSVName="che-operator.clusterserviceversion.yaml"
@ -97,21 +96,23 @@ do
newNightlyBundleVersion=$(yq -r ".spec.version" "${NEW_CSV}")
echo "[INFO] Will create new nightly bundle version: ${newNightlyBundleVersion}"
csv_config=${olmCatalog}/eclipse-che-preview-${platform}/csv-config.yaml
generateFolder=${olmCatalog}/eclipse-che-preview-${platform}/generated
rm -rf "${generateFolder}"
mkdir -p "${generateFolder}"
"${bundleFolder}"/build-roles.sh
packageManifestFolderPath=${ROOT_PROJECT_DIR}/deploy/olm-catalog/che-operator/${newNightlyBundleVersion}
packageManifestCSVPath=${packageManifestFolderPath}/che-operator.v${newNightlyBundleVersion}.clusterserviceversion.yaml
operatorYaml=$(yq -r ".\"operator-path\"" "${csv_config}")
cp -rf "${operatorYaml}" "${generateFolder}/"
mkdir -p "${packageManifestFolderPath}"
cp -rf "${NEW_CSV}" "${packageManifestCSVPath}"
cp -rf "${bundleFolder}/csv-config.yaml" "${olmCatalog}"
crdsDir=${ROOT_PROJECT_DIR}/deploy/crds
cp -rf "${crdsDir}" "${generateFolder}/"
echo "[INFO] Updating new package version..."
"${OPERATOR_SDK_BINARY}" olm-catalog gen-csv --csv-version "${newNightlyBundleVersion}" 2>&1 | sed -e 's/^/ /'
cp -rf "${packageManifestCSVPath}" "${NEW_CSV}"
rm -rf "${operatorFolder}" "${olmCatalog}/csv-config.yaml"
"${OPERATOR_SDK_BINARY}" generate csv \
--csv-version "${newNightlyBundleVersion}" \
--deploy-dir "${generateFolder}" \
--output-dir "${bundleFolder}" 2>&1 | sed -e 's/^/ /'
containerImage=$(sed -n 's|^ *image: *\([^ ]*/che-operator:[^ ]*\) *|\1|p' ${NEW_CSV})
echo "[INFO] Updating new package version fields:"
@ -160,6 +161,24 @@ do
done
fi
# Fix sample
if [ "${platform}" == "openshift" ]; then
echo "[INFO] Fix openshift sample"
sample=$(yq -r ".metadata.annotations.\"alm-examples\"" "${NEW_CSV}")
fixedSample=$(echo "${sample}" | yq -r ".[0] | del(.spec.k8s) | [.]" | sed -r 's/"/\\"/g')
# Update sample in the CSV
yq -rY " (.metadata.annotations.\"alm-examples\") = \"${fixedSample}\"" "${NEW_CSV}" > "${NEW_CSV}.old"
mv "${NEW_CSV}.old" "${NEW_CSV}"
fi
if [ "${platform}" == "kubernetes" ]; then
echo "[INFO] Fix kubernetes sample"
sample=$(yq -r ".metadata.annotations.\"alm-examples\"" "${NEW_CSV}")
fixedSample=$(echo "${sample}" | yq -r ".[0] | (.spec.k8s.ingressDomain) = \"\" | del(.spec.auth.openShiftoAuth) | [.]" | sed -r 's/"/\\"/g')
# Update sample in the CSV
yq -rY " (.metadata.annotations.\"alm-examples\") = \"${fixedSample}\"" "${NEW_CSV}" > "${NEW_CSV}.old"
mv "${NEW_CSV}.old" "${NEW_CSV}"
fi
# Format code.
yq -rY "." "${NEW_CSV}" > "${NEW_CSV}.old"
mv "${NEW_CSV}.old" "${NEW_CSV}"

View File

@ -137,6 +137,9 @@ type CheClusterSpecServer struct {
// This is enabled by default.
// Disabling TLS may cause malfunction of some Che components.
// +optional
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Tls support"
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
TlsSupport bool `json:"tlsSupport"`
// Public URL of the Devfile registry, that serves sample, ready-to-use devfiles.
// You should set it ONLY if you use an external devfile registry (see the `externalDevfileRegistry` field).
@ -519,15 +522,27 @@ type CheClusterStatus struct {
OpenShiftoAuthProvisioned bool `json:"openShiftoAuthProvisioned"`
// Status of a Che installation. Can be `Available`, `Unavailable`, or `Available, Rolling Update in Progress`
// +optional
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.displayName="Status"
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.x-descriptors="urn:alm:descriptor:io.kubernetes.phase"
CheClusterRunning string `json:"cheClusterRunning"`
// Current installed Che version
// +optional
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.displayName="displayName: Eclipse Che version"
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.x-descriptors="urn:alm:descriptor:org.w3:link"
CheVersion string `json:"cheVersion"`
// Public URL to the Che server
// +optional
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.displayName="Eclipse Che URL"
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.x-descriptors="urn:alm:descriptor:org.w3:link"
CheURL string `json:"cheURL"`
// Public URL to the Identity Provider server (Keycloak / RH SSO).
// +optional
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.displayName="Keycloak Admin Console URL"
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.x-descriptors="urn:alm:descriptor:org.w3:link"
KeycloakURL string `json:"keycloakURL"`
// Public URL to the Devfile registry
// +optional
@ -537,12 +552,21 @@ type CheClusterStatus struct {
PluginRegistryURL string `json:"pluginRegistryURL"`
// A human readable message indicating details about why the pod is in this condition.
// +optional
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.displayName="Message"
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.x-descriptors="urn:alm:descriptor:text"
Message string `json:"message,omitempty"`
// A brief CamelCase message indicating details about why the pod is in this state.
// +optional
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.displayName="Reason"
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.x-descriptors="urn:alm:descriptor:text"
Reason string `json:"reason,omitempty"`
// A URL that can point to some URL where to find help related to the current Operator status.
// +optional
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.displayName="Help link"
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.x-descriptors="urn:alm:descriptor:org.w3:link"
HelpLink string `json:"helpLink,omitempty"`
}
@ -551,6 +575,7 @@ type CheClusterStatus struct {
// The `CheCluster` custom resource allows defining and managing a Che server installation
// +k8s:openapi-gen=true
// +kubebuilder:subresource:status
// +operator-sdk:gen-csv:customresourcedefinitions.displayName="Eclipse Che Cluster"
type CheCluster struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

View File

@ -1,6 +1,6 @@
// +build !ignore_autogenerated
// Code generated by operator-sdk-0.15.2. DO NOT EDIT.
// Code generated by operator-sdk. DO NOT EDIT.
package v1