Skip to content

Commit a3211d8

Browse files
author
Georg Martin Weber
committed
fix env var replacement with lists, simplify debug of installer script
1 parent fdea689 commit a3211d8

File tree

5 files changed

+24
-2
lines changed

5 files changed

+24
-2
lines changed

hull-vidispine-addon/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ apiVersion: v1
33
appVersion: 1.30.0
44
description: hull-vidispine-addon
55
name: hull-vidispine-addon
6-
version: 1.30.1
6+
version: 1.30.2

hull-vidispine-addon/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ Describes configuration options. <br>Has exclusively the following sub-fields: <
115115
| `debug.ignoreEntityRestCallErrors` | If `false`, the `hull-install` and `hull-configure` scripts will stop after an error was encountered and the allowed number of retries was exceeded. To instead ignore errors and provide a list of failed `entities` after execution set this value to `true`, This can be useful for debugging potential issues with Helm Charts. | `false` | `true`
116116
| `debug.retriesForEntityRestCall` | Sets number of retries for each individual GET, PUT, POST and DELETE call before considering the operation failed. | `3` | `1`
117117
| `debug.retriesForEntityRestCall` | Sets number of retries for each individual GET, PUT, POST and DELETE call before considering the operation failed. | `5` | `2`
118+
| `debug.debugInstallerScript` | If enabled, the Installer.ps1 script is not being run embedded in the container but is mounted and run from the hull-install ConfigMap. Normally to not clutter the configuration the script is embedded into the container and cannot be debugged easily without creating new container images. To easily debug `Installer.ps1` script, copy the current script from the `/images/hull-integration/Installer.ps1` file to the ConfigMap `Installer.ps1` inline placeholder. Now when making changes to the ConfigMap entry this will affect the Job that is executed. | `false` | `true`
118119
| `legacy` | Setttings for legacy compatibility.
119120
| `legacy.defaultServiceAccountIsHook` | In older versions of the `hull-vidispine-addon`, the `default` ServiceAccount that is being created by HULL was annotated as a Helm hook by the `hull-vidispine-addon`and used for all pods in the Helm chart. This behavior was problematic because the Hook lifecycle was only appropriate for the `hull-vidispine-addon` jobs but not the remaining pods. Furthermore it opposed granular RBAC settings for the `hull-install` Jobs vs. continuously running regular pods. So by now there are different Helm hook ServiceAccounts created for the `hull-install` and `hull-configure` job and the `default` ServiceAccount is not annotated as a Helm hook anymore.<br><br> This setting should **NEVER** be set to `true` for new Helm charts, only for a transition phase it may be useful to set it to `true` to avoid immediate migration issues. | `false` | `true`
120121
### EndpointSpec

hull-vidispine-addon/hull-vidispine-addon.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ hull:
1919
ignoreEntityRestCallErrors: false
2020
retriesForEntityRestCall: 3
2121
retriesForAuthServiceCall: 10
22+
debugInstallerScript: false
2223
legacy:
2324
defaultServiceAccountIsHook: false
2425
runtime:
@@ -683,4 +684,11 @@ hull:
683684
{{- end }}
684685
{{- $_ := include "hull.util.transformation" (dict "PARENT_CONTEXT" $ "SOURCE" $configScope "CALLER" nil "CALLER_KEY" nil "SOURCE_PATH" list) -}}
685686
{{- toYaml $configScope -}}
686-
{{ end }}
687+
{{ end }}
688+
Installer.ps1:
689+
enabled: _HT*hull.config.general.data.installation.config.debug.debugInstallerScript
690+
inline: |-
691+
*** ENABLE hull.config.general.data.installation.config.debug.debugInstallerScript
692+
*** AND COPY SCRIPT CODE FROM
693+
*** /images/hull-integration/Installer.ps1
694+
*** HERE TO START DEBUGGING

hull-vidispine-addon/templates/_transformations.tpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,14 @@ Icon: |-
169169
"mountPath": "/script/installation.yaml",
170170
"subPath": "installation.yaml"
171171
},
172+
{{ if $parent.Values.hull.config.general.data.installation.config.debug.debugInstallerScript }}
173+
"installer":
174+
{
175+
"name": "installation",
176+
"mountPath": "/script/Installer.ps1",
177+
"subPath": "Installer.ps1"
178+
},
179+
{{ end }}
172180
"custom-installation-files":
173181
{
174182
"name": "custom-installation-files",

images/hull-integration/Installer.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,11 @@ Class Installer
529529
$this.WriteLog("+++++ Converting Content from OrderedDictionary to JSON for environment variable insertion")
530530
$source = $source | ConvertTo-Json
531531
}
532+
if ($source.GetType() -Eq [System.Collections.Generic.List[System.Object]])
533+
{
534+
$this.WriteLog("+++++ Converting Content from Generic.List[System.Object] to JSON for environment variable insertion")
535+
$source = $source | ConvertTo-Json
536+
}
532537

533538
Select-String '\$\{env:(.*)\}' -Input $source -AllMatches | ForEach-Object {
534539
$_.matches | ForEach-Object {

0 commit comments

Comments
 (0)