diff --git a/internal/app/cli.go b/internal/app/cli.go index ed355508..b58a12c6 100644 --- a/internal/app/cli.go +++ b/internal/app/cli.go @@ -245,6 +245,7 @@ func (c *cli) readState(s *state) { } s.setDefaults() + s.initializeNamespaces() s.disableUntargetedApps(c.group, c.target) if len(c.target) > 0 && len(s.TargetMap) == 0 { diff --git a/internal/app/state.go b/internal/app/state.go index b41dc349..72fa0f7d 100644 --- a/internal/app/state.go +++ b/internal/app/state.go @@ -68,6 +68,14 @@ func (s *state) setDefaults() { } } +func (s *state) initializeNamespaces() { + for nsName, ns := range s.Namespaces { + if ns == nil { + s.Namespaces[nsName] = &namespace{} + } + } +} + // validate validates that the values specified in the desired state are valid according to the desired state spec. // check https://github.com/Praqma/helmsman/blob/master/docs/desired_state_specification.md for the detailed specification func (s *state) validate() error {