diff --git a/.github/action_scripts/operator_code_check.sh b/.github/action_scripts/operator_code_check.sh index 3c92e7a7e..de57fcae3 100755 --- a/.github/action_scripts/operator_code_check.sh +++ b/.github/action_scripts/operator_code_check.sh @@ -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." diff --git a/.github/action_scripts/provideNewNightlyBundle.sh b/.github/action_scripts/provideNewNightlyBundle.sh index 991675a0d..31265f8e8 100755 --- a/.github/action_scripts/provideNewNightlyBundle.sh +++ b/.github/action_scripts/provideNewNightlyBundle.sh @@ -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!" diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 97960cbfd..06eccb8ab 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -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", diff --git a/deploy/olm-catalog/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml b/deploy/olm-catalog/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml index f8f62a1de..1a935f5c0 100644 --- a/deploy/olm-catalog/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml +++ b/deploy/olm-catalog/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml @@ -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 diff --git a/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml b/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml index 009ada047..affc0c16d 100644 --- a/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml +++ b/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml @@ -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 diff --git a/local-debug.sh b/local-debug.sh index 0e7ecae78..3148fe04b 100755 --- a/local-debug.sh +++ b/local-debug.sh @@ -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 diff --git a/make-release.sh b/make-release.sh index 2eef150cf..1c24b986c 100755 --- a/make-release.sh +++ b/make-release.sh @@ -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 diff --git a/olm/docker-run.sh b/olm/docker-run.sh index a257440c9..d81f853cc 100755 --- a/olm/docker-run.sh +++ b/olm/docker-run.sh @@ -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 -<&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}" diff --git a/pkg/apis/org/v1/che_types.go b/pkg/apis/org/v1/che_types.go index fdb8efaf5..bf5ca4509 100644 --- a/pkg/apis/org/v1/che_types.go +++ b/pkg/apis/org/v1/che_types.go @@ -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"` diff --git a/pkg/apis/org/v1/zz_generated.deepcopy.go b/pkg/apis/org/v1/zz_generated.deepcopy.go index 66914f1f5..a73dbe4bb 100644 --- a/pkg/apis/org/v1/zz_generated.deepcopy.go +++ b/pkg/apis/org/v1/zz_generated.deepcopy.go @@ -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