Skip to content

Commit

Permalink
fix(RHIDP-4928): fix dynamic-plugins for RHDH v1.4 (#126)
Browse files Browse the repository at this point in the history
* fix(RHIDP-4928): fix dynamic-plugins for RHDH v1.4

Signed-off-by: Pavel Macík <[email protected]>

* apply workaround for RHIDP-4936 and RHIDP-4937

Signed-off-by: Pavel Macík <[email protected]>

---------

Signed-off-by: Pavel Macík <[email protected]>
  • Loading branch information
pmacik authored Nov 22, 2024
1 parent 4b20f4f commit 368a9b7
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 37 deletions.
22 changes: 21 additions & 1 deletion ci-scripts/rhdh-setup/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,24 @@ create_objs() {
fi
}

# TODO: remove once https://issues.redhat.com/browse/RHIDP-4936 and https://issues.redhat.com/browse/RHIDP-4937 are fixed
RHIDP-4936_RHIDP-4937_workaround() {
log_info "Applyling workaround for https://issues.redhat.com/browse/RHIDP-4936 and https://issues.redhat.com/browse/RHIDP-4937 issues"
pod=$($clin get pods -l app.kubernetes.io/instance=rhdh -o json | jq -rc '.items[] | select(.metadata.name | startswith("rhdh-developer-hub")).metadata.name')
for package in backstage-community-plugin-catalog-backend-module-keycloak-dynamic backstage-plugin-techdocs-backend-dynamic; do
log_info "Applying workaround for $package package"
$clin exec "$pod" -c backstage-backend -- bash -c "for i in \$(find /opt/app-root/src/dynamic-plugins-root -type d -name '$package*'); do cd \$i; npm install; done"
done
log_info "Restarting RHDH..."
if [ "$INSTALL_METHOD" == "helm" ]; then
rhdh_deployment="${RHDH_HELM_RELEASE_NAME}-developer-hub"
elif [ "$INSTALL_METHOD" == "olm" ]; then
rhdh_deployment=backstage-developer-hub
fi
$clin rollout restart deployment/"$rhdh_deployment"
wait_to_start deployment "$rhdh_deployment" 300 300
}

backstage_install() {
log_info "Installing RHDH with install method: $INSTALL_METHOD"
cp "template/backstage/app-config.yaml" "$TMP_DIR/app-config.yaml"
Expand Down Expand Up @@ -242,6 +260,7 @@ backstage_install() {
until $clin create -f "$TMP_DIR/rbac-config.yaml"; do $clin delete configmap rbac-policy --ignore-not-found=true; done
fi
envsubst <template/backstage/plugin-secrets.yaml | $clin apply -f -
until $clin create -f "template/backstage/techdocs-pvc.yaml"; do $clin delete pvc rhdh-techdocs --ignore-not-found=true; done
if [ "$INSTALL_METHOD" == "helm" ]; then
install_rhdh_with_helm
elif [ "$INSTALL_METHOD" == "olm" ]; then
Expand All @@ -258,6 +277,7 @@ backstage_install() {
fi
envsubst <template/backstage/rhdh-servicemonitor.yaml | $clin create -f -
fi
RHIDP-4936_RHIDP-4937_workaround # TODO: remove once https://issues.redhat.com/browse/RHIDP-4936 and https://issues.redhat.com/browse/RHIDP-4937 are fixed
log_info "RHDH Installed, waiting for the catalog to be populated"
timeout=300
timeout_timestamp=$(date -d "$timeout seconds" "+%s")
Expand Down Expand Up @@ -409,7 +429,7 @@ psql_debug() {
rhdh_deployment=backstage-developer-hub
fi
if ${PSQL_LOG}; then
log_info "Setting ups PostgreSQL logging"
log_info "Setting up PostgreSQL logging"
$clin exec "${psql_db}" -- sh -c "sed -i "s/^\s*#log_min_duration_statement.*/log_min_duration_statement=${LOG_MIN_DURATION_STATEMENT}/" /var/lib/pgsql/data/userdata/postgresql.conf "
$clin exec "${psql_db}" -- sh -c "sed -i "s/^\s*#log_min_duration_sample.*/log_min_duration_sample=${LOG_MIN_DURATION_SAMPLE}/" /var/lib/pgsql/data/userdata/postgresql.conf "
$clin exec "${psql_db}" -- sh -c "sed -i "s/^\s*#log_statement_sample_rate.*/log_statement_sample_rate=${LOG_STATEMENT_SAMPLE_RATE}/" /var/lib/pgsql/data/userdata/postgresql.conf "
Expand Down
10 changes: 10 additions & 0 deletions ci-scripts/rhdh-setup/template/backstage/app-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
app:
title: Red Hat Developer Hub
organization:
name: RHDH Perf&Scale
integrations:
github:
- host: github.com
Expand All @@ -20,6 +22,14 @@ catalog:
frequency: { seconds: 30 }
timeout: { minutes: 1 }
initialDelay: { seconds: 15 }
techdocs:
builder: local
generator:
runIn: local
publisher:
type: local
local:
publishDirectory: /opt/app-root/src/techdocs-data
enabled:
github: true
keycloak: true
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ global:
includes:
- dynamic-plugins.default.yaml
plugins:
- package: ./dynamic-plugins/dist/janus-idp-backstage-plugin-keycloak-backend-dynamic
- package: ./dynamic-plugins/dist/backstage-community-plugin-catalog-backend-module-keycloak-dynamic
disabled: false
# TechDocs
- package: ./dynamic-plugins/dist/backstage-plugin-techdocs
disabled: false
- package: ./dynamic-plugins/dist/backstage-plugin-techdocs-backend-dynamic
disabled: false
route:
enabled: true
Expand All @@ -21,11 +26,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}"
Expand Down Expand Up @@ -88,7 +93,6 @@ upstream:
- name: NODE_TLS_REJECT_UNAUTHORIZED
value: "0"
image:
debug: false
pullPolicy: Always
registry: ${RHDH_IMAGE_REGISTRY}
repository: ${RHDH_IMAGE_REPO}
Expand Down Expand Up @@ -146,6 +150,7 @@ upstream:
enabled: false
architecture: replication
replication:
enabled: true
synchronousCommit: "on"
numSynchronousReplicas: ${RHDH_DB_REPLICAS}
applicationName: "${RHDH_HELM_RELEASE_NAME}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ global:
includes:
- dynamic-plugins.default.yaml
plugins:
- package: ./dynamic-plugins/dist/janus-idp-backstage-plugin-keycloak-backend-dynamic
- package: ./dynamic-plugins/dist/backstage-community-plugin-catalog-backend-module-keycloak-dynamic
disabled: false
# TechDocs
- package: ./dynamic-plugins/dist/backstage-plugin-techdocs
disabled: false
- package: ./dynamic-plugins/dist/backstage-plugin-techdocs-backend-dynamic
disabled: false
route:
enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@
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: audit-log-data
mountPath: /var/log/redhat-developer-hub/audit
- name: rbac-policy
mountPath: /opt/app-root/src/rbac
- name: techdocs-data
mountPath: /opt/app-root/src/techdocs-data
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
persistentVolumeClaim:
claimName: '{{ printf "%s-dynamic-plugins-root" .Release.Name }}'
- name: audit-log-data
persistentVolumeClaim:
claimName: '{{ printf "%s-audit-log" .Release.Name }}'
- name: dynamic-plugins
configMap:
defaultMode: 420
Expand All @@ -31,10 +29,9 @@ extraVolumes:
defaultMode: 420
optional: true
secretName: dynamic-plugins-npmrc
- name: npmcacache
emptyDir: {}
- name: diststatic
emptyDir: {}
- name: techdocs-data
persistentVolumeClaim:
claimName: rhdh-techdocs
initContainers:
- name: install-dynamic-plugins
image: '{{ include "backstage.image" . }}'
Expand All @@ -56,6 +53,4 @@ initContainers:
name: dynamic-plugins-npmrc
readOnly: true
subPath: .npmrc
- mountPath: /opt/app-root/src/.npm/_cacache
name: npmcacache
workingDir: /opt/app-root/src
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extraContainers:
containerPort: 4180
protocol: TCP
imagePullPolicy: IfNotPresent
image: quay.io/oauth2-proxy/oauth2-proxy:v7.6.0
image: quay.io/oauth2-proxy/oauth2-proxy:v7.7.1
args:
- "--provider=oidc"
- "--email-domain=*"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
- package: ./dynamic-plugins/dist/janus-idp-backstage-plugin-rbac
- package: ./dynamic-plugins/dist/backstage-community-plugin-rbac
disabled: false
12 changes: 4 additions & 8 deletions ci-scripts/rhdh-setup/template/backstage/olm/backstage.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: rhdh.redhat.com/v1alpha2
apiVersion: rhdh.redhat.com/v1alpha3
kind: Backstage
metadata:
name: developer-hub
Expand Down Expand Up @@ -34,14 +34,10 @@ spec:
name: keycloak-client-secret-backstage
- key: BACKEND_SECRET
name: rhdh-backend-secret
imagePullSecrets:
- rhdh-pull-secret
replicas: ${RHDH_DEPLOYMENT_REPLICAS}
route:
enabled: true
database:
enableLocalDb: true
deployment:
spec:
replicas: ${RHDH_DEPLOYMENT_REPLICAS}
template:
spec:
imagePullSecrets:
- rhdh-pull-secret
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ data:
includes:
- dynamic-plugins.default.yaml
plugins:
- package: ./dynamic-plugins/dist/janus-idp-backstage-plugin-keycloak-backend-dynamic
- package: ./dynamic-plugins/dist/backstage-community-plugin-catalog-backend-module-keycloak-dynamic
disabled: false
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
- package: ./dynamic-plugins/dist/janus-idp-backstage-plugin-rbac
- package: ./dynamic-plugins/dist/backstage-community-plugin-rbac
disabled: false
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spec:
value: https://keycloak-${RHDH_NAMESPACE}.${OPENSHIFT_APP_DOMAIN}/auth/realms/backstage
- name: OAUTH2_PROXY_SSL_INSECURE_SKIP_VERIFY
value: "true"
image: quay.io/oauth2-proxy/oauth2-proxy:v7.6.0
image: quay.io/oauth2-proxy/oauth2-proxy:v7.7.1
imagePullPolicy: IfNotPresent
name: oauth2-proxy
ports:
Expand Down
10 changes: 10 additions & 0 deletions ci-scripts/rhdh-setup/template/backstage/techdocs-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: rhdh-techdocs
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

0 comments on commit 368a9b7

Please sign in to comment.