diff --git a/chaoslib/litmus/container-kill/helper/container-kill.go b/chaoslib/litmus/container-kill/helper/container-kill.go index d92b15956..0a18bfa41 100644 --- a/chaoslib/litmus/container-kill/helper/container-kill.go +++ b/chaoslib/litmus/container-kill/helper/container-kill.go @@ -171,7 +171,7 @@ func validate(t targetDetails, timeout, delay int, clients clients.ClientSets) e return verifyRestartCount(t, timeout, delay, clients, t.RestartCountBefore) } -//stopContainerdContainer kill the application container +// stopContainerdContainer kill the application container func stopContainerdContainer(containerIDs []string, socketPath, signal, source string) error { if signal != "SIGKILL" && signal != "SIGTERM" { return cerrors.Error{ErrorCode: cerrors.ErrorTypeHelper, Source: source, Reason: fmt.Sprintf("unsupported signal %s, use either SIGTERM or SIGKILL", signal)} @@ -192,7 +192,7 @@ func stopContainerdContainer(containerIDs []string, socketPath, signal, source s return nil } -//stopDockerContainer kill the application container +// stopDockerContainer kill the application container func stopDockerContainer(containerIDs []string, socketPath, signal, source string) error { var errOut, out bytes.Buffer cmd := exec.Command("sudo", "docker", "--host", fmt.Sprintf("unix://%s", socketPath), "kill", "--signal", signal) @@ -205,7 +205,7 @@ func stopDockerContainer(containerIDs []string, socketPath, signal, source strin return nil } -//getRestartCount return the restart count of target container +// getRestartCount return the restart count of target container func getRestartCount(target targetDetails, clients clients.ClientSets) (int, error) { pod, err := clients.KubeClient.CoreV1().Pods(target.Namespace).Get(context.Background(), target.Name, v1.GetOptions{}) if err != nil { @@ -221,7 +221,7 @@ func getRestartCount(target targetDetails, clients clients.ClientSets) (int, err return restartCount, nil } -//verifyRestartCount verify the restart count of target container that it is restarted or not after chaos injection +// verifyRestartCount verify the restart count of target container that it is restarted or not after chaos injection func verifyRestartCount(t targetDetails, timeout, delay int, clients clients.ClientSets, restartCountBefore int) error { restartCountAfter := 0 @@ -247,7 +247,7 @@ func verifyRestartCount(t targetDetails, timeout, delay int, clients clients.Cli }) } -//getENV fetches all the env variables from the runner pod +// getENV fetches all the env variables from the runner pod func getENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "") experimentDetails.InstanceID = types.Getenv("INSTANCE_ID", "") diff --git a/chaoslib/litmus/container-kill/lib/container-kill.go b/chaoslib/litmus/container-kill/lib/container-kill.go index 79c92b776..028e1301e 100644 --- a/chaoslib/litmus/container-kill/lib/container-kill.go +++ b/chaoslib/litmus/container-kill/lib/container-kill.go @@ -22,7 +22,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -//PrepareContainerKill contains the preparation steps before chaos injection +// PrepareContainerKill contains the preparation steps before chaos injection func PrepareContainerKill(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { var err error @@ -280,8 +280,8 @@ func getPodEnv(experimentsDetails *experimentTypes.ExperimentDetails, targets st return envDetails.ENV } -//SetChaosTunables will setup a random value within a given range of values -//If the value is not provided in range it'll setup the initial provided value. +// SetChaosTunables will setup a random value within a given range of values +// If the value is not provided in range it'll setup the initial provided value. func SetChaosTunables(experimentsDetails *experimentTypes.ExperimentDetails) { experimentsDetails.PodsAffectedPerc = common.ValidateRange(experimentsDetails.PodsAffectedPerc) experimentsDetails.Sequence = common.GetRandomSequence(experimentsDetails.Sequence) diff --git a/chaoslib/litmus/disk-fill/lib/disk-fill.go b/chaoslib/litmus/disk-fill/lib/disk-fill.go index cf0192abd..6c261bab2 100644 --- a/chaoslib/litmus/disk-fill/lib/disk-fill.go +++ b/chaoslib/litmus/disk-fill/lib/disk-fill.go @@ -23,7 +23,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -//PrepareDiskFill contains the preparation steps before chaos injection +// PrepareDiskFill contains the preparation steps before chaos injection func PrepareDiskFill(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { var err error diff --git a/chaoslib/litmus/http-chaos/lib/header/header.go b/chaoslib/litmus/http-chaos/lib/header/header.go index 737efb2a5..60e63ec81 100644 --- a/chaoslib/litmus/http-chaos/lib/header/header.go +++ b/chaoslib/litmus/http-chaos/lib/header/header.go @@ -9,7 +9,7 @@ import ( "github.com/sirupsen/logrus" ) -//PodHttpModifyHeaderChaos contains the steps to prepare and inject http modify header chaos +// PodHttpModifyHeaderChaos contains the steps to prepare and inject http modify header chaos func PodHttpModifyHeaderChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { log.InfoWithValues("[Info]: The chaos tunables are:", logrus.Fields{ diff --git a/chaoslib/litmus/http-chaos/lib/http-chaos.go b/chaoslib/litmus/http-chaos/lib/http-chaos.go index 3d2b11600..9bf398091 100644 --- a/chaoslib/litmus/http-chaos/lib/http-chaos.go +++ b/chaoslib/litmus/http-chaos/lib/http-chaos.go @@ -22,7 +22,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -//PrepareAndInjectChaos contains the preparation & injection steps +// PrepareAndInjectChaos contains the preparation & injection steps func PrepareAndInjectChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails, args string) error { var err error @@ -284,8 +284,8 @@ func getPodEnv(experimentsDetails *experimentTypes.ExperimentDetails, targets, a return envDetails.ENV } -//SetChaosTunables will set up a random value within a given range of values -//If the value is not provided in range it'll set up the initial provided value. +// SetChaosTunables will set up a random value within a given range of values +// If the value is not provided in range it'll set up the initial provided value. func SetChaosTunables(experimentsDetails *experimentTypes.ExperimentDetails) { experimentsDetails.PodsAffectedPerc = common.ValidateRange(experimentsDetails.PodsAffectedPerc) experimentsDetails.Sequence = common.GetRandomSequence(experimentsDetails.Sequence) diff --git a/chaoslib/litmus/http-chaos/lib/latency/latency.go b/chaoslib/litmus/http-chaos/lib/latency/latency.go index df9c11278..cb96672ce 100644 --- a/chaoslib/litmus/http-chaos/lib/latency/latency.go +++ b/chaoslib/litmus/http-chaos/lib/latency/latency.go @@ -11,7 +11,7 @@ import ( "github.com/sirupsen/logrus" ) -//PodHttpLatencyChaos contains the steps to prepare and inject http latency chaos +// PodHttpLatencyChaos contains the steps to prepare and inject http latency chaos func PodHttpLatencyChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { log.InfoWithValues("[Info]: The chaos tunables are:", logrus.Fields{ diff --git a/chaoslib/litmus/http-chaos/lib/reset/reset.go b/chaoslib/litmus/http-chaos/lib/reset/reset.go index 20838ca3c..8a0f7691e 100644 --- a/chaoslib/litmus/http-chaos/lib/reset/reset.go +++ b/chaoslib/litmus/http-chaos/lib/reset/reset.go @@ -11,7 +11,7 @@ import ( "github.com/sirupsen/logrus" ) -//PodHttpResetPeerChaos contains the steps to prepare and inject http reset peer chaos +// PodHttpResetPeerChaos contains the steps to prepare and inject http reset peer chaos func PodHttpResetPeerChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { log.InfoWithValues("[Info]: The chaos tunables are:", logrus.Fields{ diff --git a/chaoslib/litmus/network-chaos/helper/netem.go b/chaoslib/litmus/network-chaos/helper/netem.go index c0193f518..88b02ec6f 100644 --- a/chaoslib/litmus/network-chaos/helper/netem.go +++ b/chaoslib/litmus/network-chaos/helper/netem.go @@ -76,7 +76,7 @@ func Helper(clients clients.ClientSets) { } -//preparePodNetworkChaos contains the prepration steps before chaos injection +// preparePodNetworkChaos contains the prepration steps before chaos injection func preparePodNetworkChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails, resultDetails *types.ResultDetails) error { targetEnv := os.Getenv("TARGETS") @@ -295,7 +295,7 @@ type targetDetails struct { Source string } -//getENV fetches all the env variables from the runner pod +// getENV fetches all the env variables from the runner pod func getENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "") experimentDetails.InstanceID = types.Getenv("INSTANCE_ID", "") diff --git a/chaoslib/litmus/network-chaos/lib/corruption/corruption.go b/chaoslib/litmus/network-chaos/lib/corruption/corruption.go index 78974f0f9..c63d7d600 100644 --- a/chaoslib/litmus/network-chaos/lib/corruption/corruption.go +++ b/chaoslib/litmus/network-chaos/lib/corruption/corruption.go @@ -7,7 +7,7 @@ import ( "github.com/litmuschaos/litmus-go/pkg/types" ) -//PodNetworkCorruptionChaos contains the steps to prepare and inject chaos +// PodNetworkCorruptionChaos contains the steps to prepare and inject chaos func PodNetworkCorruptionChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { args := "corrupt " + experimentsDetails.NetworkPacketCorruptionPercentage diff --git a/chaoslib/litmus/network-chaos/lib/duplication/duplication.go b/chaoslib/litmus/network-chaos/lib/duplication/duplication.go index a5705f0a2..8e6753fa1 100644 --- a/chaoslib/litmus/network-chaos/lib/duplication/duplication.go +++ b/chaoslib/litmus/network-chaos/lib/duplication/duplication.go @@ -7,7 +7,7 @@ import ( "github.com/litmuschaos/litmus-go/pkg/types" ) -//PodNetworkDuplicationChaos contains the steps to prepare and inject chaos +// PodNetworkDuplicationChaos contains the steps to prepare and inject chaos func PodNetworkDuplicationChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { args := "duplicate " + experimentsDetails.NetworkPacketDuplicationPercentage diff --git a/chaoslib/litmus/network-chaos/lib/latency/latency.go b/chaoslib/litmus/network-chaos/lib/latency/latency.go index c5482f1d9..1e3fc08f0 100644 --- a/chaoslib/litmus/network-chaos/lib/latency/latency.go +++ b/chaoslib/litmus/network-chaos/lib/latency/latency.go @@ -9,7 +9,7 @@ import ( "github.com/litmuschaos/litmus-go/pkg/types" ) -//PodNetworkLatencyChaos contains the steps to prepare and inject chaos +// PodNetworkLatencyChaos contains the steps to prepare and inject chaos func PodNetworkLatencyChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { args := "delay " + strconv.Itoa(experimentsDetails.NetworkLatency) + "ms " + strconv.Itoa(experimentsDetails.Jitter) + "ms" diff --git a/chaoslib/litmus/network-chaos/lib/loss/loss.go b/chaoslib/litmus/network-chaos/lib/loss/loss.go index 419f37da9..b90949386 100644 --- a/chaoslib/litmus/network-chaos/lib/loss/loss.go +++ b/chaoslib/litmus/network-chaos/lib/loss/loss.go @@ -7,7 +7,7 @@ import ( "github.com/litmuschaos/litmus-go/pkg/types" ) -//PodNetworkLossChaos contains the steps to prepare and inject chaos +// PodNetworkLossChaos contains the steps to prepare and inject chaos func PodNetworkLossChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { args := "loss " + experimentsDetails.NetworkPacketLossPercentage diff --git a/chaoslib/litmus/network-chaos/lib/network-chaos.go b/chaoslib/litmus/network-chaos/lib/network-chaos.go index deeaba98c..2b302fc22 100644 --- a/chaoslib/litmus/network-chaos/lib/network-chaos.go +++ b/chaoslib/litmus/network-chaos/lib/network-chaos.go @@ -28,7 +28,7 @@ var serviceMesh = []string{"istio", "envoy"} var destIpsSvcMesh string var destIps string -//PrepareAndInjectChaos contains the preparation & injection steps +// PrepareAndInjectChaos contains the preparation & injection steps func PrepareAndInjectChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails, args string) error { var err error @@ -414,8 +414,8 @@ func getIpsForTargetHosts(targetHosts string, clients clients.ClientSets, servic return strings.Join(commaSeparatedIPs, ","), nil } -//SetChaosTunables will set up a random value within a given range of values -//If the value is not provided in range it'll set up the initial provided value. +// SetChaosTunables will set up a random value within a given range of values +// If the value is not provided in range it'll set up the initial provided value. func SetChaosTunables(experimentsDetails *experimentTypes.ExperimentDetails) { experimentsDetails.NetworkPacketLossPercentage = common.ValidateRange(experimentsDetails.NetworkPacketLossPercentage) experimentsDetails.NetworkPacketCorruptionPercentage = common.ValidateRange(experimentsDetails.NetworkPacketCorruptionPercentage) diff --git a/chaoslib/litmus/node-cpu-hog/lib/node-cpu-hog.go b/chaoslib/litmus/node-cpu-hog/lib/node-cpu-hog.go index 6e9e1f0b8..b19bbfcc7 100644 --- a/chaoslib/litmus/node-cpu-hog/lib/node-cpu-hog.go +++ b/chaoslib/litmus/node-cpu-hog/lib/node-cpu-hog.go @@ -217,7 +217,7 @@ func injectChaosInParallelMode(experimentsDetails *experimentTypes.ExperimentDet return nil } -//setCPUCapacity fetch the node cpu capacity +// setCPUCapacity fetch the node cpu capacity func setCPUCapacity(experimentsDetails *experimentTypes.ExperimentDetails, appNode string, clients clients.ClientSets) error { node, err := clients.KubeClient.CoreV1().Nodes().Get(context.Background(), appNode, v1.GetOptions{}) if err != nil { @@ -278,8 +278,8 @@ func createHelperPod(experimentsDetails *experimentTypes.ExperimentDetails, chao return nil } -//setChaosTunables will set up a random value within a given range of values -//If the value is not provided in range it'll set up the initial provided value. +// setChaosTunables will set up a random value within a given range of values +// If the value is not provided in range it'll set up the initial provided value. func setChaosTunables(experimentsDetails *experimentTypes.ExperimentDetails) { experimentsDetails.NodeCPUcores = common.ValidateRange(experimentsDetails.NodeCPUcores) experimentsDetails.CPULoad = common.ValidateRange(experimentsDetails.CPULoad) diff --git a/chaoslib/litmus/node-drain/lib/node-drain.go b/chaoslib/litmus/node-drain/lib/node-drain.go index 860c675ee..13aaa2883 100644 --- a/chaoslib/litmus/node-drain/lib/node-drain.go +++ b/chaoslib/litmus/node-drain/lib/node-drain.go @@ -31,7 +31,7 @@ var ( inject, abort chan os.Signal ) -//PrepareNodeDrain contains the preparation steps before chaos injection +// PrepareNodeDrain contains the preparation steps before chaos injection func PrepareNodeDrain(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { // inject channel is used to transmit signal notifications. diff --git a/chaoslib/litmus/node-io-stress/lib/node-io-stress.go b/chaoslib/litmus/node-io-stress/lib/node-io-stress.go index abcc1530d..34dc6d4cb 100644 --- a/chaoslib/litmus/node-io-stress/lib/node-io-stress.go +++ b/chaoslib/litmus/node-io-stress/lib/node-io-stress.go @@ -287,8 +287,8 @@ func getContainerArguments(experimentsDetails *experimentTypes.ExperimentDetails return stressArgs } -//setChaosTunables will set up a random value within a given range of values -//If the value is not provided in range it'll set up the initial provided value. +// setChaosTunables will set up a random value within a given range of values +// If the value is not provided in range it'll set up the initial provided value. func setChaosTunables(experimentsDetails *experimentTypes.ExperimentDetails) { experimentsDetails.FilesystemUtilizationBytes = common.ValidateRange(experimentsDetails.FilesystemUtilizationBytes) experimentsDetails.FilesystemUtilizationPercentage = common.ValidateRange(experimentsDetails.FilesystemUtilizationPercentage) diff --git a/chaoslib/litmus/node-memory-hog/lib/node-memory-hog.go b/chaoslib/litmus/node-memory-hog/lib/node-memory-hog.go index 9ab8bc251..9431c109e 100644 --- a/chaoslib/litmus/node-memory-hog/lib/node-memory-hog.go +++ b/chaoslib/litmus/node-memory-hog/lib/node-memory-hog.go @@ -362,8 +362,8 @@ func createHelperPod(experimentsDetails *experimentTypes.ExperimentDetails, chao return nil } -//setChaosTunables will set up a random value within a given range of values -//If the value is not provided in range it'll set up the initial provided value. +// setChaosTunables will set up a random value within a given range of values +// If the value is not provided in range it'll set up the initial provided value. func setChaosTunables(experimentsDetails *experimentTypes.ExperimentDetails) { experimentsDetails.MemoryConsumptionMebibytes = common.ValidateRange(experimentsDetails.MemoryConsumptionMebibytes) experimentsDetails.MemoryConsumptionPercentage = common.ValidateRange(experimentsDetails.MemoryConsumptionPercentage) diff --git a/chaoslib/litmus/node-taint/lib/node-taint.go b/chaoslib/litmus/node-taint/lib/node-taint.go index 1d48078e8..aa4046a9a 100644 --- a/chaoslib/litmus/node-taint/lib/node-taint.go +++ b/chaoslib/litmus/node-taint/lib/node-taint.go @@ -28,7 +28,7 @@ var ( inject, abort chan os.Signal ) -//PrepareNodeTaint contains the preparation steps before chaos injection +// PrepareNodeTaint contains the preparation steps before chaos injection func PrepareNodeTaint(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { // inject channel is used to transmit signal notifications. diff --git a/chaoslib/litmus/pod-autoscaler/lib/pod-autoscaler.go b/chaoslib/litmus/pod-autoscaler/lib/pod-autoscaler.go index 813d514ec..18a650cc7 100644 --- a/chaoslib/litmus/pod-autoscaler/lib/pod-autoscaler.go +++ b/chaoslib/litmus/pod-autoscaler/lib/pod-autoscaler.go @@ -31,7 +31,7 @@ var ( appsv1StatefulsetClient appsv1.StatefulSetInterface ) -//PreparePodAutoscaler contains the preparation steps and chaos injection steps +// PreparePodAutoscaler contains the preparation steps and chaos injection steps func PreparePodAutoscaler(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { //Waiting for the ramp time before chaos injection @@ -117,7 +117,7 @@ func getSliceOfTotalApplicationsTargeted(appList []experimentTypes.ApplicationUn return appList[:newAppListLength] } -//getDeploymentDetails is used to get the name and total number of replicas of the deployment +// getDeploymentDetails is used to get the name and total number of replicas of the deployment func getDeploymentDetails(experimentsDetails *experimentTypes.ExperimentDetails) ([]experimentTypes.ApplicationUnderTest, error) { deploymentList, err := appsv1DeploymentClient.List(context.Background(), metav1.ListOptions{LabelSelector: experimentsDetails.AppLabel}) @@ -135,7 +135,7 @@ func getDeploymentDetails(experimentsDetails *experimentTypes.ExperimentDetails) return getSliceOfTotalApplicationsTargeted(appsUnderTest, experimentsDetails), nil } -//getStatefulsetDetails is used to get the name and total number of replicas of the statefulsets +// getStatefulsetDetails is used to get the name and total number of replicas of the statefulsets func getStatefulsetDetails(experimentsDetails *experimentTypes.ExperimentDetails) ([]experimentTypes.ApplicationUnderTest, error) { statefulsetList, err := appsv1StatefulsetClient.List(context.Background(), metav1.ListOptions{LabelSelector: experimentsDetails.AppLabel}) @@ -154,7 +154,7 @@ func getStatefulsetDetails(experimentsDetails *experimentTypes.ExperimentDetails return getSliceOfTotalApplicationsTargeted(appsUnderTest, experimentsDetails), nil } -//podAutoscalerChaosInDeployment scales up the replicas of deployment and verify the status +// podAutoscalerChaosInDeployment scales up the replicas of deployment and verify the status func podAutoscalerChaosInDeployment(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, appsUnderTest []experimentTypes.ApplicationUnderTest, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { // Scale Application @@ -185,7 +185,7 @@ func podAutoscalerChaosInDeployment(experimentsDetails *experimentTypes.Experime return deploymentStatusCheck(experimentsDetails, clients, appsUnderTest, resultDetails, eventsDetails, chaosDetails) } -//podAutoscalerChaosInStatefulset scales up the replicas of statefulset and verify the status +// podAutoscalerChaosInStatefulset scales up the replicas of statefulset and verify the status func podAutoscalerChaosInStatefulset(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, appsUnderTest []experimentTypes.ApplicationUnderTest, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { // Scale Application @@ -305,7 +305,7 @@ func statefulsetStatusCheck(experimentsDetails *experimentTypes.ExperimentDetail return nil } -//autoscalerRecoveryInDeployment rollback the replicas to initial values in deployment +// autoscalerRecoveryInDeployment rollback the replicas to initial values in deployment func autoscalerRecoveryInDeployment(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, appsUnderTest []experimentTypes.ApplicationUnderTest, chaosDetails *types.ChaosDetails) error { // Scale back to initial number of replicas @@ -351,7 +351,7 @@ func autoscalerRecoveryInDeployment(experimentsDetails *experimentTypes.Experime }) } -//autoscalerRecoveryInStatefulset rollback the replicas to initial values in deployment +// autoscalerRecoveryInStatefulset rollback the replicas to initial values in deployment func autoscalerRecoveryInStatefulset(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, appsUnderTest []experimentTypes.ApplicationUnderTest, chaosDetails *types.ChaosDetails) error { // Scale back to initial number of replicas @@ -399,7 +399,7 @@ func autoscalerRecoveryInStatefulset(experimentsDetails *experimentTypes.Experim func int32Ptr(i int32) *int32 { return &i } -//abortPodAutoScalerChaos go routine will continuously watch for the abort signal for the entire chaos duration and generate the required events and result +// abortPodAutoScalerChaos go routine will continuously watch for the abort signal for the entire chaos duration and generate the required events and result func abortPodAutoScalerChaos(appsUnderTest []experimentTypes.ApplicationUnderTest, experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) { // signChan channel is used to transmit signal notifications. diff --git a/chaoslib/litmus/pod-cpu-hog-exec/lib/pod-cpu-hog-exec.go b/chaoslib/litmus/pod-cpu-hog-exec/lib/pod-cpu-hog-exec.go index 0e4c86caa..eaeac5d03 100644 --- a/chaoslib/litmus/pod-cpu-hog-exec/lib/pod-cpu-hog-exec.go +++ b/chaoslib/litmus/pod-cpu-hog-exec/lib/pod-cpu-hog-exec.go @@ -25,7 +25,7 @@ import ( var inject chan os.Signal -//PrepareCPUExecStress contains the chaos preparation and injection steps +// PrepareCPUExecStress contains the chaos preparation and injection steps func PrepareCPUExecStress(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { // inject channel is used to transmit signal notifications. @@ -62,7 +62,7 @@ func stressCPU(experimentsDetails *experimentTypes.ExperimentDetails, podName, n stressErr <- err } -//experimentCPU function orchestrates the experiment by calling the StressCPU function for every core, of every container, of every pod that is targeted +// experimentCPU function orchestrates the experiment by calling the StressCPU function for every core, of every container, of every pod that is targeted func experimentCPU(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { // Get the target pod details for the chaos execution @@ -287,7 +287,8 @@ loop: } // killStressCPUSerial function to kill a stress process running inside target container -// Triggered by either timeout of chaos duration or termination of the experiment +// +// Triggered by either timeout of chaos duration or termination of the experiment func killStressCPUSerial(experimentsDetails *experimentTypes.ExperimentDetails, podName, ns string, clients clients.ClientSets, chaosDetails *types.ChaosDetails) error { // It will contain all the pod & container details required for exec command execCommandDetails := litmusexec.PodDetails{} diff --git a/chaoslib/litmus/pod-dns-chaos/helper/dnschaos.go b/chaoslib/litmus/pod-dns-chaos/helper/dnschaos.go index c80a5a1fc..794da032e 100644 --- a/chaoslib/litmus/pod-dns-chaos/helper/dnschaos.go +++ b/chaoslib/litmus/pod-dns-chaos/helper/dnschaos.go @@ -74,7 +74,7 @@ func Helper(clients clients.ClientSets) { } -//preparePodDNSChaos contains the preparation steps before chaos injection +// preparePodDNSChaos contains the preparation steps before chaos injection func preparePodDNSChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails, resultDetails *types.ResultDetails) error { targetList, err := common.ParseTargets(chaosDetails.ChaosPodName) @@ -264,7 +264,7 @@ func abortWatcher(targets []targetDetails, resultName, chaosNS string) { os.Exit(1) } -//getENV fetches all the env variables from the runner pod +// getENV fetches all the env variables from the runner pod func getENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "") experimentDetails.InstanceID = types.Getenv("INSTANCE_ID", "") diff --git a/chaoslib/litmus/pod-dns-chaos/lib/pod-dns-chaos.go b/chaoslib/litmus/pod-dns-chaos/lib/pod-dns-chaos.go index 3910a48f1..34f0560ef 100644 --- a/chaoslib/litmus/pod-dns-chaos/lib/pod-dns-chaos.go +++ b/chaoslib/litmus/pod-dns-chaos/lib/pod-dns-chaos.go @@ -23,7 +23,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -//PrepareAndInjectChaos contains the preparation & injection steps +// PrepareAndInjectChaos contains the preparation & injection steps func PrepareAndInjectChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { // Get the target pod details for the chaos execution diff --git a/chaoslib/litmus/pod-fio-stress/lib/pod-fio-stress.go b/chaoslib/litmus/pod-fio-stress/lib/pod-fio-stress.go index a289bd5ba..52275c324 100644 --- a/chaoslib/litmus/pod-fio-stress/lib/pod-fio-stress.go +++ b/chaoslib/litmus/pod-fio-stress/lib/pod-fio-stress.go @@ -24,7 +24,7 @@ import ( corev1 "k8s.io/api/core/v1" ) -//PrepareChaos contains the chaos preparation and injection steps +// PrepareChaos contains the chaos preparation and injection steps func PrepareChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { //Waiting for the ramp time before chaos injection @@ -66,7 +66,7 @@ func stressStorage(experimentDetails *experimentTypes.ExperimentDetails, podName stressErr <- err } -//experimentExecution function orchestrates the experiment by calling the StressStorage function, of every container, of every pod that is targeted +// experimentExecution function orchestrates the experiment by calling the StressStorage function, of every container, of every pod that is targeted func experimentExecution(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { // Get the target pod details for the chaos execution @@ -265,7 +265,8 @@ loop: } // killStressSerial function to kill a stress process running inside target container -// Triggered by either timeout of chaos duration or termination of the experiment +// +// Triggered by either timeout of chaos duration or termination of the experiment func killStressSerial(containerName, podName, namespace, KillCmd string, clients clients.ClientSets) error { // It will contain all the pod & container details required for exec command execCommandDetails := litmusexec.PodDetails{} diff --git a/chaoslib/litmus/pod-memory-hog-exec/lib/pod-memory-hog-exec.go b/chaoslib/litmus/pod-memory-hog-exec/lib/pod-memory-hog-exec.go index 18aec9a66..677f44fd7 100644 --- a/chaoslib/litmus/pod-memory-hog-exec/lib/pod-memory-hog-exec.go +++ b/chaoslib/litmus/pod-memory-hog-exec/lib/pod-memory-hog-exec.go @@ -27,7 +27,7 @@ import ( var inject chan os.Signal -//PrepareMemoryExecStress contains the chaos preparation and injection steps +// PrepareMemoryExecStress contains the chaos preparation and injection steps func PrepareMemoryExecStress(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { // inject channel is used to transmit signal notifications. @@ -71,7 +71,7 @@ func stressMemory(MemoryConsumption, containerName, podName, namespace string, c stressErr <- err } -//experimentMemory function orchestrates the experiment by calling the StressMemory function, of every container, of every pod that is targeted +// experimentMemory function orchestrates the experiment by calling the StressMemory function, of every container, of every pod that is targeted func experimentMemory(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { // Get the target pod details for the chaos execution @@ -291,7 +291,8 @@ loop: } // killStressMemorySerial function to kill a stress process running inside target container -// Triggered by either timeout of chaos duration or termination of the experiment +// +// Triggered by either timeout of chaos duration or termination of the experiment func killStressMemorySerial(containerName, podName, namespace, memFreeCmd string, clients clients.ClientSets, chaosDetails *types.ChaosDetails) error { // It will contains all the pod & container details required for exec command execCommandDetails := litmusexec.PodDetails{} diff --git a/chaoslib/litmus/pod-network-partition/lib/pod-network-partition.go b/chaoslib/litmus/pod-network-partition/lib/pod-network-partition.go index 7fb31b04b..63db37274 100644 --- a/chaoslib/litmus/pod-network-partition/lib/pod-network-partition.go +++ b/chaoslib/litmus/pod-network-partition/lib/pod-network-partition.go @@ -31,7 +31,7 @@ var ( inject, abort chan os.Signal ) -//PrepareAndInjectChaos contains the prepration & injection steps +// PrepareAndInjectChaos contains the prepration & injection steps func PrepareAndInjectChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { // inject channel is used to transmit signal notifications. diff --git a/chaoslib/litmus/stress-chaos/helper/stress-helper.go b/chaoslib/litmus/stress-chaos/helper/stress-helper.go index 1846d0197..8b46f001b 100644 --- a/chaoslib/litmus/stress-chaos/helper/stress-helper.go +++ b/chaoslib/litmus/stress-chaos/helper/stress-helper.go @@ -30,7 +30,7 @@ import ( clientTypes "k8s.io/apimachinery/pkg/types" ) -//list of cgroups in a container +// list of cgroups in a container var ( cgroupSubsystemList = []string{"cpu", "memory", "systemd", "net_cls", "net_prio", "freezer", "blkio", "perf_event", "devices", "cpuset", @@ -91,7 +91,7 @@ func Helper(clients clients.ClientSets) { } } -//prepareStressChaos contains the chaos preparation and injection steps +// prepareStressChaos contains the chaos preparation and injection steps func prepareStressChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails, resultDetails *types.ResultDetails) error { // get stressors in list format stressorList := prepareStressor(experimentsDetails) @@ -244,7 +244,7 @@ func prepareStressChaos(experimentsDetails *experimentTypes.ExperimentDetails, c return nil } -//terminateProcess will remove the stress process from the target container after chaos completion +// terminateProcess will remove the stress process from the target container after chaos completion func terminateProcess(t targetDetails) error { if err := syscall.Kill(-t.Cmd.Process.Pid, syscall.SIGKILL); err != nil { if strings.Contains(err.Error(), ProcessAlreadyKilled) || strings.Contains(err.Error(), ProcessAlreadyFinished) { @@ -256,7 +256,7 @@ func terminateProcess(t targetDetails) error { return nil } -//prepareStressor will set the required stressors for the given experiment +// prepareStressor will set the required stressors for the given experiment func prepareStressor(experimentDetails *experimentTypes.ExperimentDetails) []string { stressArgs := []string{ @@ -324,7 +324,7 @@ func prepareStressor(experimentDetails *experimentTypes.ExperimentDetails) []str return stressArgs } -//pidPath will get the pid path of the container +// pidPath will get the pid path of the container func pidPath(t targetDetails) cgroups.Path { processPath := "/proc/" + strconv.Itoa(t.Pid) + "/cgroup" paths, err := parseCgroupFile(processPath, t) @@ -334,7 +334,7 @@ func pidPath(t targetDetails) cgroups.Path { return getExistingPath(paths, t.Pid, "") } -//parseCgroupFile will read and verify the cgroup file entry of a container +// parseCgroupFile will read and verify the cgroup file entry of a container func parseCgroupFile(path string, t targetDetails) (map[string]string, error) { file, err := os.Open(path) if err != nil { @@ -344,7 +344,7 @@ func parseCgroupFile(path string, t targetDetails) (map[string]string, error) { return parseCgroupFromReader(file, t) } -//parseCgroupFromReader will parse the cgroup file from the reader +// parseCgroupFromReader will parse the cgroup file from the reader func parseCgroupFromReader(r io.Reader, t targetDetails) (map[string]string, error) { var ( cgroups = make(map[string]string) @@ -371,7 +371,7 @@ func parseCgroupFromReader(r io.Reader, t targetDetails) (map[string]string, err return cgroups, nil } -//getExistingPath will be used to get the existing valid cgroup path +// getExistingPath will be used to get the existing valid cgroup path func getExistingPath(paths map[string]string, pid int, suffix string) cgroups.Path { for n, p := range paths { dest, err := getCgroupDestination(pid, n) @@ -401,14 +401,14 @@ func getExistingPath(paths map[string]string, pid int, suffix string) cgroups.Pa } } -//getErrorPath will give the invalid cgroup path +// getErrorPath will give the invalid cgroup path func getErrorPath(err error) cgroups.Path { return func(_ cgroups.Name) (string, error) { return "", err } } -//getCgroupDestination will validate the subsystem with the mountpath in container mountinfo file. +// getCgroupDestination will validate the subsystem with the mountpath in container mountinfo file. func getCgroupDestination(pid int, subsystem string) (string, error) { mountinfoPath := fmt.Sprintf("/proc/%d/mountinfo", pid) file, err := os.Open(mountinfoPath) @@ -431,7 +431,7 @@ func getCgroupDestination(pid int, subsystem string) (string, error) { return "", errors.Errorf("no destination found for %v ", subsystem) } -//findValidCgroup will be used to get a valid cgroup path +// findValidCgroup will be used to get a valid cgroup path func findValidCgroup(path cgroups.Path, t targetDetails) (string, error) { for _, subsystem := range cgroupSubsystemList { path, err := path(cgroups.Name(subsystem)) @@ -446,7 +446,7 @@ func findValidCgroup(path cgroups.Path, t targetDetails) (string, error) { return "", cerrors.Error{ErrorCode: cerrors.ErrorTypeHelper, Source: t.Source, Target: fmt.Sprintf("{podName: %s, namespace: %s, container: %s}", t.Name, t.Namespace, t.TargetContainer), Reason: "could not find valid cgroup"} } -//getENV fetches all the env variables from the runner pod +// getENV fetches all the env variables from the runner pod func getENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "") experimentDetails.InstanceID = types.Getenv("INSTANCE_ID", "") diff --git a/chaoslib/litmus/stress-chaos/lib/stress-chaos.go b/chaoslib/litmus/stress-chaos/lib/stress-chaos.go index 88df25491..308a275dd 100644 --- a/chaoslib/litmus/stress-chaos/lib/stress-chaos.go +++ b/chaoslib/litmus/stress-chaos/lib/stress-chaos.go @@ -22,7 +22,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -//PrepareAndInjectStressChaos contains the prepration & injection steps for the stress experiments. +// PrepareAndInjectStressChaos contains the prepration & injection steps for the stress experiments. func PrepareAndInjectStressChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error { var err error @@ -332,8 +332,8 @@ func ptrint64(p int64) *int64 { return &p } -//SetChaosTunables will set up a random value within a given range of values -//If the value is not provided in range it'll set up the initial provided value. +// SetChaosTunables will set up a random value within a given range of values +// If the value is not provided in range it'll set up the initial provided value. func SetChaosTunables(experimentsDetails *experimentTypes.ExperimentDetails) { experimentsDetails.CPUcores = common.ValidateRange(experimentsDetails.CPUcores) experimentsDetails.CPULoad = common.ValidateRange(experimentsDetails.CPULoad) diff --git a/experiments/generic/node-drain/experiment/node-drain.go b/experiments/generic/node-drain/experiment/node-drain.go index 91876c45a..8e709bcd2 100644 --- a/experiments/generic/node-drain/experiment/node-drain.go +++ b/experiments/generic/node-drain/experiment/node-drain.go @@ -18,7 +18,7 @@ import ( "github.com/sirupsen/logrus" ) -//NodeDrain inject the node-drain chaos +// NodeDrain inject the node-drain chaos func NodeDrain(clients clients.ClientSets) { experimentsDetails := experimentTypes.ExperimentDetails{} diff --git a/pkg/baremetal/redfish-node-restart/environment/environment.go b/pkg/baremetal/redfish-node-restart/environment/environment.go index bafe960ae..90585cc9c 100644 --- a/pkg/baremetal/redfish-node-restart/environment/environment.go +++ b/pkg/baremetal/redfish-node-restart/environment/environment.go @@ -9,7 +9,7 @@ import ( "github.com/litmuschaos/litmus-go/pkg/types" ) -//GetENV fetches all the env variables from the runner pod +// GetENV fetches all the env variables from the runner pod func GetENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "") experimentDetails.ChaosNamespace = types.Getenv("CHAOS_NAMESPACE", "litmus") diff --git a/pkg/cassandra/pod-delete/environment/environment.go b/pkg/cassandra/pod-delete/environment/environment.go index b081cc714..72d264ce3 100644 --- a/pkg/cassandra/pod-delete/environment/environment.go +++ b/pkg/cassandra/pod-delete/environment/environment.go @@ -9,7 +9,7 @@ import ( clientTypes "k8s.io/apimachinery/pkg/types" ) -//GetENV fetches all the env variables from the runner pod +// GetENV fetches all the env variables from the runner pod func GetENV(cassandraDetails *cassandraTypes.ExperimentDetails) { var ChaoslibDetail exp.ExperimentDetails diff --git a/pkg/cloud/aws/common/common.go b/pkg/cloud/aws/common/common.go index 5d58e8558..ec76241f1 100644 --- a/pkg/cloud/aws/common/common.go +++ b/pkg/cloud/aws/common/common.go @@ -7,7 +7,7 @@ import ( "github.com/pkg/errors" ) -//GetAWSSession will return the aws session for a given region +// GetAWSSession will return the aws session for a given region func GetAWSSession(region string) *session.Session { return session.Must(session.NewSessionWithOptions(session.Options{ SharedConfigState: session.SharedConfigEnable, @@ -15,7 +15,7 @@ func GetAWSSession(region string) *session.Session { })) } -//CheckAWSError will return the aws errors +// CheckAWSError will return the aws errors func CheckAWSError(err error) error { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { diff --git a/pkg/events/event.go b/pkg/events/event.go index 70c1b1c2f..21b9b0957 100644 --- a/pkg/events/event.go +++ b/pkg/events/event.go @@ -11,7 +11,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -//CreateEvents create the events in the desired resource +// CreateEvents create the events in the desired resource func CreateEvents(eventsDetails *types.EventDetails, clients clients.ClientSets, chaosDetails *types.ChaosDetails, kind, eventName string) error { events := &apiv1.Event{ ObjectMeta: metav1.ObjectMeta{ @@ -40,7 +40,7 @@ func CreateEvents(eventsDetails *types.EventDetails, clients clients.ClientSets, return err } -//GenerateEvents update the events and increase the count by 1, if already present +// GenerateEvents update the events and increase the count by 1, if already present // else it will create a new event func GenerateEvents(eventsDetails *types.EventDetails, clients clients.ClientSets, chaosDetails *types.ChaosDetails, kind string) error { diff --git a/pkg/generic/docker-service-kill/environment/environment.go b/pkg/generic/docker-service-kill/environment/environment.go index 6e360d9ed..f515b7a21 100644 --- a/pkg/generic/docker-service-kill/environment/environment.go +++ b/pkg/generic/docker-service-kill/environment/environment.go @@ -9,7 +9,7 @@ import ( "github.com/litmuschaos/litmus-go/pkg/types" ) -//GetENV fetches all the env variables from the runner pod +// GetENV fetches all the env variables from the runner pod func GetENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "docker-service-kill") experimentDetails.ChaosNamespace = types.Getenv("CHAOS_NAMESPACE", "litmus") diff --git a/pkg/generic/kubelet-service-kill/environment/environment.go b/pkg/generic/kubelet-service-kill/environment/environment.go index 6d524fa49..c9eed0b1b 100644 --- a/pkg/generic/kubelet-service-kill/environment/environment.go +++ b/pkg/generic/kubelet-service-kill/environment/environment.go @@ -9,7 +9,7 @@ import ( "github.com/litmuschaos/litmus-go/pkg/types" ) -//GetENV fetches all the env variables from the runner pod +// GetENV fetches all the env variables from the runner pod func GetENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "kubelet-service-kill") experimentDetails.ChaosNamespace = types.Getenv("CHAOS_NAMESPACE", "litmus") diff --git a/pkg/generic/node-cpu-hog/environment/environment.go b/pkg/generic/node-cpu-hog/environment/environment.go index 75e0b6d9f..644021bca 100644 --- a/pkg/generic/node-cpu-hog/environment/environment.go +++ b/pkg/generic/node-cpu-hog/environment/environment.go @@ -8,7 +8,7 @@ import ( clientTypes "k8s.io/apimachinery/pkg/types" ) -//GetENV fetches all the env variables from the runner pod +// GetENV fetches all the env variables from the runner pod func GetENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "node-cpu-hog") experimentDetails.ChaosNamespace = types.Getenv("CHAOS_NAMESPACE", "litmus") diff --git a/pkg/generic/node-drain/environment/environment.go b/pkg/generic/node-drain/environment/environment.go index 46065ba1e..5d7707d7d 100644 --- a/pkg/generic/node-drain/environment/environment.go +++ b/pkg/generic/node-drain/environment/environment.go @@ -9,7 +9,7 @@ import ( "github.com/litmuschaos/litmus-go/pkg/types" ) -//GetENV fetches all the env variables from the runner pod +// GetENV fetches all the env variables from the runner pod func GetENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "node-drain") experimentDetails.ChaosNamespace = types.Getenv("CHAOS_NAMESPACE", "litmus") diff --git a/pkg/generic/node-io-stress/environment/environment.go b/pkg/generic/node-io-stress/environment/environment.go index ad229c360..dac8033ab 100644 --- a/pkg/generic/node-io-stress/environment/environment.go +++ b/pkg/generic/node-io-stress/environment/environment.go @@ -8,7 +8,7 @@ import ( clientTypes "k8s.io/apimachinery/pkg/types" ) -//GetENV fetches all the env variables from the runner pod +// GetENV fetches all the env variables from the runner pod func GetENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "node-io-stress") experimentDetails.ChaosNamespace = types.Getenv("CHAOS_NAMESPACE", "litmus") diff --git a/pkg/generic/node-memory-hog/environment/environment.go b/pkg/generic/node-memory-hog/environment/environment.go index d914351a5..edae0f468 100644 --- a/pkg/generic/node-memory-hog/environment/environment.go +++ b/pkg/generic/node-memory-hog/environment/environment.go @@ -8,7 +8,7 @@ import ( clientTypes "k8s.io/apimachinery/pkg/types" ) -//GetENV fetches all the env variables from the runner pod +// GetENV fetches all the env variables from the runner pod func GetENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "node-memory-hog") experimentDetails.ChaosNamespace = types.Getenv("CHAOS_NAMESPACE", "litmus") diff --git a/pkg/generic/node-restart/environment/environment.go b/pkg/generic/node-restart/environment/environment.go index 54fb4222c..e86a6cc23 100644 --- a/pkg/generic/node-restart/environment/environment.go +++ b/pkg/generic/node-restart/environment/environment.go @@ -8,7 +8,7 @@ import ( clientTypes "k8s.io/apimachinery/pkg/types" ) -//GetENV fetches all the env variables from the runner pod +// GetENV fetches all the env variables from the runner pod func GetENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "node-restart") experimentDetails.ChaosNamespace = types.Getenv("CHAOS_NAMESPACE", "litmus") diff --git a/pkg/generic/node-taint/environment/environment.go b/pkg/generic/node-taint/environment/environment.go index c04183c92..5531525fc 100644 --- a/pkg/generic/node-taint/environment/environment.go +++ b/pkg/generic/node-taint/environment/environment.go @@ -9,7 +9,7 @@ import ( "github.com/litmuschaos/litmus-go/pkg/types" ) -//GetENV fetches all the env variables from the runner pod +// GetENV fetches all the env variables from the runner pod func GetENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "node-taint") experimentDetails.ChaosNamespace = types.Getenv("CHAOS_NAMESPACE", "litmus") diff --git a/pkg/generic/pod-autoscaler/environment/environment.go b/pkg/generic/pod-autoscaler/environment/environment.go index 1d80d5f2c..cdd3c9cb0 100644 --- a/pkg/generic/pod-autoscaler/environment/environment.go +++ b/pkg/generic/pod-autoscaler/environment/environment.go @@ -8,7 +8,7 @@ import ( clientTypes "k8s.io/apimachinery/pkg/types" ) -//GetENV fetches all the env variables from the runner pod +// GetENV fetches all the env variables from the runner pod func GetENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "pod-autoscaler") diff --git a/pkg/generic/pod-cpu-hog-exec/environment/environment.go b/pkg/generic/pod-cpu-hog-exec/environment/environment.go index 3619db2bd..397a39a1b 100644 --- a/pkg/generic/pod-cpu-hog-exec/environment/environment.go +++ b/pkg/generic/pod-cpu-hog-exec/environment/environment.go @@ -8,7 +8,7 @@ import ( clientTypes "k8s.io/apimachinery/pkg/types" ) -//GetENV fetches all the env variables from the runner pod +// GetENV fetches all the env variables from the runner pod func GetENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "pod-cpu-hog") experimentDetails.ChaosNamespace = types.Getenv("CHAOS_NAMESPACE", "litmus") diff --git a/pkg/generic/pod-delete/environment/environment.go b/pkg/generic/pod-delete/environment/environment.go index dce477981..d2f0cefa1 100644 --- a/pkg/generic/pod-delete/environment/environment.go +++ b/pkg/generic/pod-delete/environment/environment.go @@ -9,7 +9,7 @@ import ( "github.com/litmuschaos/litmus-go/pkg/types" ) -//GetENV fetches all the env variables from the runner pod +// GetENV fetches all the env variables from the runner pod func GetENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "pod-delete") experimentDetails.ChaosNamespace = types.Getenv("CHAOS_NAMESPACE", "litmus") diff --git a/pkg/generic/pod-fio-stress/environment/environment.go b/pkg/generic/pod-fio-stress/environment/environment.go index 9c2140c64..41f257563 100644 --- a/pkg/generic/pod-fio-stress/environment/environment.go +++ b/pkg/generic/pod-fio-stress/environment/environment.go @@ -9,7 +9,7 @@ import ( "github.com/litmuschaos/litmus-go/pkg/types" ) -//GetENV fetches all the env variables from the runner pod +// GetENV fetches all the env variables from the runner pod func GetENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "") experimentDetails.ChaosNamespace = types.Getenv("CHAOS_NAMESPACE", "litmus") diff --git a/pkg/generic/pod-memory-hog-exec/environment/environment.go b/pkg/generic/pod-memory-hog-exec/environment/environment.go index 4cfc97834..a325eedfb 100644 --- a/pkg/generic/pod-memory-hog-exec/environment/environment.go +++ b/pkg/generic/pod-memory-hog-exec/environment/environment.go @@ -8,7 +8,7 @@ import ( clientTypes "k8s.io/apimachinery/pkg/types" ) -//GetENV fetches all the env variables from the runner pod +// GetENV fetches all the env variables from the runner pod func GetENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "pod-memory-hog") experimentDetails.ChaosNamespace = types.Getenv("CHAOS_NAMESPACE", "litmus") diff --git a/pkg/generic/pod-network-partition/environment/environment.go b/pkg/generic/pod-network-partition/environment/environment.go index a6b456696..50233b245 100644 --- a/pkg/generic/pod-network-partition/environment/environment.go +++ b/pkg/generic/pod-network-partition/environment/environment.go @@ -9,7 +9,7 @@ import ( "github.com/litmuschaos/litmus-go/pkg/types" ) -//GetENV fetches all the env variables from the runner pod +// GetENV fetches all the env variables from the runner pod func GetENV(experimentDetails *experimentTypes.ExperimentDetails) { experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "pod-network-partition") experimentDetails.ChaosNamespace = types.Getenv("CHAOS_NAMESPACE", "litmus") diff --git a/pkg/log/log.go b/pkg/log/log.go index caf36024e..cfc75e1fc 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -4,24 +4,24 @@ import ( logrus "github.com/sirupsen/logrus" ) -//Fatalf Logs first and then calls `logger.Exit(1)` +// Fatalf Logs first and then calls `logger.Exit(1)` // logging level is set to Panic. func Fatalf(msg string, err ...interface{}) { logrus.WithFields(logrus.Fields{}).Fatalf(msg, err...) } -//Fatal Logs first and then calls `logger.Exit(1)` +// Fatal Logs first and then calls `logger.Exit(1)` // logging level is set to Panic. func Fatal(msg string) { logrus.WithFields(logrus.Fields{}).Fatal(msg) } -//Infof log the General operational entries about what's going on inside the application +// Infof log the General operational entries about what's going on inside the application func Infof(msg string, val ...interface{}) { logrus.WithFields(logrus.Fields{}).Infof(msg, val...) } -//Info log the General operational entries about what's going on inside the application +// Info log the General operational entries about what's going on inside the application func Info(msg string) { logrus.WithFields(logrus.Fields{}).Infof(msg) } @@ -38,23 +38,23 @@ func ErrorWithValues(msg string, val map[string]interface{}) { logrus.WithFields(val).Error(msg) } -//Warn log the Non-critical entries that deserve eyes. +// Warn log the Non-critical entries that deserve eyes. func Warn(msg string) { logrus.WithFields(logrus.Fields{}).Warn(msg) } -//Warnf log the Non-critical entries that deserve eyes. +// Warnf log the Non-critical entries that deserve eyes. func Warnf(msg string, val ...interface{}) { logrus.WithFields(logrus.Fields{}).Warnf(msg, val...) } -//Errorf used for errors that should definitely be noted. +// Errorf used for errors that should definitely be noted. // Commonly used for hooks to send errors to an error tracking service. func Errorf(msg string, err ...interface{}) { logrus.WithFields(logrus.Fields{}).Errorf(msg, err...) } -//Error used for errors that should definitely be noted. +// Error used for errors that should definitely be noted. // Commonly used for hooks to send errors to an error tracking service func Error(msg string) { logrus.WithFields(logrus.Fields{}).Error(msg) diff --git a/pkg/math/math.go b/pkg/math/math.go index 30a94f09f..26b18ef26 100644 --- a/pkg/math/math.go +++ b/pkg/math/math.go @@ -8,7 +8,7 @@ func Maximum(a int, b int) int { return b } -//Minimum calculates the minimum value among two integers +// Minimum calculates the minimum value among two integers func Minimum(a int, b int) int { if a > b { return b @@ -16,7 +16,7 @@ func Minimum(a int, b int) int { return a } -//Adjustment contains rule of three for calculating an integer given another integer representing a percentage +// Adjustment contains rule of three for calculating an integer given another integer representing a percentage func Adjustment(a int, b int) int { return (a * b / 100) } diff --git a/pkg/utils/common/nodes.go b/pkg/utils/common/nodes.go index 77951d0f5..5880d643d 100644 --- a/pkg/utils/common/nodes.go +++ b/pkg/utils/common/nodes.go @@ -19,7 +19,7 @@ import ( var err error -//GetNodeList check for the availability of the application node for the chaos execution +// GetNodeList check for the availability of the application node for the chaos execution // if the application node is not defined it will derive the random target node list using node affected percentage func GetNodeList(nodeNames, nodeLabel string, nodeAffPerc int, clients clients.ClientSets) ([]string, error) { @@ -60,7 +60,7 @@ func GetNodeList(nodeNames, nodeLabel string, nodeAffPerc int, clients clients.C return nodeList, nil } -//GetNodeName will select a random replica of application pod and return the node name of that application pod +// GetNodeName will select a random replica of application pod and return the node name of that application pod func GetNodeName(namespace, labels, nodeLabel string, clients clients.ClientSets) (string, error) { switch nodeLabel { diff --git a/pkg/utils/common/pid.go b/pkg/utils/common/pid.go index 8ff32eec1..86e367752 100644 --- a/pkg/utils/common/pid.go +++ b/pkg/utils/common/pid.go @@ -131,7 +131,7 @@ func getCRIOPID(containerID, socketPath, source string) (int, error) { return pid, nil } -//GetPauseAndSandboxPID extract out the PID of the target container +// GetPauseAndSandboxPID extract out the PID of the target container func GetPauseAndSandboxPID(runtime, containerID, socketPath, source string) (int, error) { var pid int