Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't print Krmfile file in tree output #3759

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions cmd/config/internal/commands/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ type TreeRunner struct {
structure string
}

func (r *TreeRunner) getMatchFilesGlob() []string {
matchFilesGlob := append([]string{ext.KRMFileName()}, kio.DefaultMatch...)
return append(matchFilesGlob, "Kustomization")
}

func (r *TreeRunner) runE(c *cobra.Command, args []string) error {
var input kio.Reader
var root = "."
Expand All @@ -90,7 +85,7 @@ func (r *TreeRunner) runE(c *cobra.Command, args []string) error {
input = &kio.ByteReader{Reader: c.InOrStdin()}
} else {
root = filepath.Clean(args[0])
input = kio.LocalPackageReader{PackagePath: args[0], MatchFilesGlob: r.getMatchFilesGlob()}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will this affect the output of kustomize cfg tree? Is this what we want for kustomize as well as kpt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Essentially users would be interested to see resource files summary.

input = kio.LocalPackageReader{PackagePath: args[0]}
}

var fields []kio.TreeWriterField
Expand Down
3 changes: 0 additions & 3 deletions cmd/config/internal/commands/tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ resources:
}

if !assert.Equal(t, fmt.Sprintf(`%s
├── [Kustomization] Kustomization
└── [f2.yaml] Deployment bar
`, d), b.String()) {
return
Expand Down Expand Up @@ -307,11 +306,9 @@ openAPI:
}

if !assert.Equal(t, fmt.Sprintf(`%s
├── [Krmfile] Krmfile mainpkg
├── [f1.yaml] Deployment foo
├── [f1.yaml] Service foo
└── Pkg: subpkg
├── [Krmfile] Krmfile subpkg
└── [f2.yaml] Deployment bar
`, d), b.String()) {
return
Expand Down