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

Feat: kusion resource command #1261

Open
2 tasks
hoangndst opened this issue Aug 8, 2024 · 6 comments
Open
2 tasks

Feat: kusion resource command #1261

hoangndst opened this issue Aug 8, 2024 · 6 comments
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature pending-discussion
Milestone

Comments

@hoangndst
Copy link
Collaborator

hoangndst commented Aug 8, 2024

What would you like to be added?

Command kusion resource to interact with resources :

  • Add new command kusion resource list to show all resources of a specific project in a workspace.
    - --workspace: optional, default is current workspace
    - --project: required
    - --backend: optional, default is current backend
  • Add new command kusion resource show {id} to show the latest state of the specific resource by the id.
    - --workspace: optional, default is current workspace
    - --project: required
    - --backend: optional, default is current backend

Why is this needed?

  • It serves to check the status and get resource information by ID, by project, by workspace, or by all resources.
  • To get the information about resources of a project that are applied in a workspace, from that we can get the kusion-id and the terraform import id of these resources and use them for another project in the same workspace.
@hoangndst hoangndst added the kind/feature Categorizes issue or PR as related to a new feature label Aug 8, 2024
@hoangndst
Copy link
Collaborator Author

cc @SparkYuan , @liu-hm19

@liu-hm19
Copy link
Contributor

liu-hm19 commented Aug 9, 2024

Thanks for your advice! 👍

I believe this feature is indeed very helpful for users, but we are planning to implement the kusion release show command, which might to have some overlap in functionality with the kusion resource command you proposed in this Issue.

The related issue can be found here. We expect the kusion release show command to directly display the specified Release file for a certain project in one workspace. If users need to show a specific resource, I think maybe we can add a flag like --resource-id to achieve this. Since all the information of a resource is recorded in the Release file (Spec & State), I think displaying the resource information managed by Kusion should also read from the Release file. So, is it enough to just implement the kusion release show command?

cc @hoangndst @ffforest

@hoangndst
Copy link
Collaborator Author

We can change it to --project (project name) can show or list the release even we don't have the workdir : D
About the import resource. Where the import resource will be saved, still a field in workspace or you guys have other plan?
cc @liu-hm19 @ffforest

@liu-hm19
Copy link
Contributor

liu-hm19 commented Aug 9, 2024

Sure, I think we can add --project and --resource-id in the kusion release show command for users' convenience.

As for the imported resources, we don't have any other plans at the moment, but we are planning to optimize based on the configurations stored in Workspace.

@liu-hm19
Copy link
Contributor

After the discussion with @hoangndst, we have reached a consensus on kusion resource command that it can be used to assist users in importing existing application's TF resources. And the specific process is as follows:

  • Users can use kusion resource list to view all the resource Kusion IDs for a Project in a specified Workspace.
  • After that, users can use kusion resource show to view the details of a specified resource for a Project in a specified Workspace.
  • The above ability can help users determine the Kusion Resource ID and the Terraform Instance ID of the resources to be imported.

However, there still might be some concerns about the kusion resource command:

  • There might be some overlap between kusion resource command and kusion release command, as well as the Application Graph feature (related issue can be found here).
  • It might be necessary to clarify the resource listing and showing permissions.
  • If there is a need to support listing all the resources of all the Projects under a Workspace at once, this might cause performance issues due to the large number of resources.

We can discuss about this issue together with the community in the follow-up communication. cc @ffforest @Yangyang96

@liu-hm19
Copy link
Contributor

After the discussion with @hoangndst @ffforest and @Yangyang96, we have reached the following consensus:

  • We will still implement the kusion resource command, and integrate the functionality of Application Graph into this command (kusion resource graph).
  • Due to the functionality overlap between kusion resource graph and kusion resource list, we finally chose to implement the kusion resource graph command to display the list of Kusion Resource IDs for a specified Project in a Workspace, including the Kubernetes resources and Terraform resources in the State, as well as some relevant K8s resources like ReplicaSet, Pod and ServiceAccount. This sub-command is assigned to @Yangyang96
  • We will implement the kusion resource show command to display the details of a specified Kusion Resource ID for a Project in a Workspace, if convenient, we would like @hoangndst as the assignee for this sub-command. 👍
  • Currently, for the development of the kusion resource command, we have check-out a develop branch. PRs can be submitted to feat_resource branch before merging it into the main branch to close the related issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature pending-discussion
Projects
None yet
Development

No branches or pull requests

3 participants