-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
312 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"go.uber.org/zap" | ||
) | ||
|
||
var chaosAllowTrafficCmd = &cobra.Command{ | ||
Use: "allow-traffic", | ||
Short: "Allows inter-node traffic to a specific node", | ||
Args: cobra.MinimumNArgs(2), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
helper := CmdHelper{} | ||
logger := helper.GetLogger() | ||
ctx := helper.GetContext() | ||
|
||
_, deployer, cluster := helper.IdentifyCluster(ctx, args[0]) | ||
node := helper.IdentifyNode(ctx, cluster, args[1]) | ||
|
||
err := deployer.AllowNodeTraffic(ctx, cluster.GetID(), node.GetID()) | ||
if err != nil { | ||
logger.Fatal("failed to allow node traffic", zap.Error(err)) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
chaosCmd.AddCommand(chaosAllowTrafficCmd) | ||
} |
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,29 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"go.uber.org/zap" | ||
) | ||
|
||
var chaosBlockTrafficCmd = &cobra.Command{ | ||
Use: "block-traffic", | ||
Short: "Blocks inter-node traffic to a specific node", | ||
Args: cobra.MinimumNArgs(2), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
helper := CmdHelper{} | ||
logger := helper.GetLogger() | ||
ctx := helper.GetContext() | ||
|
||
_, deployer, cluster := helper.IdentifyCluster(ctx, args[0]) | ||
node := helper.IdentifyNode(ctx, cluster, args[1]) | ||
|
||
err := deployer.BlockNodeTraffic(ctx, cluster.GetID(), node.GetID()) | ||
if err != nil { | ||
logger.Fatal("failed to block node traffic", zap.Error(err)) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
chaosCmd.AddCommand(chaosBlockTrafficCmd) | ||
} |
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,15 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var chaosCmd = &cobra.Command{ | ||
Use: "chaos", | ||
Short: "Provides chaos tools for the system", | ||
Run: nil, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(chaosCmd) | ||
} |
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
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
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
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