Skip to content

Commit b802fb7

Browse files
committed
fix: do not index providerconfigs with ns
1 parent 7bb930f commit b802fb7

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

internal/parser/parser.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ func (p *Parser) Run(ctx context.Context, in io.Reader) error {
6161
}
6262

6363
if err := index.Push(obj); err != nil {
64-
return err
65-
}
64+
return err
65+
}
6666
}
6767
}
6868
}))
@@ -80,14 +80,18 @@ func (p *Parser) Run(ctx context.Context, in io.Reader) error {
8080
}
8181

8282
pool.Push(worker.Task(func(ctx context.Context) error {
83-
obj, _, err := p.Decoder.Decode(
83+
obj, gvk, err := p.Decoder.Decode(
8484
resourceYAML,
8585
nil,
8686
nil)
8787
if err != nil {
8888
return nil
8989
}
9090

91+
if gvk.Group == v1beta1.Group && gvk.Kind == "ProviderConfig" {
92+
accessor.SetNamespace(obj, "")
93+
}
94+
9195
objects <- obj
9296
return nil
9397
}))
@@ -124,7 +128,7 @@ func (p *Parser) exit(waiters ...worker.Waiter) {
124128
for _, w := range waiters {
125129
err := w.Wait()
126130
if err != nil && !p.AllowFailure {
127-
p.Logger.Error(err, "error occured")
131+
p.Logger.Error(err, "error occurred")
128132
os.Exit(1)
129133
}
130134
}

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
"context"
5-
"errors"
5+
"fmt"
66
"log"
77
"os"
88
"runtime"
@@ -76,7 +76,7 @@ func main() {
7676
}
7777

7878
if _, err := os.Stat(out); err == nil {
79-
must(errors.New("output directory does already exists"))
79+
must(fmt.Errorf("output directory `%s` does already exists", out))
8080
}
8181

8282
err = os.MkdirAll(out, 0740)

0 commit comments

Comments
 (0)