Skip to content

Commit

Permalink
fix: do not index providerconfigs with ns
Browse files Browse the repository at this point in the history
  • Loading branch information
raffis committed May 30, 2024
1 parent 7bb930f commit b802fb7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions internal/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}))
Expand All @@ -80,14 +80,18 @@ 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)
if err != nil {
return nil
}

if gvk.Group == v1beta1.Group && gvk.Kind == "ProviderConfig" {
accessor.SetNamespace(obj, "")
}

objects <- obj
return nil
}))
Expand Down Expand Up @@ -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)
}
}
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"context"
"errors"
"fmt"
"log"
"os"
"runtime"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b802fb7

Please sign in to comment.