diff --git a/internal/parser/parser.go b/internal/parser/parser.go index 25fa7a7..f9b8769 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -61,8 +61,8 @@ func (p *Parser) Run(ctx context.Context, in io.Reader) error { } if err := index.Push(obj); err != nil { - return err - } + return err + } } } })) @@ -80,7 +80,7 @@ func (p *Parser) Run(ctx context.Context, in io.Reader) error { } pool.Push(worker.Task(func(ctx context.Context) error { - obj, _, err := p.Decoder.Decode( + obj, gvk, err := p.Decoder.Decode( resourceYAML, nil, nil) @@ -88,6 +88,10 @@ func (p *Parser) Run(ctx context.Context, in io.Reader) error { return nil } + if gvk.Group == v1beta1.Group && gvk.Kind == "ProviderConfig" { + accessor.SetNamespace(obj, "") + } + objects <- obj return nil })) @@ -124,7 +128,7 @@ func (p *Parser) exit(waiters ...worker.Waiter) { for _, w := range waiters { err := w.Wait() if err != nil && !p.AllowFailure { - p.Logger.Error(err, "error occured") + p.Logger.Error(err, "error occurred") os.Exit(1) } } diff --git a/main.go b/main.go index 11e4af0..2052672 100644 --- a/main.go +++ b/main.go @@ -2,7 +2,7 @@ package main import ( "context" - "errors" + "fmt" "log" "os" "runtime" @@ -76,7 +76,7 @@ func main() { } if _, err := os.Stat(out); err == nil { - must(errors.New("output directory does already exists")) + must(fmt.Errorf("output directory `%s` does already exists", out)) } err = os.MkdirAll(out, 0740)