1
1
<# PSScriptInfo
2
- .VERSION 1.2 .0
2
+ .VERSION 1.3 .0
3
3
.GUID 04273f72-e001-415b-add0-e5e95e378355
4
4
.AUTHOR Code Dx
5
5
.DESCRIPTION Includes Helm-related helpers
@@ -67,12 +67,6 @@ function Invoke-HelmCommand([string] $message,
67
67
[switch ] $dryRun ,
68
68
[switch ] $skipCRDs ) {
69
69
70
- if (-not $dryRun ) {
71
- if (-not (Test-Namespace $namespace )) {
72
- New-Namespace $namespace
73
- }
74
- }
75
-
76
70
if (test-path $chartReference - pathtype container) {
77
71
Write-Verbose ' Running helm dependency update...'
78
72
helm dependency update $chartReference | Out-Null
@@ -82,7 +76,11 @@ function Invoke-HelmCommand([string] $message,
82
76
}
83
77
84
78
if (-not $dryRun ) {
85
- Wait-AllRunningPods " Pre-Helm Install: $message " $waitSeconds $namespace
79
+ if (Test-Namespace $namespace ) {
80
+ Wait-AllRunningPods " Pre-Helm Install: $message " $waitSeconds $namespace
81
+ } else {
82
+ Write-Verbose " Skipping pre-helm install check because namespace '$namespace ' does not exist or insufficient privileges affected the namespace test."
83
+ }
86
84
}
87
85
88
86
# NOTE: Latter values files take precedence over former ones
@@ -118,7 +116,7 @@ function Invoke-HelmCommand([string] $message,
118
116
}
119
117
120
118
$crdAction = $skipCRDs ? ' --skip-crds' : ' '
121
- $helmOutput = helm upgrade -- namespace $namespace -- install $valuesParam $releaseName -- timeout $timeout @ ( $ values) $chartReference @ ( $ versionParam) $crdAction $dryRunParam $debugParam
119
+ $helmOutput = helm upgrade -- namespace $namespace -- install -- create - namespace $valuesParam $releaseName -- timeout $timeout @values $chartReference @versionParam $crdAction $dryRunParam $debugParam
122
120
if ($LASTEXITCODE -ne 0 ) {
123
121
throw " Unable to run helm upgrade/install, helm exited with code $LASTEXITCODE ."
124
122
}
0 commit comments