Skip to content

Commit ad01f74

Browse files
feat: Add helm timeout parameter
1 parent d388b10 commit ad01f74

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

functions/helm.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<#PSScriptInfo
2-
.VERSION 1.1.0
2+
.VERSION 1.2.0
33
.GUID 04273f72-e001-415b-add0-e5e95e378355
44
.AUTHOR Code Dx
55
.DESCRIPTION Includes Helm-related helpers
@@ -58,6 +58,7 @@ function Invoke-HelmCommand([string] $message,
5858
[int] $waitSeconds,
5959
[string] $namespace,
6060
[string] $releaseName,
61+
[string] $timeout = '5m0s',
6162
[string] $chartReference,
6263
[string] $valuesFile,
6364
[string[]] $extraValuesPaths,
@@ -105,8 +106,8 @@ function Invoke-HelmCommand([string] $message,
105106
$versionParam = $versionParam + "--version"
106107
$versionParam = $versionParam + "$version"
107108
}
108-
109-
Write-Verbose "Running Helm Upgrade: $message..."
109+
110+
Write-Verbose "Running Helm Upgrade: $message (timeout $timeout)..."
110111

111112
$dryRunParam = $dryRun ? '--dry-run' : ''
112113
$debugParam = $dryRun ? '--debug' : ''
@@ -117,7 +118,7 @@ function Invoke-HelmCommand([string] $message,
117118
}
118119

119120
$crdAction = $skipCRDs ? '--skip-crds' : ''
120-
$helmOutput = helm upgrade --namespace $namespace --install $valuesParam $releaseName @($values) $chartReference @($versionParam) $crdAction $dryRunParam $debugParam
121+
$helmOutput = helm upgrade --namespace $namespace --install $valuesParam $releaseName --timeout $timeout @($values) $chartReference @($versionParam) $crdAction $dryRunParam $debugParam
121122
if ($LASTEXITCODE -ne 0) {
122123
throw "Unable to run helm upgrade/install, helm exited with code $LASTEXITCODE."
123124
}

functions/resource.ps1

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<#PSScriptInfo
2-
.VERSION 1.1.0
2+
.VERSION 1.2.0
33
.GUID 7eadb850-7e43-4308-a9fa-0119a0a883a3
44
.AUTHOR Code Dx
55
.DESCRIPTION Includes resource-related helpers
@@ -306,6 +306,8 @@ function New-HelmRelease(
306306
[string] $namespace,
307307
[Parameter(Position=2)] [Parameter(ParameterSetName='GitChart')] [Parameter(ParameterSetName='RepoChart')]
308308
[string] $releaseName,
309+
[Parameter(Position=3)] [Parameter(ParameterSetName='GitChart')] [Parameter(ParameterSetName='RepoChart')]
310+
[string] $timeout = '5m0s',
309311
[Parameter(ParameterSetName='GitChart')]
310312
[string] $chartGitName,
311313
[Parameter(ParameterSetName='GitChart')]
@@ -396,6 +398,7 @@ metadata:
396398
namespace: {2}
397399
spec:
398400
releaseName: {3}
401+
timeout: {9}
399402
chart:
400403
{4}
401404
{5}
@@ -407,7 +410,8 @@ spec:
407410
($useHelmController ? 'helm.toolkit.fluxcd.io/v2beta1' : 'helm.fluxcd.io/v1'),
408411
$name,$namespace,$releaseName,$chartSource,$valuesFrom,$values,
409412
($useHelmController ? ' interval: 1m0s' : ''),
410-
($useHelmController ? "skipCRDs: true" : "crds: 'Skip'")
413+
($useHelmController ? "skipCRDs: true" : "crds: 'Skip'"),
414+
$timeout
411415

412416
New-ResourceFile 'HelmRelease' $namespace $name $helmRelease
413417
}
@@ -418,7 +422,8 @@ function New-HelmCommand(
418422
[string] $releaseName,
419423
[string] $chartRootPath,
420424
[string[]] $valuesPaths,
421-
[hashtable] $dockerImageNames) {
425+
[hashtable] $dockerImageNames,
426+
[string] $timeout = '5m0s') {
422427

423428
$crdAction = '--skip-crds'
424429
$valuesParam = '--reset-values' # merge $values with the latest, default chart values
@@ -441,7 +446,7 @@ function New-HelmCommand(
441446
}
442447
$values += $helmValuesPath
443448

444-
$helmOutput = "helm upgrade --namespace $namespace --install $crdAction $valuesParam "
449+
$helmOutput = "helm upgrade --namespace $namespace --install --timeout $timeout $crdAction $valuesParam "
445450
$values | ForEach-Object {
446451
$helmOutput += "--values ""$_"" "
447452
}

guided-setup.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'guided-setup'
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.10.0'
15+
ModuleVersion = '1.11.0'
1616

1717
# Supported PSEditions
1818
CompatiblePSEditions = @('Core')

0 commit comments

Comments
 (0)