11<# PSScriptInfo
2- .VERSION 1.2 .0
2+ .VERSION 1.3 .0
33.GUID 04273f72-e001-415b-add0-e5e95e378355
44.AUTHOR Code Dx
55.DESCRIPTION Includes Helm-related helpers
@@ -67,12 +67,6 @@ function Invoke-HelmCommand([string] $message,
6767 [switch ] $dryRun ,
6868 [switch ] $skipCRDs ) {
6969
70- if (-not $dryRun ) {
71- if (-not (Test-Namespace $namespace )) {
72- New-Namespace $namespace
73- }
74- }
75-
7670 if (test-path $chartReference - pathtype container) {
7771 Write-Verbose ' Running helm dependency update...'
7872 helm dependency update $chartReference | Out-Null
@@ -82,7 +76,11 @@ function Invoke-HelmCommand([string] $message,
8276 }
8377
8478 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+ }
8684 }
8785
8886 # NOTE: Latter values files take precedence over former ones
@@ -118,7 +116,7 @@ function Invoke-HelmCommand([string] $message,
118116 }
119117
120118 $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
122120 if ($LASTEXITCODE -ne 0 ) {
123121 throw " Unable to run helm upgrade/install, helm exited with code $LASTEXITCODE ."
124122 }
0 commit comments