-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(socketPath): correcting socketPath env name (#124) Signed-off-by: shubhamchaudhary <[email protected]> * chore(network-chaos): Adding ability to inject network chaos w/ pause container (#126) Signed-off-by: shubhamchaudhary <[email protected]> * fix(permission-issue): fixing the username permission issue for sockfile (#129) Signed-off-by: shubhamchaudhary <[email protected]> * chore(k8sprobe): Adding label-selector field in k8sprobe (#127) Signed-off-by: shubhamchaudhary <[email protected]> * Chore/ Splitting different files for network chaos experiment (#128) * Chore/ Splitting different variables for network chaos experiment Signed-off-by: Udit Gaurav <[email protected]> * fix(userid): revert the userid from dockerfile (#131) Signed-off-by: shubhamchaudhary <[email protected]> * fix(duplicate): fixing network duplicate exp (#132) Signed-off-by: shubhamchaudhary <[email protected]> * chore(network-chaos): splitting network chaos for containerd (#133) Signed-off-by: shubhamchaudhary <[email protected]> Co-authored-by: Shubham Chaudhary <[email protected]>
- Loading branch information
1 parent
4c62402
commit bfdb421
Showing
30 changed files
with
449 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
chaoslib/litmus/network-chaos/lib/corruption/corruption.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package corruption | ||
|
||
import ( | ||
"strconv" | ||
|
||
network_chaos "github.com/litmuschaos/litmus-go/chaoslib/litmus/network-chaos/lib" | ||
clients "github.com/litmuschaos/litmus-go/pkg/clients" | ||
experimentTypes "github.com/litmuschaos/litmus-go/pkg/generic/network-chaos/types" | ||
"github.com/litmuschaos/litmus-go/pkg/types" | ||
) | ||
|
||
var err error | ||
|
||
//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 " + strconv.Itoa(experimentsDetails.NetworkPacketCorruptionPercentage) | ||
err = network_chaos.PrepareAndInjectChaos(experimentsDetails, clients, resultDetails, eventsDetails, chaosDetails, args) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
24 changes: 24 additions & 0 deletions
24
chaoslib/litmus/network-chaos/lib/duplication/duplication.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package duplication | ||
|
||
import ( | ||
"strconv" | ||
|
||
network_chaos "github.com/litmuschaos/litmus-go/chaoslib/litmus/network-chaos/lib" | ||
clients "github.com/litmuschaos/litmus-go/pkg/clients" | ||
experimentTypes "github.com/litmuschaos/litmus-go/pkg/generic/network-chaos/types" | ||
"github.com/litmuschaos/litmus-go/pkg/types" | ||
) | ||
|
||
var err error | ||
|
||
//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 " + strconv.Itoa(experimentsDetails.NetworkPacketDuplicationPercentage) | ||
err = network_chaos.PrepareAndInjectChaos(experimentsDetails, clients, resultDetails, eventsDetails, chaosDetails, args) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package latency | ||
|
||
import ( | ||
"strconv" | ||
|
||
network_chaos "github.com/litmuschaos/litmus-go/chaoslib/litmus/network-chaos/lib" | ||
clients "github.com/litmuschaos/litmus-go/pkg/clients" | ||
experimentTypes "github.com/litmuschaos/litmus-go/pkg/generic/network-chaos/types" | ||
"github.com/litmuschaos/litmus-go/pkg/types" | ||
) | ||
|
||
var err error | ||
|
||
//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" | ||
err = network_chaos.PrepareAndInjectChaos(experimentsDetails, clients, resultDetails, eventsDetails, chaosDetails, args) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package loss | ||
|
||
import ( | ||
"strconv" | ||
|
||
network_chaos "github.com/litmuschaos/litmus-go/chaoslib/litmus/network-chaos/lib" | ||
clients "github.com/litmuschaos/litmus-go/pkg/clients" | ||
experimentTypes "github.com/litmuschaos/litmus-go/pkg/generic/network-chaos/types" | ||
"github.com/litmuschaos/litmus-go/pkg/types" | ||
) | ||
|
||
var err error | ||
|
||
//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 " + strconv.Itoa(experimentsDetails.NetworkPacketLossPercentage) | ||
err = network_chaos.PrepareAndInjectChaos(experimentsDetails, clients, resultDetails, eventsDetails, chaosDetails, args) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package corruption | ||
|
||
import ( | ||
"strconv" | ||
|
||
network_chaos "github.com/litmuschaos/litmus-go/chaoslib/pumba/network-chaos/lib" | ||
clients "github.com/litmuschaos/litmus-go/pkg/clients" | ||
experimentTypes "github.com/litmuschaos/litmus-go/pkg/generic/network-chaos/types" | ||
"github.com/litmuschaos/litmus-go/pkg/types" | ||
) | ||
|
||
var err error | ||
|
||
//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 := GetContainerArguments(experimentsDetails) | ||
err = network_chaos.PrepareAndInjectChaos(experimentsDetails, clients, resultDetails, eventsDetails, chaosDetails, args) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// GetContainerArguments derives the args for the pumba pod | ||
func GetContainerArguments(experimentsDetails *experimentTypes.ExperimentDetails) []string { | ||
baseArgs := []string{ | ||
"netem", | ||
"--tc-image", | ||
experimentsDetails.TCImage, | ||
"--interface", | ||
experimentsDetails.NetworkInterface, | ||
"--duration", | ||
strconv.Itoa(experimentsDetails.ChaosDuration) + "s", | ||
} | ||
|
||
args := baseArgs | ||
args = network_chaos.AddTargetIpsArgs(experimentsDetails.TargetIPs, args) | ||
args = network_chaos.AddTargetIpsArgs(network_chaos.GetIpsForTargetHosts(experimentsDetails.TargetHosts), args) | ||
args = append(args, "corrupt", "--percent", strconv.Itoa(experimentsDetails.NetworkPacketCorruptionPercentage)) | ||
|
||
return args | ||
} |
44 changes: 44 additions & 0 deletions
44
chaoslib/pumba/network-chaos/lib/duplication/duplication.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package duplication | ||
|
||
import ( | ||
"strconv" | ||
|
||
network_chaos "github.com/litmuschaos/litmus-go/chaoslib/pumba/network-chaos/lib" | ||
clients "github.com/litmuschaos/litmus-go/pkg/clients" | ||
experimentTypes "github.com/litmuschaos/litmus-go/pkg/generic/network-chaos/types" | ||
"github.com/litmuschaos/litmus-go/pkg/types" | ||
) | ||
|
||
var err error | ||
|
||
//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 := GetContainerArguments(experimentsDetails) | ||
err = network_chaos.PrepareAndInjectChaos(experimentsDetails, clients, resultDetails, eventsDetails, chaosDetails, args) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// GetContainerArguments derives the args for the pumba pod | ||
func GetContainerArguments(experimentsDetails *experimentTypes.ExperimentDetails) []string { | ||
baseArgs := []string{ | ||
"netem", | ||
"--tc-image", | ||
experimentsDetails.TCImage, | ||
"--interface", | ||
experimentsDetails.NetworkInterface, | ||
"--duration", | ||
strconv.Itoa(experimentsDetails.ChaosDuration) + "s", | ||
} | ||
|
||
args := baseArgs | ||
args = network_chaos.AddTargetIpsArgs(experimentsDetails.TargetIPs, args) | ||
args = network_chaos.AddTargetIpsArgs(network_chaos.GetIpsForTargetHosts(experimentsDetails.TargetHosts), args) | ||
args = append(args, "duplicate", "--percent", strconv.Itoa(experimentsDetails.NetworkPacketDuplicationPercentage)) | ||
|
||
return args | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package latency | ||
|
||
import ( | ||
"strconv" | ||
|
||
network_chaos "github.com/litmuschaos/litmus-go/chaoslib/pumba/network-chaos/lib" | ||
clients "github.com/litmuschaos/litmus-go/pkg/clients" | ||
experimentTypes "github.com/litmuschaos/litmus-go/pkg/generic/network-chaos/types" | ||
"github.com/litmuschaos/litmus-go/pkg/types" | ||
) | ||
|
||
var err error | ||
|
||
//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 := GetContainerArguments(experimentsDetails) | ||
err = network_chaos.PrepareAndInjectChaos(experimentsDetails, clients, resultDetails, eventsDetails, chaosDetails, args) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// GetContainerArguments derives the args for the pumba pod | ||
func GetContainerArguments(experimentsDetails *experimentTypes.ExperimentDetails) []string { | ||
baseArgs := []string{ | ||
"netem", | ||
"--tc-image", | ||
experimentsDetails.TCImage, | ||
"--interface", | ||
experimentsDetails.NetworkInterface, | ||
"--duration", | ||
strconv.Itoa(experimentsDetails.ChaosDuration) + "s", | ||
} | ||
|
||
args := baseArgs | ||
args = network_chaos.AddTargetIpsArgs(experimentsDetails.TargetIPs, args) | ||
args = network_chaos.AddTargetIpsArgs(network_chaos.GetIpsForTargetHosts(experimentsDetails.TargetHosts), args) | ||
args = append(args, "delay", "--time", strconv.Itoa(experimentsDetails.NetworkLatency)) | ||
|
||
return args | ||
} |
Oops, something went wrong.