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

kpt pkg tree visualization of package hierarchy #1622

Closed
frankfarzan opened this issue Mar 25, 2021 · 5 comments · Fixed by #1740
Closed

kpt pkg tree visualization of package hierarchy #1622

frankfarzan opened this issue Mar 25, 2021 · 5 comments · Fixed by #1740
Assignees
Labels
area/pkg triaged Issue has been triaged by adding an `area/` label
Milestone

Comments

@frankfarzan
Copy link
Contributor

$ kpt pkg tree cassandra
.
├── [Kptfile]  Kptfile cassandra
├── [service.yaml]  Service cassandra
├── [statefulset.yaml]  StatefulSet cassandra
└── [statefulset.yaml]  StorageClass fas

Kptfile is rendered like a regular file which makes the output less readable.

@frankfarzan frankfarzan added area/pkg triaged Issue has been triaged by adding an `area/` label labels Mar 25, 2021
@phanimarupaka
Copy link
Contributor

@frankfarzan Here is the PR. kubernetes-sigs/kustomize#3759

@mortent
Copy link
Contributor

mortent commented Mar 29, 2021

So the reason why the Kptfile is included in the output, it that it provides a way for users to see the package hierarchy with the tree command. I agree we should look at whether including the Kptfile in the output is the right way to achieve this, but I'm not sure we should just remove it without any replacement. Visualizing the package hierarchy seems pretty useful, so I think we should keep that as an option.

I'm also not certain if we need to address this in the cmd/config package. It seems like the pkg tree, fn sink and fn source are the only remaining dependencies from cmd/config, so maybe we should consider pulling the tree command into thirdparty.

@phanimarupaka
Copy link
Contributor

@mortent There is Pkg: prefix for folders which are packages. Please refer to tests in the PR. This helps users to know the package hierarchy.

@phanimarupaka phanimarupaka added this to the v1.0 alpha 2 milestone Mar 29, 2021
@mortent
Copy link
Contributor

mortent commented Mar 29, 2021

Ack. I had forgotten that we also use the Pkg prefix.

@frankfarzan
Copy link
Contributor Author

frankfarzan commented Apr 5, 2021

Couple of issue with current formatting:

$ kpt pkg tree wordpress/
wordpress
├── [service.yaml]  Service wordpress
├── deployment
│   ├── [service.yaml]  Deployment wordpress
│   └── [volume.yaml]  PersistentVolumeClaim wp-pv-claim
└── Pkg: mysql
    ├── [deployment.yaml]  PersistentVolumeClaim mysql-pv-claim
    ├── [deployment.yaml]  Deployment wordpress-mysql
    └── [deployment.yaml]  Service wordpress-mysq
  1. Inconsistent treatment of top-level package (wordress) and subpackages (mysql). There's Pkg: prefix for subpackages, but not top-level package.
  2. The Pkg: prefix gets lost in the output.
  3. Inconsistent treatment of meta resources. We define meta resources as any resource specific to kpt functioning. Besides, Kptfile, there are also function configs. Omitting just the Kptfile will be confusing.

Here's is what I think is a reasonable UX for now:

  • PKG: wordpress
    • [Kptfile] Kptfile wordpress
    • [service.yaml] Service wordpress
    • deployment
      • [service.yaml] Deployment wordpress
      • [volume.yaml] PersistentVolumeClaim wp-pv-claim
    • PKG: mysql
      • [Kptfile] Kptfile mysql
      • [deployment.yaml] PersistentVolumeClaim mysql-pv-claim
      • [deployment.yaml] Deployment wordpress-mysql
      • [deployment.yaml] Service wordpress-mysql

Changes:

  • Top-level package is marked as a package
  • All packages are marked in bold using PKG: my-package-name.
  • Show Kptfile and Function configs like regular resources for now. Given the previous point, this is no longer an issue.

I think eventually, we should also provide view that only shows the package hierarchy:

  • wordpress
    • mysql

@frankfarzan frankfarzan reopened this Apr 5, 2021
@frankfarzan frankfarzan changed the title kpt pkg tree should not render Kptfile as a regular file kpt pkg tree highlight package hierarchy Apr 5, 2021
@frankfarzan frankfarzan changed the title kpt pkg tree highlight package hierarchy kpt pkg tree visualization of package hierarchy Apr 5, 2021
@phanimarupaka phanimarupaka linked a pull request Apr 13, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/pkg triaged Issue has been triaged by adding an `area/` label
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants