feat: Newer operator sdk (#826)

* Define new dependencies. Update vendor folder. Use newer operator sdk v1.7.1.

Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
pull/945/head
Oleksandr Andriienko 2021-07-19 14:29:11 +03:00 committed by GitHub
parent 48d69e27fb
commit f555494a7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2351 changed files with 313213 additions and 171228 deletions

View File

@ -114,7 +114,7 @@ podman push --authfile="${REG_CREDS}" --tls-verify=false "${INTERNAL_REGISTRY_UR
podman push --authfile="${REG_CREDS}" --tls-verify=false "${INTERNAL_REGISTRY_URL}"/"${ORGANIZATION}"/che-plugin-registry:"${TAG}"
# Get all containers images used in eclipse-che deployment(postgresql, che-server, che-dashboard, keycloak...)
curl -sSLo- https://raw.githubusercontent.com/eclipse-che/che-operator/main/deploy/operator.yaml > /tmp/yam.yaml
curl -sSLo- https://raw.githubusercontent.com/eclipse-che/che-operator/main/config/manager/manager.yaml > /tmp/yam.yaml
export ARRAY_OF_IMAGES=$(cat /tmp/yam.yaml | yq '.spec.template.spec.containers[0].env[] | select(.name|test("RELATED_")) | .value' -r)
# Remove from Array of images devfile and plugins because will be builded using build.sh in offline mode.

View File

@ -18,10 +18,10 @@ if [ -z "${ROOT_PROJECT_DIR}" ]; then
ROOT_PROJECT_DIR=$(dirname "$(dirname "${BASE_DIR}")")
fi
CSV_KUBERNETES_NEW="deploy/olm-catalog/nightly/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml"
CSV_KUBERNETES_NEW="bundle/nightly/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml"
CSV_KUBERNETES_CURRENT=https://raw.githubusercontent.com/eclipse-che/che-operator/main/deploy/olm-catalog/nightly/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml
CSV_OPENSHIFT_NEW="deploy/olm-catalog/nightly/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml"
CSV_OPENSHIFT_NEW="bundle/nightly/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml"
CSV_OPENSHIFT_CURRENT=https://raw.githubusercontent.com/eclipse-che/che-operator/main/deploy/olm-catalog/nightly/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml
checkNightlyBundleVersions() {
@ -56,7 +56,7 @@ compareVersions() {
if (( $VERSION_NEW_NUMBER <= $VERSION_CURRENT_NUMBER )); then
echo "[ERROR] New nightly bundle version is less than the current one."
echo "[ERROR] Please update nightly bundle with script 'olm/update-resources.sh'"
echo "[ERROR] Please update nightly bundle with script 'make update-resources -s'"
exit 1
fi
}

View File

@ -28,48 +28,39 @@ installOperatorSDK() {
OPERATOR_SDK_BINARY=$(command -v operator-sdk) || true
if [[ ! -x "${OPERATOR_SDK_BINARY}" ]]; then
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..."
OPERATOR_SDK=$(yq -r ".\"operator-sdk\"" "${ROOT_PROJECT_DIR}/REQUIREMENTS")
curl -sLo operator-sdk $(curl -sL https://api.github.com/repos/operator-framework/operator-sdk/releases/tags/${OPERATOR_SDK} | jq -r "[.assets[] | select(.name == \"operator-sdk-${OPERATOR_SDK}-x86_64-linux-gnu\")] | first | .browser_download_url")
pushd "${ROOT_PROJECT_DIR}" || exit
make download-operator-sdk OP_SDK_DIR="${OPERATOR_SDK_TEMP_DIR}"
export OPERATOR_SDK_BINARY="${OPERATOR_SDK_TEMP_DIR}/operator-sdk"
chmod +x "${OPERATOR_SDK_BINARY}"
echo "[INFO] Downloading completed!"
echo "[INFO] $(${OPERATOR_SDK_BINARY} version)"
popd || exit
fi
}
updateResources() {
export NO_DATE_UPDATE="true"
export NO_INCREMENT="true"
. "${ROOT_PROJECT_DIR}/olm/update-resources.sh"
echo "[INFO] Update resources with skipping version incrementation and timestamp..."
pushd "${ROOT_PROJECT_DIR}" || exit
make update-resources NO_DATE_UPDATE="true" NO_INCREMENT="true" -s
popd || exit
}
# 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.
# check_che_types function check first if api/v1/checluster_types.go file suffer modifications and
# in case of modification should exist also modifications in config/crd/bases/* folder.
checkCRDs() {
echo "[INFO] Checking CRDs"
# files to check
local checluster_CRD_V1="deploy/crds/org_v1_che_crd.yaml"
local chebackupserverconfiguration_CRD_V1="deploy/crds/org.eclipse.che_chebackupserverconfigurations_crd.yaml"
local checlusterbackup_CRD_V1="deploy/crds/org.eclipse.che_checlusterbackups_crd.yaml"
local checlusterrestore_CRD_V1="org.eclipse.che_checlusterrestores_crd.yaml"
local checluster_CRD_V1="config/crd/bases/org_v1_che_crd.yaml"
local chebackupserverconfiguration_CRD_V1="config/crd/bases/org.eclipse.che_chebackupserverconfigurations_crd.yaml"
local checlusterbackup_CRD_V1="config/crd/bases/org.eclipse.che_checlusterbackups_crd.yaml"
local checlusterrestore_CRD_V1="config/crd/bases/org.eclipse.che_checlusterrestores_crd.yaml"
local checluster_CRD_V1BETA1="deploy/crds/org_v1_che_crd-v1beta1.yaml"
local chebackupserverconfiguration_CRD_V1BETA1="deploy/crds/org.eclipse.che_chebackupserverconfigurations_crd-v1beta1.yaml"
local checlusterbackup_CRD_V1BETA1="deploy/crds/org.eclipse.che_checlusterbackups_crd-v1beta1.yaml"
local checlusterrestore_CRD_V1BETA1="deploy/crds/org.eclipse.che_checlusterrestores_crd-v1beta1.yaml"
changedFiles=(
$(git diff --name-only)
)
local checluster_CRD_V1BETA1="config/crd/bases/org_v1_che_crd-v1beta1.yaml"
local chebackupserverconfiguration_CRD_V1BETA1="config/crd/bases/org.eclipse.che_chebackupserverconfigurations_crd-v1beta1.yaml"
local checlusterbackup_CRD_V1BETA1="config/crd/bases/org.eclipse.che_checlusterbackups_crd-v1beta1.yaml"
local checlusterrestore_CRD_V1BETA1="config/crd/bases/org.eclipse.che_checlusterrestores_crd-v1beta1.yaml"
changedFiles=($(cd ${ROOT_PROJECT_DIR}; git diff --name-only))
# Check if there are any difference in the crds. If yes, then fail check.
if [[ " ${changedFiles[*]} " =~ $checluster_CRD_V1 ]] || [[ " ${changedFiles[*]} " =~ $checluster_CRD_V1BETA1 ]] || \
[[ " ${changedFiles[*]} " =~ $chebackupserverconfiguration_CRD_V1 ]] || [[ " ${changedFiles[*]} " =~ $chebackupserverconfiguration_CRD_V1BETA1 ]] || \
@ -77,7 +68,7 @@ checkCRDs() {
[[ " ${changedFiles[*]} " =~ $checlusterrestore_CRD_V1 ]] || [[ " ${changedFiles[*]} " =~ $checlusterrestore_CRD_V1BETA1 ]]
then
echo "[ERROR] CRD file is not up to date: ${BASH_REMATCH}"
echo "[ERROR] Run 'olm/update-resources.sh' to regenerate CRD files."
echo "[ERROR] Run 'make update-resources -s' to regenerate CRD files."
exit 1
else
echo "[INFO] CRDs files are up to date."
@ -86,18 +77,16 @@ checkCRDs() {
checkNightlyOlmBundle() {
# files to check
local CSV_FILE_KUBERNETES="deploy/olm-catalog/nightly/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml"
local CSV_FILE_OPENSHIFT="deploy/olm-catalog/nightly/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml"
local CRD_FILE_KUBERNETES="deploy/olm-catalog/nightly/eclipse-che-preview-kubernetes/manifests/org_v1_che_crd.yaml"
local CRD_FILE_OPENSHIFT="deploy/olm-catalog/nightly/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml"
local CSV_FILE_KUBERNETES="bundle/nightly/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml"
local CSV_FILE_OPENSHIFT="bundle/nightly/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml"
local CRD_FILE_KUBERNETES="bundle/nightly/eclipse-che-preview-kubernetes/manifests/org_v1_che_crd.yaml"
local CRD_FILE_OPENSHIFT="bundle/nightly/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml"
changedFiles=(
$(git diff --name-only)
)
changedFiles=($(cd ${ROOT_PROJECT_DIR}; git diff --name-only))
if [[ " ${changedFiles[*]} " =~ $CSV_FILE_OPENSHIFT ]] || [[ " ${changedFiles[*]} " =~ $CSV_FILE_OPENSHIFT ]] || \
[[ " ${changedFiles[*]} " =~ $CRD_FILE_KUBERNETES ]] || [[ " ${changedFiles[*]} " =~ $CRD_FILE_OPENSHIFT ]]; then
echo "[ERROR] Nighlty bundle is not up to date: ${BASH_REMATCH}"
echo "[ERROR] Run 'olm/update-resources.sh' to regenerate CSV/CRD files."
echo "[ERROR] Run 'make update-resources -s' to regenerate CSV/CRD files."
exit 1
else
echo "[INFO] Nightly bundles are up to date."
@ -108,12 +97,10 @@ checkDockerfile() {
# files to check
local Dockerfile="Dockerfile"
changedFiles=(
$(git diff --name-only)
)
changedFiles=($(cd ${ROOT_PROJECT_DIR}; git diff --name-only))
if [[ " ${changedFiles[*]} " =~ $Dockerfile ]]; then
echo "[ERROR] Dockerfile is not up to date"
echo "[ERROR] Run 'olm/update-resources.sh' to update Dockerfile"
echo "[ERROR] Run 'make update-resources -s' to update Dockerfile"
exit 1
else
echo "[INFO] Dockerfile is up to date."
@ -122,14 +109,12 @@ checkDockerfile() {
checkOperatorYaml() {
# files to check
local OperatorYaml="deploy/operator.yaml"
local OperatorYaml="config/manager/manager.yaml"
changedFiles=(
$(git diff --name-only)
)
changedFiles=($(cd ${ROOT_PROJECT_DIR}; git diff --name-only))
if [[ " ${changedFiles[*]} " =~ $OperatorYaml ]]; then
echo "[ERROR] $OperatorYaml is not up to date"
echo "[ERROR] Run 'olm/update-resources.sh' to update $OperatorYaml"
echo "[ERROR] Run 'make update-resources -s' to update $OperatorYaml"
exit 1
else
echo "[INFO] $OperatorYaml is up to date."

70
.github/bin/common.sh vendored
View File

@ -34,7 +34,7 @@ initDefaults() {
export OPERATOR_IMAGE="test/che-operator:test"
export DEFAULT_DEVFILE="https://raw.githubusercontent.com/eclipse-che/che-devfile-registry/master/devfiles/go/devfile.yaml"
export CHE_EXPOSURE_STRATEGY="multi-host"
export OPENSHIFT_NIGHTLY_CSV_FILE="${OPERATOR_REPO}/deploy/olm-catalog/nightly/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml"
export OPENSHIFT_NIGHTLY_CSV_FILE="${OPERATOR_REPO}/bundle/nightly/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml"
export DEV_WORKSPACE_CONTROLLER_VERSION="main"
export DEV_WORKSPACE_ENABLE="false"
@ -48,12 +48,13 @@ initDefaults() {
}
initLatestTemplates() {
rm -rf /tmp/devfile-devworkspace-operator-*
curl -L https://api.github.com/repos/devfile/devworkspace-operator/zipball/${DEV_WORKSPACE_CONTROLLER_VERSION} > /tmp/devworkspace-operator.zip && \
unzip /tmp/devworkspace-operator.zip */deploy/deployment/* -d /tmp && \
mkdir -p /tmp/devworkspace-operator/templates/ && \
mv /tmp/devfile-devworkspace-operator-*/deploy ${TEMPLATES}/devworkspace
cp -rf ${OPERATOR_REPO}/deploy/* "${TEMPLATES}/che-operator"
prepareTemplates "${OPERATOR_REPO}" "${TEMPLATES}/che-operator"
}
getLatestsStableVersions() {
@ -89,14 +90,20 @@ initStableTemplates() {
mkdir -p "${LAST_OPERATOR_TEMPLATE}/che-operator"
mkdir -p "${PREVIOUS_OPERATOR_TEMPLATE}/che-operator"
cp -rf ${previousOperatorPath}/deploy/* "${PREVIOUS_OPERATOR_TEMPLATE}/che-operator"
cp -rf ${lastOperatorPath}/deploy/* "${LAST_OPERATOR_TEMPLATE}/che-operator"
# todo: set up final version before merge pr...
compareResult=$(pysemver compare "${LAST_PACKAGE_VERSION}" "7.34.0")
if [ "${compareResult}" == "1" ]; then
prepareTemplates "${lastOperatorPath}" "${LAST_OPERATOR_TEMPLATE}/che-operator"
else
cp -rf ${lastOperatorPath}/deploy/* "${LAST_OPERATOR_TEMPLATE}/che-operator"
fi
}
# Utility to wait for a workspace to be started after workspace:create.
waitWorkspaceStart() {
export x=0
while [ $x -le 180 ]
timeout=240
while [ $x -le $timeout ]
do
login
@ -114,9 +121,9 @@ waitWorkspaceStart() {
x=$(( x+1 ))
done
if [ $x -gt 180 ]
if [ $x -gt $timeout ]
then
echo "[ERROR] Workspace didn't start after 3 minutes."
echo "[ERROR] Workspace didn't start after 4 minutes."
exit 1
fi
}
@ -174,6 +181,38 @@ copyCheOperatorImageToMinishift() {
eval $(minishift docker-env) && docker load -i /tmp/operator.tar && rm /tmp/operator.tar
}
# Prepare chectl che-operator templates
prepareTemplates() {
if [ -n "${1}" ]; then
SRC_TEMPLATES="${1}"
else
echo "[ERROR] Specify templates original location"
exit 1
fi
if [ -n "${2}" ]; then
TARGET_TEMPLATES="${2}"
else
echo "[ERROR] Specify templates target location"
exit 1
fi
mkdir -p "${SRC_TEMPLATES}"
cp -f "${SRC_TEMPLATES}/config/manager/manager.yaml" "${TARGET_TEMPLATES}/operator.yaml"
cp -rf "${SRC_TEMPLATES}/config/crd/bases/" "${TARGET_TEMPLATES}/crds/"
cp -f "${SRC_TEMPLATES}/config/rbac/role.yaml" "${TARGET_TEMPLATES}/"
cp -f "${SRC_TEMPLATES}/config/rbac/role_binding.yaml" "${TARGET_TEMPLATES}/"
cp -f "${SRC_TEMPLATES}/config/rbac/cluster_role.yaml" "${TARGET_TEMPLATES}/"
cp -f "${SRC_TEMPLATES}/config/rbac/cluster_rolebinding.yaml" "${TARGET_TEMPLATES}/"
cp -f "${SRC_TEMPLATES}/config/rbac/service_account.yaml" "${TARGET_TEMPLATES}/"
cp -f "${SRC_TEMPLATES}/config/samples/org.eclipse.che_v1_checluster.yaml" "${TARGET_TEMPLATES}/crds/org_v1_che_cr.yaml"
cp -f "${SRC_TEMPLATES}/config/crd/bases/org_v1_che_crd-v1beta1.yaml" "${TARGET_TEMPLATES}/crds/org_v1_che_crd-v1beta1.yaml"
}
deployEclipseCheStable(){
local installer=$1
local platform=$2
@ -194,7 +233,8 @@ deployEclipseCheWithTemplates() {
local templates=$4
echo "[INFO] Eclipse Che custom resource"
cat ${templates}/che-operator/crds/org_v1_che_cr.yaml
local crSample=${templates}/che-operator/crds/org_v1_che_cr.yaml
cat ${crSample}
echo "[INFO] Eclipse Che operator deployment"
cat ${templates}/che-operator/operator.yaml
@ -206,7 +246,7 @@ deployEclipseCheWithTemplates() {
--chenamespace ${NAMESPACE} \
--che-operator-image ${image} \
--skip-kubernetes-health-check \
--che-operator-cr-yaml ${templates}/che-operator/crds/org_v1_che_cr.yaml \
--che-operator-cr-yaml ${crSample} \
--templates ${templates}
}
@ -332,18 +372,6 @@ setCustomOperatorImage() {
insecurePrivateDockerRegistry() {
IMAGE_REGISTRY_HOST="127.0.0.1:5000"
export IMAGE_REGISTRY_HOST
# local dockerDaemonConfig="/etc/docker/daemon.json"
# sudo mkdir -p "/etc/docker"
# sudo touch "${dockerDaemonConfig}"
# config="{\"insecure-registries\" : [\"${IMAGE_REGISTRY_HOST}\"]}"
# echo "${config}" | sudo tee "${dockerDaemonConfig}"
# if [ -x "$(command -v docker)" ]; then
# echo "[INFO] Restart docker daemon to set up private registry info."
# sudo service docker restart
# fi
}
# Utility to print objects created by Openshift CI automatically

View File

@ -76,7 +76,7 @@ waitBackupFinished() {
}
waitRestoreFinished() {
maxAttempts=75
maxAttempts=130
count=0
while [ $count -le $maxAttempts ]; do
state=$(kubectl get checlusterrestore eclipse-che-restore -n ${NAMESPACE} -o jsonpath='{.status.state}')
@ -123,7 +123,7 @@ runTest() {
waitWorkspaceStart
}
prepareTemplates() {
patchTemplates() {
disableUpdateAdminPassword ${TEMPLATES}
setIngressDomain ${TEMPLATES} "$(minikube ip).nip.io"
setCustomOperatorImage ${TEMPLATES} ${OPERATOR_IMAGE}
@ -131,7 +131,7 @@ prepareTemplates() {
initDefaults
initLatestTemplates
prepareTemplates
patchTemplates
buildCheOperatorImage
copyCheOperatorImageToMinikube
runTest

View File

@ -15,13 +15,17 @@ set -x
set -u
# Get absolute path for root repo directory from github actions context: https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions
export OPERATOR_REPO="${GITHUB_WORKSPACE}"
export OPERATOR_REPO="${GITHUB_WORKSPACE:-}"
if [ -z "${OPERATOR_REPO}" ]; then
SCRIPT=$(readlink -f "${BASH_SOURCE[0]}")
OPERATOR_REPO=$(dirname "$(dirname "$(dirname "$(dirname "$SCRIPT")")")")
fi
source "${OPERATOR_REPO}"/.github/bin/common.sh
# Stop execution on any error
trap "catchFinish" EXIT SIGINT
prepareTemplates() {
patchTemplates() {
disableUpdateAdminPassword ${TEMPLATES}
setCustomOperatorImage ${TEMPLATES} ${OPERATOR_IMAGE}
setServerExposureStrategy ${TEMPLATES} "single-host"
@ -37,7 +41,7 @@ runTest() {
initDefaults
initLatestTemplates
prepareTemplates
patchTemplates
buildCheOperatorImage
copyCheOperatorImageToMinikube
runTest

View File

@ -15,12 +15,16 @@ set -x
# Get absolute path for root repo directory from github actions context: https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions
export OPERATOR_REPO="${GITHUB_WORKSPACE}"
if [ -z "${OPERATOR_REPO}" ]; then
SCRIPT=$(readlink -f "${BASH_SOURCE[0]}")
OPERATOR_REPO=$(dirname "$(dirname "$(dirname "$(dirname "$SCRIPT")")")")
fi
source "${OPERATOR_REPO}"/.github/bin/common.sh
# Stop execution on any error
trap "catchFinish" EXIT SIGINT
prepareTemplates() {
patchTemplates() {
disableUpdateAdminPassword ${TEMPLATES}
setCustomOperatorImage ${TEMPLATES} ${OPERATOR_IMAGE}
setServerExposureStrategy ${TEMPLATES} "single-host"
@ -36,7 +40,7 @@ runTest() {
initDefaults
initLatestTemplates
prepareTemplates
patchTemplates
buildCheOperatorImage
copyCheOperatorImageToMinikube
runTest

View File

@ -25,7 +25,7 @@ source "${OPERATOR_REPO}/olm/olm.sh"
# Stop execution on any error
trap "catchFinish" EXIT SIGINT
prepareTemplates() {
patchTemplates() {
disableUpdateAdminPassword ${LAST_OPERATOR_TEMPLATE}
setIngressDomain ${LAST_OPERATOR_TEMPLATE} "$(minikube ip).nip.io"
setCustomOperatorImage ${TEMPLATES} ${OPERATOR_IMAGE}
@ -46,7 +46,7 @@ initDefaults
installOperatorMarketPlace
initLatestTemplates
initStableTemplates "kubernetes" "stable"
prepareTemplates
patchTemplates
buildCheOperatorImage
copyCheOperatorImageToMinikube
runTest

View File

@ -20,7 +20,7 @@ source "${OPERATOR_REPO}"/.github/bin/common.sh
# Stop execution on any error
trap "catchFinish" EXIT SIGINT
prepareTemplates() {
patchTemplates() {
disableOpenShiftOAuth ${LAST_OPERATOR_TEMPLATE}
disableUpdateAdminPassword ${LAST_OPERATOR_TEMPLATE}
setCustomOperatorImage ${TEMPLATES} ${OPERATOR_IMAGE}
@ -41,7 +41,7 @@ initDefaults
installYq
initLatestTemplates
initStableTemplates "openshift" "stable"
prepareTemplates
patchTemplates
if [[ -z "$GITHUB_ACTIONS" ]]; then
buildCheOperatorImage
fi

View File

@ -15,12 +15,16 @@ set -x
# Get absolute path for root repo directory from github actions context: https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions
export OPERATOR_REPO="${GITHUB_WORKSPACE}"
if [ -z "${OPERATOR_REPO}" ]; then
SCRIPT=$(readlink -f "${BASH_SOURCE[0]}")
OPERATOR_REPO=$(dirname "$(dirname "$(dirname "$(dirname "$SCRIPT")")")")
fi
source "${OPERATOR_REPO}"/.github/bin/common.sh
# Stop execution on any error
trap "catchFinish" EXIT SIGINT
prepareTemplates() {
patchTemplates() {
disableOpenShiftOAuth ${TEMPLATES}
disableUpdateAdminPassword ${TEMPLATES}
setCustomOperatorImage ${TEMPLATES} ${OPERATOR_IMAGE}
@ -35,7 +39,7 @@ runTest() {
initDefaults
installYq
initLatestTemplates
prepareTemplates
patchTemplates
if [[ -z "$GITHUB_ACTIONS" ]]; then
buildCheOperatorImage
fi

View File

@ -21,8 +21,8 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Install yq
run: sudo pip install yq
- name: Install yq and pysemver
run: sudo pip install yq pysemver
- name: Docker login
uses: azure/docker-login@v1
with:

View File

@ -17,8 +17,15 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Install yq
run: sudo pip install yq
- name: Install yq and pysemver
run: |
pip install operator-courier==2.1.7
sudo pip install yq pysemver;
echo "[INFO] pysemver version:"
pysemver --version;
echo "[INFO] yq version:"
yq --version;
- name: Provision Minikube cluster
run: |
curl -LO https://storage.googleapis.com/minikube/releases/v1.21.0/minikube-linux-amd64
@ -44,8 +51,8 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Install yq
run: sudo pip install yq
- name: Install yq and pysemver
run: sudo pip install yq pysemver
- name: Provision Minikube cluster
run: |
curl -LO https://storage.googleapis.com/minikube/releases/v1.21.0/minikube-linux-amd64

View File

@ -21,8 +21,14 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Install yq
run: sudo pip install yq
- name: Install yq and pysemver
run: |
pip install operator-courier==2.1.7
sudo pip install yq pysemver;
echo "[INFO] pysemver version:"
pysemver --version;
echo "[INFO] yq version:"
yq --version;
- name: Provision Minikube cluster
run: |
curl -LO https://storage.googleapis.com/minikube/releases/v1.21.0/minikube-linux-amd64

View File

@ -45,8 +45,18 @@ jobs:
minishift start --memory=5500 --vm-driver=virtualbox --registry-mirror=https://quay.io
- name: Install chectl
run: bash <(curl -sL https://www.eclipse.org/che/chectl/) --channel=stable
- name: Install jq
run: sudo pip install yq
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install yq and pysemver
run: |
pip3 install operator-courier==2.1.7
sudo pip install yq pysemver;
echo "[INFO] pysemver version:"
pysemver --version;
echo "[INFO] yq version:"
yq --version;
- name: Replace Minishift default certificates
run: /bin/bash .github/bin/minishift/certs.sh
- name: Tests

View File

@ -42,8 +42,7 @@ jobs:
set -e
OP_SDK_DIR=/opt/operator-sdk
mkdir -p $OP_SDK_DIR
OPERATOR_SDK=$(sed -r 's|operator-sdk:\s*(.*)|\1|' REQUIREMENTS)
curl -sSLo $OP_SDK_DIR/operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK}/operator-sdk-${OPERATOR_SDK}-x86_64-linux-gnu && chmod +x $OP_SDK_DIR/operator-sdk
make download-operator-sdk OP_SDK_DIR="${OP_SDK_DIR}"
export PATH="$PATH:$OP_SDK_DIR"
export QUAY_ECLIPSE_CHE_USERNAME=${{ secrets.QUAY_USERNAME }}
export QUAY_ECLIPSE_CHE_PASSWORD=${{ secrets.QUAY_PASSWORD }}

View File

@ -83,15 +83,11 @@ jobs:
git config --global user.email "mkuznets@redhat.com"
export GITHUB_TOKEN=${{ secrets.CHE_BOT_GITHUB_TOKEN }}
set -e
OP_SDK_DIR=/opt/operator-sdk
mkdir -p $OP_SDK_DIR
if [[ ${CHE_VERSION%.*} == 7.21 ]];then
wget https://github.com/operator-framework/operator-sdk/releases/download/v0.10.0/operator-sdk-v0.10.0-x86_64-linux-gnu -O $OP_SDK_DIR/operator-sdk
else
OPERATOR_SDK=$(sed -r 's|operator-sdk:\s*(.*)|\1|' REQUIREMENTS)
wget https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK}/operator-sdk-${OPERATOR_SDK}-x86_64-linux-gnu -O $OP_SDK_DIR/operator-sdk
fi
chmod +x $OP_SDK_DIR/operator-sdk
make download-operator-sdk OP_SDK_DIR="${OP_SDK_DIR}"
export PATH="$PATH:$OP_SDK_DIR"
export QUAY_ECLIPSE_CHE_USERNAME=${{ secrets.QUAY_USERNAME }}
export QUAY_ECLIPSE_CHE_PASSWORD=${{ secrets.QUAY_PASSWORD }}
@ -114,9 +110,6 @@ jobs:
# echo "[DEBUG] QUAY_USERNAME_K8S = ${QUAY_USERNAME_K8S} and"
# echo "[DEBUG] QUAY_USERNAME_OS = ${QUAY_USERNAME_OS}"
# publish quay applications to:
# https://quay.io/application/eclipse-che-operator-kubernetes/eclipse-che-preview-kubernetes?tab=releases and
# https://quay.io/application/eclipse-che-operator-openshift/eclipse-che-preview-openshift?tab=releases
git checkout ${CHE_VERSION}-release
./make-release.sh ${CHE_VERSION} --push-olm-bundles

21
.gitignore vendored
View File

@ -1,5 +1,8 @@
# Idea
# Editor and IDE paraphernalia
.idea/
*.swp
*.swo
*~
# Temporary Build Files
tmp
@ -80,7 +83,9 @@ anaconda-mode/
*.dll
*.so
*.dylib
cmd/manager/__debug_bin
__debug_bin
bin
testbin/*
# Test binary, build with 'go test -c'
*.test
@ -109,9 +114,11 @@ tags
build/
olm/generated
deploy/olm-catalog/nightly/eclipse-che-preview-kubernetes/generated
deploy/olm-catalog/nightly/eclipse-che-preview-openshift/generated
deploy/olm-catalog/stable/eclipse-che-preview-kubernetes/generated
deploy/olm-catalog/stable/eclipse-che-preview-openshift/generated
bundle/nightly/eclipse-che-preview-kubernetes/generated
bundle/nightly/eclipse-che-preview-openshift/generated
bundle/stable/eclipse-che-preview-kubernetes/generated
bundle/stable/eclipse-che-preview-openshift/generated
# End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode
testbin/setup-envtest.sh
.DS_Store

30
.vscode/launch.json vendored
View File

@ -1,6 +1,19 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "bashdb",
"request": "launch",
"name": "Make release",
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/make-release.sh",
"args": [
"7.30.0",
"--release",
"--check-resources",
"--release-olm-files"
]
},
{
"type": "bashdb",
"request": "launch",
@ -8,7 +21,7 @@
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/olm/release-olm-files.sh",
"args": [
"7.13.2"
"7.30.0"
]
},
{
@ -140,17 +153,6 @@
"name": "Bash-Debug (simplest configuration)",
"program": "${file}",
},
{
"name": "Launch Current Test *.go File",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${file}",
"env": {
"MOCK_API": true,
"CHE_FLAVOR": "che"
},
},
{
"name": "Launch Main *.go File",
"type": "go",
@ -170,7 +172,7 @@
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/manager/main.go",
"program": "${workspaceFolder}/main.go",
"env": {
"CHE_FLAVOR": "che",
"CONSOLE_LINK_NAME": "che",
@ -186,7 +188,7 @@
"cwd": "${workspaceFolder}",
"args": [
"--defaults-path",
"deploy/operator.yaml"
"config/manager/manager.yaml"
]
}
]

240
.vscode/tasks.json vendored
View File

@ -3,7 +3,7 @@
"tasks": [
{
"label": "Compile che-operator code",
"command": "GOOS=linux GOARCH=${ARCH} CGO_ENABLED=0 go build -mod=vendor -o /tmp/che-operator/che-operator cmd/manager/main.go",
"command": "GOOS=linux GOARCH=${ARCH} CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -a -o /tmp/che-operator/che-operator main.go",
"options": {
"env": {
"ARCH": "amd64"
@ -22,11 +22,19 @@
{
"label": "Format che-operator code",
"command": "go fmt ./...",
"options": {
"env": {
"ARCH": "amd64"
}
"type": "shell",
"args": [],
"problemMatcher": [
"$go"
],
"presentation": {
"reveal": "always"
},
"group": "build"
},
{
"label": "Fix che-operator imports",
"command": "find . -not -path \"./vendor/*\" -name '*.go' -exec goimports -l -w {} \\;",
"type": "shell",
"args": [],
"problemMatcher": [
@ -39,12 +47,7 @@
},
{
"label": "Update che-operator dependencies",
"command": "go mod vendor",
"options": {
"env": {
"ARCH": "amd64"
}
},
"command": "go mod tidy; go mod vendor",
"type": "shell",
"args": [],
"problemMatcher": [
@ -56,13 +59,8 @@
"group": "build"
},
{
"label": "Run che-operator mock tests",
"label": "Run che-operator tests",
"command": "go test -mod=vendor -v ./...",
"options": {
"env": {
"MOCK_API": "true"
}
},
"type": "shell",
"args": [],
"problemMatcher": [
@ -75,7 +73,7 @@
},
{
"label": "Update resources",
"command": "./olm/update-resources.sh",
"command": "make update-resources -s",
"type": "shell",
"args": [],
"problemMatcher": [
@ -87,8 +85,210 @@
"group": "build"
},
{
"label": "Build and push custom che-operator image: '${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:nightly'",
"command": "docker build --no-cache -t ${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:nightly . && docker push ${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:nightly",
"label": "Update CR/CRDs",
"command": "make generate manifests -s",
"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:next'",
"command": "make docker-build docker-push IMG=\"${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:next\"",
"type": "shell",
"args": [],
"problemMatcher": [
"$go"
],
"presentation": {
"reveal": "always"
},
"group": "build"
},
{
"label": "Install OLM on the cluster",
"command": "operator-sdk olm install",
"type": "shell",
"args": [],
"problemMatcher": [
"$go"
],
"presentation": {
"reveal": "always"
},
"group": "build"
},
{
"label": "Build and push test bundle Kubernetes platform",
"command": "export BUNDLE_IMG=\"${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator-bundle:v0.0.1\"; make bundle IMG=${BUNDLE_IMG} platform=\"kubernetes\" -s; make bundle-build bundle-push -s BUNDLE_IMG=${BUNDLE_IMG} platform=\"kubernetes\"",
"type": "shell",
"args": [],
"problemMatcher": [
"$go"
],
"presentation": {
"reveal": "always"
},
"group": "build"
},
{
"label": "Build and push test bundle Openshift platform",
"command": "export BUNDLE_IMG=\"${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator-bundle:v0.0.1\"; make bundle IMG=${BUNDLE_IMG} platform=\"openshift\" -s; make bundle-build bundle-push -s BUNDLE_IMG=${BUNDLE_IMG} platform=\"openshift\"",
"type": "shell",
"args": [],
"problemMatcher": [
"$go"
],
"presentation": {
"reveal": "always"
},
"group": "build"
},
{
"label": "Install che-operator via OLM",
"command": "operator-sdk run bundle ${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator-bundle:v0.0.1 --namespace ${NAMESPACE}; kubectl apply -f config/samples/org.eclipse.che_v1_checluster.yaml -n ${NAMESPACE}",
"type": "shell",
"args": [],
"problemMatcher": [
"$go"
],
"presentation": {
"reveal": "always"
},
"group": "build",
"options": {
"env": {
"NAMESPACE": "eclipse-che"
}
}
},
{
"label": "UnInstall che-operator via OLM Openshift",
"command": "operator-sdk cleanup eclipse-che-preview-openshift --namespace ${NAMESPACE}",
"type": "shell",
"args": [],
"problemMatcher": [
"$go"
],
"presentation": {
"reveal": "always"
},
"group": "build",
"options": {
"env": {
"NAMESPACE": "eclipse-che"
}
}
},
{
"label": "UnInstall che-operator via OLM Kubernetes",
"command": "operator-sdk cleanup eclipse-che-preview-kubernetes --namespace ${NAMESPACE}",
"type": "shell",
"args": [],
"problemMatcher": [
"$go"
],
"presentation": {
"reveal": "always"
},
"group": "build",
"options": {
"env": {
"NAMESPACE": "eclipse-che"
}
}
},
{
"label": "Install che-operator outside cluster",
"command": "make -s apply-cr-crd; make create-full-env-file -s; set -a; . /tmp/che-operator-debug.env; set +a; kubectl apply -f config/samples/org.eclipse.che_v1_checluster.yaml -n ${WATCH_NAMESPACE}; make -s run",
"type": "shell",
"options": {
"env": {
"CHE_FLAVOR": "che",
"CONSOLE_LINK_NAME": "che",
"CONSOLE_LINK_DISPLAY_NAME": "Eclipse Che",
"CONSOLE_LINK_SECTION": "Red Hat Applications",
"CONSOLE_LINK_IMAGE": "/dashboard/assets/branding/loader.svg",
"CHE_IDENTITY_SECRET": "che-identity-secret",
"CHE_IDENTITY_POSTGRES_SECRET": "che-identity-postgres-secret",
"CHE_POSTGRES_SECRET": "che-postgres-secret",
"CHE_SERVER_TRUST_STORE_CONFIGMAP_NAME": "ca-certs"
}
},
"args": [],
"problemMatcher": [
"$go"
],
"presentation": {
"reveal": "always"
},
"group": "build"
},
{
"label": "UnInstall Che outside cluster",
"command": "kubectl patch checluster eclipse-che -p '{\"metadata\":{\"finalizers\":null}}' --type=merge -n ${NAMESPACE}; kubectl delete -f config/samples/org.eclipse.che_v1_checluster.yaml -n ${NAMESPACE}",
"type": "shell",
"args": [],
"problemMatcher": [
"$go"
],
"presentation": {
"reveal": "always"
},
"group": "build",
"options": {
"env": {
"NAMESPACE": "eclipse-che"
}
}
},
{
"label": "Deploy che-operator",
"command": "make deploy IMG=\"${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:next\" -s; kubectl apply -f config/samples/org.eclipse.che_v1_checluster.yaml -n eclipse-che",
"type": "shell",
"args": [],
"problemMatcher": [
"$go"
],
"presentation": {
"reveal": "always"
},
"group": "build"
},
{
"label": "UnDeploy che-operator",
"command": "make undeploy",
"type": "shell",
"args": [],
"problemMatcher": [
"$go"
],
"presentation": {
"reveal": "always"
},
"group": "build"
},
{
"label": "Await debugger attach for che-operator",
"command": "make debug -s",
"type": "shell",
"args": [],
"problemMatcher": [
"$go"
],
"presentation": {
"reveal": "always"
},
"group": "build"
},
{
"label": "[CRD beta(Minishift)] Await debugger attach for che-operator",
"command": "make debug -s ECLIPSE_CHE_CRD='config/crd/bases/org_v1_che_crd-v1beta1.yaml'",
"type": "shell",
"args": [],
"problemMatcher": [

3014
Dependencies.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -16,8 +16,19 @@ ENV RESTIC_TAG=v0.12.0
ARG DEV_WORKSPACE_CONTROLLER_VERSION="main"
ARG DEV_WORKSPACE_CHE_OPERATOR_VERSION="main"
USER root
ADD . /che-operator
WORKDIR /che-operator
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# Copy the go source
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY templates/ templates/
COPY pkg/ pkg/
COPY vendor/ vendor/
# upstream, download zips for every build
# downstream, copy prefetched asset-*.zip into /tmp
@ -27,9 +38,7 @@ RUN curl -sSLo /tmp/asset-devworkspace-operator.zip https://api.github.com/repos
# build operator
RUN export ARCH="$(uname -m)" && if [[ ${ARCH} == "x86_64" ]]; then export ARCH="amd64"; elif [[ ${ARCH} == "aarch64" ]]; then export ARCH="arm64"; fi && \
export MOCK_API=true && \
go test -mod=vendor -v ./... && \
GOOS=linux GOARCH=${ARCH} CGO_ENABLED=0 go build -mod=vendor -o /tmp/che-operator/che-operator cmd/manager/main.go
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o che-operator main.go
RUN unzip /tmp/asset-devworkspace-operator.zip */deploy/deployment/* -d /tmp && \
mkdir -p /tmp/devworkspace-operator/templates/ && \
@ -50,7 +59,7 @@ RUN mkdir -p $GOPATH/restic && cd $GOPATH/restic && \
# https://access.redhat.com/containers/?tab=tags#/registry.access.redhat.com/ubi8-minimal
FROM registry.access.redhat.com/ubi8-minimal:8.4-205
COPY --from=builder /tmp/che-operator/che-operator /usr/local/bin/che-operator
COPY --from=builder /che-operator/che-operator /manager
COPY --from=builder /che-operator/templates/*.sh /tmp/
COPY --from=builder /tmp/devworkspace-operator/templates/deploy /tmp/devworkspace-operator/templates
COPY --from=builder /tmp/devworkspace-che-operator/templates/deploy /tmp/devworkspace-che-operator/templates
@ -60,6 +69,10 @@ COPY --from=builder /go/restic/LICENSE /usr/local/bin/restic-LICENSE.txt
# install httpd-tools for /usr/bin/htpasswd
RUN microdnf install -y httpd-tools && microdnf -y update && microdnf -y clean all && rm -rf /var/cache/yum && echo "Installed Packages" && rpm -qa | sort -V && echo "End Of Installed Packages" && \
mkdir ~/.ssh && chmod 0766 ~/.ssh
CMD ["che-operator"]
WORKDIR /
USER 65532:65532
ENTRYPOINT ["/manager"]
# append Brew metadata here - see https://github.com/redhat-developer/codeready-workspaces-images/blob/crw-2-rhel-8/crw-jenkins/jobs/CRW_CI/crw-operator_2.x.jenkinsfile

900
Makefile Normal file
View File

@ -0,0 +1,900 @@
# VERSION defines the project version for the bundle.
# Update this value when you upgrade the version of your project.
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 1.0.2
CHANNELS = "nightly"
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mkfile_dir := $(dir $(mkfile_path))
# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "preview,fast,stable")
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=preview,fast,stable)
# - use environment variables to overwrite this value (e.g export CHANNELS="preview,fast,stable")
ifneq ($(origin CHANNELS), undefined)
BUNDLE_CHANNELS := --channels=$(CHANNELS)
endif
DEFAULT_CHANNEL = "nightly"
# DEFAULT_CHANNEL defines the default channel used in the bundle.
# Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable")
# To re-generate a bundle for any other default channel without changing the default setup, you can:
# - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable)
# - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable")
ifneq ($(origin DEFAULT_CHANNEL), undefined)
BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
OPERATOR_SDK_BINARY ?= operator-sdk
# IMAGE_TAG_BASE defines the quay.io namespace and part of the image name for remote images.
# This variable is used to construct full image tags for bundle and catalog images.
#
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
# quay.io/eclipse/che-operator-bundle:$VERSION and quay.io/eclipse/che-operator-catalog:$VERSION.
IMAGE_TAG_BASE ?= quay.io/eclipse/che-operator
# BUNDLE_IMG defines the image:tag used for the bundle.
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)
# Image URL to use all building/pushing image targets
IMG ?= quay.io/eclipse/che-operator:next
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false"
CRD_BETA_OPTIONS ?= "crd:trivialVersions=true,crdVersions=v1beta1"
OPERATOR_YAML="config/manager/manager.yaml"
ENV_FILE="/tmp/che-operator-debug.env"
ECLIPSE_CHE_NAMESPACE="eclipse-che"
CRD_FOLDER="config/crd/bases"
ECLIPSE_CHE_CR=config/samples/org.eclipse.che_v1_checluster.yaml
# legacy crd v1beta1 file names
ECLIPSE_CHE_CRD_V1BETA1="$(CRD_FOLDER)/org_v1_che_crd-v1beta1.yaml"
ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD_V1BETA1="$(CRD_FOLDER)/org.eclipse.che_chebackupserverconfigurations_crd-v1beta1.yaml"
ECLIPSE_CHE_BACKUP_CRD_V1BETA1="$(CRD_FOLDER)/org.eclipse.che_checlusterbackups_crd-v1beta1.yaml"
ECLIPSE_CHE_RESTORE_CRD_V1BETA1="$(CRD_FOLDER)/org.eclipse.che_checlusterrestores_crd-v1beta1.yaml"
# legacy crd file names
ECLIPSE_CHE_CRD_V1="$(CRD_FOLDER)/org_v1_che_crd.yaml"
ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD_V1="$(CRD_FOLDER)/org.eclipse.che_chebackupserverconfigurations_crd.yaml"
ECLIPSE_CHE_BACKUP_CRD_V1="$(CRD_FOLDER)/org.eclipse.che_checlusterbackups_crd.yaml"
ECLIPSE_CHE_RESTORE_CRD_V1="$(CRD_FOLDER)/org.eclipse.che_checlusterrestores_crd.yaml"
# default crd names used operator-sdk from the box
ECLIPSE_CHE_CRD="$(CRD_FOLDER)/org.eclipse.che_checlusters.yaml"
ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD="$(CRD_FOLDER)/org.eclipse.che_chebackupserverconfigurations.yaml"
ECLIPSE_CHE_BACKUP_CRD="$(CRD_FOLDER)/org.eclipse.che_checlusterbackups.yaml"
ECLIPSE_CHE_RESTORE_CRD="$(CRD_FOLDER)/org.eclipse.che_checlusterrestores.yaml"
DEV_WORKSPACE_CONTROLLER_VERSION="main"
DEV_WORKSPACE_CHE_OPERATOR_VERSION="main"
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
# Setting SHELL to bash allows bash commands to be executed by recipes.
# This is a requirement for 'setup-envtest.sh' in the test target.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
.ONESHELL:
all: build
##@ General
# The help target prints out all targets with their descriptions organized
# beneath their categories. The categories are represented by '##@' and the
# target descriptions by '##'. The awk commands is responsible for reading the
# entire set of makefiles included in this invocation, looking for lines of the
# file as xyz: ## something, and then pretty-format the target and help. Then,
# if there's a line with ##@ something, that gets pretty-printed as a category.
# More info on the usage of ANSI control characters for terminal formatting:
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
# More info on the awk command:
# http://linuxcommand.org/lc3_adv_awk.php
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
##@ Development
download-operator-sdk:
ARCH=$$(case "$$(uname -m)" in
x86_64) echo -n amd64 ;;
aarch64) echo -n arm64 ;;
*) echo -n $$(uname -m)
esac)
OS=$$(uname | awk '{print tolower($$0)}')
OPERATOR_SDK_VERSION=$$(sed -r 's|operator-sdk:\s*(.*)|\1|' REQUIREMENTS)
echo "[INFO] ARCH: $$ARCH, OS: $$OS. operator-sdk version: $$OPERATOR_SDK_VERSION"
if [ -z $(OP_SDK_DIR) ]; then
OP_SDK_PATH="operator-sdk"
else
OP_SDK_PATH="$(OP_SDK_DIR)/operator-sdk"
fi
echo "[INFO] Downloading operator-sdk..."
OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/$${OPERATOR_SDK_VERSION}
curl -sSLo $${OP_SDK_PATH} $${OPERATOR_SDK_DL_URL}/operator-sdk_$${OS}_$${ARCH}
echo "[INFO] operator-sdk will downloaded to: $${OP_SDK_PATH}"
echo "[INFO] Set up executable permissions to binary."
chmod +x $${OP_SDK_PATH}
echo "[INFO] operator-sdk is ready."
removeRequiredAttribute: SHELL := /bin/bash
removeRequiredAttribute:
REQUIRED=false
while IFS= read -r line
do
if [[ $$REQUIRED == true ]]; then
if [[ $$line == *"- "* ]]; then
continue
else
REQUIRED=false
fi
fi
if [[ $$line == *"required:"* ]]; then
REQUIRED=true
continue
fi
echo "$$line" >> $$filePath.tmp
done < "$$filePath"
mv $${filePath}.tmp $${filePath}
ensure-license-header:
if [ -z $(FILE) ]; then
echo "[ERROR] Provide argument `FILE` with file path value."
exit 1
fi
fileHeader=$$(head -10 $(FILE) | tr --delete '\n' | tr --delete '\r')
licenseMarker="Copyright (c)"
case "$${fileHeader}" in
*$${licenseMarker}*) return ;;
esac;
echo "#
# Copyright (c) 2019-2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation" > $(FILE).tmp
cat $(FILE) >> $(FILE).tmp
mv $(FILE).tmp $(FILE)
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
# Generate CRDs v1beta1
$(CONTROLLER_GEN) $(CRD_BETA_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
mv "$(ECLIPSE_CHE_CRD)" "$(ECLIPSE_CHE_CRD_V1BETA1)"
mv "$(ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD)" "$(ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD_V1BETA1)"
mv "$(ECLIPSE_CHE_BACKUP_CRD)" "$(ECLIPSE_CHE_BACKUP_CRD_V1BETA1)"
mv "$(ECLIPSE_CHE_RESTORE_CRD)" "$(ECLIPSE_CHE_RESTORE_CRD_V1BETA1)"
# Generate CRDs v1
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
mv "$(ECLIPSE_CHE_CRD)" "$(ECLIPSE_CHE_CRD_V1)"
mv "$(ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD)" "$(ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD_V1)"
mv "$(ECLIPSE_CHE_BACKUP_CRD)" "$(ECLIPSE_CHE_BACKUP_CRD_V1)"
mv "$(ECLIPSE_CHE_RESTORE_CRD)" "$(ECLIPSE_CHE_RESTORE_CRD_V1)"
# remove yaml delimitier, which makes OLM catalog source image broken.
sed -i.bak '/---/d' "$(ECLIPSE_CHE_CRD_V1BETA1)"
sed -i.bak '/---/d' "$(ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD_V1BETA1)"
sed -i.bak '/---/d' "$(ECLIPSE_CHE_BACKUP_CRD_V1BETA1)"
sed -i.bak '/---/d' "$(ECLIPSE_CHE_RESTORE_CRD_V1BETA1)"
rm -rf "$(ECLIPSE_CHE_CRD_V1BETA1).bak" "$(ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD_V1BETA1).bak" "$(ECLIPSE_CHE_BACKUP_CRD_V1BETA1).bak" "$(ECLIPSE_CHE_RESTORE_CRD_V1BETA1).bak"
sed -i.bak '/---/d' "$(ECLIPSE_CHE_CRD_V1)"
sed -i.bak '/---/d' "$(ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD_V1)"
sed -i.bak '/---/d' "$(ECLIPSE_CHE_BACKUP_CRD_V1)"
sed -i.bak '/---/d' "$(ECLIPSE_CHE_RESTORE_CRD_V1)"
rm -rf "$(ECLIPSE_CHE_CRD_V1).bak" "$(ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD_V1).bak" "$(ECLIPSE_CHE_BACKUP_CRD_V1).bak" "$(ECLIPSE_CHE_RESTORE_CRD_V1).bak"
# remove v1alphav2 version from crd files
yq -rYi "del(.spec.versions[1])" "$(ECLIPSE_CHE_CRD_V1BETA1)"
yq -rYi "del(.spec.versions[1])" "$(ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD_V1BETA1)"
yq -rYi "del(.spec.versions[1])" "$(ECLIPSE_CHE_BACKUP_CRD_V1BETA1)"
yq -rYi "del(.spec.versions[1])" "$(ECLIPSE_CHE_RESTORE_CRD_V1BETA1)"
yq -rYi "del(.spec.versions[1])" "$(ECLIPSE_CHE_CRD_V1)"
yq -rYi "del(.spec.versions[1])" "$(ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD_V1)"
yq -rYi "del(.spec.versions[1])" "$(ECLIPSE_CHE_BACKUP_CRD_V1)"
yq -rYi "del(.spec.versions[1])" "$(ECLIPSE_CHE_RESTORE_CRD_V1)"
# remove .spec.subresources.status from crd v1beta1 files
yq -rYi ".spec.subresources.status = {}" "$(ECLIPSE_CHE_CRD_V1BETA1)"
yq -rYi ".spec.subresources.status = {}" "$(ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD_V1BETA1)"
yq -rYi ".spec.subresources.status = {}" "$(ECLIPSE_CHE_BACKUP_CRD_V1BETA1)"
yq -rYi ".spec.subresources.status = {}" "$(ECLIPSE_CHE_RESTORE_CRD_V1BETA1)"
# remove "required" attributes from v1beta1 crd files
$(MAKE) removeRequiredAttribute "filePath=$(ECLIPSE_CHE_CRD_V1BETA1)"
$(MAKE) removeRequiredAttribute "filePath=$(ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD_V1BETA1)"
$(MAKE) removeRequiredAttribute "filePath=$(ECLIPSE_CHE_BACKUP_CRD_V1BETA1)"
$(MAKE) removeRequiredAttribute "filePath=$(ECLIPSE_CHE_RESTORE_CRD_V1BETA1)"
$(MAKE) ensure-license-header FILE="$(ECLIPSE_CHE_CRD_V1BETA1)"
$(MAKE) ensure-license-header FILE="$(ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD_V1BETA1)"
$(MAKE) ensure-license-header FILE="$(ECLIPSE_CHE_BACKUP_CRD_V1BETA1)"
$(MAKE) ensure-license-header FILE="$(ECLIPSE_CHE_RESTORE_CRD_V1BETA1)"
$(MAKE) ensure-license-header FILE="$(ECLIPSE_CHE_CRD_V1)"
$(MAKE) ensure-license-header FILE="$(ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD_V1)"
$(MAKE) ensure-license-header FILE="$(ECLIPSE_CHE_BACKUP_CRD_V1)"
$(MAKE) ensure-license-header FILE="$(ECLIPSE_CHE_RESTORE_CRD_V1)"
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
fmt: ## Run go fmt against code.
go fmt ./...
vet: ## Run go vet against code.
go vet ./...
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
test: manifests generate fmt vet ## Run tests.
mkdir -p ${ENVTEST_ASSETS_DIR}
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.6.3/hack/setup-envtest.sh
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out
##@ Build
build: generate fmt vet ## Build manager binary.
go build -o bin/manager main.go
run: manifests generate fmt vet ## Run a controller from your host.
go run ./main.go
IMAGE_TOOL=docker
docker-build: test ## Build docker image with the manager.
${IMAGE_TOOL} build -t ${IMG} .
docker-push: ## Push docker image with the manager.
${IMAGE_TOOL} push ${IMG}
##@ Deployment
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl apply -f -
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl delete -f -
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager || true && $(KUSTOMIZE) edit set image controller=${IMG} && cd ../..
$(KUSTOMIZE) build config/default | kubectl apply -f -
echo "[INFO] Start printing logs..."
oc wait --for=condition=ready pod -l app.kubernetes.io/component=che-operator -n ${ECLIPSE_CHE_NAMESPACE} --timeout=60s
oc logs $$(oc get pods -o json -n ${ECLIPSE_CHE_NAMESPACE} | jq -r '.items[] | select(.metadata.name | test("che-operator-")).metadata.name') -n ${ECLIPSE_CHE_NAMESPACE} --all-containers -f
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/default | kubectl delete -f -
prepare-templates:
cp templates/keycloak-provision.sh /tmp/keycloak-provision.sh
cp templates/delete-identity-provider.sh /tmp/delete-identity-provider.sh
cp templates/create-github-identity-provider.sh /tmp/create-github-identity-provider.sh
cp templates/oauth-provision.sh /tmp/oauth-provision.sh
cp templates/keycloak-update.sh /tmp/keycloak-update.sh
# Download Dev Workspace operator templates
echo "[INFO] Downloading Dev Workspace operator templates ..."
rm -f /tmp/devworkspace-operator.zip
rm -rf /tmp/devfile-devworkspace-operator-*
rm -rf /tmp/devworkspace-operator/
mkdir -p /tmp/devworkspace-operator/templates
curl -sL https://api.github.com/repos/devfile/devworkspace-operator/zipball/${DEV_WORKSPACE_CONTROLLER_VERSION} > /tmp/devworkspace-operator.zip
unzip -q /tmp/devworkspace-operator.zip '*/deploy/deployment/*' -d /tmp
cp -rf /tmp/devfile-devworkspace-operator*/deploy/* /tmp/devworkspace-operator/templates
echo "[INFO] Downloading Dev Workspace operator templates completed."
# Download Dev Workspace Che operator templates
echo "[INFO] Downloading Dev Workspace Che operator templates ..."
rm -f /tmp/devworkspace-che-operator.zip
rm -rf /tmp/che-incubator-devworkspace-che-operator-*
rm -rf /tmp/devworkspace-che-operator/
mkdir -p /tmp/devworkspace-che-operator/templates
curl -sL https://api.github.com/repos/che-incubator/devworkspace-che-operator/zipball/${DEV_WORKSPACE_CHE_OPERATOR_VERSION} > /tmp/devworkspace-che-operator.zip
unzip -q /tmp/devworkspace-che-operator.zip '*/deploy/deployment/*' -d /tmp
cp -r /tmp/che-incubator-devworkspace-che-operator*/deploy/* /tmp/devworkspace-che-operator/templates
echo "[INFO] Downloading Dev Workspace operator templates completed."
create-namespace:
set +e
kubectl create namespace ${ECLIPSE_CHE_NAMESPACE} || true
set -e
apply-cr-crd:
kubectl apply -f ${ECLIPSE_CHE_CRD_V1}
kubectl apply -f ${ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD_V1}
kubectl apply -f ${ECLIPSE_CHE_BACKUP_CRD_V1}
kubectl apply -f ${ECLIPSE_CHE_RESTORE_CRD_V1}
kubectl apply -f ${ECLIPSE_CHE_CR} -n ${ECLIPSE_CHE_NAMESPACE}
apply-cr-crd-beta:
kubectl apply -f ${ECLIPSE_CHE_CRD_V1BETA1}
kubectl apply -f ${ECLIPSE_CHE_BACKUP_SERVER_CONFIGURATION_CRD_V1BETA1}
kubectl apply -f ${ECLIPSE_CHE_BACKUP_CRD_V1BETA1}
kubectl apply -f ${ECLIPSE_CHE_RESTORE_CRD_V1BETA1}
kubectl apply -f ${ECLIPSE_CHE_CR} -n ${ECLIPSE_CHE_NAMESPACE}
create-env-file: prepare-templates
rm -rf "${ENV_FILE}"
touch "${ENV_FILE}"
CLUSTER_API_URL=$$(oc whoami --show-server=true) || true;
if [ -n $${CLUSTER_API_URL} ]; then
echo "CLUSTER_API_URL='$${CLUSTER_API_URL}'" >> "${ENV_FILE}"
echo "[INFO] Set up cluster api url: $${CLUSTER_API_URL}"
fi;
echo "WATCH_NAMESPACE='${ECLIPSE_CHE_NAMESPACE}'" >> "${ENV_FILE}"
create-full-env-file: create-env-file
cat ./config/manager/manager.yaml | \
yq -r '.spec.template.spec.containers[0].env[] | select(.name == "WATCH_NAMESPACE" | not) | "export \(.name)=\"\(.value)\""' \
>> ${ENV_FILE}
echo "[INFO] Env file: ${ENV_FILE}"
source ${ENV_FILE} ; env | grep CHE_VERSION
debug: generate manifests kustomize prepare-templates create-namespace apply-cr-crd create-env-file
echo "[WARN] Make sure that your CR contains valid ingress domain!"
# dlv has an issue with 'Ctrl-C' termination, that's why we're doing trick with detach.
dlv debug --listen=:2345 --headless=true --api-version=2 ./main.go -- &
OPERATOR_SDK_PID=$!
echo "[INFO] Use 'make uninstall' to remove Che installation after debug"
wait $$OPERATOR_SDK_PID
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1)
KUSTOMIZE = $(shell pwd)/bin/kustomize
kustomize: ## Download kustomize locally if necessary.
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v3@v3.8.7)
# go-get-tool will 'go get' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-get-tool
@[ -f $(1) ] || { \
set -e ;\
TMP_DIR=$$(mktemp -d) ;\
cd $$TMP_DIR ;\
go mod init tmp ;\
echo "[INFO] Downloading $(2)" ;\
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
rm -rf $$TMP_DIR ;\
}
endef
update-roles:
echo "[INFO] Updating roles with DW and DWCO roles"
CLUSTER_ROLES=(
https://raw.githubusercontent.com/devfile/devworkspace-operator/main/deploy/deployment/openshift/objects/devworkspace-controller-view-workspaces.ClusterRole.yaml
https://raw.githubusercontent.com/devfile/devworkspace-operator/main/deploy/deployment/openshift/objects/devworkspace-controller-edit-workspaces.ClusterRole.yaml
https://raw.githubusercontent.com/devfile/devworkspace-operator/main/deploy/deployment/openshift/objects/devworkspace-controller-leader-election-role.Role.yaml
https://raw.githubusercontent.com/devfile/devworkspace-operator/main/deploy/deployment/openshift/objects/devworkspace-controller-proxy-role.ClusterRole.yaml
https://raw.githubusercontent.com/devfile/devworkspace-operator/main/deploy/deployment/openshift/objects/devworkspace-controller-role.ClusterRole.yaml
https://raw.githubusercontent.com/devfile/devworkspace-operator/main/deploy/deployment/openshift/objects/devworkspace-controller-view-workspaces.ClusterRole.yaml
https://raw.githubusercontent.com/che-incubator/devworkspace-che-operator/main/deploy/deployment/openshift/objects/devworkspace-che-role.ClusterRole.yaml
https://raw.githubusercontent.com/che-incubator/devworkspace-che-operator/main/deploy/deployment/openshift/objects/devworkspace-che-metrics-reader.ClusterRole.yaml
)
# Updates cluster_role.yaml based on DW and DWCO roles
## Removes old cluster roles
cat config/rbac/cluster_role.yaml | sed '/CHE-OPERATOR ROLES ONLY: END/q0' > config/rbac/cluster_role.yaml.tmp
mv config/rbac/cluster_role.yaml.tmp config/rbac/cluster_role.yaml
# Copy new cluster roles
for roles in "$${CLUSTER_ROLES[@]}"; do
echo " # "$$(basename $$roles) >> config/rbac/cluster_role.yaml
CONTENT=$$(curl -sL $$roles | sed '1,/rules:/d')
while IFS= read -r line; do
echo " $$line" >> config/rbac/cluster_role.yaml
done <<< "$$CONTENT"
done
ROLES=(
https://raw.githubusercontent.com/che-incubator/devworkspace-che-operator/main/deploy/deployment/openshift/objects/devworkspace-che-leader-election-role.Role.yaml
)
# Updates role.yaml
## Removes old roles
cat config/rbac/role.yaml | sed '/CHE-OPERATOR ROLES ONLY: END/q0' > config/rbac/role.yaml.tmp
mv config/rbac/role.yaml.tmp config/rbac/role.yaml
## Copy new roles
for roles in "$${ROLES[@]}"; do
echo "# "$$(basename $$roles) >> config/rbac/role.yaml
CONTENT=$$(curl -sL $$roles | sed '1,/rules:/d')
while IFS= read -r line; do
echo "$$line" >> config/rbac/role.yaml
done <<< "$$CONTENT"
done
.PHONY: bundle
bundle: generate manifests kustomize ## Generate bundle manifests and metadata, then validate generated files.
if [ -z "$(platform)" ]; then
echo "[INFO] You must specify 'platform' macros. For example: `make bundle platform=kubernetes`"
exit 1
fi
if [ -z "$(NO_INCREMENT)" ]; then
$(MAKE) increment-nightly-version platform="$${platform}"
fi
echo "[INFO] Updating OperatorHub bundle for platform '$${platform}'"
NIGHTLY_BUNDLE_PATH=$$($(MAKE) getBundlePath platform="$${platform}" channel="nightly" -s)
NEW_CSV=$${NIGHTLY_BUNDLE_PATH}/manifests/che-operator.clusterserviceversion.yaml
newNightlyBundleVersion=$$(yq -r ".spec.version" "$${NEW_CSV}")
echo "[INFO] Creation new nightly bundle version: $${newNightlyBundleVersion}"
createdAtOld=$$(yq -r ".metadata.annotations.createdAt" "$${NEW_CSV}")
BUNDLE_PACKAGE="eclipse-che-preview-$(platform)"
BUNDLE_DIR="bundle/$(DEFAULT_CHANNEL)/$${BUNDLE_PACKAGE}"
GENERATED_CSV_NAME=$${BUNDLE_PACKAGE}.clusterserviceversion.yaml
DESIRED_CSV_NAME=che-operator.clusterserviceversion.yaml
GENERATED_CRD_NAME=org.eclipse.che_checlusters.yaml
DESIRED_CRD_NAME=org_v1_che_crd.yaml
$(OPERATOR_SDK_BINARY) generate kustomize manifests -q
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG) && cd ../..
$(KUSTOMIZE) build config/platforms/$(platform) | \
$(OPERATOR_SDK_BINARY) generate bundle \
-q --overwrite \
--version $${newNightlyBundleVersion} \
--package $${BUNDLE_PACKAGE} \
--output-dir $${BUNDLE_DIR} \
$(BUNDLE_METADATA_OPTS)
rm -rf bundle.Dockerfile
cd $${BUNDLE_DIR}/manifests;
mv $${GENERATED_CSV_NAME} $${DESIRED_CSV_NAME}
mv $${GENERATED_CRD_NAME} $${DESIRED_CRD_NAME}
cd $(mkfile_dir)
$(OPERATOR_SDK_BINARY) bundle validate ./$${BUNDLE_DIR}
containerImage=$$(sed -n 's|^ *image: *\([^ ]*/che-operator:[^ ]*\) *|\1|p' $${NEW_CSV})
echo "[INFO] Updating new package version fields:"
echo "[INFO] - containerImage => $${containerImage}"
sed -e "s|containerImage:.*$$|containerImage: $${containerImage}|" "$${NEW_CSV}" > "$${NEW_CSV}.new"
mv "$${NEW_CSV}.new" "$${NEW_CSV}"
if [ "$(NO_DATE_UPDATE)" = true ]; then
echo "[INFO] - createdAt => $${createdAtOld}"
sed -e "s/createdAt:.*$$/createdAt: \"$${createdAtOld}\"/" "$${NEW_CSV}" > "$${NEW_CSV}.new"
mv "$${NEW_CSV}.new" "$${NEW_CSV}"
fi
platformCRD="$${NIGHTLY_BUNDLE_PATH}/manifests/org_v1_che_crd.yaml"
if [ "$${platform}" = "openshift" ]; then
yq -riY '.spec.preserveUnknownFields = false' $${platformCRD}
fi
$(MAKE) ensure-license-header FILE="$${platformCRD}"
if [ -n "$(TAG)" ]; then
echo "[INFO] Set tags in nightly OLM files"
sed -ri "s/(.*:\s?)$(RELEASE)([^-])?$$/\1$(TAG)\2/" "$${NEW_CSV}"
fi
YAML_CONTENT=$$(cat "$${NEW_CSV}")
if [ $${platform} = "kubernetes" ]; then
clusterPermLength=$$(echo "$${YAML_CONTENT}" | yq -r ".spec.install.spec.clusterPermissions[0].rules | length")
i=0
while [ "$${i}" -lt "$${clusterPermLength}" ]; do
apiGroupLength=$$(echo "$${YAML_CONTENT}" | yq -r '.spec.install.spec.clusterPermissions[0].rules['$${i}'].apiGroups | length')
if [ "$${apiGroupLength}" -gt 0 ]; then
j=0
while [ "$${j}" -lt "$${apiGroupLength}" ]; do
apiGroup=$$(echo "$${YAML_CONTENT}" | yq -r '.spec.install.spec.clusterPermissions[0].rules['$${i}'].apiGroups['$${j}']')
case $${apiGroup} in *openshift.io)
YAML_CONTENT=$$(echo "$${YAML_CONTENT}" | yq -rY 'del(.spec.install.spec.clusterPermissions[0].rules['$${i}'])' )
j=$$((j-1))
i=$$((i-1))
break
;;
esac;
j=$$((i+1))
done
fi
i=$$((i+1))
done
permLength=$$(echo "$${YAML_CONTENT}" | yq -r ".spec.install.spec.permissions[0].rules | length")
i=0
while [ "$${i}" -lt "$${permLength}" ]; do
apiGroupLength=$$(echo "$${YAML_CONTENT}" | yq -r '.spec.install.spec.permissions[0].rules['$${i}'].apiGroups | length')
if [ "$${apiGroupLength}" -gt 0 ]; then
j=0
while [ "$${j}" -lt "$${apiGroupLength}" ]; do
apiGroup=$$(echo "$${YAML_CONTENT}" | yq -r '.spec.install.spec.permissions[0].rules['$${i}'].apiGroups['$${j}']')
case $${apiGroup} in *openshift.io)
YAML_CONTENT=$$(echo "$${YAML_CONTENT}" | yq -rY 'del(.spec.install.spec.permissions[0].rules['$${i}'])' )
j=$$((j-1))
i=$$((i-1))
break
;;
esac;
j=$$((i+1))
done
fi
i=$$((i+1))
done
fi
echo "$${YAML_CONTENT}" > "$${NEW_CSV}"
if [ $${platform} = "openshift" ]; then
# Removes che-tls-secret-creator
index=0
while [ $${index} -le 30 ]
do
if [ $$(cat $${NEW_CSV} | yq -r '.spec.install.spec.deployments[0].spec.template.spec.containers[0].env['$${index}'].name') = "RELATED_IMAGE_che_tls_secrets_creation_job" ]; then
yq -rYSi 'del(.spec.install.spec.deployments[0].spec.template.spec.containers[0].env['$${index}'])' $${NEW_CSV}
break
fi
index=$$((index+1))
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
# set `app.kubernetes.io/managed-by` label
yq -riSY '(.spec.install.spec.deployments[0].spec.template.metadata.labels."app.kubernetes.io/managed-by") = "olm"' "$${NEW_CSV}"
# set Pod Security Context Posture
yq -riSY '(.spec.install.spec.deployments[0].spec.template.spec."hostIPC") = false' "$${NEW_CSV}"
yq -riSY '(.spec.install.spec.deployments[0].spec.template.spec."hostNetwork") = false' "$${NEW_CSV}"
yq -riSY '(.spec.install.spec.deployments[0].spec.template.spec."hostPID") = false' "$${NEW_CSV}"
if [ "$${platform}" = "openshift" ]; then
yq -riSY '(.spec.install.spec.deployments[0].spec.template.spec.containers[0].securityContext."allowPrivilegeEscalation") = false' "$${NEW_CSV}"
yq -riSY '(.spec.install.spec.deployments[0].spec.template.spec.containers[0].securityContext."runAsNonRoot") = true' "$${NEW_CSV}"
yq -riSY '(.spec.install.spec.deployments[0].spec.template.spec.containers[1].securityContext."allowPrivilegeEscalation") = false' "$${NEW_CSV}"
yq -riSY '(.spec.install.spec.deployments[0].spec.template.spec.containers[1].securityContext."runAsNonRoot") = true' "$${NEW_CSV}"
fi
# Format code.
yq -rY "." "$${NEW_CSV}" > "$${NEW_CSV}.old"
mv "$${NEW_CSV}.old" "$${NEW_CSV}"
# $(MAKE) ensure-license-header "$${NEW_CSV}"
getPackageName:
if [ -z "$(platform)" ]; then
echo "[ERROR] Please specify first argument: 'platform'"
exit 1
fi
echo "eclipse-che-preview-$(platform)"
getBundlePath:
if [ -z "$(platform)" ]; then
echo "[ERROR] Please specify first argument: 'platform'"
exit 1
fi
if [ -z "$(channel)" ]; then
echo "[ERROR] Please specify second argument: 'channel'"
exit 1
fi
PACKAGE_NAME=$$($(MAKE) getPackageName platform="$(platform)" -s)
echo "$(PROJECT_DIR)/bundle/$(channel)/$${PACKAGE_NAME}"
increment-nightly-version:
if [ -z "$(platform)" ]; then
echo "[ERROR] please specify first argument 'platform'"
exit 1
fi
NIGHTLY_BUNDLE_PATH=$$($(MAKE) getBundlePath platform="$(platform)" channel="nightly" -s)
OPM_BUNDLE_MANIFESTS_DIR="$${NIGHTLY_BUNDLE_PATH}/manifests"
CSV="$${OPM_BUNDLE_MANIFESTS_DIR}/che-operator.clusterserviceversion.yaml"
currentNightlyVersion=$$(yq -r ".spec.version" "$${CSV}")
echo "[INFO] current nightly $(platform) version: $${currentNightlyVersion}"
incrementPart=$$($(MAKE) get-nightly-version-increment nightlyVersion="$${currentNightlyVersion}" -s)
PACKAGE_NAME="eclipse-che-preview-$(platform)"
CLUSTER_SERVICE_VERSION=$$($(MAKE) get-current-stable-version platform="$(platform)" -s)
STABLE_PACKAGE_VERSION=$$(echo "$${CLUSTER_SERVICE_VERSION}" | sed -e "s/$${PACKAGE_NAME}.v//")
echo "[INFO] Current stable package version: $${STABLE_PACKAGE_VERSION}"
# Parse stable version parts
majorAndMinor=$${STABLE_PACKAGE_VERSION%.*}
STABLE_MINOR_VERSION=$${majorAndMinor#*.}
STABLE_MAJOR_VERSION=$${majorAndMinor%.*}
STABLE_MINOR_VERSION=$$(($$STABLE_MINOR_VERSION+1))
echo "$${STABLE_MINOR_VERSION}"
incrementPart=$$((incrementPart+1))
newVersion="$${STABLE_MAJOR_VERSION}.$${STABLE_MINOR_VERSION}.0-$${incrementPart}.nightly"
echo "[INFO] Set up nightly $(platform) version: $${newVersion}"
yq -rY "(.spec.version) = \"$${newVersion}\" | (.metadata.name) = \"eclipse-che-preview-$(platform).v$${newVersion}\"" "$${CSV}" > "$${CSV}.old"
mv "$${CSV}.old" "$${CSV}"
get-current-stable-version:
if [ -z "$(platform)" ]; then
echo "[ERROR] Please specify first argument: 'platform'"
exit 1
fi
STABLE_BUNDLE_PATH=$$($(MAKE) getBundlePath platform="$(platform)" channel="stable" -s)
LAST_STABLE_CSV="$${STABLE_BUNDLE_PATH}/manifests/che-operator.clusterserviceversion.yaml"
lastStableVersion=$$(yq -r ".spec.version" "$${LAST_STABLE_CSV}")
echo "$${lastStableVersion}"
get-nightly-version-increment:
if [ -z $(nightlyVersion) ]; then
echo "[ERROR] Provide nightly version to parse"
exit 1
fi
versionWithoutNightly="$${nightlyVersion%.nightly}"
version="$${versionWithoutNightly%-*}"
incrementPart="$${versionWithoutNightly#*-}"
echo "$${incrementPart}"
update-resources: SHELL := /bin/bash
update-resources: check-requirements update-resource-images update-roles
for platform in 'kubernetes' 'openshift'
do
$(MAKE) bundle "platform=$${platform}"
done
check-requirements:
. olm/check-yq.sh
DOCKER=$$(command -v docker || true)
if [[ ! -x $$DOCKER ]]; then
echo "[ERROR] "docker" is not installed."
exit 1
fi
SKOPEO=$$(command -v skopeo || true)
if [[ ! -x $$SKOPEO ]]; then
echo "[ERROR] "scopeo" is not installed."
exit 1
fi
OPERATOR_SDK_BINARY=$(OPERATOR_SDK_BINARY)
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
operatorVersion=$$($${OPERATOR_SDK_BINARY} version)
REQUIRED_OPERATOR_SDK=$$(yq -r ".\"operator-sdk\"" "REQUIREMENTS")
case "$$operatorVersion" in
*$$REQUIRED_OPERATOR_SDK*) ;;
*) echo "[ERROR] operator-sdk $${REQUIRED_OPERATOR_SDK} is required"; exit 1 ;;
esac
update-deployment-yaml-images:
if [ -z $(UBI8_MINIMAL_IMAGE) ] || [ -z $(PLUGIN_BROKER_METADATA_IMAGE) ] || [ -z $(PLUGIN_BROKER_ARTIFACTS_IMAGE) ] || [ -z $(JWT_PROXY_IMAGE) ]; then
echo "[ERROR] Define required arguments: `UBI8_MINIMAL_IMAGE`, `PLUGIN_BROKER_METADATA_IMAGE`, `PLUGIN_BROKER_ARTIFACTS_IMAGE`, `JWT_PROXY_IMAGE`"
exit 1
fi
yq -riY "( .spec.template.spec.containers[] | select(.name == \"che-operator\").env[] | select(.name == \"RELATED_IMAGE_pvc_jobs\") | .value ) = \"$(UBI8_MINIMAL_IMAGE)\"" $(OPERATOR_YAML)
yq -riY "( .spec.template.spec.containers[] | select(.name == \"che-operator\").env[] | select(.name == \"RELATED_IMAGE_che_workspace_plugin_broker_metadata\") | .value ) = \"$(PLUGIN_BROKER_METADATA_IMAGE)\"" $(OPERATOR_YAML)
yq -riY "( .spec.template.spec.containers[] | select(.name == \"che-operator\").env[] | select(.name == \"RELATED_IMAGE_che_workspace_plugin_broker_artifacts\") | .value ) = \"$(PLUGIN_BROKER_ARTIFACTS_IMAGE)\"" $(OPERATOR_YAML)
yq -riY "( .spec.template.spec.containers[] | select(.name == \"che-operator\").env[] | select(.name == \"RELATED_IMAGE_che_server_secure_exposer_jwt_proxy_image\") | .value ) = \"$(JWT_PROXY_IMAGE)\"" $(OPERATOR_YAML)
$(MAKE) ensure-license-header FILE="config/manager/manager.yaml"
update-devworkspace-container:
echo "[INFO] Update devworkspace container in the che-operator deployment"
# Deletes old DWCO container
yq -riY "del(.spec.template.spec.containers[1])" $(OPERATOR_YAML)
yq -riY ".spec.template.spec.containers[1].name = \"devworkspace-container\"" $(OPERATOR_YAML)
# Extract DWCO container spec from deployment
DWCO_CONTAINER=$$(curl -sL https://raw.githubusercontent.com/che-incubator/devworkspace-che-operator/main/deploy/deployment/openshift/objects/devworkspace-che-manager.Deployment.yaml \
| sed '1,/containers:/d' \
| sed -n '/serviceAccountName:/q;p' \
| sed -e 's/^/ /')
echo "$${DWCO_CONTAINER}" > dwcontainer
# Add DWCO container to manager.yaml
sed -i -e '/- name: devworkspace-container/{r dwcontainer' -e 'd}' $(OPERATOR_YAML)
rm dwcontainer
# update securityContext
yq -riY ".spec.template.spec.containers[1].securityContext.privileged = false" $(OPERATOR_YAML)
yq -riY ".spec.template.spec.containers[1].securityContext.readOnlyRootFilesystem = false" $(OPERATOR_YAML)
yq -riY ".spec.template.spec.containers[1].securityContext.capabilities.drop[0] = \"ALL\"" $(OPERATOR_YAML)
# update env variable
yq -riY "del( .spec.template.spec.containers[1].env[] | select(.name == \"CONTROLLER_SERVICE_ACCOUNT_NAME\") | .valueFrom)" $(OPERATOR_YAML)
yq -riY "( .spec.template.spec.containers[1].env[] | select(.name == \"CONTROLLER_SERVICE_ACCOUNT_NAME\") | .value) = \"che-operator\"" $(OPERATOR_YAML)
yq -riY "del( .spec.template.spec.containers[1].env[] | select(.name == \"WATCH_NAMESPACE\") | .value)" $(OPERATOR_YAML)
yq -riY "( .spec.template.spec.containers[1].env[] | select(.name == \"WATCH_NAMESPACE\") | .valueFrom.fieldRef.fieldPath) = \"metadata.namespace\"" $(OPERATOR_YAML)
yq -riY ".spec.template.spec.containers[1].args[1] = \"--metrics-addr\"" $(OPERATOR_YAML)
yq -riY ".spec.template.spec.containers[1].args[2] = \"0\"" $(OPERATOR_YAML)
# $(MAKE) ensureLicense $(OPERATOR_YAML)
update-dockerfile-image:
if [ -z $(UBI8_MINIMAL_IMAGE) ]; then
echo "[ERROR] Define `UBI8_MINIMAL_IMAGE` argument"
fi
DOCKERFILE="Dockerfile"
sed -i 's|registry.access.redhat.com/ubi8-minimal:[^\s]* |'${UBI8_MINIMAL_IMAGE}' |g' $${DOCKERFILE}
update-resource-images:
# Detect newer images
echo "[INFO] Check update some base images..."
ubiMinimal8Version=$$(skopeo --override-os linux inspect docker://registry.access.redhat.com/ubi8-minimal:latest | jq -r '.Labels.version')
ubiMinimal8Release=$$(skopeo --override-os linux inspect docker://registry.access.redhat.com/ubi8-minimal:latest | jq -r '.Labels.release')
UBI8_MINIMAL_IMAGE="registry.access.redhat.com/ubi8-minimal:$${ubiMinimal8Version}-$${ubiMinimal8Release}"
skopeo --override-os linux inspect docker://$${UBI8_MINIMAL_IMAGE} > /dev/null
echo "[INFO] Check update broker and jwt proxy images..."
wget https://raw.githubusercontent.com/eclipse-che/che-server/main/assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/che/che.properties -q -O /tmp/che.properties
PLUGIN_BROKER_METADATA_IMAGE=$$(cat /tmp/che.properties| grep "che.workspace.plugin_broker.metadata.image" | cut -d = -f2)
PLUGIN_BROKER_ARTIFACTS_IMAGE=$$(cat /tmp/che.properties | grep "che.workspace.plugin_broker.artifacts.image" | cut -d = -f2)
JWT_PROXY_IMAGE=$$(cat /tmp/che.properties | grep "che.server.secure_exposer.jwtproxy.image" | cut -d = -f2)
echo "[INFO] UBI base image : $${UBI8_MINIMAL_IMAGE}"
echo "[INFO] Plugin broker metadata image : $${PLUGIN_BROKER_METADATA_IMAGE}"
echo "[INFO] Plugin broker artifacts image: $${PLUGIN_BROKER_ARTIFACTS_IMAGE}"
echo "[INFO] Plugin broker jwt proxy image: $${JWT_PROXY_IMAGE}"
# Update operator deployment images.
$(MAKE) update-deployment-yaml-images \
UBI8_MINIMAL_IMAGE="$${UBI8_MINIMAL_IMAGE}" \
PLUGIN_BROKER_METADATA_IMAGE=$${PLUGIN_BROKER_METADATA_IMAGE} \
PLUGIN_BROKER_ARTIFACTS_IMAGE=$${PLUGIN_BROKER_ARTIFACTS_IMAGE} \
JWT_PROXY_IMAGE=$${JWT_PROXY_IMAGE}
# Update che-operator Dockerfile
$(MAKE) update-dockerfile-image UBI8_MINIMAL_IMAGE="$${UBI8_MINIMAL_IMAGE}"
$(MAKE) update-devworkspace-container
.PHONY: bundle-build
bundle-build: ## Build the bundle image.
if [ -z "$(platform)" ]; then
echo "[INFO] You must specify 'platform' macros. For example: `make bundle platform=kubernetes`"
exit 1
fi
BUNDLE_PACKAGE="eclipse-che-preview-$(platform)"
BUNDLE_DIR="bundle/$(DEFAULT_CHANNEL)/$${BUNDLE_PACKAGE}"
docker build -f $${BUNDLE_DIR}/bundle.Dockerfile -t $(BUNDLE_IMG) .
.PHONY: bundle-push
bundle-push: ## Push the bundle image.
$(MAKE) docker-push IMG=$(BUNDLE_IMG)
.PHONY: opm
OPM = ./bin/opm
opm: ## Download opm locally if necessary.
ifeq (,$(wildcard $(OPM)))
ifeq (,$(shell which opm 2>/dev/null))
@{ \
set -e ;\
mkdir -p $(dir $(OPM)) ;\
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.15.2/$${OS}-$${ARCH}-opm ;\
chmod +x $(OPM) ;\
}
else
OPM = $(shell which opm)
endif
endif
# A comma-separated list of bundle images (e.g. make catalog-build BUNDLE_IMGS=quay.io/eclipse/operator-bundle:v0.1.0,quay.io/eclipse/operator-bundle:v0.2.0).
# These images MUST exist in a registry and be pull-able.
BUNDLE_IMGS ?= $(BUNDLE_IMG)
# The image tag given to the resulting catalog image (e.g. make catalog-build CATALOG_IMG=quay.io/eclipse/operator-catalog:v0.2.0).
CATALOG_IMG ?= $(IMAGE_TAG_BASE)-catalog:v$(VERSION)
# Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to that image.
ifneq ($(origin CATALOG_BASE_IMG), undefined)
FROM_INDEX_OPT := --from-index $(CATALOG_BASE_IMG)
endif
# Build a catalog image by adding bundle images to an empty catalog using the operator package manager tool, 'opm'.
# This recipe invokes 'opm' in 'semver' bundle add mode. For more information on add modes, see:
# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
.PHONY: catalog-build
catalog-build: opm ## Build a catalog image.
$(OPM) index add \
--build-tool $(IMAGE_TOOL) \
--bundles $(BUNDLE_IMGS) \
--tag $(CATALOG_IMG) \
--pull-tool $(IMAGE_TOOL) \
--binary-image=quay.io/operator-framework/upstream-opm-builder:v1.15.2 \
--mode semver $(FROM_INDEX_OPT)
# Push the catalog image.
.PHONY: catalog-push
catalog-push: ## Push a catalog image.
$(MAKE) docker-push IMG=$(CATALOG_IMG)
chectl-templ:
if [ -z "$(TARGET)" ];
then echo "A";
echo "[ERROR] Specify templates target location, using argument `TARGET`"
exit 1
fi
if [ -z "$(SRC)" ]; then
SRC=$$(pwd)
else
SRC=$(SRC)
fi
mkdir -p $(TARGET)
cp -f "$${SRC}/config/manager/manager.yaml" "$(TARGET)/operator.yaml"
cp -rf "$${SRC}/config/crd/bases/" "$(TARGET)/crds/"
cp -f "$${SRC}/config/rbac/role.yaml" "$(TARGET)/"
cp -f "$${SRC}/config/rbac/role_binding.yaml" "$(TARGET)/"
cp -f "$${SRC}/config/rbac/cluster_role.yaml" "$(TARGET)/"
cp -f "$${SRC}/config/rbac/cluster_rolebinding.yaml" "$(TARGET)/"
cp -f "$${SRC}/config/rbac/service_account.yaml" "$(TARGET)/"
cp -f "$${SRC}/$(ECLIPSE_CHE_CR)" "$(TARGET)/crds/org_v1_che_cr.yaml"
echo "[INFO] chectl template folder is ready: ${TARGET}"

51
PROJECT Normal file
View File

@ -0,0 +1,51 @@
domain: eclipse.che
layout:
- go.kubebuilder.io/v3
plugins:
manifests.sdk.operatorframework.io/v2: {}
scorecard.sdk.operatorframework.io/v2: {}
projectName: che-operator
repo: github.com/eclipse-che/che-operator
resources:
- api:
crdVersion: v1
namespaced: true
controller: true
domain: eclipse.che
group: org
kind: CheCluster
path: github.com/eclipse-che/che-operator/api/v1
version: v1
- api:
crdVersion: v1
namespaced: true
domain: eclipse.che
group: org
kind: CheBackupServerConfiguration
path: github.com/eclipse-che/che-operator/api/v1
version: v1
- api:
crdVersion: v1
namespaced: true
domain: eclipse.che
group: org
kind: CheClusterBackup
path: github.com/eclipse-che/che-operator/api/v1
version: v1
- api:
crdVersion: v1
namespaced: true
domain: org.eclipse.che
group: org
kind: CheClusterRestore
path: github.com/eclipse-che/che-operator/api/v1
version: v1
- api:
crdVersion: v1
namespaced: true
domain: eclipse.che
group: org
kind: CheCluster
path: github.com/eclipse-che/che-operator/api/v2alpha1
version: v2alpha1
version: "3"

161
README.md
View File

@ -16,19 +16,19 @@ The operator watches for a Custom Resource of Kind `CheCluster`, and operator co
* turn on/off OpenShift oAuth (login with OpenShift in Che) (create identity provider, oAuth client, update Che ConfigMap)
* etc
Che operator is implemented using [operator framework](https://github.com/operator-framework) and the Go programming language. Eclipse Che configuration defined using a custom resource definition object and stored in the custom Kubernetes resource named CheCluster (Kubernetes API group `org.eclipse.checluster`). Che operator extends Kubernetes API to embed Eclipse Che to Kubernetes cluster in a native way.
Che operator is implemented using [operator framework](https://github.com/operator-framework) and the Go programming language. Eclipse Che configuration defined using a custom resource definition object and stored in the custom Kubernetes resource named `checluster`(or plural `checlusters`) in the Kubernetes API group `org.eclipse.che`. Che operator extends Kubernetes API to embed Eclipse Che to Kubernetes cluster in a native way.
## CheCluster custom resource
Che operator deploys Eclipse Che using configuration stored in the Kubernetes custom resource(CR). CR object structure defined in the code using `pkg/apis/org/v1/che_types.go` file. Field name defined using the serialization tag `json`, for example `json:"openShiftoAuth"`. Che operator default CR sample is stored in the `deploy/crds/org_v1_che_cr.yaml`. This file should be directly modified if you want to apply new fields with default values, or in case of changing default values for existing fields.
Che operator deploys Eclipse Che using configuration stored in the Kubernetes custom resource(CR). CR object structure defined in the code using `api/v1/checluster_types.go` file. Field name defined using the serialization tag `json`, for example `json:"openShiftoAuth"`. Che operator default CR sample is stored in the `config/samples/org.eclipse.che_v1_checluster.yaml`. This file should be directly modified if you want to apply new fields with default values, or in case of changing default values for existing fields.
Also, you can apply in the field comments Openshift UI annotations: to display some
interactive information about these fields on the Openshift UI.
For example:
```go
// +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"
// +operator-sdk:csv:customresourcedefinitions:type=status
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Eclipse Che URL"
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:org.w3:link"
```
This comment-annotations displays clickable link on the Openshift ui with a text "Eclipse Che URL"
@ -37,11 +37,11 @@ It is mandatory to update the OLM bundle after modification of the CR sample to
## Build and push custom Che operator image
1. Export environment variables:
1. Export globally environment variables:
```bash
$ export IMAGE_REGISTRY_USER_NAME=<IMAGE_REGISTRY_USER_NAME> && \
export IMAGE_REGISTRY_HOST=<IMAGE_REGISTRY_HOST> && \
export IMAGE_REGISTRY_HOST=<IMAGE_REGISTRY_HOST>
```
Where:
@ -51,15 +51,28 @@ Where:
2. Run VSCode task `Build and push custom che-operator image` or use the terminal:
```bash
$ docker build -t ${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:next .
$ docker push ${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:next
$ make docker-build docker-push IMG="${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:next"
```
## Deploy Che operator
## Deploy Che operator using make
che-operator MAKE file provides ability to install che-operator(VSCode task `Deploy che-operator`):
```bash
$ make deploy IMG=\"${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:nightly\"
$ kubectl apply -f config/samples/org.eclipse.che_v1_checluster.yaml -n <NAMESPACE>
```
Undeploy che-operator(VSCode task `UnDeploy che-operator`):
```bash
$ make undeploy
```
### Deploy Che operator with chectl
To deploy Che operator you can use [chectl](https://github.com/che-incubator/chectl). It has got two installer types corresponding to Che operator: `operator` and `olm`. With the `--installer operator` chectl reuses copies of Che operator deployment and roles (cluster roles) YAMLs, CR, CRD from the `deploy` directory of the project. With `--installer olm` chectl uses catalog source index image with olm bundles from the `deploy/olm-catalog` directory.
To deploy Che operator you can use [chectl](https://github.com/che-incubator/chectl). It has got two installer types corresponding to Che operator: `operator` and `olm`. With the `--installer operator` chectl reuses copies of Che operator deployment and roles (cluster roles) YAMLs, CR, CRD from the `deploy` directory of the project. With `--installer olm` chectl uses catalog source index image with olm bundles from the `bundle` directory.
#### Deploy Che operator with chectl using `--installer operator` flag
@ -74,7 +87,13 @@ $ chectl server:deploy --installer operator -p <PLATFORM> --che-operator-image=$
Where:
- `PLATFORM` - k8s platform supported by chectl.
> INFO: if you have changed Che operator deployment, roles, cluster roles, CRD or CR then you must use `--templates` flag to point chectl to modified Che operator templates. Copy all files from the `deploy` folder of the che-operator project into a folder `<SOME_PATH>/templates/che-operator` and use it with chectl:
If you have changed Che operator deployment, roles, cluster roles, CRD or CR then you must use `--templates` flag to point chectl to modified Che operator templates. Use make command to prepare chectl templates folder:
```bash
$ make chectl-templ TARGET=<SOME_PATH>/che-operator
```
Execute chectl:
```bash
$ chectl server:deploy --installer operator -p <PLATFORM> --che-operator-image=${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:next --templates <SOME_PATH>/templates
@ -84,10 +103,10 @@ $ chectl server:deploy --installer operator -p <PLATFORM> --che-operator-image=$
1. Build your custom operator image, see [How to Build Che operator Image](#build-and-push-custom-che-operator-image).
2. Create newer OLM files:
2. Update OLM files:
```bash
$ olm/update-resources.sh
$ make update-resources -s
```
3. Build catalog source and bundle images:
@ -118,21 +137,43 @@ spec:
$ chectl server:deploy --installer=olm --platform=<CHECTL_SUPPORTED_PLATFORM> --catalog-source-yaml <PATH_TO_CUSTOM_CATALOG_SOURCE_YAML> --olm-channel=nightly --package-manifest-name=eclipse-che-preview-<openshift|kubernetes>
```
### Deploy Che operator using bash script
### Deploy Che operator using operator-sdk
> WARNING: Cluster Admin privileges are required
```bash
./deploy.sh $namespace
```
The script creates service account, roles, roles binding, operator deployment, CRD, and CR resources. Wait until Che deployment is scaled to 1 and Che pod is run. Make sure you provide a global ingress domain in `deploy/crds/org_v1_che_cr.yaml` for k8s platform, for example:
If you don't have operator-sdk, then you can use make command to install it:
```bash
k8s:
ingressDomain: '192.168.99.101.nip.io'
$ make download-operator-sdk
$ sudo mv operator-sdk /usr/local/bin
```
Prepare bundle:
```bash
$ export BUNDLE_IMG="${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator-bundle:v0.0.1"
$ export PLATFORM=<kubernetes|openshift>
$ make bundle IMG="${BUNDLE_IMG}" platform="${PLATFORM}"
$ make bundle-build bundle-push BUNDLE_IMG="${BUNDLE_IMG}" platform="${PLATFORM}"
```
Also for this purpose you can use VSCode tast `Build test bundle Kubernetes platform` or `Build test bundle Openshift platform`.
Install che-operator and apply custom resource file/files(corresponding VSCode task: `Install che-operator via OLM`):
```bash
$ operator-sdk run bundle "${BUNDLE_IMG}" --namespace "${NAMESPACE}";
$ make -s apply-cr-crd ECLIPSE_CHE_NAMESPACE="${NAMESPACE}"
```
To uninstall Che operator(corresponding VSCode task is `UnInstall che-operator via OLM Openshift` or `UnInstall che-operator via OLM Kubernetes`):
```bash
$ operator-sdk cleanup eclipse-che-preview-<kubernetes|openshift>
```
## Deploy Che operator for different usecases
### Single user mode
@ -268,37 +309,29 @@ You can run/debug this operator on your local machine (without deploying to a k8
Go client grabs kubeconfig either from InClusterConfig or `~/.kube` locally. Make sure your current kubectl context points to a target cluster and namespace and a current user can create objects in a target namespace.
```bash
`./local-debug.sh -n <ECLIPSE-CHE-NAMESPACE> -cr <CUSTOM_RESOURCE>
`make debug ECLIPSE_CHE_NAMESPACE=<ECLIPSE-CHE-NAMESPACE> ECLIPSE_CHE_CR=<CUSTOM_RESOURCE_PATH>
```
Where:
* `ECLIPSE-CHE-NAMESPACE` - namespace name to deploy Che operator into, default is `che`
* `CUSTOM_RESOURCE` - path to custom resource yaml, default is `./deploy/crds/org_v1_che_cr.yaml`
* `CUSTOM_RESOURCE` - path to custom resource yaml, default is `./config/samples/org.eclipse.che_v1_checluster.yaml`
Use VSCode debug configuration `Che Operator` to attach to the running process.
### Run and debug mock tests
Che operator covered with mock tests. To run them use VSCode task `Run che-operator mock tests` or run in the terminal in the root of the project:
To uninstall che-operator use:
```bash
$ export MOCK_API="true"; go test -mod=vendor -v ./...
$ make uninstall
```
To debug Che operator tests you can use VSCode `Launch Current File` debug configuration.
For that you have to open file with a test, for example `pkg/controller/che/che_controller_test.go`, set up some breakpoints, select debug tab, select `Launch Current File` configuration in the debug panel and click the `Start debugging` button. Test will be executed with the environment variable `MOCK_API=true` to enable "mocks" mode.
And then interrupt debug process by `CTRL+C`.
### Run E2E tests
### Run unit tests
`e2e` directory contains end-to-end tests that create a custom resource, operator deployment, required RBAC.
Pre-reqs to run end-to-end (e2e) tests:
* a running Minishift cluster
* current oc/kubectl context as a cluster admin user
Che operator covered with unit tests. Some of them uses mocks. To run tests use VSCode task `Run che-operator tests` or run in the terminal in the root of the project:
```bash
$ e2e/run_tests.sh
$ go test -mod=vendor -v ./...
```
### Compile Che operator code
@ -307,7 +340,7 @@ The operator will be compiled to the binary `/tmp/che-operator/che-operator`.
This command is useful to make sure that che-operator is still compiling after your changes. Run VSCode task: `Compile che-operator code` or use the terminal:
```bash
GOOS=linux GOARCH=${ARCH} CGO_ENABLED=0 go build -mod=vendor -o /tmp/che-operator/che-operator cmd/manager/main.go
$ GOOS=linux GOARCH=${ARCH} CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -a -o /tmp/che-operator/che-operator main.go
```
### Format code
@ -317,51 +350,69 @@ Run the VSCode task: `Format che-operator code` or use the terminal:
```bash
$ go fmt ./...
```
> Notice: if you don't have redhat subscription, use public image registry.access.redhat.com/devtools/go-toolset-rhel7:latest
### Fix imports
Run the VSCode task: `Fix che-operator imports` or use the terminal:
```bash
$ find . -not -path \"./vendor/*\" -name '*.go' -exec goimports -l -w {} \\;
```
### Update golang dependencies
Che operator uses Go modules and a vendor folder. Run the VSCode task: `Update che-operator dependencies` or use the terminal:
```bash
$ go mod tidy
$ go mod vendor
```
New golang dependencies in the vendor folder should be committed and included in the pull request.
Notice: freeze all new transitive dependencies using "replaces" go.mod file section to prevent CQ issues.
### Updating Custom Resource Definition file
Che cluster custom resource definition (CRD) defines Eclipse CheCluster custom resource object. It contains information about object structure, field types, field descriptions. CRD file is a YAML definition located in the folder `deploy/crds`. These files are auto-generated, so do not edit it directly to update them. If you want to add new fields or fix descriptions in the CRDs, make your changes in the file `pkg/apis/org/v1/che_types.go` and run VSCode task `Update resources` or use the terminal
Che cluster custom resource definition (CRD) defines Eclipse CheCluster custom resource object. It contains information about object structure, field types, field descriptions. CRD file is a YAML definition located in the folder `config/crd/bases`. These files are auto-generated, so do not edit it directly to update them. If you want to add new fields or fix descriptions in the CRDs, make your changes in the file `api/v1/checluster_types.go` and run VSCode task `Update CR/CRDs` or use the terminal:
```bash
$ olm/update-resources.sh
```
$ make generate; make manifests
```
> Notice: this script contains commands to make the CRD compatible with Openshift 3.
This command will update CRD files:
- `config/crd/bases/org_v1_che_crd.yaml`
- `config/crd/bases/org_v1_che_crd-v1beta1.yaml`
- `config/crd/bases/org.eclipse.che_chebackupserverconfigurations_crd-v1beta1.yaml`
- `config/crd/bases/org.eclipse.che_chebackupserverconfigurations_crd.yaml`
- `config/crd/bases/org.eclipse.che_checlusterbackups_crd-v1beta1.yaml`
- `config/crd/bases/org.eclipse.che_checlusterbackups_crd.yaml`
- `config/crd/bases/org.eclipse.che_checlusterrestores_crd-v1beta1.yaml`
- `config/crd/bases/org.eclipse.che_checlusterrestores_crd.yaml`
CRD beta yamls should be used for back compatibility with Openshift 3.
### Update nightly OLM bundle
Sometimes, during development, you need to modify some YAML definitions in the `deploy` folder or Che cluster custom resource. There are most frequently changes which should be included to the new OLM bundle:
- operator deployment `deploy/operator.yaml`
- operator roles/cluster roles permissions. They are defined like role/rolebinding or cluster role/rolebinding yamls in the `deploy` folder.
- operator custom resource CR `deploy/crds/org_v1_che_cr.yaml`. This file contains the default CheCluster sample. Also this file is the default OLM CheCluster sample.
- Che cluster custom resource definition `pkg/apis/org/v1/che_types.go`. For example you want to fix some properties description or apply new Che type properties with default values. These changes affect CRD `deploy/crds/org_v1_che_crd.yaml`.
- add Openshift ui annotations for Che types properties (`pkg/apis/org/v1/che_types.go`) to display information or interactive elements on the Openshift user interface.
Sometimes, during development, you need to modify some YAML definitions in the `config` folder or Che cluster custom resource. There are most frequently changes which should be included to the new OLM bundle:
- operator deployment `config/manager/manager.yaml`
- operator roles/cluster roles permissions. They are defined like role/rolebinding or cluster role/rolebinding yamls in the `config` folder.
- operator custom resource CR `config/crd/bases/org_v1_che_cr.yaml`. This file contains the default CheCluster sample. Also this file is the default OLM CheCluster sample.
- Che cluster custom resource definition `api/v1/checluster_types.go`. For example you want to fix some properties description or apply new Che type properties with default values. These changes affect CRD `config/crd/bases/org_v1_che_crd.yaml`.
- add Openshift ui annotations for Che types properties (`api/v1/checluster_types.go`) to display information or interactive elements on the Openshift user interface.
For all these cases it's a necessary to generate a new OLM bundle to make these changes working with OLM. Run the VSCode tasks `Update resources` or use the terminal:
```bash
$ olm/update-resources.sh
$ make update-resources -s
```
Every changes will be included to the `deploy/olm-catalog` bundles and will override all previous changes. OLM bundle changes should be committed to the pull request.
Every changes will be included to the `bundle` folder and will override all previous changes. OLM bundle changes should be committed to the pull request.
To update a bundle without version incrementation and time update you can use env variables `NO_DATE_UPDATE` and `NO_INCREMENT`. For example, during development you need to update bundle a lot of times with changed che-operator deployment or role, rolebinding and etc, but you don't want to increment the bundle version and time creation, when all desired changes were completed:
```bash
$ export NO_DATE_UPDATE="true" \
&& export NO_INCREMENT="true" \
&& olm/update-resources.sh
$ make update-resources NO_DATE_UPDATE="true" NO_INCREMENT="true" -s
```
### Che operator PR checks

View File

@ -1 +1 @@
operator-sdk: v0.17.2
operator-sdk: v1.7.1

View File

@ -1,8 +1,8 @@
package org
import (
v1 "github.com/eclipse-che/che-operator/pkg/apis/org/v1"
"github.com/eclipse-che/che-operator/pkg/apis/org/v2alpha1"
v1 "github.com/eclipse-che/che-operator/api/v1"
"github.com/eclipse-che/che-operator/api/v2alpha1"
"github.com/eclipse-che/che-operator/pkg/util"
"sigs.k8s.io/yaml"
)

View File

@ -6,8 +6,8 @@ import (
"testing"
"github.com/che-incubator/kubernetes-image-puller-operator/pkg/apis/che/v1alpha1"
v1 "github.com/eclipse-che/che-operator/pkg/apis/org/v1"
"github.com/eclipse-che/che-operator/pkg/apis/org/v2alpha1"
v1 "github.com/eclipse-che/che-operator/api/v1"
"github.com/eclipse-che/che-operator/api/v2alpha1"
"github.com/eclipse-che/che-operator/pkg/util"
"github.com/google/go-cmp/cmp"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2021 Red Hat, Inc.
// Copyright (c) 2012-2021 Red Hat, Inc.
// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/
@ -9,6 +9,7 @@
// Contributors:
// Red Hat, Inc. - initial API and implementation
//
package v1
import (
@ -109,11 +110,13 @@ type SftpServerConfing struct {
type CheBackupServerConfigurationStatus struct {
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// The `CheBackupServerConfiguration` custom resource allows defining and managing Eclipse Che Backup Server Configurations
// CheBackupServerConfiguration is the Schema for the chebackupserverconfigurations API
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=chebackupserverconfigurations,scope=Namespaced
// +k8s:openapi-gen=true
// +operator-sdk:csv:customresourcedefinitions:displayName="Eclipse Che Cluster Backup Server Configuration"
type CheBackupServerConfiguration struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
@ -122,7 +125,7 @@ type CheBackupServerConfiguration struct {
Status CheBackupServerConfigurationStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
//+kubebuilder:object:root=true
// CheBackupServerConfigurationList contains a list of CheBackupServerConfiguration
type CheBackupServerConfigurationList struct {

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2012-2019 Red Hat, Inc.
// Copyright (c) 2012-2021 Red Hat, Inc.
// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/
@ -9,18 +9,20 @@
// Contributors:
// Red Hat, Inc. - initial API and implementation
//
package v1
// Important: You must regenerate some generated code after modifying this file. At the root of the project:
// - Run `operator-sdk generate k8s`: this will perform required changes in the `pkg/apis/org/v1/zz_generatedxxx` files
// - Run `operator-sdk generate openapi`: this will generate the `deploy/crds/org_v1_checluster_crd.yaml` file
// - In the updated `deploy/crds/org_v1_checluster_crd.yaml`: Delete all the `required:` openAPI rules in the CRD OpenApi schema.
// - Rename the new `deploy/crds/org_v1_checluster_crd.yaml` to `deploy/crds/org_v1_che_crd.yaml` to override it.
// Run `make generate`. It will perform required changes:
// - update `api/v1/zz_generatedxxx` files;
// - update `config/crd/bases/org_v1_checluster_crd.yaml` and `config/crd/bases/org_v1_che_crd-v1beta1.yaml` files;
// - In the updated `config/crd/bases/org_v1_checluster_crd.yaml`: Delete all the `required:` openAPI rules in the CRD OpenApi schema;
// - Rename the new `config/crd/bases/org_v1_checluster_crd.yaml` to `config/crd/bases/org_v1_che_crd.yaml` to override it.
// IMPORTANT These 2 last steps are important to ensure backward compatibility with already existing `CheCluster` CRs that were created when no schema was provided.
import (
chev1alpha1 "github.com/che-incubator/kubernetes-image-puller-operator/pkg/apis/che/v1alpha1"
"github.com/eclipse-che/che-operator/pkg/apis/org/v2alpha1"
v2alpha1 "github.com/eclipse-che/che-operator/api/v2alpha1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
@ -52,9 +54,11 @@ type CheClusterSpec struct {
// Configuration settings specific to Che installations made on upstream Kubernetes.
// +optional
K8s CheClusterSpecK8SOnly `json:"k8s"`
// Kubernetes Image Puller configuration
// +optional
ImagePuller CheClusterSpecImagePuller `json:"imagePuller"`
// Dev Workspace operator configuration
// +optional
DevWorkspace CheClusterSpecDevWorkspace `json:"devWorkspace"`
@ -611,9 +615,8 @@ type CheClusterSpecDevWorkspace struct {
// Deploys the DevWorkspace Operator in the cluster.
// Does nothing when a matching version of the Operator is already installed.
// Fails when a non-matching version of the Operator is already installed.
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=false
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Enable Dev Workspace operator"
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enable Dev Workspace operator"
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
Enable bool `json:"enable"`
// Overrides the container image used in the DevWorkspace controller deployment.
// This includes the image tag. Omit it or leave it empty to use the default container image provided by the Operator.
@ -632,9 +635,9 @@ type ExternalDevfileRegistries struct {
// CheClusterStatus defines the observed state of Che installation
type CheClusterStatus struct {
// OpenShift OAuth secret in `openshift-config` namespace that contains user credentials for HTPasswd identity provider.
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.displayName="OpenShift OAuth secret in `openshift-config` namespace that contains user credentials for HTPasswd identity provider."
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.x-descriptors="urn:alm:descriptor:text"
// +operator-sdk:csv:customresourcedefinitions:type=status
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="OpenShift OAuth secret in `openshift-config` namespace that contains user credentials for HTPasswd identity provider."
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:text"
OpenShiftOAuthUserCredentialsSecret string `json:"openShiftOAuthUserCredentialsSecret,omitempty"`
// Indicates that a PostgreSQL instance has been correctly provisioned or not.
// +optional
@ -650,57 +653,57 @@ type CheClusterStatus struct {
GitHubOAuthProvisioned bool `json:"gitHubOAuthProvisioned"`
// 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"
// +operator-sdk:csv:customresourcedefinitions:type=status
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Status"
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="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"
// +operator-sdk:csv:customresourcedefinitions:type=status
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="displayName: Eclipse Che version"
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="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"
// +operator-sdk:csv:customresourcedefinitions:type=status
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Eclipse Che URL"
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:org.w3:link"
CheURL string `json:"cheURL"`
// Public URL to the Identity Provider server, Keycloak or 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"
// +operator-sdk:csv:customresourcedefinitions:type=status
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Keycloak Admin Console URL"
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:org.w3:link"
KeycloakURL string `json:"keycloakURL"`
// Public URL to the devfile registry.
// +optional
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.displayName="Devfile registry URL"
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.x-descriptors="urn:alm:descriptor:org.w3:link"
// +operator-sdk:csv:customresourcedefinitions:type=status
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Devfile registry URL"
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:org.w3:link"
DevfileRegistryURL string `json:"devfileRegistryURL"`
// Public URL to the plugin registry.
// +optional
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.displayName="Plugin registry URL"
// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.x-descriptors="urn:alm:descriptor:org.w3:link"
// +operator-sdk:csv:customresourcedefinitions:type=status
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Plugin registry URL"
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:org.w3:link"
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"
// +operator-sdk:csv:customresourcedefinitions:type=status
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Message"
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="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"
// +operator-sdk:csv:customresourcedefinitions:type=status
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Reason"
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:text"
Reason string `json:"reason,omitempty"`
// A URL that points 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"
// +operator-sdk:csv:customresourcedefinitions:type=status
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Help link"
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:org.w3:link"
HelpLink string `json:"helpLink,omitempty"`
// The status of the Devworkspace subsystem
@ -708,12 +711,13 @@ type CheClusterStatus struct {
DevworkspaceStatus v2alpha1.CheClusterStatusV2Alpha1 `json:"devworkspaceStatus,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// The `CheCluster` custom resource allows defining and managing a Che server installation
// +k8s:openapi-gen=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +operator-sdk:gen-csv:customresourcedefinitions.displayName="Eclipse Che Cluster"
// +k8s:openapi-gen=true
// +operator-sdk:csv:customresourcedefinitions:displayName="Eclipse Che Cluster"
// +kubebuilder:storageversion
type CheCluster struct {
metav1.TypeMeta `json:",inline"`
@ -730,8 +734,7 @@ type CheCluster struct {
Status CheClusterStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
//+kubebuilder:object:root=true
// CheClusterList contains a list of CheCluster
type CheClusterList struct {
metav1.TypeMeta `json:",inline"`

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2021 Red Hat, Inc.
// Copyright (c) 2012-2021 Red Hat, Inc.
// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/
@ -9,13 +9,13 @@
// Contributors:
// Red Hat, Inc. - initial API and implementation
//
package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +k8s:openapi-gen=true
// CheClusterBackupSpec defines the desired state of CheClusterBackup
type CheClusterBackupSpec struct {
// Automatically setup pod with REST backup server and use the server in this configuration.
@ -28,7 +28,6 @@ type CheClusterBackupSpec struct {
BackupServerConfigRef string `json:"backupServerConfigRef,omitempty"`
}
// +k8s:openapi-gen=true
// CheClusterBackupStatus defines the observed state of CheClusterBackup
type CheClusterBackupStatus struct {
// Message explaining the state of the backup or an error message
@ -45,11 +44,13 @@ type CheClusterBackupStatus struct {
SnapshotId string `json:"snapshotId,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// The `CheClusterBackup` custom resource allows defining and managing Eclipse Che backup
// CheClusterBackup is the Schema for the checlusterbackups API
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=checlusterbackups,scope=Namespaced
// +k8s:openapi-gen=true
// +operator-sdk:csv:customresourcedefinitions:displayName="Eclipse Che Cluster Backup"
type CheClusterBackup struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
@ -58,7 +59,7 @@ type CheClusterBackup struct {
Status CheClusterBackupStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
//+kubebuilder:object:root=true
// CheClusterBackupList contains a list of CheClusterBackup
type CheClusterBackupList struct {

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2021 Red Hat, Inc.
// Copyright (c) 2012-2021 Red Hat, Inc.
// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/
@ -9,6 +9,7 @@
// Contributors:
// Red Hat, Inc. - initial API and implementation
//
package v1
import (
@ -16,8 +17,7 @@ import (
)
// CheClusterRestoreSpec defines the desired state of CheClusterRestore
type CheClusterRestoreSpec struct {
// Snapshot ID to restore from.
type CheClusterRestoreSpec struct { // Snapshot ID to restore from.
// If omitted, latest snapshot will be used.
// +optional
SnapshotId string `json:"snapshotId,omitempty"`
@ -40,11 +40,13 @@ type CheClusterRestoreStatus struct {
State string `json:"state,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// The `CheClusterRestore` custom resource allows defining and managing Eclipse Che restore
// CheClusterRestore is the Schema for the checlusterrestores API
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=checlusterrestores,scope=Namespaced
// +k8s:openapi-gen=true
// +operator-sdk:csv:customresourcedefinitions:displayName="Eclipse Che Cluster Restore"
type CheClusterRestore struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
@ -53,7 +55,7 @@ type CheClusterRestore struct {
Status CheClusterRestoreStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
//+kubebuilder:object:root=true
// CheClusterRestoreList contains a list of CheClusterRestore
type CheClusterRestoreList struct {

View File

@ -0,0 +1,32 @@
//
// Copyright (c) 2012-2021 Red Hat, Inc.
// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/
//
// SPDX-License-Identifier: EPL-2.0
//
// Contributors:
// Red Hat, Inc. - initial API and implementation
//
// Package v1 contains API Schema definitions for the org.eclipse.che v1 API group
//+kubebuilder:object:generate=true
//+groupName=org.eclipse.che
package v1
import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)
var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "org.eclipse.che", Version: "v1"}
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)

View File

@ -1,18 +1,29 @@
// +build !ignore_autogenerated
// Code generated by operator-sdk. DO NOT EDIT.
//
// Copyright (c) 2012-2021 Red Hat, Inc.
// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/
//
// SPDX-License-Identifier: EPL-2.0
//
// Contributors:
// Red Hat, Inc. - initial API and implementation
//
// Code generated by controller-gen. DO NOT EDIT.
package v1
import (
labels "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/labels"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AwsS3ServerConfig) DeepCopyInto(out *AwsS3ServerConfig) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AwsS3ServerConfig.
@ -32,7 +43,6 @@ func (in *CheBackupServerConfiguration) DeepCopyInto(out *CheBackupServerConfigu
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheBackupServerConfiguration.
@ -65,7 +75,6 @@ func (in *CheBackupServerConfigurationList) DeepCopyInto(out *CheBackupServerCon
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheBackupServerConfigurationList.
@ -104,7 +113,6 @@ func (in *CheBackupServerConfigurationSpec) DeepCopyInto(out *CheBackupServerCon
*out = new(SftpServerConfing)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheBackupServerConfigurationSpec.
@ -120,7 +128,6 @@ func (in *CheBackupServerConfigurationSpec) DeepCopy() *CheBackupServerConfigura
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CheBackupServerConfigurationStatus) DeepCopyInto(out *CheBackupServerConfigurationStatus) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheBackupServerConfigurationStatus.
@ -140,7 +147,6 @@ func (in *CheCluster) DeepCopyInto(out *CheCluster) {
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheCluster.
@ -168,7 +174,6 @@ func (in *CheClusterBackup) DeepCopyInto(out *CheClusterBackup) {
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
out.Status = in.Status
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterBackup.
@ -201,7 +206,6 @@ func (in *CheClusterBackupList) DeepCopyInto(out *CheClusterBackupList) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterBackupList.
@ -225,7 +229,6 @@ func (in *CheClusterBackupList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CheClusterBackupSpec) DeepCopyInto(out *CheClusterBackupSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterBackupSpec.
@ -241,7 +244,6 @@ func (in *CheClusterBackupSpec) DeepCopy() *CheClusterBackupSpec {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CheClusterBackupStatus) DeepCopyInto(out *CheClusterBackupStatus) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterBackupStatus.
@ -266,7 +268,6 @@ func (in *CheClusterList) DeepCopyInto(out *CheClusterList) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterList.
@ -294,7 +295,6 @@ func (in *CheClusterRestore) DeepCopyInto(out *CheClusterRestore) {
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
out.Status = in.Status
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterRestore.
@ -327,7 +327,6 @@ func (in *CheClusterRestoreList) DeepCopyInto(out *CheClusterRestoreList) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterRestoreList.
@ -351,7 +350,6 @@ func (in *CheClusterRestoreList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CheClusterRestoreSpec) DeepCopyInto(out *CheClusterRestoreSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterRestoreSpec.
@ -367,7 +365,6 @@ func (in *CheClusterRestoreSpec) DeepCopy() *CheClusterRestoreSpec {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CheClusterRestoreStatus) DeepCopyInto(out *CheClusterRestoreStatus) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterRestoreStatus.
@ -391,7 +388,6 @@ func (in *CheClusterSpec) DeepCopyInto(out *CheClusterSpec) {
out.K8s = in.K8s
out.ImagePuller = in.ImagePuller
out.DevWorkspace = in.DevWorkspace
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterSpec.
@ -425,7 +421,6 @@ func (in *CheClusterSpecAuth) DeepCopyInto(out *CheClusterSpecAuth) {
*out = new(bool)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterSpecAuth.
@ -442,7 +437,6 @@ func (in *CheClusterSpecAuth) DeepCopy() *CheClusterSpecAuth {
func (in *CheClusterSpecDB) DeepCopyInto(out *CheClusterSpecDB) {
*out = *in
out.ChePostgresContainerResources = in.ChePostgresContainerResources
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterSpecDB.
@ -458,7 +452,6 @@ func (in *CheClusterSpecDB) DeepCopy() *CheClusterSpecDB {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CheClusterSpecDevWorkspace) DeepCopyInto(out *CheClusterSpecDevWorkspace) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterSpecDevWorkspace.
@ -475,7 +468,6 @@ func (in *CheClusterSpecDevWorkspace) DeepCopy() *CheClusterSpecDevWorkspace {
func (in *CheClusterSpecImagePuller) DeepCopyInto(out *CheClusterSpecImagePuller) {
*out = *in
out.Spec = in.Spec
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterSpecImagePuller.
@ -491,7 +483,6 @@ func (in *CheClusterSpecImagePuller) DeepCopy() *CheClusterSpecImagePuller {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CheClusterSpecK8SOnly) DeepCopyInto(out *CheClusterSpecK8SOnly) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterSpecK8SOnly.
@ -507,7 +498,6 @@ func (in *CheClusterSpecK8SOnly) DeepCopy() *CheClusterSpecK8SOnly {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CheClusterSpecMetrics) DeepCopyInto(out *CheClusterSpecMetrics) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterSpecMetrics.
@ -555,7 +545,6 @@ func (in *CheClusterSpecServer) DeepCopyInto(out *CheClusterSpecServer) {
}
in.CheServerIngress.DeepCopyInto(&out.CheServerIngress)
in.CheServerRoute.DeepCopyInto(&out.CheServerRoute)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterSpecServer.
@ -571,7 +560,6 @@ func (in *CheClusterSpecServer) DeepCopy() *CheClusterSpecServer {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CheClusterSpecStorage) DeepCopyInto(out *CheClusterSpecStorage) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterSpecStorage.
@ -588,7 +576,6 @@ func (in *CheClusterSpecStorage) DeepCopy() *CheClusterSpecStorage {
func (in *CheClusterStatus) DeepCopyInto(out *CheClusterStatus) {
*out = *in
out.DevworkspaceStatus = in.DevworkspaceStatus
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterStatus.
@ -604,7 +591,6 @@ func (in *CheClusterStatus) DeepCopy() *CheClusterStatus {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ExternalDevfileRegistries) DeepCopyInto(out *ExternalDevfileRegistries) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalDevfileRegistries.
@ -627,7 +613,6 @@ func (in *IngressCustomSettings) DeepCopyInto(out *IngressCustomSettings) {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressCustomSettings.
@ -643,7 +628,6 @@ func (in *IngressCustomSettings) DeepCopy() *IngressCustomSettings {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Resources) DeepCopyInto(out *Resources) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Resources.
@ -661,7 +645,6 @@ func (in *ResourcesCustomSettings) DeepCopyInto(out *ResourcesCustomSettings) {
*out = *in
out.Requests = in.Requests
out.Limits = in.Limits
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcesCustomSettings.
@ -677,7 +660,6 @@ func (in *ResourcesCustomSettings) DeepCopy() *ResourcesCustomSettings {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RestServerConfig) DeepCopyInto(out *RestServerConfig) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestServerConfig.
@ -700,7 +682,6 @@ func (in *RouteCustomSettings) DeepCopyInto(out *RouteCustomSettings) {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteCustomSettings.
@ -716,7 +697,6 @@ func (in *RouteCustomSettings) DeepCopy() *RouteCustomSettings {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SftpServerConfing) DeepCopyInto(out *SftpServerConfing) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SftpServerConfing.

View File

@ -17,17 +17,8 @@ import (
"k8s.io/apimachinery/pkg/labels"
)
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// NOTE THAT THIS IS CURRENTLY INTENTIONALLY NOT PART OF THE GENERATED API
//
// (the generator comments are switched off by using a '\' instead of a '+')
//
// This is so that we can start using this spec in the code before we are
// actually ready to start deploying it in the cluster.
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// CheClusterSpec holds the configuration of the Che controller.
// \k8s:openapi-gen=true
// +k8s:openapi-gen=true
type CheClusterSpec struct {
// If false, Che is disabled and does not resolve the devworkspaces with the che routingClass.
Enabled *bool `json:"enabled,omitempty"`
@ -147,7 +138,7 @@ const (
)
// CheClusterStatusV2Alpha1 contains the status of the CheCluster object
// \k8s:openapi-gen=true
// +k8s:openapi-gen=true
type CheClusterStatusV2Alpha1 struct {
// GatewayPhase specifies the phase in which the gateway deployment currently is.
// If the gateway is disabled, the phase is "Inactive".
@ -173,9 +164,9 @@ type CheClusterStatusV2Alpha1 struct {
}
// CheCluster is the configuration of the CheCluster layer of Devworkspace.
// \k8s:openapi-gen=true
// \kubebuilder:subresource:status
// \kubebuilder:resource:path=checlusters,scope=Namespaced
// +k8s:openapi-gen=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=checlusters,scope=Namespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type CheCluster struct {
metav1.TypeMeta `json:",inline"`

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2012-2019 Red Hat, Inc.
// Copyright (c) 2012-2021 Red Hat, Inc.
// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/
@ -9,7 +9,8 @@
// Contributors:
// Red Hat, Inc. - initial API and implementation
//
// Package v1 contains API Schema definitions for the org v1 API group
// Package v2alpha1 contains API Schema definitions for the org v2alpha1 API group
// +k8s:deepcopy-gen=package,register
// +groupName=org.eclipse.che
package v1
package v2alpha1

View File

@ -9,6 +9,7 @@
// Contributors:
// Red Hat, Inc. - initial API and implementation
//
// NOTE: Boilerplate only. Ignore this file.
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@ -21,8 +22,8 @@
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Package v2alpha1 contains API Schema definitions for the org v2alpha1 API group
// \k8s:deepcopy-gen=package,register
// \groupName=org.eclipse.che
//+kubebuilder:object:generate=true
//+groupName=org.eclipse.che
package v2alpha1
import (
@ -31,11 +32,11 @@ import (
)
var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: "org.eclipse.che", Version: "v2alpha1"}
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "org.eclipse.che", Version: "v2alpha1"}
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme

View File

@ -1,10 +1,23 @@
// +build !ignore_autogenerated
// Code generated by operator-sdk. DO NOT EDIT.
//
// Copyright (c) 2012-2021 Red Hat, Inc.
// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/
//
// SPDX-License-Identifier: EPL-2.0
//
// Contributors:
// Red Hat, Inc. - initial API and implementation
//
// Code generated by controller-gen. DO NOT EDIT.
package v2alpha1
import (
"k8s.io/apimachinery/pkg/labels"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@ -15,7 +28,6 @@ func (in *CheCluster) DeepCopyInto(out *CheCluster) {
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheCluster.
@ -48,7 +60,6 @@ func (in *CheClusterList) DeepCopyInto(out *CheClusterList) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterList.
@ -72,9 +83,14 @@ func (in *CheClusterList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CheClusterSpec) DeepCopyInto(out *CheClusterSpec) {
*out = *in
if in.Enabled != nil {
in, out := &in.Enabled, &out.Enabled
*out = new(bool)
**out = **in
}
out.WorkspaceDomainEndpoints = in.WorkspaceDomainEndpoints
in.Gateway.DeepCopyInto(&out.Gateway)
in.K8s.DeepCopyInto(&out.K8s)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterSpec.
@ -97,7 +113,6 @@ func (in *CheClusterSpecK8s) DeepCopyInto(out *CheClusterSpecK8s) {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterSpecK8s.
@ -113,10 +128,9 @@ func (in *CheClusterSpecK8s) DeepCopy() *CheClusterSpecK8s {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CheClusterStatusV2Alpha1) DeepCopyInto(out *CheClusterStatusV2Alpha1) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterStatus.
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterStatusV2Alpha1.
func (in *CheClusterStatusV2Alpha1) DeepCopy() *CheClusterStatusV2Alpha1 {
if in == nil {
return nil
@ -134,7 +148,13 @@ func (in *CheGatewaySpec) DeepCopyInto(out *CheGatewaySpec) {
*out = new(bool)
**out = **in
}
return
if in.ConfigLabels != nil {
in, out := &in.ConfigLabels, &out.ConfigLabels
*out = make(labels.Set, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheGatewaySpec.
@ -146,3 +166,18 @@ func (in *CheGatewaySpec) DeepCopy() *CheGatewaySpec {
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkspaceDomainEndpoints) DeepCopyInto(out *WorkspaceDomainEndpoints) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceDomainEndpoints.
func (in *WorkspaceDomainEndpoints) DeepCopy() *WorkspaceDomainEndpoints {
if in == nil {
return nil
}
out := new(WorkspaceDomainEndpoints)
in.DeepCopyInto(out)
return out
}

View File

@ -1,13 +0,0 @@
# Copyright (c) 2018-2020 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#
# Empty file.
# Is required by operator-sdk for some tasks.

View File

@ -0,0 +1,21 @@
FROM scratch
# Core bundle labels.
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=eclipse-che-preview-kubernetes
LABEL operators.operatorframework.io.bundle.channels.v1=nightly
LABEL operators.operatorframework.io.bundle.channel.default.v1=nightly
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.7.1+git
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
# Labels for testing.
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/
# Copy files to locations specified by labels.
COPY bundle/nightly/eclipse-che-preview-kubernetes/manifests /manifests/
COPY bundle/nightly/eclipse-che-preview-kubernetes/metadata /metadata/
COPY bundle/nightly/eclipse-che-preview-kubernetes/tests/scorecard /tests/scorecard/

View File

@ -1,13 +1,3 @@
#
# Copyright (c) 2019-2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
@ -85,23 +75,42 @@ metadata:
categories: Developer Tools
certified: "false"
containerImage: quay.io/eclipse/che-operator:next
createdAt: "2021-07-15T07:38:13Z"
createdAt: "2021-05-11T18:38:31Z"
description: A Kube-native development solution that delivers portable and collaborative
developer workspaces.
operatorframework.io/suggested-namespace: eclipse-che
operators.operatorframework.io/builder: operator-sdk-v1.6.1+git
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
name: eclipse-che-preview-kubernetes.v7.33.0-258.nightly
name: eclipse-che-preview-kubernetes.v7.34.0-262.nightly
namespace: placeholder
spec:
apiservicedefinitions: {}
customresourcedefinitions:
owned:
- description: The `CheCluster` custom resource allows defining and managing
a Che server installation
displayName: Eclipse Che Cluster
- displayName: Eclipse Che Cluster Backup Server Configuration
kind: CheBackupServerConfiguration
name: chebackupserverconfigurations.org.eclipse.che
version: v1
- displayName: Eclipse Che Cluster Backup
kind: CheClusterBackup
name: checlusterbackups.org.eclipse.che
version: v1
- kind: CheClusterRestore
name: checlusterrestores.org.eclipse.che
version: v1
- displayName: Eclipse Che Cluster
kind: CheCluster
name: checlusters.org.eclipse.che
specDescriptors:
- description: Deploys the DevWorkspace Operator in the cluster. Does nothing
when a matching version of the Operator is already installed. Fails
when a non-matching version of the Operator is already installed.
displayName: Enable Dev Workspace operator
path: devWorkspace.enable
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
statusDescriptors:
- description: Status of a Che installation. Can be `Available`, `Unavailable`,
or `Available, Rolling Update in Progress`.
@ -158,7 +167,6 @@ spec:
displayName: Reason
path: reason
x-descriptors:
- urn:alm:descriptor:io.kubernetes.phase:reason
- urn:alm:descriptor:text
version: v1
description: |
@ -274,6 +282,12 @@ spec:
spec:
clusterPermissions:
- rules:
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- apiGroups:
- rbac.authorization.k8s.io
resources:
@ -319,6 +333,7 @@ spec:
- checlusters
- checlusters/status
- checlusters/finalizers
- checlusters/status
verbs:
- '*'
- apiGroups:
@ -656,19 +671,6 @@ spec:
verbs:
- create
- get
- apiGroups:
- oauth.openshift.io
resources:
- oauthclients
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- rbac.authorization.k8s.io
resources:
@ -682,18 +684,6 @@ spec:
- list
- update
- watch
- apiGroups:
- route.openshift.io
resources:
- routes
verbs:
- '*'
- apiGroups:
- route.openshift.io
resources:
- routes/custom-host
verbs:
- create
- apiGroups:
- workspace.devfile.io
resources:
@ -843,19 +833,6 @@ spec:
verbs:
- create
- get
- apiGroups:
- oauth.openshift.io
resources:
- oauthclients
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- rbac.authorization.k8s.io
resources:
@ -869,18 +846,6 @@ spec:
- list
- update
- watch
- apiGroups:
- route.openshift.io
resources:
- routes
verbs:
- '*'
- apiGroups:
- route.openshift.io
resources:
- routes/custom-host
verbs:
- create
- nonResourceURLs:
- /metrics
verbs:
@ -905,8 +870,10 @@ spec:
app.kubernetes.io/name: che
spec:
containers:
- command:
- /usr/local/bin/che-operator
- args:
- --leader-elect
command:
- /manager
env:
- name: WATCH_NAMESPACE
valueFrom:
@ -992,22 +959,15 @@ spec:
- containerPort: 60000
name: metrics
readinessProbe:
exec:
command:
- stat
- /tmp/operator-sdk-ready
failureThreshold: 10
httpGet:
path: /readyz
port: 6789
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 100m
memory: 64Mi
resources: {}
securityContext:
capabilities:
drop:
@ -1195,6 +1155,37 @@ spec:
- events
verbs:
- create
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
serviceAccountName: che-operator
strategy: deployment
installModes:
@ -1226,4 +1217,4 @@ spec:
maturity: stable
provider:
name: Eclipse Foundation
version: 7.33.0-258.nightly
version: 7.34.0-262.nightly

View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/component: che-operator
app.kubernetes.io/instance: che
app.kubernetes.io/name: che
name: che-operator

View File

@ -0,0 +1,17 @@
apiVersion: v1
data:
controller_manager_config.yaml: |
apiVersion: controller-runtime.sigs.k8s.io/v1alpha1
kind: ControllerManagerConfig
health:
healthProbeBindAddress: :6789
metrics:
bindAddress: 127.0.0.1:60000
webhook:
port: 9443
leaderElection:
leaderElect: true
resourceName: e79b08a4.org.eclipse.che
kind: ConfigMap
metadata:
name: manager-config

View File

@ -1,16 +1,9 @@
#
# Copyright (c) 2019-2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: chebackupserverconfigurations.org.eclipse.che
spec:
group: org.eclipse.che
@ -24,49 +17,35 @@ spec:
- name: v1
schema:
openAPIV3Schema:
description: CheBackupServerConfiguration is the Schema for the chebackupserverconfigurations
API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: CheBackupServerConfigurationSpec defines the desired state
of CheBackupServerConfiguration Only one type of backup server is allowed
to be configured per CR.
description: CheBackupServerConfigurationSpec defines the desired state of CheBackupServerConfiguration Only one type of backup server is allowed to be configured per CR.
properties:
awss3:
description: Amazon S3 or compatible alternatives.
properties:
awsAccessKeySecretRef:
description: Reference to secret that contains awsAccessKeyId
and awsSecretAccessKey keys.
description: Reference to secret that contains awsAccessKeyId and awsSecretAccessKey keys.
type: string
hostname:
description: Server hostname, defaults to 's3.amazonaws.com'.
Might be customized in case of alternative server.
description: Server hostname, defaults to 's3.amazonaws.com'. Might be customized in case of alternative server.
type: string
port:
description: Backup server port. Usually default value is used.
Might be customized in case of alternative server.
description: Backup server port. Usually default value is used. Might be customized in case of alternative server.
type: integer
protocol:
description: Protocol to use when connection to the server. Might
be customized in case of alternative server.
description: Protocol to use when connection to the server. Might be customized in case of alternative server.
type: string
repositoryPasswordSecretRef:
description: Holds reference to a secret with restic repository
password under 'repo-password' field to encrypt / decrypt its
content.
description: Holds reference to a secret with restic repository password under 'repo-password' field to encrypt / decrypt its content.
type: string
repositoryPath:
description: Bucket name and repository, e.g. bucket/repo
@ -80,9 +59,7 @@ spec:
description: Rest backup server configuration.
properties:
credentialsSecretRef:
description: Secret that contains username and password fields
to login into restic server. Note, each repository is encrypted
with own password. See ResticRepoPasswordSecretRef field.
description: Secret that contains username and password fields to login into restic server. Note, each repository is encrypted with own password. See ResticRepoPasswordSecretRef field.
type: string
hostname:
description: Backup server host
@ -91,13 +68,10 @@ spec:
description: Backup server port
type: integer
protocol:
description: Protocol to use when connection to the server Defaults
to https.
description: Protocol to use when connection to the server Defaults to https.
type: string
repositoryPasswordSecretRef:
description: Holds reference to a secret with restic repository
password under 'repo-password' field to encrypt / decrypt its
content.
description: Holds reference to a secret with restic repository password under 'repo-password' field to encrypt / decrypt its content.
type: string
repositoryPath:
description: Restic repository path
@ -116,17 +90,13 @@ spec:
description: Backup server port
type: integer
repositoryPasswordSecretRef:
description: Holds reference to a secret with restic repository
password under 'repo-password' field to encrypt / decrypt its
content.
description: Holds reference to a secret with restic repository password under 'repo-password' field to encrypt / decrypt its content.
type: string
repositoryPath:
description: Restic repository path, relative or absolute, e.g.
/srv/repo
description: Restic repository path, relative or absolute, e.g. /srv/repo
type: string
sshKeySecretRef:
description: Private ssh key under 'ssh-privatekey' field for
passwordless login
description: Private ssh key under 'ssh-privatekey' field for passwordless login
type: string
username:
description: User login on the remote server
@ -140,11 +110,16 @@ spec:
type: object
type: object
status:
description: CheBackupServerConfigurationStatus defines the observed state
of CheBackupServerConfiguration
description: CheBackupServerConfigurationStatus defines the observed state of CheBackupServerConfiguration
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -1,16 +1,9 @@
#
# Copyright (c) 2019-2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: checlusterbackups.org.eclipse.che
spec:
group: org.eclipse.che
@ -24,17 +17,12 @@ spec:
- name: v1
schema:
openAPIV3Schema:
description: CheClusterBackup is the Schema for the checlusterbackups API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
@ -42,22 +30,17 @@ spec:
description: CheClusterBackupSpec defines the desired state of CheClusterBackup
properties:
backupServerConfigRef:
description: Name of custom resource with a backup server configuration
to use for this backup. Note, UseInternalBackupServer field can
configure internal backup server automatically.
description: Name of custom resource with a backup server configuration to use for this backup. Note, UseInternalBackupServer field can configure internal backup server automatically.
type: string
useInternalBackupServer:
description: Automatically setup pod with REST backup server and use
the server in this configuration. Note, this flag takes precedence
and will overwrite existing backup server configuration.
description: Automatically setup pod with REST backup server and use the server in this configuration. Note, this flag takes precedence and will overwrite existing backup server configuration.
type: boolean
type: object
status:
description: CheClusterBackupStatus defines the observed state of CheClusterBackup
properties:
message:
description: Message explaining the state of the backup or an error
message
description: Message explaining the state of the backup or an error message
type: string
snapshotId:
description: Last backup snapshot ID
@ -74,3 +57,9 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -1,16 +1,9 @@
#
# Copyright (c) 2019-2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: checlusterrestores.org.eclipse.che
spec:
group: org.eclipse.che
@ -24,17 +17,12 @@ spec:
- name: v1
schema:
openAPIV3Schema:
description: CheClusterRestore is the Schema for the checlusterrestores API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
@ -42,13 +30,10 @@ spec:
description: CheClusterRestoreSpec defines the desired state of CheClusterRestore
properties:
backupServerConfigRef:
description: Name of custom resource with a backup server configuration
to use for this restore. Can be omitted if only one server configuration
object exists within the namespace.
description: Name of custom resource with a backup server configuration to use for this restore. Can be omitted if only one server configuration object exists within the namespace.
type: string
snapshotId:
description: Snapshot ID to restore from. If omitted, latest snapshot
will be used.
description: If omitted, latest snapshot will be used.
type: string
type: object
status:
@ -69,3 +54,9 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,689 @@
#
# Copyright (c) 2019-2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: checlusters.org.eclipse.che
spec:
group: org.eclipse.che
names:
kind: CheCluster
listKind: CheClusterList
plural: checlusters
singular: checluster
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Desired configuration of the Che installation. Based on these settings, the Operator automatically creates and maintains several ConfigMaps that will contain the appropriate environment variables the various components of the Che installation. These generated ConfigMaps must NOT be updated manually.
properties:
auth:
description: Configuration settings related to the Authentication used by the Che installation.
properties:
externalIdentityProvider:
description: 'Instructs the Operator on whether or not to deploy a dedicated Identity Provider (Keycloak or RH SSO instance). Instructs the Operator on whether to deploy a dedicated Identity Provider (Keycloak or RH-SSO instance). By default, a dedicated Identity Provider server is deployed as part of the Che installation. When `externalIdentityProvider` is `true`, no dedicated identity provider will be deployed by the Operator and you will need to provide details about the external identity provider you are about to use. See also all the other fields starting with: `identityProvider`.'
type: boolean
gatewayAuthenticationSidecarImage:
description: Gateway sidecar responsible for authentication when NativeUserMode is enabled. See link:https://github.com/oauth2-proxy/oauth2-proxy[oauth2-proxy] or link:https://github.com/openshift/oauth-proxy[openshift/oauth-proxy].
type: string
gatewayAuthorizationSidecarImage:
description: Gateway sidecar responsible for authorization when NativeUserMode is enabled. See link:https://github.com/brancz/kube-rbac-proxy[kube-rbac-proxy] or link:https://github.com/openshift/kube-rbac-proxy[openshift/kube-rbac-proxy]
type: string
gatewayHeaderRewriteSidecarImage:
description: Header Rewrite Proxy sidecar image is used to properly set authorization header. See link:https://github.com/che-incubator/header-rewrite-proxy[header-rewrite-proxy]
type: string
identityProviderAdminUserName:
description: Overrides the name of the Identity Provider administrator user. Defaults to `admin`.
type: string
identityProviderClientId:
description: Name of a Identity provider, Keycloak or RH-SSO, `client-id` that is used for Che. Override this when an external Identity Provider is in use. See the `externalIdentityProvider` field. When omitted or left blank, it is set to the value of the `flavour` field suffixed with `-public`.
type: string
identityProviderContainerResources:
description: Identity provider container custom settings.
properties:
limits:
description: Limits describes the maximum amount of compute resources allowed.
properties:
cpu:
description: CPU, in cores. (500m = .5 cores)
type: string
memory:
description: Memory, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024)
type: string
type: object
request:
description: Requests describes the minimum amount of compute resources required.
properties:
cpu:
description: CPU, in cores. (500m = .5 cores)
type: string
memory:
description: Memory, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024)
type: string
type: object
type: object
identityProviderImage:
description: Overrides the container image used in the Identity Provider, Keycloak or RH-SSO, deployment. This includes the image tag. Omit it or leave it empty to use the default container image provided by the Operator.
type: string
identityProviderImagePullPolicy:
description: Overrides the image pull policy used in the Identity Provider, Keycloak or RH-SSO, deployment. Default value is `Always` for `nightly` or `latest` images, and `IfNotPresent` in other cases.
type: string
identityProviderIngress:
description: Ingress custom settings.
properties:
annotations:
additionalProperties:
type: string
description: Unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
type: object
labels:
description: Comma separated list of labels that can be used to organize and categorize objects by scoping and selecting.
type: string
type: object
identityProviderPassword:
description: Overrides the password of Keycloak administrator user. Override this when an external Identity Provider is in use. See the `externalIdentityProvider` field. When omitted or left blank, it is set to an auto-generated password.
type: string
identityProviderPostgresPassword:
description: Password for a Identity Provider, Keycloak or RH-SSO, to connect to the database. Override this when an external Identity Provider is in use. See the `externalIdentityProvider` field. When omitted or left blank, it is set to an auto-generated password.
type: string
identityProviderPostgresSecret:
description: 'The secret that contains `password` for the Identity Provider, Keycloak or RH-SSO, to connect to the database. When the secret is defined, the `identityProviderPostgresPassword` is ignored. When the value is omitted or left blank, the one of following scenarios applies: 1. `identityProviderPostgresPassword` is defined, then it will be used to connect to the database. 2. `identityProviderPostgresPassword` is not defined, then a new secret with the name `che-identity-postgres-secret` will be created with an auto-generated value for `password`.'
type: string
identityProviderRealm:
description: Name of a Identity provider, Keycloak or RH-SSO, realm that is used for Che. Override this when an external Identity Provider is in use. See the `externalIdentityProvider` field. When omitted or left blank, it is set to the value of the `flavour` field.
type: string
identityProviderRoute:
description: Route custom settings.
properties:
annotations:
additionalProperties:
type: string
description: Unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
type: object
domain:
description: 'Operator uses the domain to generate a hostname for a route. In a conjunction with labels it creates a route, which is served by a non-default Ingress controller. The generated host name will follow this pattern: `<route-name>-<route-namespace>.<domain>`.'
type: string
labels:
description: Comma separated list of labels that can be used to organize and categorize objects by scoping and selecting.
type: string
type: object
identityProviderSecret:
description: 'The secret that contains `user` and `password` for Identity Provider. When the secret is defined, the `identityProviderAdminUserName` and `identityProviderPassword` are ignored. When the value is omitted or left blank, the one of following scenarios applies: 1. `identityProviderAdminUserName` and `identityProviderPassword` are defined, then they will be used. 2. `identityProviderAdminUserName` or `identityProviderPassword` are not defined, then a new secret with the name `che-identity-secret` will be created with default value `admin` for `user` and with an auto-generated value for `password`.'
type: string
identityProviderURL:
description: Public URL of the Identity Provider server (Keycloak / RH-SSO server). Set this ONLY when a use of an external Identity Provider is needed. See the `externalIdentityProvider` field. By default, this will be automatically calculated and set by the Operator.
type: string
initialOpenShiftOAuthUser:
description: For operating with the OpenShift OAuth authentication, create a new user account since the kubeadmin can not be used. If the value is true, then a new OpenShift OAuth user will be created for the HTPasswd identity provider. If the value is false and the user has already been created, then it will be removed. If value is an empty, then do nothing. The user's credentials are stored in the `openshift-oauth-user-credentials` secret in 'openshift-config' namespace by Operator. Note that this solution is Openshift 4 platform-specific.
type: boolean
nativeUserMode:
description: Enables native user mode. Currently works only on OpenShift and DevWorkspace engine. Native User mode uses OpenShift OAuth directly as identity provider, without Keycloak.
type: boolean
oAuthClientName:
description: Name of the OpenShift `OAuthClient` resource used to setup identity federation on the OpenShift side. Auto-generated when left blank. See also the `OpenShiftoAuth` field.
type: string
oAuthSecret:
description: Name of the secret set in the OpenShift `OAuthClient` resource used to setup identity federation on the OpenShift side. Auto-generated when left blank. See also the `OAuthClientName` field.
type: string
openShiftoAuth:
description: 'Enables the integration of the identity provider (Keycloak / RHSSO) with OpenShift OAuth. Empty value on OpenShift by default. This will allow users to directly login with their OpenShift user through the OpenShift login, and have their workspaces created under personal OpenShift namespaces. WARNING: the `kubeadmin` user is NOT supported, and logging through it will NOT allow accessing the Che Dashboard.'
type: boolean
updateAdminPassword:
description: Forces the default `admin` Che user to update password on first login. Defaults to `false`.
type: boolean
type: object
database:
description: Configuration settings related to the database used by the Che installation.
properties:
chePostgresContainerResources:
description: PostgreSQL container custom settings
properties:
limits:
description: Limits describes the maximum amount of compute resources allowed.
properties:
cpu:
description: CPU, in cores. (500m = .5 cores)
type: string
memory:
description: Memory, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024)
type: string
type: object
request:
description: Requests describes the minimum amount of compute resources required.
properties:
cpu:
description: CPU, in cores. (500m = .5 cores)
type: string
memory:
description: Memory, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024)
type: string
type: object
type: object
chePostgresDb:
description: PostgreSQL database name that the Che server uses to connect to the DB. Defaults to `dbche`.
type: string
chePostgresHostName:
description: PostgreSQL Database host name that the Che server uses to connect to. Defaults is `postgres`. Override this value ONLY when using an external database. See field `externalDb`. In the default case it will be automatically set by the Operator.
type: string
chePostgresPassword:
description: PostgreSQL password that the Che server uses to connect to the DB. When omitted or left blank, it will be set to an automatically generated value.
type: string
chePostgresPort:
description: PostgreSQL Database port that the Che server uses to connect to. Defaults to 5432. Override this value ONLY when using an external database. See field `externalDb`. In the default case it will be automatically set by the Operator.
type: string
chePostgresSecret:
description: 'The secret that contains PostgreSQL`user` and `password` that the Che server uses to connect to the DB. When the secret is defined, the `chePostgresUser` and `chePostgresPassword` are ignored. When the value is omitted or left blank, the one of following scenarios applies: 1. `chePostgresUser` and `chePostgresPassword` are defined, then they will be used to connect to the DB. 2. `chePostgresUser` or `chePostgresPassword` are not defined, then a new secret with the name `che-postgres-secret` will be created with default value of `pgche` for `user` and with an auto-generated value for `password`.'
type: string
chePostgresUser:
description: PostgreSQL user that the Che server uses to connect to the DB. Defaults to `pgche`.
type: string
externalDb:
description: 'Instructs the Operator on whether to deploy a dedicated database. By default, a dedicated PostgreSQL database is deployed as part of the Che installation. When `externalDb` is `true`, no dedicated database will be deployed by the Operator and you will need to provide connection details to the external DB you are about to use. See also all the fields starting with: `chePostgres`.'
type: boolean
postgresImage:
description: Overrides the container image used in the PostgreSQL database deployment. This includes the image tag. Omit it or leave it empty to use the default container image provided by the Operator.
type: string
postgresImagePullPolicy:
description: Overrides the image pull policy used in the PostgreSQL database deployment. Default value is `Always` for `nightly` or `latest` images, and `IfNotPresent` in other cases.
type: string
type: object
devWorkspace:
description: Dev Workspace operator configuration
properties:
controllerImage:
description: Overrides the container image used in the DevWorkspace controller deployment. This includes the image tag. Omit it or leave it empty to use the default container image provided by the Operator.
type: string
enable:
description: Deploys the DevWorkspace Operator in the cluster. Does nothing when a matching version of the Operator is already installed. Fails when a non-matching version of the Operator is already installed.
type: boolean
required:
- enable
type: object
imagePuller:
description: Kubernetes Image Puller configuration
properties:
enable:
description: Install and configure the Community Supported Kubernetes Image Puller Operator. When set to `true` and no spec is provided, it will create a default KubernetesImagePuller object to be managed by the Operator. When set to `false`, the KubernetesImagePuller object will be deleted, and the Operator will be uninstalled, regardless of whether a spec is provided. If the `spec.images` field is empty, a set of recommended workspace-related images will be automatically detected and pre-pulled after installation. Note that while this Operator and its behavior is community-supported, its payload may be commercially-supported for pulling commercially-supported images.
type: boolean
spec:
description: A KubernetesImagePullerSpec to configure the image puller in the CheCluster
properties:
cachingCPULimit:
type: string
cachingCPURequest:
type: string
cachingIntervalHours:
type: string
cachingMemoryLimit:
type: string
cachingMemoryRequest:
type: string
configMapName:
type: string
daemonsetName:
type: string
deploymentName:
type: string
imagePullSecrets:
type: string
images:
type: string
nodeSelector:
type: string
type: object
required:
- enable
type: object
k8s:
description: Configuration settings specific to Che installations made on upstream Kubernetes.
properties:
ingressClass:
description: 'Ingress class that will define the which controller will manage ingresses. Defaults to `nginx`. NB: This drives the `kubernetes.io/ingress.class` annotation on Che-related ingresses.'
type: string
ingressDomain:
description: 'Global ingress domain for a Kubernetes cluster. This MUST be explicitly specified: there are no defaults.'
type: string
ingressStrategy:
description: 'Strategy for ingress creation. Options are: `multi-host` (host is explicitly provided in ingress), `single-host` (host is provided, path-based rules) and `default-host` (no host is provided, path-based rules). Defaults to `multi-host` Deprecated in favor of `serverExposureStrategy` in the `server` section, which defines this regardless of the cluster type. When both are defined, the `serverExposureStrategy` option takes precedence.'
type: string
securityContextFsGroup:
description: The FSGroup in which the Che Pod and workspace Pods containers runs in. Default value is `1724`.
type: string
securityContextRunAsUser:
description: ID of the user the Che Pod and workspace Pods containers run as. Default value is `1724`.
type: string
singleHostExposureType:
description: When the serverExposureStrategy is set to `single-host`, the way the server, registries and workspaces are exposed is further configured by this property. The possible values are `native`, which means that the server and workspaces are exposed using ingresses on K8s or `gateway` where the server and workspaces are exposed using a custom gateway based on link:https://doc.traefik.io/traefik/[Traefik]. All the endpoints whether backed by the ingress or gateway `route` always point to the subpaths on the same domain. Defaults to `native`.
type: string
tlsSecretName:
description: Name of a secret that will be used to setup ingress TLS termination when TLS is enabled. When the field is empty string, the default cluster certificate will be used. See also the `tlsSupport` field.
type: string
type: object
metrics:
description: Configuration settings related to the metrics collection used by the Che installation.
properties:
enable:
description: Enables `metrics` the Che server endpoint. Default to `true`.
type: boolean
type: object
server:
description: General configuration settings related to the Che server and the plugin and devfile registries
properties:
airGapContainerRegistryHostname:
description: Optional host name, or URL, to an alternate container registry to pull images from. This value overrides the container registry host name defined in all the default container images involved in a Che deployment. This is particularly useful to install Che in a restricted environment.
type: string
airGapContainerRegistryOrganization:
description: Optional repository name of an alternate container registry to pull images from. This value overrides the container registry organization defined in all the default container images involved in a Che deployment. This is particularly useful to install Eclipse Che in a restricted environment.
type: string
allowUserDefinedWorkspaceNamespaces:
description: Deprecated. The value of this flag is ignored. Defines that a user is allowed to specify a Kubernetes namespace, or an OpenShift project, which differs from the default. It's NOT RECOMMENDED to set to `true` without OpenShift OAuth configured. The OpenShift infrastructure also uses this property.
type: boolean
cheClusterRoles:
description: A comma-separated list of ClusterRoles that will be assigned to Che ServiceAccount. Be aware that the Che Operator has to already have all permissions in these ClusterRoles to grant them.
type: string
cheDebug:
description: Enables the debug mode for Che server. Defaults to `false`.
type: string
cheFlavor:
description: Specifies a variation of the installation. The options are `che` for upstream Che installations, or `codeready` for link:https://developers.redhat.com/products/codeready-workspaces/overview[CodeReady Workspaces] installation. Override the default value only on necessary occasions.
type: string
cheHost:
description: Public host name of the installed Che server. When value is omitted, the value it will be automatically set by the Operator. See the `cheHostTLSSecret` field.
type: string
cheHostTLSSecret:
description: Name of a secret containing certificates to secure ingress or route for the custom host name of the installed Che server. See the `cheHost` field.
type: string
cheImage:
description: Overrides the container image used in Che deployment. This does NOT include the container image tag. Omit it or leave it empty to use the default container image provided by the Operator.
type: string
cheImagePullPolicy:
description: Overrides the image pull policy used in Che deployment. Default value is `Always` for `nightly` or `latest` images, and `IfNotPresent` in other cases.
type: string
cheImageTag:
description: Overrides the tag of the container image used in Che deployment. Omit it or leave it empty to use the default image tag provided by the Operator.
type: string
cheLogLevel:
description: 'Log level for the Che server: `INFO` or `DEBUG`. Defaults to `INFO`.'
type: string
cheServerIngress:
description: The Che server ingress custom settings.
properties:
annotations:
additionalProperties:
type: string
description: Unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
type: object
labels:
description: Comma separated list of labels that can be used to organize and categorize objects by scoping and selecting.
type: string
type: object
cheServerRoute:
description: The Che server route custom settings.
properties:
annotations:
additionalProperties:
type: string
description: Unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
type: object
domain:
description: 'Operator uses the domain to generate a hostname for a route. In a conjunction with labels it creates a route, which is served by a non-default Ingress controller. The generated host name will follow this pattern: `<route-name>-<route-namespace>.<domain>`.'
type: string
labels:
description: Comma separated list of labels that can be used to organize and categorize objects by scoping and selecting.
type: string
type: object
cheWorkspaceClusterRole:
description: Custom cluster role bound to the user for the Che workspaces. The default roles are used when omitted or left blank.
type: string
customCheProperties:
additionalProperties:
type: string
description: Map of additional environment variables that will be applied in the generated `che` ConfigMap to be used by the Che server, in addition to the values already generated from other fields of the `CheCluster` custom resource (CR). When `customCheProperties` contains a property that would be normally generated in `che` ConfigMap from other CR fields, the value defined in the `customCheProperties` is used instead.
type: object
dashboardCpuLimit:
description: Overrides the CPU limit used in the dashboard deployment. In cores. (500m = .5 cores). Default to 500m.
type: string
dashboardCpuRequest:
description: Overrides the CPU request used in the dashboard deployment. In cores. (500m = .5 cores). Default to 100m.
type: string
dashboardImage:
description: Overrides the container image used in the dashboard deployment. This includes the image tag. Omit it or leave it empty to use the default container image provided by the Operator.
type: string
dashboardImagePullPolicy:
description: Overrides the image pull policy used in the dashboard deployment. Default value is `Always` for `nightly` or `latest` images, and `IfNotPresent` in other cases.
type: string
dashboardIngress:
description: Dashboard ingress custom settings.
properties:
annotations:
additionalProperties:
type: string
description: Unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
type: object
labels:
description: Comma separated list of labels that can be used to organize and categorize objects by scoping and selecting.
type: string
type: object
dashboardMemoryLimit:
description: Overrides the memory limit used in the dashboard deployment. Defaults to 256Mi.
type: string
dashboardMemoryRequest:
description: Overrides the memory request used in the dashboard deployment. Defaults to 16Mi.
type: string
dashboardRoute:
description: Dashboard route custom settings.
properties:
annotations:
additionalProperties:
type: string
description: Unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
type: object
domain:
description: 'Operator uses the domain to generate a hostname for a route. In a conjunction with labels it creates a route, which is served by a non-default Ingress controller. The generated host name will follow this pattern: `<route-name>-<route-namespace>.<domain>`.'
type: string
labels:
description: Comma separated list of labels that can be used to organize and categorize objects by scoping and selecting.
type: string
type: object
devfileRegistryCpuLimit:
description: Overrides the CPU limit used in the devfile registry deployment. In cores. (500m = .5 cores). Default to 500m.
type: string
devfileRegistryCpuRequest:
description: Overrides the CPU request used in the devfile registry deployment. In cores. (500m = .5 cores). Default to 100m.
type: string
devfileRegistryImage:
description: Overrides the container image used in the devfile registry deployment. This includes the image tag. Omit it or leave it empty to use the default container image provided by the Operator.
type: string
devfileRegistryIngress:
description: The devfile registry ingress custom settings.
properties:
annotations:
additionalProperties:
type: string
description: Unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
type: object
labels:
description: Comma separated list of labels that can be used to organize and categorize objects by scoping and selecting.
type: string
type: object
devfileRegistryMemoryLimit:
description: Overrides the memory limit used in the devfile registry deployment. Defaults to 256Mi.
type: string
devfileRegistryMemoryRequest:
description: Overrides the memory request used in the devfile registry deployment. Defaults to 16Mi.
type: string
devfileRegistryPullPolicy:
description: Overrides the image pull policy used in the devfile registry deployment. Default value is `Always` for `nightly` or `latest` images, and `IfNotPresent` in other cases.
type: string
devfileRegistryRoute:
description: The devfile registry route custom settings.
properties:
annotations:
additionalProperties:
type: string
description: Unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
type: object
domain:
description: 'Operator uses the domain to generate a hostname for a route. In a conjunction with labels it creates a route, which is served by a non-default Ingress controller. The generated host name will follow this pattern: `<route-name>-<route-namespace>.<domain>`.'
type: string
labels:
description: Comma separated list of labels that can be used to organize and categorize objects by scoping and selecting.
type: string
type: object
devfileRegistryUrl:
description: Deprecated in favor of `externalDevfileRegistries` fields.
type: string
disableInternalClusterSVCNames:
description: Disable internal cluster SVC names usage to communicate between components to speed up the traffic and avoid proxy issues.
type: boolean
externalDevfileRegistries:
description: External devfile registries, that serves sample, ready-to-use devfiles. Configure this in addition to a dedicated devfile registry (when `externalDevfileRegistry` is `false`) or instead of it (when `externalDevfileRegistry` is `true`)
items:
description: Settings for a configuration of the external devfile registries.
properties:
url:
description: Public URL of the devfile registry.
type: string
type: object
type: array
externalDevfileRegistry:
description: Instructs the Operator on whether to deploy a dedicated devfile registry server. By default, a dedicated devfile registry server is started. When `externalDevfileRegistry` is `true`, no such dedicated server will be started by the Operator and configure at least one devfile registry with `externalDevfileRegistries` field.
type: boolean
externalPluginRegistry:
description: Instructs the Operator on whether to deploy a dedicated plugin registry server. By default, a dedicated plugin registry server is started. When `externalPluginRegistry` is `true`, no such dedicated server will be started by the Operator and you will have to manually set the `pluginRegistryUrl` field.
type: boolean
gitSelfSignedCert:
description: When enabled, the certificate from `che-git-self-signed-cert` ConfigMap will be propagated to the Che components and provide particular configuration for Git.
type: boolean
nonProxyHosts:
description: 'List of hosts that will be reached directly, bypassing the proxy. Specify wild card domain use the following form `.<DOMAIN>` and `|` as delimiter, for example: `localhost|.my.host.com|123.42.12.32` Only use when configuring a proxy is required. Operator respects OpenShift cluster wide proxy configuration and no additional configuration is required, but defining `nonProxyHosts` in a custom resource leads to merging non proxy hosts lists from the cluster proxy configuration and ones defined in the custom resources. See the doc https://docs.openshift.com/container-platform/4.4/networking/enable-cluster-wide-proxy.html. See also the `proxyURL` fields.'
type: string
pluginRegistryCpuLimit:
description: Overrides the CPU limit used in the plugin registry deployment. In cores. (500m = .5 cores). Default to 500m.
type: string
pluginRegistryCpuRequest:
description: Overrides the CPU request used in the plugin registry deployment. In cores. (500m = .5 cores). Default to 100m.
type: string
pluginRegistryImage:
description: Overrides the container image used in the plugin registry deployment. This includes the image tag. Omit it or leave it empty to use the default container image provided by the Operator.
type: string
pluginRegistryIngress:
description: Plugin registry ingress custom settings.
properties:
annotations:
additionalProperties:
type: string
description: Unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
type: object
labels:
description: Comma separated list of labels that can be used to organize and categorize objects by scoping and selecting.
type: string
type: object
pluginRegistryMemoryLimit:
description: Overrides the memory limit used in the plugin registry deployment. Defaults to 256Mi.
type: string
pluginRegistryMemoryRequest:
description: Overrides the memory request used in the plugin registry deployment. Defaults to 16Mi.
type: string
pluginRegistryPullPolicy:
description: Overrides the image pull policy used in the plugin registry deployment. Default value is `Always` for `nightly` or `latest` images, and `IfNotPresent` in other cases.
type: string
pluginRegistryRoute:
description: Plugin registry route custom settings.
properties:
annotations:
additionalProperties:
type: string
description: Unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
type: object
domain:
description: 'Operator uses the domain to generate a hostname for a route. In a conjunction with labels it creates a route, which is served by a non-default Ingress controller. The generated host name will follow this pattern: `<route-name>-<route-namespace>.<domain>`.'
type: string
labels:
description: Comma separated list of labels that can be used to organize and categorize objects by scoping and selecting.
type: string
type: object
pluginRegistryUrl:
description: Public URL of the plugin registry that serves sample ready-to-use devfiles. Set this ONLY when a use of an external devfile registry is needed. See the `externalPluginRegistry` field. By default, this will be automatically calculated by the Operator.
type: string
proxyPassword:
description: Password of the proxy server. Only use when proxy configuration is required. See the `proxyURL`, `proxyUser` and `proxySecret` fields.
type: string
proxyPort:
description: Port of the proxy server. Only use when configuring a proxy is required. See also the `proxyURL` and `nonProxyHosts` fields.
type: string
proxySecret:
description: The secret that contains `user` and `password` for a proxy server. When the secret is defined, the `proxyUser` and `proxyPassword` are ignored.
type: string
proxyURL:
description: URL (protocol+host name) of the proxy server. This drives the appropriate changes in the `JAVA_OPTS` and `https(s)_proxy` variables in the Che server and workspaces containers. Only use when configuring a proxy is required. Operator respects OpenShift cluster wide proxy configuration and no additional configuration is required, but defining `proxyUrl` in a custom resource leads to overrides the cluster proxy configuration with fields `proxyUrl`, `proxyPort`, `proxyUser` and `proxyPassword` from the custom resource. See the doc https://docs.openshift.com/container-platform/4.4/networking/enable-cluster-wide-proxy.html. See also the `proxyPort` and `nonProxyHosts` fields.
type: string
proxyUser:
description: User name of the proxy server. Only use when configuring a proxy is required. See also the `proxyURL`, `proxyPassword` and `proxySecret` fields.
type: string
selfSignedCert:
description: Deprecated. The value of this flag is ignored. The Che Operator will automatically detect whether the router certificate is self-signed and propagate it to other components, such as the Che server.
type: boolean
serverCpuLimit:
description: Overrides the CPU limit used in the Che server deployment In cores. (500m = .5 cores). Default to 1.
type: string
serverCpuRequest:
description: Overrides the CPU request used in the Che server deployment In cores. (500m = .5 cores). Default to 100m.
type: string
serverExposureStrategy:
description: Sets the server and workspaces exposure type. Possible values are `multi-host`, `single-host`, `default-host`. Defaults to `multi-host`, which creates a separate ingress, or OpenShift routes, for every required endpoint. `single-host` makes Che exposed on a single host name with workspaces exposed on subpaths. Read the docs to learn about the limitations of this approach. Also consult the `singleHostExposureType` property to further configure how the Operator and the Che server make that happen on Kubernetes. `default-host` exposes the Che server on the host of the cluster. Read the docs to learn about the limitations of this approach.
type: string
serverMemoryLimit:
description: Overrides the memory limit used in the Che server deployment. Defaults to 1Gi.
type: string
serverMemoryRequest:
description: Overrides the memory request used in the Che server deployment. Defaults to 512Mi.
type: string
serverTrustStoreConfigMapName:
description: Name of the ConfigMap with public certificates to add to Java trust store of the Che server. This is often required when adding the OpenShift OAuth provider, which has HTTPS endpoint signed with self-signed cert. The Che server must be aware of its CA cert to be able to request it. This is disabled by default.
type: string
singleHostGatewayConfigMapLabels:
additionalProperties:
type: string
description: The labels that need to be present in the ConfigMaps representing the gateway configuration.
type: object
singleHostGatewayConfigSidecarImage:
description: The image used for the gateway sidecar that provides configuration to the gateway. Omit it or leave it empty to use the default container image provided by the Operator.
type: string
singleHostGatewayImage:
description: The image used for the gateway in the single host mode. Omit it or leave it empty to use the default container image provided by the Operator.
type: string
tlsSupport:
description: Deprecated. Instructs the Operator to deploy Che in TLS mode. This is enabled by default. Disabling TLS sometimes cause malfunction of some Che components.
type: boolean
useInternalClusterSVCNames:
description: Deprecated in favor of `disableInternalClusterSVCNames`.
type: boolean
workspaceNamespaceDefault:
description: Defines Kubernetes default namespace in which user's workspaces are created for a case when a user does not override it. It's possible to use `<username>`, `<userid>` and `<workspaceid>` placeholders, such as che-workspace-<username>. In that case, a new namespace will be created for each user or workspace.
type: string
type: object
storage:
description: Configuration settings related to the persistent storage used by the Che installation.
properties:
postgresPVCStorageClassName:
description: Storage class for the Persistent Volume Claim dedicated to the PostgreSQL database. When omitted or left blank, a default storage class is used.
type: string
preCreateSubPaths:
description: Instructs the Che server to start a special Pod to pre-create a sub-path in the Persistent Volumes. Defaults to `false`, however it will need to enable it according to the configuration of your Kubernetes cluster.
type: boolean
pvcClaimSize:
description: Size of the persistent volume claim for workspaces. Defaults to `10Gi`.
type: string
pvcJobsImage:
description: Overrides the container image used to create sub-paths in the Persistent Volumes. This includes the image tag. Omit it or leave it empty to use the default container image provided by the Operator. See also the `preCreateSubPaths` field.
type: string
pvcStrategy:
description: Persistent volume claim strategy for the Che server. This Can be:`common` (all workspaces PVCs in one volume), `per-workspace` (one PVC per workspace for all declared volumes) and `unique` (one PVC per declared volume). Defaults to `common`.
type: string
workspacePVCStorageClassName:
description: Storage class for the Persistent Volume Claims dedicated to the Che workspaces. When omitted or left blank, a default storage class is used.
type: string
type: object
type: object
status:
description: CheClusterStatus defines the observed state of Che installation
properties:
cheClusterRunning:
description: Status of a Che installation. Can be `Available`, `Unavailable`, or `Available, Rolling Update in Progress`.
type: string
cheURL:
description: Public URL to the Che server.
type: string
cheVersion:
description: Current installed Che version.
type: string
dbProvisioned:
description: Indicates that a PostgreSQL instance has been correctly provisioned or not.
type: boolean
devfileRegistryURL:
description: Public URL to the devfile registry.
type: string
devworkspaceStatus:
description: The status of the Devworkspace subsystem
properties:
gatewayHost:
description: GatewayHost is the resolved host of the ingress/route. This is equal to the Host in the spec on Kubernetes but contains the actual host name of the route if Host is unspecified on OpenShift.
type: string
gatewayPhase:
description: GatewayPhase specifies the phase in which the gateway deployment currently is. If the gateway is disabled, the phase is "Inactive".
type: string
message:
description: Message contains further human-readable info for why the Che cluster is in the phase it currently is.
type: string
phase:
description: Phase is the phase in which the Che cluster as a whole finds itself in.
type: string
reason:
description: A brief CamelCase message indicating details about why the Che cluster is in this state.
type: string
workspaceBaseDomain:
description: The resolved workspace base domain. This is either the copy of the explicitly defined property of the same name in the spec or, if it is undefined in the spec and we're running on OpenShift, the automatically resolved basedomain for routes.
type: string
type: object
gitHubOAuthProvisioned:
description: Indicates whether an Identity Provider instance, Keycloak or RH-SSO, has been configured to integrate with the GitHub OAuth.
type: boolean
helpLink:
description: A URL that points to some URL where to find help related to the current Operator status.
type: string
keycloakProvisioned:
description: Indicates whether an Identity Provider instance, Keycloak or RH-SSO, has been provisioned with realm, client and user.
type: boolean
keycloakURL:
description: Public URL to the Identity Provider server, Keycloak or RH-SSO,.
type: string
message:
description: A human readable message indicating details about why the Pod is in this condition.
type: string
openShiftOAuthUserCredentialsSecret:
description: OpenShift OAuth secret in `openshift-config` namespace that contains user credentials for HTPasswd identity provider.
type: string
openShiftoAuthProvisioned:
description: Indicates whether an Identity Provider instance, Keycloak or RH-SSO, has been configured to integrate with the OpenShift OAuth.
type: boolean
pluginRegistryURL:
description: Public URL to the plugin registry.
type: string
reason:
description: A brief CamelCase message indicating details about why the Pod is in this state.
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -1,9 +1,15 @@
annotations:
operators.operatorframework.io.bundle.channel.default.v1: nightly
operators.operatorframework.io.bundle.channels.v1: nightly
operators.operatorframework.io.bundle.manifests.v1: manifests/
# Core bundle annotations.
operators.operatorframework.io.bundle.mediatype.v1: registry+v1
operators.operatorframework.io.bundle.manifests.v1: manifests/
operators.operatorframework.io.bundle.metadata.v1: metadata/
operators.operatorframework.io.bundle.package.v1: eclipse-che-preview-kubernetes
operators.operatorframework.io.bundle.channels.v1: nightly
operators.operatorframework.io.bundle.channel.default.v1: nightly
operators.operatorframework.io.metrics.builder: operator-sdk-v1.6.1+git
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: go
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3
# Annotations for testing.
operators.operatorframework.io.test.mediatype.v1: scorecard+v1
operators.operatorframework.io.test.config.v1: tests/scorecard/

View File

@ -0,0 +1,49 @@
apiVersion: scorecard.operatorframework.io/v1alpha3
kind: Configuration
metadata:
name: config
stages:
- parallel: true
tests:
- entrypoint:
- scorecard-test
- basic-check-spec
image: quay.io/operator-framework/scorecard-test:v1.7.1
labels:
suite: basic
test: basic-check-spec-test
- entrypoint:
- scorecard-test
- olm-bundle-validation
image: quay.io/operator-framework/scorecard-test:v1.7.1
labels:
suite: olm
test: olm-bundle-validation-test
- entrypoint:
- scorecard-test
- olm-crds-have-validation
image: quay.io/operator-framework/scorecard-test:v1.7.1
labels:
suite: olm
test: olm-crds-have-validation-test
- entrypoint:
- scorecard-test
- olm-crds-have-resources
image: quay.io/operator-framework/scorecard-test:v1.7.1
labels:
suite: olm
test: olm-crds-have-resources-test
- entrypoint:
- scorecard-test
- olm-spec-descriptors
image: quay.io/operator-framework/scorecard-test:v1.7.1
labels:
suite: olm
test: olm-spec-descriptors-test
- entrypoint:
- scorecard-test
- olm-status-descriptors
image: quay.io/operator-framework/scorecard-test:v1.7.1
labels:
suite: olm
test: olm-status-descriptors-test

View File

@ -0,0 +1,21 @@
FROM scratch
# Core bundle labels.
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=eclipse-che-preview-openshift
LABEL operators.operatorframework.io.bundle.channels.v1=nightly
LABEL operators.operatorframework.io.bundle.channel.default.v1=nightly
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.7.1+git
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
# Labels for testing.
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/
# Copy files to locations specified by labels.
COPY bundle/nightly/eclipse-che-preview-openshift/manifests /manifests/
COPY bundle/nightly/eclipse-che-preview-openshift/metadata /metadata/
COPY bundle/nightly/eclipse-che-preview-openshift/tests/scorecard /tests/scorecard/

View File

@ -1,13 +1,3 @@
#
# Copyright (c) 2019-2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
@ -73,26 +63,45 @@ metadata:
}
]
capabilities: Seamless Upgrades
categories: Developer Tools, OpenShift Optional
categories: Developer Tools
certified: "false"
containerImage: quay.io/eclipse/che-operator:next
createdAt: "2021-07-15T07:38:20Z"
createdAt: "2021-05-11T18:38:31Z"
description: A Kube-native development solution that delivers portable and collaborative
developer workspaces in OpenShift.
developer workspaces.
operatorframework.io/suggested-namespace: eclipse-che
operators.operatorframework.io/builder: operator-sdk-v1.6.1+git
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
name: eclipse-che-preview-openshift.v7.33.0-258.nightly
name: eclipse-che-preview-openshift.v7.34.0-262.nightly
namespace: placeholder
spec:
apiservicedefinitions: {}
customresourcedefinitions:
owned:
- description: The `CheCluster` custom resource allows defining and managing
a Che server installation
displayName: Eclipse Che Cluster
- displayName: Eclipse Che Cluster Backup Server Configuration
kind: CheBackupServerConfiguration
name: chebackupserverconfigurations.org.eclipse.che
version: v1
- displayName: Eclipse Che Cluster Backup
kind: CheClusterBackup
name: checlusterbackups.org.eclipse.che
version: v1
- kind: CheClusterRestore
name: checlusterrestores.org.eclipse.che
version: v1
- displayName: Eclipse Che Cluster
kind: CheCluster
name: checlusters.org.eclipse.che
specDescriptors:
- description: Deploys the DevWorkspace Operator in the cluster. Does nothing
when a matching version of the Operator is already installed. Fails
when a non-matching version of the Operator is already installed.
displayName: Enable Dev Workspace operator
path: devWorkspace.enable
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
statusDescriptors:
- description: Status of a Che installation. Can be `Available`, `Unavailable`,
or `Available, Rolling Update in Progress`.
@ -149,98 +158,112 @@ spec:
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.
This operator installs PostgreSQL, Keycloak, and the Eclipse Che server, as well as configures all three services.
A collaborative Kubernetes-native development solution that delivers Kubernetes workspaces and in-browser IDE for rapid cloud application development.
This operator installs PostgreSQL, Keycloak, Registries and the Eclipse Che server, as well as configures all these services.
## Prerequisites
- Operator Lifecycle Manager (OLM) needs to be installed.
- Kubernetes Platform. For OpenShift, the installation is directly made from OperatorHub UI in the admin console.
OLM installation can be checked by running the command:
```
$ kubectl get pods --all-namespaces | grep olm
olm catalog-operator-7b8cd7f8bf-2v7zj 1/1 Running 0 10m
olm olm-operator-5c5c798cd5-s6ll5 1/1 Running 0 10m
olm olm-operators-fm5wc 1/1 Running 0 10m
olm operatorhubio-catalog-d78km 1/1 Running 0 10m
olm packageserver-5c5f64947b-trghp 1/1 Running 0 9m56s
olm packageserver-5c5f64947b-zqvxg 1/1 Running 0 9m56s
```
## How to Install
Install `Eclipse Che Operator` by following instructions in top right button `Install`.
Press the **Install** button, choose the upgrade strategy, and wait for the **Installed** Operator status.
When the operator is installed, create a new CR of Kind CheCluster (click the **Create New** button).
The CR spec contains all defaults (see below).
You can start using Eclipse Che when the CR status is set to **Available**, and you see a URL to Eclipse Che.
## Defaults
By default, the operator deploys Eclipse Che with:
* Bundled PostgreSQL and Keycloak
* Per-Workspace PVC strategy
* Auto-generated passwords
* TLS mode (secure routes)
* Regular login extended with OpenShift OAuth authentication
## Installation Options
Eclipse Che operator installation options include:
* Connection to external database and Keycloak
* Configuration of default passwords and object names
* PVC strategy (once shared PVC for all workspaces, PVC per workspace, or PVC per volume)
* Authentication options
### External Database and Keycloak
To instruct the operator to skip deploying PostgreSQL and Keycloak and connect to an existing DB and Keycloak instead:
* set respective fields to `true` in a custom resource spec
* provide the operator with connection and authentication details:
`externalDb: true`
`chePostgresHostname: 'yourPostgresHost'`
`chePostgresPort: '5432'`
`chePostgresUser: 'myuser'`
`chePostgresPassword: 'mypass'`
`chePostgresDb: 'mydb'`
`externalIdentityProvider: true`
`identityProviderURL: 'https://my-keycloak.com'`
`identityProviderRealm: 'myrealm'`
`identityProviderClientId: 'myClient'`
#### Self-signed Certificates
Eclipse Che uses self-signed certificates by default.
You can also manually create a secret:
A new pod che-operator is created in `my-eclipse-che` namespace
```
oc create secret generic self-signed-certificate --from-file=/path/to/certificate/ca.crt -n=$codeReadyNamespace
$ kubectl get pods --all-namespaces | grep my-eclipse-che
my-eclipse-che che-operator-554c564476-fl98z 1/1 Running 0 13s
```
The operator is now providing new Custom Resources Definitions: `checluster.org.eclipse.che`
Create a new Eclipse Che instance by creating a new CheCluster resource:
On the bottom of this page, there is a section `Custom Resource Definitions` with `Eclipse Che Cluster` name.
Click on `View YAML Example` *Link* and copy the content to a new file named `my-eclipse-che.yaml`
**Important!** Make sure you provide **K8s.ingressDomain** which is a global ingress domain of your k8s cluster, for example, `gcp.my-ide.cloud`
Create the new CheCluster by creating the resource in the `my-eclipse-che` namespace :
```
$ kubectl create -f my-eclipse-che.yaml -n my-eclipse-che
```
***important:*** The operator is only tracking resources in its own namespace. If CheCluster is not created in this namespace it's ignored.
The operator will now create pods for Eclipse Che. The deployment status can be tracked by looking at the Operator logs by using the command:
```
$ kubectl logs -n my-eclipse-che che-operator-554c564476-fl98z
```
***important:*** pod name is different on each installation
When all Eclipse Che containers are running, the Eclipse Che URL is printed
Eclipse Che URL can be tracked by searching for available trace:
```
$ kubectl logs -f -n my-eclipse-che che-operator-7b6b4bcb9c-m4m2m | grep "Eclipse Che is now available"
time="2019-08-01T13:31:05Z" level=info msg="Eclipse Che is now available at: http://che-my-eclipse-che.gcp.my-ide.cloud"
```
When Eclipse Che is ready, the Eclipse Che URL is displayed in CheCluster resource in `status` section
```
$ kubectl describe checluster/eclipse-che -n my-eclipse-che
```
```
Status:
Che Cluster Running: Available
Che URL: http://che-my-eclipse-che.gcp.my-ide.cloud
Che Version: 7.26.0
...
```
By opening this URL in a web browser, Eclipse Che is ready to use.
## Defaults
By default, the operator deploys Eclipse Che with:
* Bundled PostgreSQL and Keycloak
* Common PVC strategy
* Auto-generated passwords
* TLS mode (secure ingresses)
## Installation Options
Eclipse Che operator installation options include:
* Connection to external database and Keycloak
* Configuration of default passwords and object names
* PVC strategy (once shared PVC for all workspaces, PVC per workspace, or PVC per volume)
* Authentication options
### External Database and Keycloak
To instruct the operator to skip deploying PostgreSQL and Keycloak and connect to an existing DB and Keycloak instead:
* set respective fields to `true` in a custom resource spec
* provide the operator with connection and authentication details:
```
externalDb: true
chePostgresHostname: 'yourPostgresHost'
chePostgresPort: '5432'
chePostgresUser: 'myuser'
chePostgresPassword: 'mypass'
chePostgresDb: 'mydb'
externalIdentityProvider: true
identityProviderURL: 'https://my-keycloak.com'
identityProviderRealm: 'myrealm'
identityProviderClientId: 'myClient'
```
#### Self-signed Certificates and TLS Secrets
Eclipse Che uses self-signed certificates by default, as TLS mode is on by default.
To provide the name of the tls secret that will be used for Eclipse Che and workspaces ingresses:
```
tlsSecretName: 'my-ingress-tls-secret'
```
displayName: Eclipse Che
icon:
@ -250,6 +273,12 @@ spec:
spec:
clusterPermissions:
- rules:
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- apiGroups:
- oauth.openshift.io
resources:
@ -366,6 +395,7 @@ spec:
- checlusters
- checlusters/status
- checlusters/finalizers
- checlusters/status
verbs:
- '*'
- apiGroups:
@ -974,8 +1004,10 @@ spec:
app.kubernetes.io/name: che
spec:
containers:
- command:
- /usr/local/bin/che-operator
- args:
- --leader-elect
command:
- /manager
env:
- name: WATCH_NAMESPACE
valueFrom:
@ -1059,22 +1091,15 @@ spec:
- containerPort: 60000
name: metrics
readinessProbe:
exec:
command:
- stat
- /tmp/operator-sdk-ready
failureThreshold: 10
httpGet:
path: /readyz
port: 6789
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 100m
memory: 64Mi
resources: {}
securityContext:
allowPrivilegeEscalation: false
capabilities:
@ -1273,6 +1298,37 @@ spec:
- events
verbs:
- create
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
serviceAccountName: che-operator
strategy: deployment
installModes:
@ -1285,6 +1341,7 @@ spec:
- supported: false
type: AllNamespaces
keywords:
- eclipse che
- workspaces
- devtools
- developer
@ -1303,4 +1360,4 @@ spec:
maturity: stable
provider:
name: Eclipse Foundation
version: 7.33.0-258.nightly
version: 7.34.0-262.nightly

View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/component: che-operator
app.kubernetes.io/instance: che
app.kubernetes.io/name: che
name: che-operator

View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/component: che-operator
app.kubernetes.io/instance: che
app.kubernetes.io/name: che
name: default

View File

@ -0,0 +1,17 @@
apiVersion: v1
data:
controller_manager_config.yaml: |
apiVersion: controller-runtime.sigs.k8s.io/v1alpha1
kind: ControllerManagerConfig
health:
healthProbeBindAddress: :6789
metrics:
bindAddress: 127.0.0.1:60000
webhook:
port: 9443
leaderElection:
leaderElect: true
resourceName: e79b08a4.org.eclipse.che
kind: ConfigMap
metadata:
name: manager-config

View File

@ -1,16 +1,9 @@
#
# Copyright (c) 2019-2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: chebackupserverconfigurations.org.eclipse.che
spec:
group: org.eclipse.che
@ -24,49 +17,35 @@ spec:
- name: v1
schema:
openAPIV3Schema:
description: CheBackupServerConfiguration is the Schema for the chebackupserverconfigurations
API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: CheBackupServerConfigurationSpec defines the desired state
of CheBackupServerConfiguration Only one type of backup server is allowed
to be configured per CR.
description: CheBackupServerConfigurationSpec defines the desired state of CheBackupServerConfiguration Only one type of backup server is allowed to be configured per CR.
properties:
awss3:
description: Amazon S3 or compatible alternatives.
properties:
awsAccessKeySecretRef:
description: Reference to secret that contains awsAccessKeyId
and awsSecretAccessKey keys.
description: Reference to secret that contains awsAccessKeyId and awsSecretAccessKey keys.
type: string
hostname:
description: Server hostname, defaults to 's3.amazonaws.com'.
Might be customized in case of alternative server.
description: Server hostname, defaults to 's3.amazonaws.com'. Might be customized in case of alternative server.
type: string
port:
description: Backup server port. Usually default value is used.
Might be customized in case of alternative server.
description: Backup server port. Usually default value is used. Might be customized in case of alternative server.
type: integer
protocol:
description: Protocol to use when connection to the server. Might
be customized in case of alternative server.
description: Protocol to use when connection to the server. Might be customized in case of alternative server.
type: string
repositoryPasswordSecretRef:
description: Holds reference to a secret with restic repository
password under 'repo-password' field to encrypt / decrypt its
content.
description: Holds reference to a secret with restic repository password under 'repo-password' field to encrypt / decrypt its content.
type: string
repositoryPath:
description: Bucket name and repository, e.g. bucket/repo
@ -80,9 +59,7 @@ spec:
description: Rest backup server configuration.
properties:
credentialsSecretRef:
description: Secret that contains username and password fields
to login into restic server. Note, each repository is encrypted
with own password. See ResticRepoPasswordSecretRef field.
description: Secret that contains username and password fields to login into restic server. Note, each repository is encrypted with own password. See ResticRepoPasswordSecretRef field.
type: string
hostname:
description: Backup server host
@ -91,13 +68,10 @@ spec:
description: Backup server port
type: integer
protocol:
description: Protocol to use when connection to the server Defaults
to https.
description: Protocol to use when connection to the server Defaults to https.
type: string
repositoryPasswordSecretRef:
description: Holds reference to a secret with restic repository
password under 'repo-password' field to encrypt / decrypt its
content.
description: Holds reference to a secret with restic repository password under 'repo-password' field to encrypt / decrypt its content.
type: string
repositoryPath:
description: Restic repository path
@ -116,17 +90,13 @@ spec:
description: Backup server port
type: integer
repositoryPasswordSecretRef:
description: Holds reference to a secret with restic repository
password under 'repo-password' field to encrypt / decrypt its
content.
description: Holds reference to a secret with restic repository password under 'repo-password' field to encrypt / decrypt its content.
type: string
repositoryPath:
description: Restic repository path, relative or absolute, e.g.
/srv/repo
description: Restic repository path, relative or absolute, e.g. /srv/repo
type: string
sshKeySecretRef:
description: Private ssh key under 'ssh-privatekey' field for
passwordless login
description: Private ssh key under 'ssh-privatekey' field for passwordless login
type: string
username:
description: User login on the remote server
@ -140,11 +110,16 @@ spec:
type: object
type: object
status:
description: CheBackupServerConfigurationStatus defines the observed state
of CheBackupServerConfiguration
description: CheBackupServerConfigurationStatus defines the observed state of CheBackupServerConfiguration
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -1,16 +1,9 @@
#
# Copyright (c) 2019-2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: checlusterbackups.org.eclipse.che
spec:
group: org.eclipse.che
@ -24,17 +17,12 @@ spec:
- name: v1
schema:
openAPIV3Schema:
description: CheClusterBackup is the Schema for the checlusterbackups API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
@ -42,22 +30,17 @@ spec:
description: CheClusterBackupSpec defines the desired state of CheClusterBackup
properties:
backupServerConfigRef:
description: Name of custom resource with a backup server configuration
to use for this backup. Note, UseInternalBackupServer field can
configure internal backup server automatically.
description: Name of custom resource with a backup server configuration to use for this backup. Note, UseInternalBackupServer field can configure internal backup server automatically.
type: string
useInternalBackupServer:
description: Automatically setup pod with REST backup server and use
the server in this configuration. Note, this flag takes precedence
and will overwrite existing backup server configuration.
description: Automatically setup pod with REST backup server and use the server in this configuration. Note, this flag takes precedence and will overwrite existing backup server configuration.
type: boolean
type: object
status:
description: CheClusterBackupStatus defines the observed state of CheClusterBackup
properties:
message:
description: Message explaining the state of the backup or an error
message
description: Message explaining the state of the backup or an error message
type: string
snapshotId:
description: Last backup snapshot ID
@ -74,3 +57,9 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -1,16 +1,9 @@
#
# Copyright (c) 2019-2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: checlusterrestores.org.eclipse.che
spec:
group: org.eclipse.che
@ -24,17 +17,12 @@ spec:
- name: v1
schema:
openAPIV3Schema:
description: CheClusterRestore is the Schema for the checlusterrestores API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
@ -42,13 +30,10 @@ spec:
description: CheClusterRestoreSpec defines the desired state of CheClusterRestore
properties:
backupServerConfigRef:
description: Name of custom resource with a backup server configuration
to use for this restore. Can be omitted if only one server configuration
object exists within the namespace.
description: Name of custom resource with a backup server configuration to use for this restore. Can be omitted if only one server configuration object exists within the namespace.
type: string
snapshotId:
description: Snapshot ID to restore from. If omitted, latest snapshot
will be used.
description: If omitted, latest snapshot will be used.
type: string
type: object
status:
@ -69,3 +54,9 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -11,6 +11,9 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: checlusters.org.eclipse.che
spec:
group: org.eclipse.che
@ -19,14 +22,11 @@ spec:
listKind: CheClusterList
plural: checlusters
singular: checluster
preserveUnknownFields: false
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: The `CheCluster` custom resource allows defining and managing
a Che server installation
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
@ -402,10 +402,9 @@ spec:
type: string
deploymentName:
type: string
imagePullSecrets:
type: string
images:
description: If empty, a set of recommended workspace-related
images will be automatically detected and pre-pulled after
installation.
type: string
nodeSelector:
type: string
@ -1094,3 +1093,10 @@ spec:
storage: true
subresources:
status: {}
preserveUnknownFields: false
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -1,9 +1,15 @@
annotations:
operators.operatorframework.io.bundle.channel.default.v1: nightly
operators.operatorframework.io.bundle.channels.v1: nightly
operators.operatorframework.io.bundle.manifests.v1: manifests/
# Core bundle annotations.
operators.operatorframework.io.bundle.mediatype.v1: registry+v1
operators.operatorframework.io.bundle.manifests.v1: manifests/
operators.operatorframework.io.bundle.metadata.v1: metadata/
operators.operatorframework.io.bundle.package.v1: eclipse-che-preview-openshift
operators.operatorframework.io.bundle.channels.v1: nightly
operators.operatorframework.io.bundle.channel.default.v1: nightly
operators.operatorframework.io.metrics.builder: operator-sdk-v1.6.1+git
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: go
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3
# Annotations for testing.
operators.operatorframework.io.test.mediatype.v1: scorecard+v1
operators.operatorframework.io.test.config.v1: tests/scorecard/

View File

@ -0,0 +1,49 @@
apiVersion: scorecard.operatorframework.io/v1alpha3
kind: Configuration
metadata:
name: config
stages:
- parallel: true
tests:
- entrypoint:
- scorecard-test
- basic-check-spec
image: quay.io/operator-framework/scorecard-test:v1.7.1
labels:
suite: basic
test: basic-check-spec-test
- entrypoint:
- scorecard-test
- olm-bundle-validation
image: quay.io/operator-framework/scorecard-test:v1.7.1
labels:
suite: olm
test: olm-bundle-validation-test
- entrypoint:
- scorecard-test
- olm-crds-have-validation
image: quay.io/operator-framework/scorecard-test:v1.7.1
labels:
suite: olm
test: olm-crds-have-validation-test
- entrypoint:
- scorecard-test
- olm-crds-have-resources
image: quay.io/operator-framework/scorecard-test:v1.7.1
labels:
suite: olm
test: olm-crds-have-resources-test
- entrypoint:
- scorecard-test
- olm-spec-descriptors
image: quay.io/operator-framework/scorecard-test:v1.7.1
labels:
suite: olm
test: olm-spec-descriptors-test
- entrypoint:
- scorecard-test
- olm-status-descriptors
image: quay.io/operator-framework/scorecard-test:v1.7.1
labels:
suite: olm
test: olm-status-descriptors-test

View File

@ -0,0 +1,21 @@
FROM scratch
# Core bundle labels.
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=eclipse-che-preview-kubernetes
LABEL operators.operatorframework.io.bundle.channels.v1=stable
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.7.1+git
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
# Labels for testing.
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/
# Copy files to locations specified by labels.
COPY bundle/nightly/eclipse-che-preview-kubernetes/manifests /manifests/
COPY bundle/nightly/eclipse-che-preview-kubernetes/metadata /metadata/
COPY bundle/nightly/eclipse-che-preview-kubernetes/tests/scorecard /tests/scorecard/

View File

@ -0,0 +1,21 @@
FROM scratch
# Core bundle labels.
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=eclipse-che-preview-openshift
LABEL operators.operatorframework.io.bundle.channels.v1=stable
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.7.1+git
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
# Labels for testing.
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/
# Copy files to locations specified by labels.
COPY bundle/nightly/eclipse-che-preview-openshift/manifests /manifests/
COPY bundle/nightly/eclipse-che-preview-openshift/metadata /metadata/
COPY bundle/nightly/eclipse-che-preview-openshift/tests/scorecard /tests/scorecard/

View File

@ -1,181 +0,0 @@
//
// Copyright (c) 2012-2019 Red Hat, Inc.
// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/
//
// SPDX-License-Identifier: EPL-2.0
//
// Contributors:
// Red Hat, Inc. - initial API and implementation
//
package main
import (
"context"
"flag"
"fmt"
"os"
"runtime"
image_puller_api "github.com/che-incubator/kubernetes-image-puller-operator/pkg/apis"
"github.com/eclipse-che/che-operator/cmd/manager/signal"
"github.com/eclipse-che/che-operator/pkg/util"
operatorsv1 "github.com/operator-framework/api/pkg/operators/v1"
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
packagesv1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/operators/v1"
"github.com/operator-framework/operator-sdk/pkg/k8sutil"
"github.com/prometheus/common/log"
"github.com/sirupsen/logrus"
"github.com/eclipse-che/che-operator/pkg/apis"
"github.com/eclipse-che/che-operator/pkg/controller"
"github.com/eclipse-che/che-operator/pkg/deploy"
"github.com/operator-framework/operator-sdk/pkg/leader"
"github.com/operator-framework/operator-sdk/pkg/ready"
sdkVersion "github.com/operator-framework/operator-sdk/version"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
"sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/manager"
)
var (
defaultsPath string
)
func init() {
flag.StringVar(&defaultsPath, "defaults-path", "", "Path to file with operator deployment defaults. This option is useful for local development.")
}
func setLogLevel() {
logLevel, isFound := os.LookupEnv("LOG_LEVEL")
if isFound && len(logLevel) > 0 {
parsedLevel, err := logrus.ParseLevel(logLevel)
if err == nil {
logrus.SetLevel(parsedLevel)
logrus.Infof("Configured '%s' log level is applied", logLevel)
} else {
logrus.Errorf("Failed to parse log level `%s`. Possible values: panic, fatal, error, warn, info, debug. Default 'info' is applied", logLevel)
logrus.SetLevel(logrus.InfoLevel)
}
} else {
logrus.Infof("Default 'info' log level is applied")
logrus.SetLevel(logrus.InfoLevel)
}
}
func printVersion() {
setLogLevel()
logrus.Infof(fmt.Sprintf("Go Version: %s", runtime.Version()))
logrus.Infof(fmt.Sprintf("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH))
logrus.Infof(fmt.Sprintf("operator-sdk Version: %v", sdkVersion.Version))
isOpenShift, isOpenShift4, err := util.DetectOpenShift()
if err != nil {
logrus.Fatalf("Operator is exiting. An error occurred when detecting current infra: %s", err)
}
infra := "Kubernetes"
if isOpenShift {
infra = "OpenShift"
if isOpenShift4 {
infra += " v4.x"
} else {
infra += " v3.x"
}
}
logrus.Infof(fmt.Sprintf("Operator is running on %v", infra))
}
func main() {
flag.Parse()
deploy.InitDefaults(defaultsPath)
printVersion()
namespace, err := k8sutil.GetWatchNamespace()
if err != nil {
logrus.Errorf("Failed to get watch namespace. Using default namespace eclipse-che: %s", err)
namespace = "eclipse-che"
}
// Get a config to talk to the apiserver
cfg, err := config.GetConfig()
if err != nil {
log.Error(err, "")
os.Exit(1)
}
r := ready.NewFileReady()
err = r.Set()
if err != nil {
log.Error(err, "")
os.Exit(1)
}
defer r.Unset()
// Become the leader before proceeding
leader.Become(context.TODO(), "che-operator-lock")
// Create a new Cmd to provide shared dependencies and start components
options := manager.Options{
Namespace: namespace,
MetricsBindAddress: ":8081",
HealthProbeBindAddress: ":6789",
}
mgr, err := manager.New(cfg, options)
if err != nil {
log.Error(err, "")
os.Exit(1)
}
logrus.Info("Registering Che Components Types")
// Setup Scheme for all resources
if err := apis.AddToScheme(mgr.GetScheme()); err != nil {
logrus.Error(err, "")
os.Exit(1)
}
if err := image_puller_api.AddToScheme(mgr.GetScheme()); err != nil {
logrus.Error(err, "")
os.Exit(1)
}
if err := packagesv1.AddToScheme(mgr.GetScheme()); err != nil {
logrus.Error(err, "")
os.Exit(1)
}
if err := operatorsv1alpha1.AddToScheme(mgr.GetScheme()); err != nil {
log.Error(err, "")
os.Exit(1)
}
if err := operatorsv1.AddToScheme(mgr.GetScheme()); err != nil {
log.Error(err, "")
os.Exit(1)
}
// Setup all Controllers
if err := controller.AddToManager(mgr); err != nil {
log.Error(err, "")
os.Exit(1)
}
// Setup health checks
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
log.Error(err, "Unable to set up health check")
os.Exit(1)
}
logrus.Info("Starting the Cmd")
// Start the Cmd
period := signal.GetTerminationGracePeriodSeconds(mgr.GetAPIReader(), namespace)
logrus.Info("Create manager")
if err := mgr.Start(signal.SetupSignalHandler(period)); err != nil {
logrus.Error(err, "Manager exited non-zero")
os.Exit(1)
}
}

View File

@ -11,6 +11,9 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: chebackupserverconfigurations.org.eclipse.che
spec:
group: org.eclipse.che
@ -24,8 +27,6 @@ spec:
status: {}
validation:
openAPIV3Schema:
description: CheBackupServerConfiguration is the Schema for the chebackupserverconfigurations
API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
@ -133,6 +134,12 @@ spec:
type: object
version: v1
versions:
- name: v1
served: true
storage: true
- name: v1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,158 @@
#
# Copyright (c) 2019-2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: chebackupserverconfigurations.org.eclipse.che
spec:
group: org.eclipse.che
names:
kind: CheBackupServerConfiguration
listKind: CheBackupServerConfigurationList
plural: chebackupserverconfigurations
singular: chebackupserverconfiguration
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource
this object represents. Servers may infer this from the endpoint the
client submits requests to. Cannot be updated. In CamelCase. More
info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: CheBackupServerConfigurationSpec defines the desired state
of CheBackupServerConfiguration Only one type of backup server is
allowed to be configured per CR.
properties:
awss3:
description: Amazon S3 or compatible alternatives.
properties:
awsAccessKeySecretRef:
description: Reference to secret that contains awsAccessKeyId
and awsSecretAccessKey keys.
type: string
hostname:
description: Server hostname, defaults to 's3.amazonaws.com'.
Might be customized in case of alternative server.
type: string
port:
description: Backup server port. Usually default value is used.
Might be customized in case of alternative server.
type: integer
protocol:
description: Protocol to use when connection to the server.
Might be customized in case of alternative server.
type: string
repositoryPasswordSecretRef:
description: Holds reference to a secret with restic repository
password under 'repo-password' field to encrypt / decrypt
its content.
type: string
repositoryPath:
description: Bucket name and repository, e.g. bucket/repo
type: string
required:
- awsAccessKeySecretRef
- repositoryPasswordSecretRef
- repositoryPath
type: object
rest:
description: Rest backup server configuration.
properties:
credentialsSecretRef:
description: Secret that contains username and password fields
to login into restic server. Note, each repository is encrypted
with own password. See ResticRepoPasswordSecretRef field.
type: string
hostname:
description: Backup server host
type: string
port:
description: Backup server port
type: integer
protocol:
description: Protocol to use when connection to the server Defaults
to https.
type: string
repositoryPasswordSecretRef:
description: Holds reference to a secret with restic repository
password under 'repo-password' field to encrypt / decrypt
its content.
type: string
repositoryPath:
description: Restic repository path
type: string
required:
- hostname
- repositoryPasswordSecretRef
type: object
sftp:
description: Sftp backup server configuration.
properties:
hostname:
description: Backup server host
type: string
port:
description: Backup server port
type: integer
repositoryPasswordSecretRef:
description: Holds reference to a secret with restic repository
password under 'repo-password' field to encrypt / decrypt
its content.
type: string
repositoryPath:
description: Restic repository path, relative or absolute, e.g.
/srv/repo
type: string
sshKeySecretRef:
description: Private ssh key under 'ssh-privatekey' field for
passwordless login
type: string
username:
description: User login on the remote server
type: string
required:
- hostname
- repositoryPasswordSecretRef
- repositoryPath
- sshKeySecretRef
- username
type: object
type: object
status:
description: CheBackupServerConfigurationStatus defines the observed
state of CheBackupServerConfiguration
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -11,6 +11,9 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: checlusterbackups.org.eclipse.che
spec:
group: org.eclipse.che
@ -24,7 +27,6 @@ spec:
status: {}
validation:
openAPIV3Schema:
description: CheClusterBackup is the Schema for the checlusterbackups API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
@ -72,6 +74,12 @@ spec:
type: object
version: v1
versions:
- name: v1
served: true
storage: true
- name: v1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,85 @@
#
# Copyright (c) 2019-2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: checlusterbackups.org.eclipse.che
spec:
group: org.eclipse.che
names:
kind: CheClusterBackup
listKind: CheClusterBackupList
plural: checlusterbackups
singular: checlusterbackup
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource
this object represents. Servers may infer this from the endpoint the
client submits requests to. Cannot be updated. In CamelCase. More
info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: CheClusterBackupSpec defines the desired state of CheClusterBackup
properties:
backupServerConfigRef:
description: Name of custom resource with a backup server configuration
to use for this backup. Note, UseInternalBackupServer field can
configure internal backup server automatically.
type: string
useInternalBackupServer:
description: Automatically setup pod with REST backup server and
use the server in this configuration. Note, this flag takes precedence
and will overwrite existing backup server configuration.
type: boolean
type: object
status:
description: CheClusterBackupStatus defines the observed state of CheClusterBackup
properties:
message:
description: Message explaining the state of the backup or an error
message
type: string
snapshotId:
description: Last backup snapshot ID
type: string
stage:
description: Describes backup progress
type: string
state:
description: 'Backup progress state: InProgress, Failed, Succeeded'
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -11,6 +11,9 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: checlusterrestores.org.eclipse.che
spec:
group: org.eclipse.che
@ -24,7 +27,6 @@ spec:
status: {}
validation:
openAPIV3Schema:
description: CheClusterRestore is the Schema for the checlusterrestores API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
@ -47,8 +49,7 @@ spec:
object exists within the namespace.
type: string
snapshotId:
description: Snapshot ID to restore from. If omitted, latest snapshot
will be used.
description: If omitted, latest snapshot will be used.
type: string
type: object
status:
@ -67,6 +68,12 @@ spec:
type: object
version: v1
versions:
- name: v1
served: true
storage: true
- name: v1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,79 @@
#
# Copyright (c) 2019-2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: checlusterrestores.org.eclipse.che
spec:
group: org.eclipse.che
names:
kind: CheClusterRestore
listKind: CheClusterRestoreList
plural: checlusterrestores
singular: checlusterrestore
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource
this object represents. Servers may infer this from the endpoint the
client submits requests to. Cannot be updated. In CamelCase. More
info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: CheClusterRestoreSpec defines the desired state of CheClusterRestore
properties:
backupServerConfigRef:
description: Name of custom resource with a backup server configuration
to use for this restore. Can be omitted if only one server configuration
object exists within the namespace.
type: string
snapshotId:
description: If omitted, latest snapshot will be used.
type: string
type: object
status:
description: CheClusterRestoreStatus defines the observed state of CheClusterRestore
properties:
message:
description: Restore result or error message
type: string
stage:
description: Describes phase of restore progress
type: string
state:
description: 'Restore progress state: InProgress, Failed, Succeeded'
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -11,6 +11,9 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: checlusters.org.eclipse.che
spec:
group: org.eclipse.che
@ -20,12 +23,8 @@ spec:
plural: checlusters
singular: checluster
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: The `CheCluster` custom resource allows defining and managing a
Che server installation
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
@ -390,10 +389,9 @@ spec:
type: string
deploymentName:
type: string
imagePullSecrets:
type: string
images:
description: If empty, a set of recommended workspace-related
images will be automatically detected and pre-pulled after
installation.
type: string
nodeSelector:
type: string
@ -1056,6 +1054,14 @@ spec:
type: object
version: v1
versions:
- name: v1
served: true
storage: true
- name: v1
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
# This kustomization.yaml is not intended to be run by itself,
# since it depends on service name and namespace that are out of this kustomize package.
# It should be run by config/default
resources:
- bases/org_v1_che_crd.yaml
# - bases/org.eclipse.che_checlusters.yaml
- bases/org.eclipse.che_chebackupserverconfigurations_crd.yaml
- bases/org.eclipse.che_checlusterbackups_crd.yaml
- bases/org.eclipse.che_checlusterrestores_crd.yaml
#+kubebuilder:scaffold:crdkustomizeresource
patchesStrategicMerge:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#- patches/webhook_in_checlusters.yaml
#- patches/webhook_in_chebackupserverconfigurations.yaml
#- patches/webhook_in_checlusterbackups.yaml
#- patches/webhook_in_checlusterrestores.yaml
#+kubebuilder:scaffold:crdkustomizewebhookpatch
# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
#- patches/cainjection_in_checlusters.yaml
#- patches/cainjection_in_chebackupserverconfigurations.yaml
#- patches/cainjection_in_checlusterbackups.yaml
#- patches/cainjection_in_checlusterrestores.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch
# the following config is for teaching kustomize how to do kustomization for CRDs.
configurations:
- kustomizeconfig.yaml

View File

@ -0,0 +1,19 @@
# This file is for teaching kustomize how to substitute name and namespace reference in CRD
nameReference:
- kind: Service
version: v1
fieldSpecs:
- kind: CustomResourceDefinition
version: v1
group: apiextensions.k8s.io
path: spec/conversion/webhook/clientConfig/service/name
namespace:
- kind: CustomResourceDefinition
version: v1
group: apiextensions.k8s.io
path: spec/conversion/webhook/clientConfig/service/namespace
create: false
varReference:
- path: metadata/annotations

View File

@ -0,0 +1,7 @@
# The following patch adds a directive for certmanager to inject CA into the CRD
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
name: chebackupserverconfigurations.org.eclipse.che

View File

@ -0,0 +1,7 @@
# The following patch adds a directive for certmanager to inject CA into the CRD
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
name: checlusterbackups.org.eclipse.che

View File

@ -0,0 +1,7 @@
# The following patch adds a directive for certmanager to inject CA into the CRD
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
name: checlusterrestores.org.eclipse.che

View File

@ -0,0 +1,7 @@
# The following patch adds a directive for certmanager to inject CA into the CRD
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
name: checlusters.org.eclipse.che

View File

@ -0,0 +1,16 @@
# The following patch enables a conversion webhook for the CRD
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: chebackupserverconfigurations.org.eclipse.che
spec:
conversion:
strategy: Webhook
webhook:
clientConfig:
service:
namespace: system
name: webhook-service
path: /convert
conversionReviewVersions:
- v1

Some files were not shown because too many files have changed in this diff Show More