Skip to content

Commit 9610e29

Browse files
fix dependencies
Signed-off-by: Kartikay <[email protected]>
1 parent 3bac6d7 commit 9610e29

30 files changed

+291
-180
lines changed

DEVELOPMENT.md

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Litmusctl Local Development Setup Guide
2+
3+
## Introduction
4+
5+
Welcome to the local development setup guide for **`litmusctl`**. This guide will walk you through the steps required to set up and run **`litmusctl`** on your local machine.
6+
7+
## Important Note
8+
9+
Before running **`litmusctl`**, make sure you have a Chaos Centre running. Ensure that the Chaos Centre version is compatible with the **`litmusctl`** version you are using.
10+
11+
## Prerequisites
12+
13+
Before you begin, ensure that you have the following prerequisites installed on your machine:
14+
15+
- [Go programming language](https://golang.org/doc/install) (version or later)
16+
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
17+
- Kubeconfig - `litmusctl` needs the kubeconfig of the k8s cluster where we need to connect litmus Chaos Delegates. The CLI currently uses the default path of kubeconfig i.e. `~/.kube/config`.
18+
19+
## Clone the Repository
20+
21+
```bash
22+
git clone https://github.com/litmuschaos/litmusctl.git
23+
24+
cd litmusctl
25+
```
26+
27+
## **Install Dependencies**
28+
29+
```bash
30+
go mod download
31+
```
32+
33+
## **Configuration**
34+
35+
Before running **`litmusctl`**, update the following configuration paths in the **`pkg/utils/constants.go`**
36+
37+
From this
38+
39+
```go
40+
// Graphql server API path
41+
GQLAPIPath = "/api/query"
42+
43+
// Auth server API path
44+
AuthAPIPath = "/auth"
45+
```
46+
47+
To this
48+
49+
```go
50+
// Graphql server API path
51+
GQLAPIPath = "/query"
52+
53+
// Auth server API path
54+
AuthAPIPath = ""
55+
```
56+
57+
## **Running `litmusctl`**
58+
59+
Execute the following command to run **`litmusctl`** locally:
60+
61+
```bash
62+
go run main.go <command> <subcommand> <subcommand> [options and parameters]
63+
```
64+
65+
## **Testing `litmusctl`**
66+
67+
To run tests, use the following command:
68+
69+
```bash
70+
go test ./...
71+
```
72+
73+
## **Contributing Guidelines**
74+
75+
If you wish to contribute to **`litmusctl`**, please follow our [contributing guidelines](https://github.com/litmuschaos/litmus/blob/master/CONTRIBUTING.md). Your contributions are valuable, and adhering to these guidelines ensures a smooth and collaborative development process.
76+
77+
## **Troubleshooting**
78+
79+
If you encounter any issues during setup, refer to our [troubleshooting guide](https://docs.litmuschaos.io/docs/troubleshooting) or reach out to our community for assistance. We're here to help you overcome any obstacles and ensure a successful setup.
80+
81+
## **Additional Information**
82+
83+
For more details on using **`litmusctl`**, refer to our [official documentation](https://docs.litmuschaos.io/). This documentation provides comprehensive information to help you make the most out of **`litmusctl`**.
84+
85+
Thank you for setting up **`litmusctl`** locally! Feel free to explore and contribute to the project. Your involvement is crucial to the success of the **`litmusctl`** community.
86+
87+
Let the chaos begin! 🚀🔥

README.md

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Litmusctl
2+
23
[![BCH compliance](https://bettercodehub.com/edge/badge/litmuschaos/litmusctl?branch=master)](https://bettercodehub.com/)
34
![GitHub Workflow](https://github.com/litmuschaos/litmusctl/actions/workflows/push.yml/badge.svg?branch=master)
45
[![GitHub stars](https://img.shields.io/github/stars/litmuschaos/litmusctl?style=social)](https://github.com/litmuschaos/litmusctl/stargazers)
@@ -7,7 +8,9 @@
78
The Litmuschaos command-line tool, litmusctl, allows you to manage litmuschaos's agent plane. You can use litmusctl to connect Chaos Delegates, create project, schedule Chaos Scenarios, disconnect Chaos Delegates and manage multiple litmuschaos accounts.
89

910
## Usage
11+
1012
For more information including a complete list of litmusctl operations, see the litmusctl reference documentation.
13+
1114
* For 0.23.0 or latest: <a href="https://github.com/litmuschaos/litmusctl/blob/master/Usage_0.23.0.md">Click here</a>
1215
* For v0.12.0 to v0.22.0: <a href="https://github.com/litmuschaos/litmusctl/blob/master/Usage_interactive.md">Click here</a>
1316
* For v0.2.0 or earlier && compatible with Litmus-2.0.0-Beta8 or earlier: <a href="https://github.com/litmuschaos/litmusctl/blob/master/Usage_v0.2.0.md">Click here</a>
@@ -17,8 +20,7 @@ For more information including a complete list of litmusctl operations, see the
1720
The litmusctl CLI requires the following things:
1821

1922
- kubeconfig - litmusctl needs the kubeconfig of the k8s cluster where we need to connect litmus Chaos Delegates. The CLI currently uses the default path of kubeconfig i.e. `~/.kube/config`.
20-
- kubectl- litmusctl is using kubectl under the hood to apply the manifest. To install kubectl, follow: [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl)
21-
23+
- kubectl- litmusctl is using kubectl under the hood to apply the manifest. To install kubectl, follow: [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl)
2224

2325
## Compatibility matrix
2426

@@ -185,44 +187,48 @@ To install the latest version of litmusctl follow the below steps:
185187

186188
### Linux/MacOS
187189

188-
* Extract the binary
190+
- Extract the binary
189191

190192
```shell
191193
tar -zxvf litmusctl-<OS>-<ARCH>-<VERSION>.tar.gz
192194
```
193195

194-
* Provide necessary permissions
196+
- Provide necessary permissions
195197

196198
```shell
197199
chmod +x litmusctl
198200
```
199201

200-
* Move the litmusctl binary to /usr/local/bin/litmusctl. Note: Make sure to use root user or use sudo as a prefix
202+
- Move the litmusctl binary to /usr/local/bin/litmusctl. Note: Make sure to use root user or use sudo as a prefix
201203

202204
```shell
203205
mv litmusctl /usr/local/bin/litmusctl
204206
```
205207

206-
* You can run the litmusctl command in Linux/macOS:
208+
- You can run the litmusctl command in Linux/macOS:
207209

208210
```shell
209211
litmusctl <command> <subcommand> <subcommand> [options and parameters]
210212
```
211213

212214
### Windows
213215

214-
* Extract the binary from the zip using WinZip or any other extraction tool.
216+
- Extract the binary from the zip using WinZip or any other extraction tool.
215217

216-
* You can run the litmusctl command in windows:
218+
- You can run the litmusctl command in windows:
217219

218220
```shell
219221
litmusctl.exe <command> <subcommand> <subcommand> [options and parameters]
220222
```
221223

222-
* To check the version of the litmusctl:
224+
- To check the version of the litmusctl:
223225

224226
```shell
225227
litmusctl version
226228
```
227229

228-
----
230+
## Development Guide
231+
232+
You can find the local setup guide for **`litmusctl`** [here](DEVELOPMENT.md).
233+
234+
---

go.mod

+7-6
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ require (
1515
github.com/spf13/cobra v1.3.0
1616
github.com/spf13/viper v1.10.1
1717
gopkg.in/yaml.v2 v2.4.0
18-
k8s.io/api v0.26.0
19-
k8s.io/apimachinery v0.26.0
18+
k8s.io/api v0.27.3
19+
k8s.io/apimachinery v0.27.3
2020
k8s.io/client-go v12.0.0+incompatible
2121
sigs.k8s.io/yaml v1.3.0
2222
)
@@ -58,7 +58,7 @@ require (
5858
github.com/spf13/pflag v1.0.5 // indirect
5959
github.com/subosito/gotenv v1.2.0 // indirect
6060
golang.org/x/net v0.17.0 // indirect
61-
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
61+
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
6262
golang.org/x/sys v0.13.0 // indirect
6363
golang.org/x/term v0.13.0 // indirect
6464
golang.org/x/text v0.13.0 // indirect
@@ -70,10 +70,11 @@ require (
7070
gopkg.in/inf.v0 v0.9.1 // indirect
7171
gopkg.in/ini.v1 v1.66.3 // indirect
7272
gopkg.in/yaml.v3 v3.0.1 // indirect
73-
k8s.io/klog/v2 v2.80.1 // indirect
74-
k8s.io/kube-openapi v0.0.0-20220124234850-424119656bbf // indirect
75-
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect
73+
k8s.io/klog/v2 v2.90.1 // indirect
74+
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
75+
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
7676
sigs.k8s.io/controller-runtime v0.11.1 // indirect
77+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
7778
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
7879
)
7980

go.sum

+24-36
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7
5252
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
5353
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
5454
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
55+
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
5556
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
57+
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
58+
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
5659
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
5760
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
5861
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
@@ -65,6 +68,7 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV
6568
github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
6669
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
6770
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
71+
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
6872
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
6973
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
7074
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
@@ -135,19 +139,12 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V
135139
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
136140
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
137141
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
138-
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
139-
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
140-
github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
141-
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
142-
github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
143-
github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8=
144-
github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs=
145-
github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns=
146-
github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo=
147-
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
148-
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
149-
github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
150-
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
142+
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
143+
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
144+
github.com/go-openapi/jsonreference v0.20.1 h1:FBLnyygC4/IZZr893oiomc9XaghoveYTrLC1F86HID8=
145+
github.com/go-openapi/jsonreference v0.20.1/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
146+
github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=
147+
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
151148
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
152149
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I=
153150
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
@@ -909,35 +906,26 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
909906
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
910907
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
911908
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
912-
k8s.io/api v0.21.2 h1:vz7DqmRsXTCSa6pNxXwQ1IYeAZgdIsua+DZU+o+SX3Y=
913-
k8s.io/api v0.21.2/go.mod h1:Lv6UGJZ1rlMI1qusN8ruAp9PUBFyBwpEHAdG24vIsiU=
914-
k8s.io/apimachinery v0.21.2 h1:vezUc/BHqWlQDnZ+XkrpXSmnANSLbpnlpwo0Lhk0gpc=
915-
k8s.io/apimachinery v0.21.2/go.mod h1:CdTY8fU/BlvAbJ2z/8kBwimGki5Zp8/fbVuLY8gJumM=
916-
k8s.io/client-go v0.21.2 h1:Q1j4L/iMN4pTw6Y4DWppBoUxgKO8LbffEMVEV00MUp0=
917-
k8s.io/client-go v0.21.2/go.mod h1:HdJ9iknWpbl3vMGtib6T2PyI/VYxiZfq936WNVHBRrA=
918-
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
919-
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
920-
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
921-
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
922-
k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
923-
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
924-
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
925-
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE=
926-
k8s.io/kube-openapi v0.0.0-20220124234850-424119656bbf h1:M9XBsiMslw2lb2ZzglC0TOkBPK5NQi0/noUrdnoFwUg=
927-
k8s.io/kube-openapi v0.0.0-20220124234850-424119656bbf/go.mod h1:sX9MT8g7NVZM5lVL/j8QyCCJe8YSMW30QvGZWaCIDIk=
928-
k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
929-
k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
930-
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d h1:0Smp/HP1OH4Rvhe+4B8nWGERtlqAGSftbSbbmm45oFs=
931-
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
909+
k8s.io/api v0.27.3 h1:yR6oQXXnUEBWEWcvPWS0jQL575KoAboQPfJAuKNrw5Y=
910+
k8s.io/api v0.27.3/go.mod h1:C4BNvZnQOF7JA/0Xed2S+aUyJSfTGkGFxLXz9MnpIpg=
911+
k8s.io/apimachinery v0.27.3 h1:Ubye8oBufD04l9QnNtW05idcOe9Z3GQN8+7PqmuVcUM=
912+
k8s.io/apimachinery v0.27.3/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E=
913+
k8s.io/client-go v0.27.3 h1:7dnEGHZEJld3lYwxvLl7WoehK6lAq7GvgjxpA3nv1E8=
914+
k8s.io/client-go v0.27.3/go.mod h1:2MBEKuTo6V1lbKy3z1euEGnhPfGZLKTS9tiJ2xodM48=
915+
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
916+
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
917+
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg=
918+
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg=
919+
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
920+
k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
932921
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
933922
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
934923
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
935924
sigs.k8s.io/controller-runtime v0.11.1 h1:7YIHT2QnHJArj/dk9aUkYhfqfK5cIxPOX5gPECfdZLU=
936925
sigs.k8s.io/controller-runtime v0.11.1/go.mod h1:KKwLiTooNGu+JmLZGn9Sl3Gjmfj66eMbCQznLP5zcqA=
937-
sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
938-
sigs.k8s.io/structured-merge-diff/v4 v4.1.0/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
926+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
927+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
939928
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE=
940929
sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E=
941-
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
942930
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
943931
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=

pkg/apis/auth.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package apis
1818
import (
1919
"encoding/json"
2020
"errors"
21-
"io/ioutil"
21+
"io"
2222
"net/http"
2323

2424
"github.com/litmuschaos/litmusctl/pkg/utils"
@@ -47,7 +47,7 @@ func Auth(input types.AuthInput) (types.AuthResponse, error) {
4747
return types.AuthResponse{}, err
4848
}
4949

50-
bodyBytes, err := ioutil.ReadAll(resp.Body)
50+
bodyBytes, err := io.ReadAll(resp.Body)
5151
if err != nil {
5252
return types.AuthResponse{}, err
5353
}

pkg/apis/environment/environment.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ package environment
33
import (
44
"encoding/json"
55
"errors"
6+
"io"
7+
"net/http"
8+
69
models "github.com/litmuschaos/litmus/chaoscenter/graphql/server/graph/model"
710
"github.com/litmuschaos/litmusctl/pkg/apis"
811
"github.com/litmuschaos/litmusctl/pkg/types"
912
"github.com/litmuschaos/litmusctl/pkg/utils"
10-
"io/ioutil"
11-
"net/http"
1213
)
1314

1415
// CreateEnvironment connects the Infra with the given details
@@ -19,12 +20,16 @@ func CreateEnvironment(pid string, request models.CreateEnvironmentRequest, cred
1920
gqlReq.Variables.Request = request
2021

2122
query, err := json.Marshal(gqlReq)
23+
if err != nil {
24+
return CreateEnvironmentResponse{}, errors.New("Error in Creating Chaos Infrastructure: " + err.Error())
25+
}
26+
2227
resp, err := apis.SendRequest(apis.SendRequestParams{Endpoint: cred.ServerEndpoint + utils.GQLAPIPath, Token: cred.Token}, query, string(types.Post))
2328
if err != nil {
2429
return CreateEnvironmentResponse{}, errors.New("Error in Creating Chaos Infrastructure: " + err.Error())
2530
}
2631

27-
bodyBytes, err := ioutil.ReadAll(resp.Body)
32+
bodyBytes, err := io.ReadAll(resp.Body)
2833
defer resp.Body.Close()
2934
if err != nil {
3035
return CreateEnvironmentResponse{}, errors.New("Error in Creating Chaos Environment: " + err.Error())
@@ -68,7 +73,7 @@ func GetEnvironmentList(pid string, cred types.Credentials) (ListEnvironmentData
6873
if err != nil {
6974
return ListEnvironmentData{}, errors.New("Error in Getting Chaos Environment List: " + err.Error())
7075
}
71-
bodyBytes, err := ioutil.ReadAll(resp.Body)
76+
bodyBytes, err := io.ReadAll(resp.Body)
7277
defer resp.Body.Close()
7378
if err != nil {
7479
return ListEnvironmentData{}, errors.New("Error in Getting Chaos Environment List: " + err.Error())

0 commit comments

Comments
 (0)