diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index b10bb0bd..65ae81c9 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -38,7 +38,7 @@ jobs: - name: Get tag shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})" + run: echo "branch=$(echo ${GITHUB_REF##*/})" >> $GITHUB_OUTPUT id: tag - name: Building litmusctl @@ -55,4 +55,4 @@ jobs: - name: Copy binaries to the litmusctl s3 bucket run: | - aws s3 sync platforms-${{ steps.tag.outputs.branch }} s3://${{ secrets.AWS_S3_BUCKET }} \ No newline at end of file + aws s3 sync platforms-${{ steps.tag.outputs.branch }} s3://${{ secrets.AWS_S3_BUCKET }} diff --git a/README.md b/README.md index 38530519..a904d8a5 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ For more information including a complete list of litmusctl operations, see the * For v0.12.0 or latest: * Non-Interactive mode: Click here * Interactive mode: Click here + * For 0.23.0: Click here * For v0.2.0 or earlier && compatible with Litmus-2.0.0-Beta8 or earlier: Click here ## Requirements @@ -108,7 +109,12 @@ To check compatibility of litmusctl with Chaos Center 0.23.0 3.0.0-beta9 - 3.0.0-beta11 + 3.0.0-beta12 + + + 0.24.0 + 3.0.0-beta9 + 3.0.0-beta12 @@ -118,6 +124,7 @@ To install the latest version of litmusctl follow the below steps: + @@ -125,10 +132,10 @@ To install the latest version of litmusctl follow the below steps: - + @@ -136,11 +143,11 @@ To install the latest version of litmusctl follow the below steps: - + @@ -148,11 +155,11 @@ To install the latest version of litmusctl follow the below steps: - + @@ -160,11 +167,11 @@ To install the latest version of litmusctl follow the below steps: - + @@ -172,11 +179,11 @@ To install the latest version of litmusctl follow the below steps: - + @@ -184,11 +191,11 @@ To install the latest version of litmusctl follow the below steps: - + @@ -196,11 +203,11 @@ To install the latest version of litmusctl follow the below steps: - + @@ -208,11 +215,11 @@ To install the latest version of litmusctl follow the below steps: - + @@ -220,7 +227,6 @@ To install the latest version of litmusctl follow the below steps: -
Platforms0.24.0 0.23.0 0.22.0 0.21.00.19.0 0.18.0 0.17.00.16.0 master(Unreleased)
litmusctl-darwin-amd64 (MacOS)Click here Click here Click here Click hereClick here Click here Click hereClick here Click here
litmusctl-linux-386Click here Click here Click here Click hereClick here Click here Click hereClick here Click here
litmusctl-linux-amd64Click here Click here Click here Click hereClick here Click here Click hereClick here Click here
litmusctl-linux-armClick here Click here Click here Click hereClick here Click here Click hereClick here Click here
litmusctl-linux-arm64Click here Click here Click here Click hereClick here Click here Click hereClick here Click here
litmusctl-windows-386Click here Click here Click here Click hereClick here Click here Click hereClick here Click here
litmusctl-windows-amd64Click here Click here Click here Click hereClick here Click here Click hereClick here Click here
litmusctl-windows-armClick here Click here Click here Click hereClick here Click here Click hereClick here Click here
diff --git a/pkg/apis/upgrade.go b/pkg/apis/upgrade.go index f2b0af2f..912cd715 100644 --- a/pkg/apis/upgrade.go +++ b/pkg/apis/upgrade.go @@ -26,29 +26,29 @@ type manifestData struct { } type data struct { - GetManifest string `json:"getManifest"` + GetManifest string `json:"getInfraManifest"` } -type InfrasData struct { - Data GetInfraDetails `json:"data"` +type GetInfraResponse struct { + Data GetInfraData `json:"data"` Errors []struct { Message string `json:"message"` Path []string `json:"path"` } `json:"errors"` } -type GetInfraDetails struct { - GetInfraDetails InfrasDetails `json:"getAgentDetails"` +type GetInfraData struct { + GetInfraDetails InfraDetails `json:"getInfraDetails"` } -type InfrasDetails struct { +type InfraDetails struct { InfraID string `json:"infraID"` InfraNamespace *string `json:"infraNamespace"` } func UpgradeInfra(c context.Context, cred types.Credentials, projectID string, infraID string, kubeconfig string) (string, error) { - // Query to fetch agent details from server + // Query to fetch Infra details from server query := `{"query":"query {\n getInfraDetails(infraID : \"` + infraID + `\", \n projectID : \"` + projectID + `\"){\n infraNamespace infraID \n}}"}` resp, err := SendRequest(SendRequestParams{Endpoint: cred.Endpoint + utils.GQLAPIPath, Token: cred.Token}, []byte(query), string(types.Post)) if err != nil { @@ -61,7 +61,7 @@ func UpgradeInfra(c context.Context, cred types.Credentials, projectID string, i } defer resp.Body.Close() - var infra InfrasData + var infra GetInfraResponse if resp.StatusCode == http.StatusOK { err = json.Unmarshal(bodyBytes, &infra) @@ -102,13 +102,13 @@ func UpgradeInfra(c context.Context, cred types.Credentials, projectID string, i } // To write the manifest data into a temporary file - err = ioutil.WriteFile("chaos-delegate-manifest.yaml", []byte(manifest.Data.GetManifest), 0644) + err = ioutil.WriteFile("chaos-infra-manifest.yaml", []byte(manifest.Data.GetManifest), 0644) if err != nil { return "", err } - // Fetching agent-config from the subscriber - configData, err := k8s.GetConfigMap(c, "agent-config", *infra.Data.GetInfraDetails.InfraNamespace) + // Fetching subscriber-config from the subscriber + configData, err := k8s.GetConfigMap(c, "subscriber-config", *infra.Data.GetInfraDetails.InfraNamespace) if err != nil { return "", err } @@ -116,13 +116,13 @@ func UpgradeInfra(c context.Context, cred types.Credentials, projectID string, i metadata := new(bytes.Buffer) fmt.Fprintf(metadata, "\n%s: %s\n%s: %s\n%s: \n %s: %s\n %s: %s\n%s:\n", "apiVersion", "v1", - "kind", "ConfigMap", "metadata", "name", "agent-config", "namespace", *infra.Data.GetInfraDetails.InfraNamespace, "data") + "kind", "ConfigMap", "metadata", "name", "subscriber-config", "namespace", *infra.Data.GetInfraDetails.InfraNamespace, "data") for k, v := range configData { b := new(bytes.Buffer) if k == "COMPONENTS" { fmt.Fprintf(b, " %s: |\n %s", k, v) - } else if k == "START_TIME" || k == "IS_CLUSTER_CONFIRMED" { + } else if k == "START_TIME" || k == "IS_INFRA_CONFIRMED" { fmt.Fprintf(b, " %s: \"%s\"\n", k, v) } else { fmt.Fprintf(b, " %s: %s\n", k, v) @@ -134,7 +134,7 @@ func UpgradeInfra(c context.Context, cred types.Credentials, projectID string, i yamlOutput, err := k8s.ApplyYaml(k8s.ApplyYamlPrams{ Token: cred.Token, Endpoint: cred.Endpoint, - YamlPath: "chaos-delegate-manifest.yaml", + YamlPath: "chaos-infra-manifest.yaml", }, kubeconfig, true) if err != nil { @@ -142,22 +142,22 @@ func UpgradeInfra(c context.Context, cred types.Credentials, projectID string, i } utils.White.Print("\n", yamlOutput) - err = os.Remove("chaos-delegate-manifest.yaml") + err = os.Remove("chaos-infra-manifest.yaml") if err != nil { - return "Error removing Chaos Delegate manifest: ", err + return "Error removing Chaos Infrastructure manifest: ", err } - // Creating a backup for current agent-config in the SUBSCRIBER + // Creating a backup for current subscriber-config in the SUBSCRIBER home, err := homedir.Dir() cobra.CheckErr(err) configMapString = metadata.String() + configMapString - err = ioutil.WriteFile(home+"/backupAgentConfig.yaml", []byte(configMapString), 0644) + err = ioutil.WriteFile(home+"/backupSubscriberConfig.yaml", []byte(configMapString), 0644) if err != nil { - return "Error creating backup for agent config: ", err + return "Error creating backup for subscriber config: ", err } - utils.White_B.Print("\n ** A backup of agent-config configmap has been saved in your system's home directory as backupAgentConfig.yaml **\n") + utils.White_B.Print("\n ** A backup of subscriber-config configmap has been saved in your system's home directory as backupSubscriberConfig.yaml **\n") return "Manifest applied successfully", nil } else { diff --git a/pkg/cmd/connect/infra.go b/pkg/cmd/connect/infra.go index f2ff1e2f..c753dae0 100644 --- a/pkg/cmd/connect/infra.go +++ b/pkg/cmd/connect/infra.go @@ -24,8 +24,8 @@ import ( "github.com/litmuschaos/litmusctl/pkg/completion" "github.com/litmuschaos/litmusctl/pkg/apis" + "github.com/litmuschaos/litmusctl/pkg/infra_ops" "github.com/litmuschaos/litmusctl/pkg/k8s" - "github.com/litmuschaos/litmusctl/pkg/ops" "github.com/litmuschaos/litmusctl/pkg/types" "github.com/litmuschaos/litmusctl/pkg/utils" @@ -81,7 +81,7 @@ var infraCmd = &cobra.Command{ if !projectExists { utils.White_B.Print("Creating a random project...") - newInfra.ProjectId = ops.CreateRandomProject(credentials) + newInfra.ProjectId = infra_ops.CreateRandomProject(credentials) } } @@ -168,14 +168,14 @@ var infraCmd = &cobra.Command{ // Check if user has sufficient permissions based on mode utils.White_B.Print("\nšŸƒ Running prerequisites check....") - ops.ValidateSAPermissions(newInfra.Namespace, newInfra.Mode, &kubeconfig) + infra_ops.ValidateSAPermissions(newInfra.Namespace, newInfra.Mode, &kubeconfig) // Check if infra already exists - isInfraExist, err, infraList := ops.ValidateInfraNameExists(newInfra.InfraName, newInfra.ProjectId, credentials) + isInfraExist, err, infraList := infra_ops.ValidateInfraNameExists(newInfra.InfraName, newInfra.ProjectId, credentials) utils.PrintError(err) if isInfraExist { - ops.PrintExistingInfra(infraList) + infra_ops.PrintExistingInfra(infraList) os.Exit(1) } envIDs, err := environment.GetEnvironmentList(newInfra.ProjectId, credentials) @@ -192,7 +192,7 @@ var infraCmd = &cobra.Command{ } if !isEnvExist { utils.Red.Println("\nChaos Environment with the given ID doesn't exists.") - ops.PrintExistingEnvironments(envIDs) + infra_ops.PrintExistingEnvironments(envIDs) utils.White_B.Println("\nā— Please enter a name from the List or Create a new environment using `litmusctl create chaos-environment`") os.Exit(1) } @@ -203,25 +203,25 @@ var infraCmd = &cobra.Command{ if newInfra.ProjectId == "" { // Fetch project id - newInfra.ProjectId = ops.GetProjectID(userDetails) + newInfra.ProjectId = infra_ops.GetProjectID(userDetails) } - modeType := ops.GetModeType() + modeType := infra_ops.GetModeType() // Check if user has sufficient permissions based on mode utils.White_B.Print("\nšŸƒ Running prerequisites check....") - ops.ValidateSAPermissions(newInfra.Namespace, modeType, &kubeconfig) - newInfra, err = ops.GetInfraDetails(modeType, newInfra.ProjectId, credentials, &kubeconfig) + infra_ops.ValidateSAPermissions(newInfra.Namespace, modeType, &kubeconfig) + newInfra, err = infra_ops.GetInfraDetails(modeType, newInfra.ProjectId, credentials, &kubeconfig) utils.PrintError(err) newInfra.ServiceAccount, newInfra.SAExists = k8s.ValidSA(newInfra.Namespace, &kubeconfig) newInfra.Mode = modeType } - ops.Summary(newInfra, &kubeconfig) + infra_ops.Summary(newInfra, &kubeconfig) if !nonInteractive { - ops.ConfirmInstallation() + infra_ops.ConfirmInstallation() } infra, err := infrastructure.ConnectInfra(newInfra, credentials) diff --git a/pkg/cmd/upgrade/infra.go b/pkg/cmd/upgrade/infra.go index 06fd7f22..6dbc3895 100644 --- a/pkg/cmd/upgrade/infra.go +++ b/pkg/cmd/upgrade/infra.go @@ -72,7 +72,6 @@ func init() { infraCmd.Flags().String("project-id", "", "Enter the project ID") infraCmd.Flags().String("kubeconfig", "", "Enter the kubeconfig path(default: $HOME/.kube/config))") infraCmd.Flags().String("chaos-infra-id", "", "Enter the Chaos Infrastructure ID") - infraCmd.RegisterFlagCompletionFunc("project-id", completion.ProjectIDFlagCompletion) - infraCmd.RegisterFlagCompletionFunc("chaos-infra-id", completion.ChaosInfraFlagCompletion) + infraCmd.RegisterFlagCompletionFunc("chaos-infra-id", completion.ChaosInfraFlagCompletion) } diff --git a/pkg/cmd/upgrade/upgrade.go b/pkg/cmd/upgrade/upgrade.go index deb5d5ea..88a66bfe 100644 --- a/pkg/cmd/upgrade/upgrade.go +++ b/pkg/cmd/upgrade/upgrade.go @@ -23,8 +23,8 @@ import ( var UpgradeCmd = &cobra.Command{ Use: "upgrade", Short: `Examples: - #upgrade version of your Chaos Delegate - litmusctl upgrade chaos-delegate --chaos-delegate-id="4cc25543-36c8-4373-897b-2e5dbbe87bcf" --project-id="d861b650-1549-4574-b2ba-ab754058dd04" --non-interactive + #upgrade version of your Chaos Infrastructure + litmusctl upgrade chaos-infra --chaos-infra-id="4cc25543-36c8-4373-897b-2e5dbbe87bcf" --project-id="d861b650-1549-4574-b2ba-ab754058dd04" --non-interactive Note: The default location of the config file is $HOME/.litmusconfig, and can be overridden by a --config flag `, diff --git a/pkg/ops/ops.go b/pkg/infra_ops/ops.go similarity index 99% rename from pkg/ops/ops.go rename to pkg/infra_ops/ops.go index 129cff47..b4a2119b 100644 --- a/pkg/ops/ops.go +++ b/pkg/infra_ops/ops.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package ops +package infra_ops import ( "fmt" diff --git a/pkg/ops/platform.go b/pkg/infra_ops/platform.go similarity index 99% rename from pkg/ops/platform.go rename to pkg/infra_ops/platform.go index 3952c71c..dbd636f8 100644 --- a/pkg/ops/platform.go +++ b/pkg/infra_ops/platform.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package ops +package infra_ops import ( "context" diff --git a/pkg/types/api_types.go b/pkg/types/api_types.go index 1f62a11e..8b5da688 100644 --- a/pkg/types/api_types.go +++ b/pkg/types/api_types.go @@ -23,8 +23,8 @@ const ( ) type AuthResponse struct { - AccessToken string `json:"access_token"` - ExpiresIn int64 `json:"expires_in"` + AccessToken string `json:"accessToken"` + ExpiresIn int64 `json:"expiresIn"` Type string `json:"type"` } diff --git a/pkg/types/agent_types.go b/pkg/types/infra_types.go similarity index 100% rename from pkg/types/agent_types.go rename to pkg/types/infra_types.go diff --git a/pkg/utils/compatibility.go b/pkg/utils/compatibility.go index 46903cb7..671919f7 100644 --- a/pkg/utils/compatibility.go +++ b/pkg/utils/compatibility.go @@ -19,6 +19,8 @@ var ( "0.19.0": {"2.9.0", "2.10.0", "2.11.0", "2.12.0", "2.13.0", "2.14.0", "3.0-beta1", "3.0.0-beta2", "3.0.0-beta3", "3.0.0-beta4", "3.0.0-beta5", "3.0.0-beta6", "3.0.0-beta7", "3.0.0-beta8"}, "0.20.0": {"2.9.0", "2.10.0", "2.11.0", "2.12.0", "2.13.0", "2.14.0", "3.0-beta1", "3.0.0-beta2", "3.0.0-beta3", "3.0.0-beta4", "3.0.0-beta5", "3.0.0-beta6", "3.0.0-beta7", "3.0.0-beta8"}, "0.21.0": {"2.9.0", "2.10.0", "2.11.0", "2.12.0", "2.13.0", "2.14.0", "3.0-beta1", "3.0.0-beta2", "3.0.0-beta3", "3.0.0-beta4", "3.0.0-beta5", "3.0.0-beta6", "3.0.0-beta7", "3.0.0-beta8"}, - "0.22.0": {"3.0.0-beta9", "3.0.0-beta10", "3.0.0-beta11"}, + "0.22.0": {"2.9.0", "2.10.0", "2.11.0", "2.12.0", "2.13.0", "2.14.0", "3.0-beta1", "3.0.0-beta2", "3.0.0-beta3", "3.0.0-beta4", "3.0.0-beta5", "3.0.0-beta6", "3.0.0-beta7", "3.0.0-beta8"}, + "0.23.0": {"3.0.0-beta9", "3.0.0-beta10", "3.0.0-beta11", "3.0.0-beta12"}, + "0.24.0": {"3.0.0-beta9", "3.0.0-beta10", "3.0.0-beta11", "3.0.0-beta12"}, } )