Skip to content

Commit e42438b

Browse files
fix: Add test case deploying an Orchestrator-flavored instance with a user provided npmrc secret [RHDHBUGS-1893] (#195)
Co-authored-by: rm3l <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent b2370c6 commit e42438b

File tree

7 files changed

+127
-3
lines changed

7 files changed

+127
-3
lines changed

charts/backstage/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ sources: []
4747
# Versions are expected to follow Semantic Versioning (https://semver.org/)
4848
# Note that when this chart is published to https://github.com/openshift-helm-charts/charts
4949
# it will follow the RHDH versioning 1.y.z
50-
version: 4.5.1
50+
version: 4.5.2

charts/backstage/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# RHDH Backstage Helm Chart for OpenShift
33

4-
![Version: 4.5.1](https://img.shields.io/badge/Version-4.5.1-informational?style=flat-square)
4+
![Version: 4.5.2](https://img.shields.io/badge/Version-4.5.2-informational?style=flat-square)
55
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
66

77
A Helm chart for deploying Red Hat Developer Hub, which is a Red Hat supported version of Backstage.
@@ -209,11 +209,12 @@ Kubernetes: `>= 1.27.0-0`
209209
| route.tls.key | Key file contents | string | `""` |
210210
| route.tls.termination | Specify TLS termination. | string | `"edge"` |
211211
| route.wildcardPolicy | Wildcard policy if any for the route. Currently only 'Subdomain' or 'None' is allowed. | string | `"None"` |
212-
| test | Test pod parameters | object | `{"enabled":true,"image":{"registry":"quay.io","repository":"curl/curl","tag":"latest"}}` |
212+
| test | Test pod parameters | object | `{"enabled":true,"image":{"registry":"quay.io","repository":"curl/curl","tag":"latest"},"injectTestNpmrcSecret":false}` |
213213
| test.enabled | Whether to enable the test-connection pod used for testing the Release using `helm test`. | bool | `true` |
214214
| test.image.registry | Test connection pod image registry | string | `"quay.io"` |
215215
| test.image.repository | Test connection pod image repository. Note that the image needs to have both the `sh` and `curl` binaries in it. | string | `"curl/curl"` |
216216
| test.image.tag | Test connection pod image tag. Note that the image needs to have both the `sh` and `curl` binaries in it. | string | `"latest"` |
217+
| test.injectTestNpmrcSecret | Whether to inject a fake dynamic plugins npmrc secret. <br />See RHDHBUGS-1893 and RHDHBUGS-1464 for the motivation behind this. <br />This is only used for testing purposes and should not be used in production. <br />Only relevant when `test.enabled` field is set to `true`. | bool | `false` |
217218
| upstream | Upstream Backstage [chart configuration](https://github.com/backstage/charts/blob/main/charts/backstage/values.yaml) | object | Use Openshift compatible settings |
218219
| upstream.backstage.extraVolumes[0] | Ephemeral volume that will contain the dynamic plugins installed by the initContainer below at start. | object | `{"ephemeral":{"volumeClaimTemplate":{"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"5Gi"}}}}},"name":"dynamic-plugins-root"}` |
219220
| upstream.backstage.extraVolumes[0].ephemeral.volumeClaimTemplate.spec.resources.requests.storage | Size of the volume that will contain the dynamic plugins. It should be large enough to contain all the plugins. | string | `"5Gi"` |
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
route:
2+
enabled: false
3+
4+
upstream:
5+
postgresql:
6+
primary:
7+
persistence:
8+
enabled: false
9+
10+
global:
11+
dynamic:
12+
plugins:
13+
# Enable additional plugins, which should be merged with the Orchestrator plugins
14+
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import-backend-dynamic
15+
disabled: false
16+
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import
17+
disabled: false
18+
19+
orchestrator:
20+
enabled: true
21+
22+
test:
23+
injectTestNpmrcSecret: true
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# RHDHBUGS-1893: test-only option to inject a user-provided dynamic plugins npmrc secret.
2+
# Doing it this way because the secret name is dynamic and depends on the release name.
3+
{{- if and .Values.test.enabled .Values.test.injectTestNpmrcSecret }}
4+
apiVersion: v1
5+
kind: Secret
6+
metadata:
7+
name: '{{ .Release.Name }}-dynamic-plugins-npmrc'
8+
annotations:
9+
"helm.sh/hook": pre-install,pre-upgrade
10+
"helm.sh/hook-weight": "-5"
11+
immutable: true
12+
stringData:
13+
.npmrc: |
14+
@myscope:registry=https://my-registry.example.com
15+
//my-registry.example.com:_authToken=foo
16+
{{- end }}

charts/backstage/values.schema.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,45 @@
361361
"title": "OpenShift Route parameters.",
362362
"type": "object"
363363
},
364+
"test": {
365+
"additionalProperties": false,
366+
"properties": {
367+
"enabled": {
368+
"default": true,
369+
"title": "Enable test configuration. If enabled, test resources will be created to verify the Helm Release has been successfully deployed using the `helm test` command.",
370+
"type": "boolean"
371+
},
372+
"image": {
373+
"additionalProperties": false,
374+
"properties": {
375+
"registry": {
376+
"default": "quay.io",
377+
"title": "Registry to use for the test pod image.",
378+
"type": "string"
379+
},
380+
"repository": {
381+
"default": "curl/curl",
382+
"title": "Repository to use for the test pod image.",
383+
"type": "string"
384+
},
385+
"tag": {
386+
"default": "latest",
387+
"title": "Tag to use for the test pod image.",
388+
"type": "string"
389+
}
390+
},
391+
"title": "Image to use for the test pod. Note that the image needs to have both the `sh` and `curl` binaries in it.",
392+
"type": "object"
393+
},
394+
"injectTestNpmrcSecret": {
395+
"default": false,
396+
"title": "Whether to inject a fake dynamic plugins npmrc secret. This is only used for testing purposes and should not be used in production. It is only relevant when `test.enabled` field is set to `true`.",
397+
"type": "boolean"
398+
}
399+
},
400+
"title": "Test configuration for the Backstage chart.",
401+
"type": "object"
402+
},
364403
"upstream": {
365404
"properties": {
366405
"backstage": {

charts/backstage/values.schema.tmpl.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,45 @@
196196
}
197197
}
198198
},
199+
"test": {
200+
"title": "Test configuration for the Backstage chart.",
201+
"type": "object",
202+
"additionalProperties": false,
203+
"properties": {
204+
"enabled": {
205+
"title": "Enable test configuration. If enabled, test resources will be created to verify the Helm Release has been successfully deployed using the `helm test` command.",
206+
"type": "boolean",
207+
"default": true
208+
},
209+
"image": {
210+
"title": "Image to use for the test pod. Note that the image needs to have both the `sh` and `curl` binaries in it.",
211+
"type": "object",
212+
"additionalProperties": false,
213+
"properties": {
214+
"registry": {
215+
"title": "Registry to use for the test pod image.",
216+
"type": "string",
217+
"default": "quay.io"
218+
},
219+
"repository": {
220+
"title": "Repository to use for the test pod image.",
221+
"type": "string",
222+
"default": "curl/curl"
223+
},
224+
"tag": {
225+
"title": "Tag to use for the test pod image.",
226+
"type": "string",
227+
"default": "latest"
228+
}
229+
}
230+
},
231+
"injectTestNpmrcSecret": {
232+
"title": "Whether to inject a fake dynamic plugins npmrc secret. This is only used for testing purposes and should not be used in production. It is only relevant when `test.enabled` field is set to `true`.",
233+
"type": "boolean",
234+
"default": false
235+
}
236+
}
237+
},
199238
"orchestrator": {
200239
"title": "orchestrator configuration",
201240
"type": "object",

charts/backstage/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,12 @@ test:
349349
# -- Test connection pod image tag. Note that the image needs to have both the `sh` and `curl` binaries in it.
350350
tag: latest
351351

352+
# -- Whether to inject a fake dynamic plugins npmrc secret.
353+
# <br />See RHDHBUGS-1893 and RHDHBUGS-1464 for the motivation behind this.
354+
# <br />This is only used for testing purposes and should not be used in production.
355+
# <br />Only relevant when `test.enabled` field is set to `true`.
356+
injectTestNpmrcSecret: false
357+
352358
orchestrator:
353359
enabled: false
354360
serverlessLogicOperator:

0 commit comments

Comments
 (0)