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

Closed
1 of 2 tasks
hoangndst opened this issue Aug 8, 2024 · 7 comments · Fixed by #1299
Closed
1 of 2 tasks

Feat: kusion resource command #1261

hoangndst opened this issue Aug 8, 2024 · 7 comments · Fixed by #1299
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.

@liu-hm19
Copy link
Contributor

Based on our previous discussions, we will implement two sub-commands for kusion resource, one of which is kusion resource graph and the other is kusion resource show. Currently, #1296 has implemented the kusion resource graph command, providing users with the ability to display the resource ids and the deployment statuses of a specified Project in a specified Workspace. And this sub-command will be included in the upcoming release of Kusion v0.13.0, while kusion resource show may be implemented in the future.

Considering that there have been some changes in the initial design and implementation compared to what was described in this issue, I would like to close this issue for now. We can re-open or open a new issue to follow up the support for kusion resource show later. cc @hoangndst @ffforest @Yangyang96

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

Successfully merging a pull request may close this issue.

3 participants