fix: Limit che resources to run minikube tests (#1488)
* fix: Limit che resources to run minikube tests Signed-off-by: Anatolii Bazko <abazko@redhat.com> * Increase plugin registry LivenessProbe.InitialDelaySeconds Signed-off-by: Anatolii Bazko <abazko@redhat.com> Signed-off-by: Anatolii Bazko <abazko@redhat.com>pull/1489/head
parent
9d4f072023
commit
76751f4613
|
|
@ -0,0 +1,83 @@
|
|||
#
|
||||
# Copyright (c) 2019-2022 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: org.eclipse.che/v2
|
||||
spec:
|
||||
components:
|
||||
pluginRegistry:
|
||||
openVSXURL: https://open-vsx.org
|
||||
deployment:
|
||||
containers:
|
||||
- resources:
|
||||
request:
|
||||
cpu: '50m'
|
||||
limits:
|
||||
cpu: '50m'
|
||||
devfileRegistry:
|
||||
deployment:
|
||||
containers:
|
||||
- resources:
|
||||
request:
|
||||
cpu: '50m'
|
||||
limits:
|
||||
cpu: '50m'
|
||||
cheServer:
|
||||
deployment:
|
||||
containers:
|
||||
- resources:
|
||||
limits:
|
||||
cpu: '500m'
|
||||
dashboard:
|
||||
deployment:
|
||||
containers:
|
||||
- resources:
|
||||
request:
|
||||
cpu: '50m'
|
||||
limits:
|
||||
cpu: '50m'
|
||||
database:
|
||||
deployment:
|
||||
containers:
|
||||
- resources:
|
||||
request:
|
||||
cpu: '50m'
|
||||
limits:
|
||||
cpu: '50m'
|
||||
networking:
|
||||
auth:
|
||||
gateway:
|
||||
deployment:
|
||||
containers:
|
||||
- name: gateway
|
||||
resources:
|
||||
request:
|
||||
cpu: '50m'
|
||||
limits:
|
||||
cpu: '50m'
|
||||
- name: configbump
|
||||
resources:
|
||||
request:
|
||||
cpu: '50m'
|
||||
limits:
|
||||
cpu: '50m'
|
||||
- name: oauth-proxy
|
||||
resources:
|
||||
request:
|
||||
cpu: '50m'
|
||||
limits:
|
||||
cpu: '50m'
|
||||
- name: kube-rbac-proxy
|
||||
resources:
|
||||
request:
|
||||
cpu: '50m'
|
||||
limits:
|
||||
cpu: '50m'
|
||||
|
|
@ -27,7 +27,10 @@ trap "catchFinish" EXIT SIGINT
|
|||
|
||||
runTest() {
|
||||
# Deploy Eclipse Che to have Cert Manager and Dex installed
|
||||
chectl server:deploy --batch --platform minikube
|
||||
chectl server:deploy \
|
||||
--batch \
|
||||
--platform minikube \
|
||||
--che-operator-cr-patch-yaml "${OPERATOR_REPO}/build/scripts/minikube-tests/minikube-checluster-patch.yaml"
|
||||
|
||||
# Read OIDC configuration
|
||||
local IDENTITY_PROVIDER_URL=$(kubectl get checluster/eclipse-che -n ${NAMESPACE} -o jsonpath='{.spec.networking.auth.identityProviderURL}')
|
||||
|
|
@ -41,14 +44,28 @@ runTest() {
|
|||
|
||||
# Prepare HelmCharts
|
||||
HELMCHART_DIR=/tmp/chectl-helmcharts
|
||||
OPERATOR_DEPLOYMENT="${HELMCHART_DIR}"/templates/che-operator.Deployment.yaml
|
||||
rm -rf "${HELMCHART_DIR}"
|
||||
cp -r "${OPERATOR_REPO}/helmcharts/next" "${HELMCHART_DIR}"
|
||||
|
||||
# Set custom image
|
||||
OPERATOR_DEPLOYMENT="${HELMCHART_DIR}"/templates/che-operator.Deployment.yaml
|
||||
buildAndCopyCheOperatorImageToMinikube
|
||||
yq -riSY '.spec.template.spec.containers[0].image = "'${OPERATOR_IMAGE}'"' "${OPERATOR_DEPLOYMENT}"
|
||||
yq -riSY '.spec.template.spec.containers[0].imagePullPolicy = "Never"' "${OPERATOR_DEPLOYMENT}"
|
||||
|
||||
# Patch CheCluster CR to limit resources (see minikube-checluster-patch.yaml)
|
||||
CHECLUSTER_CR="${HELMCHART_DIR}"/templates/org_v2_checluster.yaml
|
||||
yq -riY '.spec.components = null' ${CHECLUSTER_CR}
|
||||
yq -riY '.spec.components.pluginRegistry.openVSXURL = "https://open-vsx.org"' ${CHECLUSTER_CR}
|
||||
for component in pluginRegistry devfileRegistry database dashboard; do
|
||||
yq -riY '.spec.components.'${component}'.deployment.containers[0].resources = {limits: {cpu: "50m"}, request: {cpu: "50m"}}' ${CHECLUSTER_CR}
|
||||
done
|
||||
yq -riY '.spec.components.cheServer.deployment.containers[0].resources.limits.cpu = "500m"' ${CHECLUSTER_CR}
|
||||
gatewayComponent=(kube-rbac-proxy oauth-proxy configbump gateway)
|
||||
for i in {0..3}; do
|
||||
yq -riY '.spec.networking.auth.gateway.deployment.containers['$i'] = {name: "'${gatewayComponent[$i]}'", resources: {limits: {cpu: "50m"}, request: {cpu: "50m"}}}' ${CHECLUSTER_CR}
|
||||
done
|
||||
|
||||
# Deploy Eclipse Che with Helm
|
||||
pushd "${HELMCHART_DIR}"
|
||||
helm install che \
|
||||
|
|
|
|||
|
|
@ -29,7 +29,12 @@ runTest() {
|
|||
buildAndCopyCheOperatorImageToMinikube
|
||||
yq -riSY '.spec.template.spec.containers[0].image = "'${OPERATOR_IMAGE}'"' "${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH}/che-operator/kubernetes/operator.yaml"
|
||||
yq -riSY '.spec.template.spec.containers[0].imagePullPolicy = "IfNotPresent"' "${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH}/che-operator/kubernetes/operator.yaml"
|
||||
chectl server:deploy --batch --platform minikube --templates "${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH}"
|
||||
|
||||
chectl server:deploy \
|
||||
--batch \
|
||||
--platform minikube \
|
||||
--templates "${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH}" \
|
||||
--che-operator-cr-patch-yaml "${OPERATOR_REPO}/build/scripts/minikube-tests/minikube-checluster-patch.yaml"
|
||||
|
||||
pushd ${OPERATOR_REPO}
|
||||
make wait-eclipseche-version VERSION="next" NAMESPACE=${NAMESPACE}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,11 @@ trap "catchFinish" EXIT SIGINT
|
|||
|
||||
runTest() {
|
||||
# Deploy stable version
|
||||
chectl server:deploy --platform minikube --batch --templates ${LAST_OPERATOR_VERSION_TEMPLATE_PATH}
|
||||
chectl server:deploy \
|
||||
--batch \
|
||||
--platform minikube \
|
||||
--templates ${LAST_OPERATOR_VERSION_TEMPLATE_PATH} \
|
||||
--che-operator-cr-patch-yaml "${OPERATOR_REPO}/build/scripts/minikube-tests/minikube-checluster-patch.yaml"
|
||||
|
||||
# Update to next version
|
||||
buildAndCopyCheOperatorImageToMinikube
|
||||
|
|
|
|||
|
|
@ -26,7 +26,12 @@ source "${OPERATOR_REPO}/build/scripts/minikube-tests/common.sh"
|
|||
trap "catchFinish" EXIT SIGINT
|
||||
|
||||
runTest() {
|
||||
chectl server:deploy --platform minikube --templates ${PREVIOUS_OPERATOR_VERSION_TEMPLATE_PATH} --batch
|
||||
chectl server:deploy \
|
||||
--batch \
|
||||
--platform minikube \
|
||||
--templates ${PREVIOUS_OPERATOR_VERSION_TEMPLATE_PATH} \
|
||||
--che-operator-cr-patch-yaml "${OPERATOR_REPO}/build/scripts/minikube-tests/minikube-checluster-patch.yaml"
|
||||
|
||||
chectl server:update --templates ${LAST_OPERATOR_VERSION_TEMPLATE_PATH} --batch
|
||||
|
||||
# Wait until Eclipse Che is deployed
|
||||
|
|
|
|||
|
|
@ -55,6 +55,11 @@ func (p *PluginRegistryReconciler) getPluginRegistryDeploymentSpec(ctx *chetypes
|
|||
resources,
|
||||
probePath)
|
||||
|
||||
if ctx.CheCluster.Spec.Components.PluginRegistry.OpenVSXURL == "" {
|
||||
// Add time to start embedded VSX registry
|
||||
deployment.Spec.Template.Spec.Containers[0].LivenessProbe.InitialDelaySeconds = 300
|
||||
}
|
||||
|
||||
deploy.EnsurePodSecurityStandards(deployment, constants.DefaultSecurityContextRunAsUser, constants.DefaultSecurityContextFsGroup)
|
||||
deploy.CustomizeDeployment(deployment, ctx.CheCluster.Spec.Components.PluginRegistry.Deployment)
|
||||
return deployment
|
||||
|
|
|
|||
Loading…
Reference in New Issue