Skip to content

Commit d50cd65

Browse files
committed
allow for customized configs
Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
1 parent 71ce683 commit d50cd65

5 files changed

Lines changed: 38 additions & 3 deletions

File tree

charts/backstage/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,15 @@ Kubernetes: `>= 1.27.0-0`
175175
| global.dynamic.plugins | List of dynamic plugins, possibly overriding the plugins listed in `includes` files. Every item defines the plugin `package` as a [NPM package spec](https://docs.npmjs.com/cli/v10/using-npm/package-spec), an optional `pluginConfig` with plugin-specific backstage configuration, and an optional `disabled` flag to disable/enable a plugin listed in `includes` files. It also includes an `integrity` field that is used to verify the plugin package [integrity](https://w3c.github.io/webappsec-subresource-integrity/#integrity-metadata-description). | list | `[]` |
176176
| global.host | Custom hostname shorthand, overrides `global.clusterRouterBase`, `upstream.ingress.host`, `route.host`, and url values in `upstream.backstage.appConfig`. | string | `""` |
177177
| global.lightspeed | Built-in Lightspeed feature configuration. | object | Use Lightspeed compatible settings / configurations. |
178+
| global.lightspeed.configMaps[0].create | Whether to create this ConfigMap from the bundled source file. Set to false and provide `nameOverride` to use a pre-existing ConfigMap. | bool | `false` |
179+
| global.lightspeed.configMaps[0].nameOverride | Name of an existing ConfigMap to use instead. Required when `create` is false. | string | `"test-stack"` |
180+
| global.lightspeed.configMaps[0].sourceFile | Bundled file used to populate the ConfigMap data when `create` is true. | string | `"lightspeed-stack.yaml"` |
181+
| global.lightspeed.configMaps[1].create | Whether to create this ConfigMap from the bundled source file. Set to false and provide `nameOverride` to use a pre-existing ConfigMap. | bool | `true` |
182+
| global.lightspeed.configMaps[1].nameOverride | Name of an existing ConfigMap to use instead. Required when `create` is false. | string | `""` |
183+
| global.lightspeed.configMaps[1].sourceFile | Bundled file used to populate the ConfigMap data when `create` is true. | string | `"config.yaml"` |
184+
| global.lightspeed.configMaps[2].create | Whether to create this ConfigMap from the bundled source file. Set to false and provide `nameOverride` to use a pre-existing ConfigMap. | bool | `true` |
185+
| global.lightspeed.configMaps[2].nameOverride | Name of an existing ConfigMap to use instead. Required when `create` is false. | string | `""` |
186+
| global.lightspeed.configMaps[2].sourceFile | Bundled file used to populate the ConfigMap data when `create` is true. | string | `"rhdh-profile.py"` |
178187
| global.lightspeed.enabled | Enable or disable the built-in Lightspeed feature. | bool | `true` |
179188
| global.lightspeed.initContainer.image | Full image reference for the Lightspeed RAG bootstrap init container. Override for disconnected environments. | string | `"quay.io/redhat-ai-dev/rag-content:release-1.9-lls-0.5.0-642c567fe10a62b5ff711654306b72912f341e05"` |
180189
| global.lightspeed.initContainer.resources | Resource requests/limits for the Lightspeed RAG bootstrap init container. | object | `{"limits":{"cpu":"100m","memory":"500Mi"},"requests":{"cpu":"50m","memory":"150Mi"}}` |

charts/backstage/templates/_helpers.tpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ into the chart archive so changes are captured by chart version bumps.
212212
{{- range $lightspeed.configMaps -}}
213213
{{- $configMaps = append $configMaps (dict
214214
"name" .name
215+
"create" (not (and (hasKey . "create") (not .create)))
215216
"nameOverride" .nameOverride
216217
"mountPath" .mountPath
217218
"subPath" .subPath
@@ -265,10 +266,13 @@ Return the Lightspeed ConfigMap name.
265266
{{- define "rhdh.lightspeed.configMapName" -}}
266267
{{- $root := .root -}}
267268
{{- $configMap := .configMap -}}
269+
{{- $create := not (and (hasKey $configMap "create") (not $configMap.create)) -}}
268270
{{- if $configMap.nameOverride -}}
269271
{{- $configMap.nameOverride -}}
270-
{{- else -}}
272+
{{- else if $create -}}
271273
{{- printf "%s-lightspeed-%s" $root.Release.Name $configMap.name | trunc 63 | trimSuffix "-" -}}
274+
{{- else -}}
275+
{{- fail (printf "global.lightspeed.configMaps[%s].nameOverride must be set when create=false" $configMap.name) -}}
272276
{{- end -}}
273277
{{- end -}}
274278

charts/backstage/templates/lightspeed/lightspeed-configmaps.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{{- $lightspeed := include "rhdh.lightspeed" . | fromYaml -}}
22
{{- if and $lightspeed.enabled $lightspeed.configMaps }}
3+
{{- $created := 0 -}}
34
{{- range $index, $configMap := $lightspeed.configMaps }}
4-
{{- if gt $index 0 }}
5+
{{- if not (and (hasKey $configMap "create") (not $configMap.create)) }}
6+
{{- if gt $created 0 }}
57
---
68
{{- end }}
9+
{{- $created = add1 $created }}
710
apiVersion: v1
811
kind: ConfigMap
912
metadata:
@@ -14,3 +17,4 @@ data:
1417
{{ include "rhdh.lightspeed.fileContent" (dict "context" $ "file" $configMap.sourceFile "optional" $configMap.optional "ref" (printf "global.lightspeed.configMaps[%s].sourceFile" $configMap.name)) | nindent 4 }}
1518
{{- end }}
1619
{{- end }}
20+
{{- end }}

charts/backstage/values.schema.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,16 @@
122122
"default": {
123123
"configMaps": [
124124
{
125+
"create": false,
125126
"mountPath": "/app-root/lightspeed-stack.yaml",
126127
"name": "stack",
127-
"nameOverride": "",
128+
"nameOverride": "test-stack",
128129
"optional": false,
129130
"sourceFile": "lightspeed-stack.yaml",
130131
"subPath": "lightspeed-stack.yaml"
131132
},
132133
{
134+
"create": true,
133135
"mountPath": "/app-root/config.yaml",
134136
"name": "config",
135137
"nameOverride": "",
@@ -138,6 +140,7 @@
138140
"subPath": "config.yaml"
139141
},
140142
{
143+
"create": true,
141144
"mountPath": "/app-root/rhdh-profile.py",
142145
"name": "rhdh-profile",
143146
"nameOverride": "",

charts/backstage/values.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,21 +94,36 @@ global:
9494
emptyDir: {}
9595
configMaps:
9696
- name: stack
97+
# -- Whether to create this ConfigMap from the bundled source file.
98+
# Set to false and provide `nameOverride` to use a pre-existing ConfigMap.
99+
create: true
100+
# -- Name of an existing ConfigMap to use instead. Required when `create` is false.
97101
nameOverride: ""
98102
mountPath: /app-root/lightspeed-stack.yaml
99103
subPath: lightspeed-stack.yaml
104+
# -- Bundled file used to populate the ConfigMap data when `create` is true.
100105
sourceFile: lightspeed-stack.yaml
101106
optional: false
102107
- name: config
108+
# -- Whether to create this ConfigMap from the bundled source file.
109+
# Set to false and provide `nameOverride` to use a pre-existing ConfigMap.
110+
create: true
111+
# -- Name of an existing ConfigMap to use instead. Required when `create` is false.
103112
nameOverride: ""
104113
mountPath: /app-root/config.yaml
105114
subPath: config.yaml
115+
# -- Bundled file used to populate the ConfigMap data when `create` is true.
106116
sourceFile: config.yaml
107117
optional: false
108118
- name: rhdh-profile
119+
# -- Whether to create this ConfigMap from the bundled source file.
120+
# Set to false and provide `nameOverride` to use a pre-existing ConfigMap.
121+
create: true
122+
# -- Name of an existing ConfigMap to use instead. Required when `create` is false.
109123
nameOverride: ""
110124
mountPath: /app-root/rhdh-profile.py
111125
subPath: rhdh-profile.py
126+
# -- Bundled file used to populate the ConfigMap data when `create` is true.
112127
sourceFile: rhdh-profile.py
113128
optional: false
114129
secret:

0 commit comments

Comments
 (0)