From 29d2387a58ef130d52e1a273f5c5f4ee1c33be6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Mac=C3=ADk?= Date: Wed, 25 Sep 2024 09:49:08 +0200 Subject: [PATCH] fix(RHIDP-4076): Migrate framework to RHDH v1.3 (#89) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(RHIDP-4076): Update backstage CR to v1alpha2 Signed-off-by: Pavel Macík * fix(RHIDP-4076): Fix helm chart for v1.3 Signed-off-by: Pavel Macík * fix(RHIDP-4076): update helm and catalog images for 1.3 Signed-off-by: Pavel Macík * allow for overriding keycloak repicas Signed-off-by: Pavel Macík --------- Signed-off-by: Pavel Macík --- Makefile | 6 +- ci-scripts/rhdh-setup/deploy.sh | 11 ++-- .../template/backstage/helm/chart-values.yaml | 6 +- .../backstage/helm/extravolume-patch-1.3.yaml | 61 +++++++++++++++++++ .../template/backstage/olm/backstage.yaml | 12 ++-- ci-scripts/scalability/test-scalability.sh | 2 +- test.env | 6 +- 7 files changed, 85 insertions(+), 19 deletions(-) create mode 100644 ci-scripts/rhdh-setup/template/backstage/helm/extravolume-patch-1.3.yaml diff --git a/Makefile b/Makefile index b452805..1443681 100644 --- a/Makefile +++ b/Makefile @@ -29,14 +29,14 @@ export RHDH_IMAGE_TAG ?= # RHDH Helm chart to deploy export RHDH_NAMESPACE ?= rhdh-performance -export RHDH_HELM_REPO ?= https://raw.githubusercontent.com/rhdh-bot/openshift-helm-charts/rhdh-1.2-rhel-9/installation +export RHDH_HELM_REPO ?= https://raw.githubusercontent.com/rhdh-bot/openshift-helm-charts/rhdh-1.3-rhel-9/installation export RHDH_HELM_CHART ?= redhat-developer-hub export RHDH_HELM_CHART_VERSION ?= export RHDH_HELM_RELEASE_NAME ?= rhdh # RHDH OLM subscription to deploy -export RHDH_OLM_INDEX_IMAGE ?= registry.redhat.io/redhat/redhat-operator-index:v$(shell oc version -o json | jq -r '.openshiftVersion' | sed -r -e "s,([0-9]+\.[0-9]+)\..+,\1,") -export RHDH_OLM_CHANNEL ?= fast-1.2 +export RHDH_OLM_INDEX_IMAGE ?= quay.io/rhdh/iib:1.3-v$(shell oc version -o json | jq -r '.openshiftVersion' | sed -r -e "s,([0-9]+\.[0-9]+)\..+,\1,")-x86_64 +export RHDH_OLM_CHANNEL ?= fast # RHDH horizontal scaling export RHDH_DEPLOYMENT_REPLICAS ?= 1 diff --git a/ci-scripts/rhdh-setup/deploy.sh b/ci-scripts/rhdh-setup/deploy.sh index 68ae2b7..fe358ee 100755 --- a/ci-scripts/rhdh-setup/deploy.sh +++ b/ci-scripts/rhdh-setup/deploy.sh @@ -36,14 +36,13 @@ export RHDH_IMAGE_REGISTRY=${RHDH_IMAGE_REGISTRY:-} export RHDH_IMAGE_REPO=${RHDH_IMAGE_REPO:-} export RHDH_IMAGE_TAG=${RHDH_IMAGE_TAG:-} -export RHDH_HELM_REPO=${RHDH_HELM_REPO:-https://raw.githubusercontent.com/rhdh-bot/openshift-helm-charts/rhdh-1.2-rhel-9/installation} +export RHDH_HELM_REPO=${RHDH_HELM_REPO:-https://raw.githubusercontent.com/rhdh-bot/openshift-helm-charts/rhdh-1.3-rhel-9/installation} export RHDH_HELM_CHART=${RHDH_HELM_CHART:-redhat-developer-hub} export RHDH_HELM_CHART_VERSION=${RHDH_HELM_CHART_VERSION:-} OCP_VER="$(oc version -o json | jq -r '.openshiftVersion' | sed -r -e "s#([0-9]+\.[0-9]+)\..+#\1#")" -#OCP_ARCH="$(oc version -o json | jq -r '.serverVersion.platform' | sed -r -e "s#linux/##" | sed -e 's#amd64#x86_64#')" -export RHDH_OLM_INDEX_IMAGE="${RHDH_OLM_INDEX_IMAGE:-registry.redhat.io/redhat/redhat-operator-index:v${OCP_VER}}" -export RHDH_OLM_CHANNEL=${RHDH_OLM_CHANNEL:-fast-1.2} +export RHDH_OLM_INDEX_IMAGE="${RHDH_OLM_INDEX_IMAGE:-quay.io/rhdh/iib:1.3-v${OCP_VER}-x86_64}" +export RHDH_OLM_CHANNEL=${RHDH_OLM_CHANNEL:-fast} export RHDH_OLM_OPERATOR_PACKAGE=${RHDH_OLM_OPERATOR_PACKAGE:-rhdh} export PRE_LOAD_DB="${PRE_LOAD_DB:-true}" @@ -259,7 +258,9 @@ install_rhdh_with_helm() { cp "$chart_values" "$TMP_DIR/chart-values.temp.yaml" if [ "${AUTH_PROVIDER}" == "keycloak" ]; then yq -i '.upstream.backstage |= . + load("template/backstage/helm/oauth2-container-patch.yaml")' "$TMP_DIR/chart-values.temp.yaml"; fi if ${ENABLE_RBAC}; then - if helm search repo --devel -r rhdh --version 1.2-1 --fail-on-no-result; then + if helm search repo --devel -r rhdh --version 1.3-1 --fail-on-no-result; then + yq -i '.upstream.backstage |= . + load("template/backstage/helm/extravolume-patch-1.3.yaml")' "$TMP_DIR/chart-values.temp.yaml" + elif helm search repo --devel -r rhdh --version 1.2-1 --fail-on-no-result; then yq -i '.upstream.backstage |= . + load("template/backstage/helm/extravolume-patch-1.2.yaml")' "$TMP_DIR/chart-values.temp.yaml" else yq -i '.upstream.backstage |= . + load("template/backstage/helm/extravolume-patch-1.1.yaml")' "$TMP_DIR/chart-values.temp.yaml" diff --git a/ci-scripts/rhdh-setup/template/backstage/helm/chart-values.yaml b/ci-scripts/rhdh-setup/template/backstage/helm/chart-values.yaml index 7bdc3e3..b0e740e 100644 --- a/ci-scripts/rhdh-setup/template/backstage/helm/chart-values.yaml +++ b/ci-scripts/rhdh-setup/template/backstage/helm/chart-values.yaml @@ -21,11 +21,11 @@ upstream: backstage: appConfig: app: - baseUrl: 'https://{{- include "janus-idp.hostname" . }}' + baseUrl: "https://${RHDH_HELM_RELEASE_NAME}-${RHDH_HELM_CHART}-${RHDH_NAMESPACE}.${OPENSHIFT_APP_DOMAIN}" backend: - baseUrl: 'https://{{- include "janus-idp.hostname" . }}' + baseUrl: "https://${RHDH_HELM_RELEASE_NAME}-${RHDH_HELM_CHART}-${RHDH_NAMESPACE}.${OPENSHIFT_APP_DOMAIN}" cors: - origin: 'https://{{- include "janus-idp.hostname" . }}' + origin: "https://${RHDH_HELM_RELEASE_NAME}-${RHDH_HELM_CHART}-${RHDH_NAMESPACE}.${OPENSHIFT_APP_DOMAIN}" database: connection: password: "${POSTGRESQL_ADMIN_PASSWORD}" diff --git a/ci-scripts/rhdh-setup/template/backstage/helm/extravolume-patch-1.3.yaml b/ci-scripts/rhdh-setup/template/backstage/helm/extravolume-patch-1.3.yaml new file mode 100644 index 0000000..65ac6bf --- /dev/null +++ b/ci-scripts/rhdh-setup/template/backstage/helm/extravolume-patch-1.3.yaml @@ -0,0 +1,61 @@ +--- +extraVolumeMounts: + - name: dynamic-plugins-root + mountPath: /opt/app-root/src/dynamic-plugins-root + - name: diststatic + mountPath: /opt/app-root/src/packages/app/dist/static + - name: rbac-policy + mountPath: /opt/app-root/src/rbac +extraVolumes: + - name: dynamic-plugins-root + ephemeral: + volumeClaimTemplate: + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + # -- Size of the volume that will contain the dynamic plugins. It should be large enough to contain all the plugins. + storage: 2Gi + - name: dynamic-plugins + configMap: + defaultMode: 420 + name: '{{ printf "%s-dynamic-plugins" .Release.Name }}' + optional: true + - name: rbac-policy + configMap: + defaultMode: 420 + name: rbac-policy + - name: dynamic-plugins-npmrc + secret: + defaultMode: 420 + optional: true + secretName: dynamic-plugins-npmrc + - name: npmcacache + emptyDir: {} + - name: diststatic + emptyDir: {} +initContainers: + - name: install-dynamic-plugins + image: '{{ include "backstage.image" . }}' + command: + - ./install-dynamic-plugins.sh + - /dynamic-plugins-root + env: + - name: NPM_CONFIG_USERCONFIG + value: /opt/app-root/src/.npmrc.dynamic-plugins + imagePullPolicy: Always + volumeMounts: + - mountPath: /dynamic-plugins-root + name: dynamic-plugins-root + - mountPath: /opt/app-root/src/dynamic-plugins.yaml + name: dynamic-plugins + readOnly: true + subPath: dynamic-plugins.yaml + - mountPath: /opt/app-root/src/.npmrc.dynamic-plugins + name: dynamic-plugins-npmrc + readOnly: true + subPath: .npmrc + - mountPath: /opt/app-root/src/.npm/_cacache + name: npmcacache + workingDir: /opt/app-root/src diff --git a/ci-scripts/rhdh-setup/template/backstage/olm/backstage.yaml b/ci-scripts/rhdh-setup/template/backstage/olm/backstage.yaml index fe8b231..61450e5 100644 --- a/ci-scripts/rhdh-setup/template/backstage/olm/backstage.yaml +++ b/ci-scripts/rhdh-setup/template/backstage/olm/backstage.yaml @@ -1,4 +1,4 @@ -apiVersion: rhdh.redhat.com/v1alpha1 +apiVersion: rhdh.redhat.com/v1alpha2 kind: Backstage metadata: name: developer-hub @@ -34,10 +34,14 @@ spec: name: keycloak-client-secret-backstage - key: BACKEND_SECRET name: rhdh-backend-secret - replicas: ${RHDH_DEPLOYMENT_REPLICAS} route: enabled: true database: enableLocalDb: true - imagePullSecrets: - - rhdh-pull-secret + deployment: + spec: + replicas: ${RHDH_DEPLOYMENT_REPLICAS} + template: + spec: + imagePullSecrets: + - rhdh-pull-secret diff --git a/ci-scripts/scalability/test-scalability.sh b/ci-scripts/scalability/test-scalability.sh index 6318eeb..f31e77a 100755 --- a/ci-scripts/scalability/test-scalability.sh +++ b/ci-scripts/scalability/test-scalability.sh @@ -116,7 +116,7 @@ for w in "${workers[@]}"; do export RHDH_RESOURCES_CPU_LIMITS="$cl" export RHDH_RESOURCES_MEMORY_REQUESTS="$mr" export RHDH_RESOURCES_MEMORY_LIMITS="$ml" - export RHDH_KEYCLOAK_REPLICAS=$r + export RHDH_KEYCLOAK_REPLICAS="${RHDH_KEYCLOAK_REPLICAS:-$r}" export BACKSTAGE_USER_COUNT=$bu export GROUP_COUNT=$bg export WORKERS=$w diff --git a/test.env b/test.env index 13fff96..4826ef0 100644 --- a/test.env +++ b/test.env @@ -25,7 +25,7 @@ ## RHDH installed via Helm # export RHDH_INSTALL_METHOD=helm # export RHDH_NAMESPACE=rhdh-performance-helm -# export RHDH_HELM_REPO=https://raw.githubusercontent.com/rhdh-bot/openshift-helm-charts/rhdh-1.2-rhel-9/installation +# export RHDH_HELM_REPO=https://raw.githubusercontent.com/rhdh-bot/openshift-helm-charts/rhdh-1.3-rhel-9/installation # export RHDH_HELM_CHART=redhat-developer-hub # export RHDH_HELM_CHART_VERSION= # export RHDH_HELM_RELEASE_NAME=rhdh @@ -38,8 +38,8 @@ # export RHDH_INSTALL_METHOD=olm # export RHDH_NAMESPACE=rhdh-performance-olm # export RHDH_OPERATOR_NAMESPACE=rhdh-operator -# export RHDH_OLM_INDEX_IMAGE=registry.redhat.io/redhat/redhat-operator-index:v4.15 -# export RHDH_OLM_CHANNEL=fast-1.2 +# export RHDH_OLM_INDEX_IMAGE=quay.io/rhdh/iib:1.3-v4.15-x86_64 +# export RHDH_OLM_CHANNEL=fast ## RHDH horizontal scaling # export RHDH_DEPLOYMENT_REPLICAS=1