Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/rhdh/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: redhat-developer-hub
type: application
version: 3.5.20
version: 3.5.21
appVersion: 2.2.0
annotations:
artifacthub.io/category: integration-delivery
Expand Down
8 changes: 4 additions & 4 deletions charts/rhdh/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# RHDH Helm Chart for OpenShift and Kubernetes

![Version: 3.5.20](https://img.shields.io/badge/Version-3.5.20-informational?style=flat-square)
![Version: 3.5.21](https://img.shields.io/badge/Version-3.5.21-informational?style=flat-square)
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)

A Helm chart for deploying Red Hat Developer Hub, which is a Red Hat supported version of Backstage.
Expand All @@ -19,7 +19,7 @@ For the **Generally Available** version of this chart, see:

## Maintainers

| Name | Email | Url |
| Name | Email | URL |
| ---- | ------ | --- |
| Red Hat | | <https://redhat.com> |

Expand All @@ -36,7 +36,7 @@ For the **Generally Available** version of this chart, see:
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add redhat-developer https://redhat-developer.github.io/rhdh-chart

helm install my-rhdh redhat-developer/redhat-developer-hub --version 3.5.20
helm install my-rhdh redhat-developer/redhat-developer-hub --version 3.5.21
```

## Introduction
Expand Down Expand Up @@ -204,7 +204,7 @@ Kubernetes: `>= 1.31.0-0`
| dynamicPlugins.initContainer.resources | Resource requests and limits. | object | `{"limits":{"cpu":"1000m","ephemeral-storage":"5Gi","memory":"2.5Gi"},"requests":{"cpu":"250m","memory":"256Mi"}}` |
| dynamicPlugins.initContainer.securityContext | Security context for the init container. | object | Same as containerSecurityContext |
| dynamicPlugins.maxEntrySize | Maximum uncompressed size (in bytes) of a single dynamic plugin entry. | int | `40000000` |
| dynamicPlugins.plugins | List of dynamic plugins. Every item defines the plugin `package` as a NPM package spec or OCI reference. | list | `[]` |
| dynamicPlugins.plugins | List of dynamic plugins. Every item defines the plugin `package` as a NPM package spec or OCI reference. A catalog reference (`ref://name` or `oci://...:{{inherit}}`) replaces a bundled default for the same plugin instead of being added alongside it. | list | `[]` |
| dynamicPlugins.volume | Volume configuration for the dynamic plugins root directory. | object | `{"emptyDir":{},"ephemeral":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"5Gi"}},"storageClassName":""},"pvc":{"claimName":""},"statefulSetPVC":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"5Gi"}},"storageClassName":""},"type":"ephemeral"}` |
| dynamicPlugins.volume.emptyDir | Raw Kubernetes emptyDir volume spec. Used when type is "emptyDir". | object | `{}` |
| dynamicPlugins.volume.ephemeral | Ephemeral volume configuration. Used when type is "ephemeral". The chart builds the full ephemeral.volumeClaimTemplate.spec from these fields. | object | `{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"5Gi"}},"storageClassName":""}` |
Expand Down
33 changes: 33 additions & 0 deletions charts/rhdh/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,39 @@ Return resolved Intelligent Assistant values from .Values.intelligentAssistant w
{{- toYaml $intelligentAssistant -}}
{{- end -}}

{{/*
Return the catalog plugin name a dynamic plugin package refers to, or "" when the
package is not a catalog reference.

Both supported catalog reference forms name the same plugin:
- ref://plugin-name
- oci://registry/plugin-name:{{inherit}} (optionally !plugin-path)

This mirrors the operator merge key, so a bundled default and a user override for
the same plugin collapse into one entry.
*/}}
{{- define "rhdh.catalogReferenceName" -}}
{{- $package := toString (. | default "") -}}
{{- if hasPrefix "ref://" $package -}}
{{- $name := trimPrefix "ref://" $package -}}
{{- if contains "!" $name -}}
{{- $name = first (splitList "!" $name) -}}
{{- end -}}
{{- $name -}}
{{- else if contains "{{inherit}}" $package -}}
{{- $reference := $package -}}
{{- if contains "!" $reference -}}
{{- $reference = first (splitList "!" $reference) -}}
{{- end -}}
{{- $reference = replace "{{inherit}}" "" $reference -}}
{{- $imageName := last (splitList "/" $reference) -}}
{{- if contains ":" $imageName -}}
{{- $imageName = first (splitList ":" $imageName) -}}
{{- end -}}
{{- $imageName -}}
{{- end -}}
{{- end -}}

{{/*
Return the bundled filename for an Intelligent Assistant config key.
*/}}
Expand Down
26 changes: 23 additions & 3 deletions charts/rhdh/templates/dynamic-plugins-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,40 @@ data:
dynamic-plugins.yaml: |
{{- $intelligentAssistant := include "rhdh.intelligentAssistant" . | fromYaml }}
{{- $dynamic := dict "includes" .Values.dynamicPlugins.includes }}
{{- $userPlugins := .Values.dynamicPlugins.plugins | default (list) }}
{{- $plugins := list }}

{{- range .Values.dynamicPlugins.plugins }}
{{- /* A user catalog reference replaces the bundled default for the same
plugin instead of adding a second entry. Both forms name the same
plugin, and install-dynamic-plugins rejects two entries for one OCI
plugin at the same level, which would stop RHDH from starting. */ -}}
{{- $seen := dict }}
{{- range $userPlugins }}
{{- $name := include "rhdh.catalogReferenceName" .package }}
{{- if $name }}
{{- $_ := set $seen $name true }}
{{- end }}
{{- $plugins = append $plugins . }}
{{- end }}

{{- $defaults := list }}
{{- if .Values.orchestrator.enabled }}
{{- range .Values.orchestrator.plugins }}
{{- $plugins = append $plugins . }}
{{- $defaults = append $defaults . }}
{{- end }}
{{- end }}

{{- if $intelligentAssistant.enabled }}
{{- range $intelligentAssistant.plugins }}
{{- $defaults = append $defaults . }}
{{- end }}
{{- end }}

{{- range $defaults }}
{{- $name := include "rhdh.catalogReferenceName" .package }}
{{- if not (and $name (hasKey $seen $name)) }}
{{- if $name }}
{{- $_ := set $seen $name true }}
{{- end }}
{{- $plugins = append $plugins . }}
{{- end }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/rhdh/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ dynamicPlugins:
# Relative paths are resolved from the working directory of the initContainer (`/opt/app-root/src`).
includes:
- "dynamic-plugins.default.yaml"
# -- List of dynamic plugins. Every item defines the plugin `package` as a NPM package spec or OCI reference.
# -- List of dynamic plugins. Every item defines the plugin `package` as a NPM package spec or OCI reference. A catalog reference (`ref://name` or `oci://...:{{inherit}}`) replaces a bundled default for the same plugin instead of being added alongside it.
plugins: []
# -- Maximum uncompressed size (in bytes) of a single dynamic plugin entry.
maxEntrySize: 40000000
Expand Down
57 changes: 56 additions & 1 deletion hack/assert-rendered-values.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
# constrained cluster (mirrored registry only, no default StorageClass) relies on:
# - global.imageRegistry is applied to every rendered image reference,
# - the helm test pod image follows test.image.*,
# - the dynamic plugins volume honours the StorageClass settings.
# - the dynamic plugins volume honours the StorageClass settings,
# - user catalog references replace bundled plugin defaults instead of
# producing two entries for one plugin, which the installer rejects.
#
# Usage: hack/assert-rendered-values.sh [chart-dir] (default: charts/rhdh)
# Requires helm and yq (mikefarah v4); run `helm dependency build <chart-dir>` first.
Expand Down Expand Up @@ -76,6 +78,22 @@ plugins_root_volume() {
yq -N 'select(.kind == "Deployment") | .spec.template.spec.volumes[] | select(.name == "dynamic-plugins-root")'
}

# Prints the rendered dynamic-plugins.yaml content as parsed YAML.
plugins_config() {
yq -N 'select(.kind == "ConfigMap" and (.metadata.name | test("-dynamic-plugins$")))
| .data["dynamic-plugins.yaml"] | from_yaml'
}

# Prints the catalog plugin name for each plugin entry, so duplicates are visible
# regardless of whether the entry uses ref:// or oci://...:{{inherit}}.
plugin_names() {
yq -N '.plugins[].package
| sub("^ref://"; "")
| split("!")[0]
| split("/")[-1]
| split(":")[0]'
}

echo "==> global.imageRegistry=${MIRROR} applies to every rendered image"
assert_images_mirrored "default values"
for ci_values in "${CHART}"/ci/*-values.yaml; do
Expand Down Expand Up @@ -144,6 +162,43 @@ claims=$(yq ea -N '[select(.kind == "PersistentVolumeClaim"),
| length' <<<"${out}")
assert_equals "type=emptyDir: no PVC or ephemeral claim rendered" "0" "${claims}"

echo "==> dynamic plugins: user catalog references replace bundled defaults"
# A ref:// default and an oci://...:{{inherit}} override name the same plugin.
# Keeping both makes install-dynamic-plugins reject the duplicate and RHDH never
# starts. The user entry must win and keep its package form.
plugin_values=$(mktemp)
trap 'rm -f "${plugin_values}"' EXIT
cat >"${plugin_values}" <<'EOF'
dynamicPlugins:
includes: []
plugins:
- package: 'oci://quay.io/rhdh/red-hat-developer-hub-backstage-plugin-intelligent-assistant:{{ "{{inherit}}" }}'
enabled: true
- package: 'ref://red-hat-developer-hub-backstage-plugin-orchestrator'
enabled: true
intelligentAssistant:
plugins:
- package: 'ref://red-hat-developer-hub-backstage-plugin-intelligent-assistant'
enabled: true
- package: 'ref://red-hat-developer-hub-backstage-plugin-intelligent-assistant-backend'
enabled: true
orchestrator:
enabled: true
plugins:
- package: 'ref://red-hat-developer-hub-backstage-plugin-orchestrator'
enabled: true
- package: 'ref://red-hat-developer-hub-backstage-plugin-orchestrator-backend'
enabled: true
EOF
out=$(render --values "${plugin_values}")
duplicates=$(plugins_config <<<"${out}" | plugin_names | sort | uniq -d)
assert_equals "user overrides: no plugin appears twice" "" "${duplicates}"
count=$(plugins_config <<<"${out}" | yq -N '.plugins | length')
assert_equals "user overrides: 4 entries (2 user + 2 untouched defaults)" "4" "${count}"
assert_equals "user overrides: oci:// form is preserved" \
'oci://quay.io/rhdh/red-hat-developer-hub-backstage-plugin-intelligent-assistant:{{inherit}}' \
"$(plugins_config <<<"${out}" | yq -N '.plugins[0].package')"

echo
if ((failures > 0)); then
echo "${failures} of ${checks} rendered-values assertions failed" >&2
Expand Down
Loading