Support for createNamespace (#1226)

- createNamespace is a new attribute that can be added to helmDefaults
  or an individual release to enforce the creation of a release namespace
  during sync if the namespace does not exist. This leverages helm's
  (3.2+) --create-namespace flag for the install/upgrade command. If
  running helm < 3.2, the createNamespace attribute has no effect.

Resolves #891
Resolves #1140
This commit is contained in:
Craig Dunford
2020-04-26 10:41:40 +09:00
committed by GitHub
parent b1190508b2
commit eeb61e6174
9 changed files with 270 additions and 26 deletions
+17
View File
@@ -30,6 +30,7 @@ type Helm struct {
Diffed []Release
FailOnUnexpectedDiff bool
FailOnUnexpectedList bool
Version *helmexec.Version
UpdateDepsCallbacks map[string]func(string) error
@@ -161,6 +162,22 @@ func (helm *Helm) IsHelm3() bool {
return false
}
func (helm *Helm) GetVersion() helmexec.Version {
if helm.Version != nil {
return *helm.Version
}
return helmexec.Version{}
}
func (helm *Helm) IsVersionAtLeast(major int, minor int) bool {
if helm.Version == nil {
return false
}
return helm.Version.Major >= major && minor >= helm.Version.Minor
}
func (helm *Helm) sync(m *sync.Mutex, f func()) {
if m != nil {
m.Lock()