Skip to content

Commit

Permalink
[Cherry-Pick for v1.9.0] (#180)
Browse files Browse the repository at this point in the history
* fix(node-io-stress): Add fix for node-io-stress (#177)

Signed-off-by: Udit Gaurav <[email protected]>

* fix(abort): fixing the result updation for abort (#178)

Signed-off-by: shubhamchaudhary <[email protected]>

* refactor(experiment): covered uncaught errors (#179)

Signed-off-by: shubhamchaudhary <[email protected]>

Co-authored-by: UDIT GAURAV <[email protected]>
  • Loading branch information
ispeakc0de and uditgaurav authored Oct 15, 2020
1 parent 807d033 commit 6128618
Show file tree
Hide file tree
Showing 18 changed files with 65 additions and 34 deletions.
2 changes: 1 addition & 1 deletion chaoslib/litmus/node-io-stress/lib/node-io-stress.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func CreateHelperPod(experimentsDetails *experimentTypes.ExperimentDetails, clie
Image: experimentsDetails.LIBImage,
ImagePullPolicy: apiv1.PullAlways,
Command: []string{
"/stress-ng",
"stress-ng",
},
Args: GetContainerArguments(experimentsDetails),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ func ContainerKill(clients clients.ClientSets) {
// Intialise Chaos Result Parameters
types.SetResultAttributes(&resultDetails, chaosDetails)

// Intialise the probe details
probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails)
// Intialise the probe details. Bail out upon error, as we haven't entered exp business logic yet
if err = probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails); err != nil {
log.Fatalf("Unable to initialize the probes, err: %v", err)
}

//Updating the chaos result in the beginning of experiment
log.Infof("[PreReq]: Updating the chaos result of %v experiment (SOT)", experimentsDetails.ExperimentName)
Expand Down
6 changes: 4 additions & 2 deletions experiments/generic/disk-fill/experiment/disk-fill.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ func DiskFill(clients clients.ClientSets) {
// Intialise Chaos Result Parameters
types.SetResultAttributes(&resultDetails, chaosDetails)

// Intialise the probe details
probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails)
// Intialise the probe details. Bail out upon error, as we haven't entered exp business logic yet
if err = probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails); err != nil {
log.Fatalf("Unable to initialize the probes, err: %v", err)
}

//Updating the chaos result in the beginning of experiment
log.Infof("[PreReq]: Updating the chaos result of %v experiment (SOT)", experimentsDetails.ExperimentName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ func KubeletServiceKill(clients clients.ClientSets) {
// Intialise Chaos Result Parameters
types.SetResultAttributes(&resultDetails, chaosDetails)

// Intialise the probe details
probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails)
// Intialise the probe details. Bail out upon error, as we haven't entered exp business logic yet
if err = probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails); err != nil {
log.Fatalf("Unable to initialize the probes, err: %v", err)
}

//Updating the chaos result in the beginning of experiment
log.Infof("[PreReq]: Updating the chaos result of %v experiment (SOT)", experimentsDetails.ExperimentName)
Expand Down
6 changes: 4 additions & 2 deletions experiments/generic/node-cpu-hog/experiment/node-cpu-hog.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ func NodeCPUHog(clients clients.ClientSets) {
// Intialise Chaos Result Parameters
types.SetResultAttributes(&resultDetails, chaosDetails)

// Intialise the probe details
probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails)
// Intialise the probe details. Bail out upon error, as we haven't entered exp business logic yet
if err = probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails); err != nil {
log.Fatalf("Unable to initialize the probes, err: %v", err)
}

//Updating the chaos result in the beginning of experiment
log.Infof("[PreReq]: Updating the chaos result of %v experiment (SOT)", experimentsDetails.ExperimentName)
Expand Down
6 changes: 4 additions & 2 deletions experiments/generic/node-drain/experiment/node-drain.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ func NodeDrain(clients clients.ClientSets) {
// Intialise Chaos Result Parameters
types.SetResultAttributes(&resultDetails, chaosDetails)

// Intialise the probe details
probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails)
// Intialise the probe details. Bail out upon error, as we haven't entered exp business logic yet
if err = probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails); err != nil {
log.Fatalf("Unable to initialize the probes, err: %v", err)
}

//Updating the chaos result in the beginning of experiment
log.Infof("[PreReq]: Updating the chaos result of %v experiment (SOT)", experimentsDetails.ExperimentName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ func NodeIOStress(clients clients.ClientSets) {
// Intialise Chaos Result Parameters
types.SetResultAttributes(&resultDetails, chaosDetails)

// Intialise the probe details
probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails)
// Intialise the probe details. Bail out upon error, as we haven't entered exp business logic yet
if err = probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails); err != nil {
log.Fatalf("Unable to initialize the probes, err: %v", err)
}

//Updating the chaos result in the beginning of experiment
log.Infof("[PreReq]: Updating the chaos result of %v experiment (SOT)", experimentsDetails.ExperimentName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ func NodeMemoryHog(clients clients.ClientSets) {
// Intialise Chaos Result Parameters
types.SetResultAttributes(&resultDetails, chaosDetails)

// Intialise the probe details
probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails)
// Intialise the probe details. Bail out upon error, as we haven't entered exp business logic yet
if err = probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails); err != nil {
log.Fatalf("Unable to initialize the probes, err: %v", err)
}

//Updating the chaos result in the beginning of experiment
log.Infof("[PreReq]: Updating the chaos result of %v experiment (SOT)", experimentsDetails.ExperimentName)
Expand Down
6 changes: 4 additions & 2 deletions experiments/generic/node-taint/experiment/node-taint.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ func NodeTaint(clients clients.ClientSets) {
// Intialise Chaos Result Parameters
types.SetResultAttributes(&resultDetails, chaosDetails)

// Intialise the probe details
probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails)
// Intialise the probe details. Bail out upon error, as we haven't entered exp business logic yet
if err = probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails); err != nil {
log.Fatalf("Unable to initialize the probes, err: %v", err)
}

//Updating the chaos result in the beginning of experiment
log.Infof("[PreReq]: Updating the chaos result of %v experiment (SOT)", experimentsDetails.ExperimentName)
Expand Down
6 changes: 4 additions & 2 deletions experiments/generic/pod-cpu-hog/experiment/pod-cpu-hog.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ func PodCPUHog(clients clients.ClientSets) {
// Intialise Chaos Result Parameters
types.SetResultAttributes(&resultDetails, chaosDetails)

// Intialise the probe details
probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails)
// Intialise the probe details. Bail out upon error, as we haven't entered exp business logic yet
if err = probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails); err != nil {
log.Fatalf("Unable to initialize the probes, err: %v", err)
}

//Updating the chaos result in the beginning of experiment
log.Infof("[PreReq]: Updating the chaos result of %v experiment (SOT)", experimentsDetails.ExperimentName)
Expand Down
3 changes: 1 addition & 2 deletions experiments/generic/pod-delete/experiment/pod-delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ func PodDelete(clients clients.ClientSets) {
// Intialise Chaos Result Parameters
types.SetResultAttributes(&resultDetails, chaosDetails)

// Intialise the probe details
// Intialise the probe details. Bail out upon error, as we haven't entered exp business logic yet
if err := probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails); err != nil {
log.Fatalf("Unable to initialise probes details from chaosengine, err: %v", err)

}

//Updating the chaos result in the beginning of experiment
Expand Down
6 changes: 4 additions & 2 deletions experiments/generic/pod-io-stress/experiment/pod-io-stress.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ func PodIOStress(clients clients.ClientSets) {
// Intialise Chaos Result Parameters
types.SetResultAttributes(&resultDetails, chaosDetails)

// Intialise the probe details
probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails)
// Intialise the probe details. Bail out upon error, as we haven't entered exp business logic yet
if err = probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails); err != nil {
log.Fatalf("Unable to initialize the probes, err: %v", err)
}

//Updating the chaos result in the beginning of experiment
log.Infof("[PreReq]: Updating the chaos result of %v experiment (SOT)", experimentsDetails.ExperimentName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ func PodMemoryHog(clients clients.ClientSets) {
// Intialise Chaos Result Parameters
types.SetResultAttributes(&resultDetails, chaosDetails)

// Intialise the probe details
probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails)
// Intialise the probe details. Bail out upon error, as we haven't entered exp business logic yet
if err = probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails); err != nil {
log.Fatalf("Unable to initialize the probes, err: %v", err)
}

//Updating the chaos result in the beginning of experiment
log.Infof("[PreReq]: Updating the chaos result of %v experiment (SOT)", experimentsDetails.ExperimentName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ func PodNetworkCorruption(clients clients.ClientSets) {
// Intialise Chaos Result Parameters
types.SetResultAttributes(&resultDetails, chaosDetails)

// Intialise the probe details
probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails)
// Intialise the probe details. Bail out upon error, as we haven't entered exp business logic yet
if err = probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails); err != nil {
log.Fatalf("Unable to initialize the probes, err: %v", err)
}

//Updating the chaos result in the beginning of experiment
log.Infof("[PreReq]: Updating the chaos result of %v experiment (SOT)", experimentsDetails.ExperimentName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ func PodNetworkDuplication(clients clients.ClientSets) {
// Intialise Chaos Result Parameters
types.SetResultAttributes(&resultDetails, chaosDetails)

// Intialise the probe details
probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails)
// Intialise the probe details. Bail out upon error, as we haven't entered exp business logic yet
if err = probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails); err != nil {
log.Fatalf("Unable to initialize the probes, err: %v", err)
}

//Updating the chaos result in the beginning of experiment
log.Infof("[PreReq]: Updating the chaos result of %v experiment (SOT)", experimentsDetails.ExperimentName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ func PodNetworkLatency(clients clients.ClientSets) {
// Intialise Chaos Result Parameters
types.SetResultAttributes(&resultDetails, chaosDetails)

// Intialise the probe details
probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails)
// Intialise the probe details. Bail out upon error, as we haven't entered exp business logic yet
if err = probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails); err != nil {
log.Fatalf("Unable to initialize the probes, err: %v", err)
}

//Updating the chaos result in the beginning of experiment
log.Infof("[PreReq]: Updating the chaos result of %v experiment (SOT)", experimentsDetails.ExperimentName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ func PodNetworkLoss(clients clients.ClientSets) {
// Intialise Chaos Result Parameters
types.SetResultAttributes(&resultDetails, chaosDetails)

// Intialise the probe details
probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails)
// Intialise the probe details. Bail out upon error, as we haven't entered exp business logic yet
if err = probe.InitializeProbesInChaosResultDetails(&chaosDetails, clients, &resultDetails); err != nil {
log.Fatalf("Unable to initialize the probes, err: %v", err)
}

//Updating the chaos result in the beginningo f experiment
log.Infof("[PreReq]: Updating the chaos result of %v experiment (SOT)", experimentsDetails.ExperimentName)
Expand Down
4 changes: 3 additions & 1 deletion pkg/result/chaosresult.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ func ChaosResult(chaosDetails *types.ChaosDetails, clients clients.ClientSets, r
return err
}

if chaosDetails.EngineName != "" {
// as the chaos pod won't be available for stopped phase
// skipping the derivation of labels from chaos pod, if phase is stopped
if chaosDetails.EngineName != "" && resultDetails.Phase != "Stopped" {
// Getting chaos pod label and passing it in chaos result
chaosPod, err := clients.KubeClient.CoreV1().Pods(chaosDetails.ChaosNamespace).Get(chaosDetails.ChaosPodName, metav1.GetOptions{})
if err != nil {
Expand Down

0 comments on commit 6128618

Please sign in to comment.