utils

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Copyright © 2021 The LitmusChaos Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 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.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 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.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 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.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 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.

Index

Constants

View Source
const (
	DefaultFileName = ".litmusconfig"

	// Default username
	DefaultUsername = "admin"

	// Default installation mode
	DefaultMode = "cluster"

	// Platform list
	PlatformList = "1. AWS\n2. GKE\n3. Openshift\n4. Rancher\n5. Others"

	// AWS identifier
	AWSIdentifier = "aws://"

	// GKE identifier
	GKEIdentifier = "gce://"

	// Openshift identifier
	OpenshiftIdentifier = "node.openshift.io/os_id"

	// Default platform name
	DefaultPlatform = "Others"

	// Label of subscriber agent being deployed
	ChaosAgentLabel = "app=subscriber"

	// Agent type is "external" for agents connected via litmusctl
	AgentType = "external"

	// Default namespace for agent installation
	DefaultNs = "litmus"

	// Default service account used for agent installation
	DefaultSA = "litmus"

	// Chaos agent connection yaml path
	ChaosYamlPath = "api/file"

	ChaosAgentPath = "targets"

	// Graphql server api path
	GQLAPIPath = "/api/query"

	// Auth server api path
	AuthAPIPath = "/auth"
)

Variables

View Source
var (
	Red     = color.New(color.FgRed)
	White_B = color.New(color.FgWhite, color.Bold)
	White   = color.New(color.FgWhite)
)
View Source
var (
	// CompatibilityMatrix to store the compatible versions of litmusctl and ChaosCenter
	CompatibilityMatrix = map[string][]string{
		"0.6.0":  {"2.2.0", "2.3.0"},
		"0.7.0":  {"2.4.0", "2.5.0", "2.6.0", "2.7.0", "2.8.0"},
		"0.8.0":  {"2.4.0", "2.5.0", "2.6.0", "2.7.0", "2.8.0"},
		"0.9.0":  {"2.4.0", "2.5.0", "2.6.0", "2.7.0", "2.8.0"},
		"0.10.0": {"2.9.0", "2.10.0", "2.11.0", "2.12.0"},
		"0.11.0": {"2.9.0", "2.10.0", "2.11.0", "2.12.0"},
		"0.12.0": {"2.9.0", "2.10.0", "2.11.0", "2.12.0"},
	}
)

Functions

func CheckKeyValueFormat

func CheckKeyValueFormat(str string) bool

func FetchWeightages added in v0.11.0

func FetchWeightages(chaosWorkFlowRequest *model.ChaosWorkFlowRequest, templates []v1alpha1.Template) error

FetchWeightages takes in the templates present in the workflow spec and assigns weightage to each of the experiments present in them. It can parse both artifacts and remote experiment specs.

func GenerateRandomString

func GenerateRandomString(n int) (string, error)

func GetCredentials

func GetCredentials(cmd *cobra.Command) (types.Credentials, error)

func GetLitmusConfigPath

func GetLitmusConfigPath(cmd *cobra.Command) string

func ParseWorkflowManifest added in v0.11.0

func ParseWorkflowManifest(file string, chaosWorkFlowRequest *model.ChaosWorkFlowRequest) error

ParseWorkflowManifest reads the manifest that is passed as an argument and populates the payload for the CreateChaosWorkflow API request. The manifest can be either a local file or a remote file.

func PrintError

func PrintError(err error)

func PrintInJsonFormat

func PrintInJsonFormat(inf interface{})

func PrintInYamlFormat

func PrintInYamlFormat(inf interface{})

func ReadRemoteFile added in v0.11.0

func ReadRemoteFile(url string) ([]byte, error)

ReadRemoteFile reads a given remote file.

func Scanner

func Scanner() string

func UnmarshalObject added in v0.11.0

func UnmarshalObject(body []byte, obj interface{}) error

UnmarshalObject unmarshals the given body into the given interface. It converts to JSON first for consistent parsing and also to support both YAML and JSON with the same function.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL