Skip to content

Commit

Permalink
UX Changes in litmusctl using promptui library. (litmuschaos#156)
Browse files Browse the repository at this point in the history
* added the ux changes

Signed-off-by: deep-poharkar <[email protected]>

* removed local setup changes

Signed-off-by: deep-poharkar <[email protected]>

* removed commented code and fixed casing

Signed-off-by: deep-poharkar <[email protected]>

* updated readme and create project now shows id

Signed-off-by: deep-poharkar <[email protected]>

* typo fixed

Signed-off-by: deep-poharkar <[email protected]>

---------

Signed-off-by: deep-poharkar <[email protected]>
  • Loading branch information
deep-poharkar authored Nov 15, 2023
1 parent 28f4744 commit 6b68c4d
Show file tree
Hide file tree
Showing 14 changed files with 378 additions and 132 deletions.
109 changes: 84 additions & 25 deletions Usage_0.23.0.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


> Notes:
>
> - For litmusctl v0.23.0 or latest
Expand Down Expand Up @@ -39,7 +37,7 @@ Next, you need to enter ChaosCenter details to login into your ChaosCenter accou

> Example, https://preview.litmuschaos.io/
**Username:** Enter your ChaosCenter username.
**Username:** Enter your ChaosCenter username.
**Password:** Enter your ChaosCenter password.

```
Expand Down Expand Up @@ -162,10 +160,10 @@ After verification of these details, you can proceed with the connection of the
```
Enter service account [Default: litmus]:
📌 Summary
📌 Summary
Chaos Infra Name: test4
Chaos EnvironmentID: test
Chaos Infra Description:
Chaos Infra Description:
Chaos Infra SSL/TLS Skip: false
Platform Name: Others
Namespace: litmuwrq (new)
Expand Down Expand Up @@ -194,15 +192,18 @@ To verify, if the connection process was successful you can view the list of con

### Steps to create a Chaos Experiment

* To setup an account with litmusctl
- To setup an account with litmusctl

```shell
litmusctl config set-account --endpoint="" --username="" --password=""
```

* To create a Chaos Experiment by passing a manifest file
> Note:
> * To get `project-id`, apply `litmusctl get projects`
> * To get `chaos-infra-id`, apply `litmusctl get chaos-infra --project-id=""`
- To create a Chaos Experiment by passing a manifest file
> Note:
>
> - To get `project-id`, apply `litmusctl get projects`
> - To get `chaos-infra-id`, apply `litmusctl get chaos-infra --project-id=""`
```shell
litmusctl create chaos-experiment -f custom-chaos-experiment.yml --project-id="" --chaos-infra-id=""
```
Expand All @@ -212,17 +213,21 @@ litmusctl create chaos-experiment -f custom-chaos-experiment.yml --project-id=""
```shell
litmusctl save chaos-experiment -f custom-litmus-experiment.yaml
```

> Note:
> * Experiment Name can also be passed through the Manifest file
>
> - Experiment Name can also be passed through the Manifest file
```shell
Enter the Project ID: eb7fc0a0-5878-4454-a9db-b67d283713bc
Enter the Chaos Infra ID: e7eb0386-085c-49c2-b550-8d85b58fd
Experiment Description:
Experiment Description:

🚀 Chaos Experiment/experiment-1 successfully created 🎉
```

- To Run a chaos Experiment:

```shell
litmusctl run chaos-experiment

Expand All @@ -233,7 +238,6 @@ Enter the Chaos Experiment ID: test_exp
🚀 Chaos Experiment running successfully 🎉
```


### Additional commands

- To view the current configuration of `.litmusconfig`, type:
Expand Down Expand Up @@ -282,6 +286,8 @@ litmusctl config use-account
Host endpoint where litmus is installed: https://preview.litmuschaos.io

Username: admin

✅ Successfully set the current account to 'account-name' at 'URL'
```

- To create a project, apply the following command :
Expand All @@ -290,20 +296,24 @@ Username: admin
litmusctl create project

Enter a project name: new

Project 'project-name' created successfully!🎉
```

- To create a new Environment, apply the following command :

```shell
litmusctl create environment
litmusctl create environment

Enter the Project ID: eb7fc0a0-5878-4454-a9db-b67d283713bc

Enter the Environment Name: test2

🚀New Chaos Environment creation successful!! 🎉
🚀 New Chaos Environment creation successful!! 🎉
```


- To view all the projects with the user, use the `get projects` command.

```shell
litmusctl get projects
```
Expand All @@ -314,6 +324,7 @@ litmusctl get projects
PROJECT ID PROJECT NAME CREATEDAT
50addd40-8767-448c-a91a-5071543a2d8e Developer Project 2021-07-21 14:38:51 +0530 IST
7a4a259a-1ae5-4204-ae83-89a8838eaec3 DevOps Project 2021-07-21 14:39:14 +0530 IST
Press Enter to show the next page (or type 'q' to quit): q
```

- To get an overview of the Chaos Infrastructures available within a project, issue the following command.
Expand All @@ -327,13 +338,13 @@ Enter the Project ID: 50addd40-8767-448c-a91a-5071543a2d8e
**Output:**

```
CHAOS Infrastructure ID CHAOS Infrastructure NAME STATUS
55ecc7f2-2754-43aa-8e12-6903e4c6183a chaos-infra-1 ACTIVE
13dsf3d1-5324-54af-4g23-5331g5v2364f chaos-infra-2 INACTIVE
CHAOS Infrastructure ID CHAOS Infrastructure NAME STATUS
55ecc7f2-2754-43aa-8e12-6903e4c6183a chaos-infra-1 ACTIVE
13dsf3d1-5324-54af-4g23-5331g5v2364f chaos-infra-2 INACTIVE
```

- To disconnect an Chaos Infrastructure, issue the following command..

* To disconnect an Chaos Infrastructure, issue the following command..
```shell
litmusctl disconnect chaos-infra <chaos-infra-id> --project-id=""
```
Expand All @@ -344,12 +355,24 @@ litmusctl disconnect chaos-infra <chaos-infra-id> --project-id=""
🚀 Chaos Infrastructure successfully disconnected.
```

- To list the created Chaos Experiments within a project, issue the following command.

Using Flag :

* To list the created Chaos Experiments within a project, issue the following command.
```shell
litmusctl get chaos-experiment --project-id=""
```

Using UI :

```shell
Enter the Project ID: "project-id"
Select an output format:
table
json
yaml
```

**Output:**

```
Expand All @@ -359,10 +382,22 @@ litmusctl get chaos-experiment --project-id=""
Showing 1 of 1 Chaos Experiments
```

- To list all the Chaos Experiment runs within a project, issue the following command.

```shell
litmusctl get chaos-experiment-runs --project-id=""
```

- To list all the Chaos Experiment runs within a specific experiment, issue the following command.

```shell
litmusctl get chaos-experiment-runs --project-id="" --experiment-id=""
```

- To list the Chaos Experiment run with a specific experiment-run-id , issue the following command.

* To list all the Chaos Experiment runs within a project, issue the following command.
```shell
litmusctl get chaos-experiments-runs --project-id=""
litmusctl get chaos-experiment-runs --project-id="" --experiment-run-id=""
```

**Output:**
Expand All @@ -374,12 +409,25 @@ CHAOS EXPERIMENT RUN ID STATUS RESILIENCY SCORE CHAOS EXPERIMENT ID CHAOS
Showing 1 of 1 Chaos Experiments runs
```

- To describe a particular Chaos Experiment, issue the following command.

Using Flag :

* To describe a particular Chaos Experiment, issue the following command.
```shell
litmusctl describe chaos-experiment <chaos-experiment-id> --project-id=""
```

Using UI :

```shell
litmusctl describe chaos-experiment
Enter the Project ID: "project-id"
Enter the Chaos Experiment ID: "chaos-experiment-id"
Select an output format :
yaml
json
```

**Output:**

```
Expand All @@ -398,12 +446,23 @@ spec:
...
```

- To delete a particular Chaos Experiment, issue the following commands.

Using Flag :

* To delete a particular Chaos Experiment, issue the following command.
```shell
litmusctl delete chaos-experiment <chaos-experiment-id> --project-id=""
```

Using UI :

```shell
litmusctl delete chaos-experiment
Enter the Project ID: "project-id"
Enter the Chaos Experiment ID: "chaos-experiment-id"
Are you sure you want to delete this Chaos Experiment? (y/n): y
```

**Output:**

```
Expand Down
4 changes: 4 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75
github.com/litmuschaos/chaos-operator v0.0.0-20230109130222-de7c74a937a9
github.com/litmuschaos/litmus/chaoscenter/graphql/server v0.0.0-20230720053327-bca5e97f553f
github.com/manifoldco/promptui v0.9.0
github.com/mitchellh/go-homedir v1.1.0
github.com/spf13/cobra v1.3.0
github.com/spf13/viper v1.10.1
Expand All @@ -30,6 +31,7 @@ require (
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful v2.16.0+incompatible // indirect
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
Expand Down Expand Up @@ -66,6 +68,8 @@ require (
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
Expand Down
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,14 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM=
github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI=
github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04=
github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8=
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
Expand Down Expand Up @@ -353,6 +359,8 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA=
github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
Expand Down Expand Up @@ -621,6 +629,7 @@ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down Expand Up @@ -688,6 +697,7 @@ golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
Loading

0 comments on commit 6b68c4d

Please sign in to comment.