-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #162 from zeebe-io/zell-hackdays-fault-injection-tool
Fault injection cli: zbchaos
- Loading branch information
Showing
36 changed files
with
1,765 additions
and
405 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
chaos-workers/chaos-experiments/scripts/connect-leader-follower.sh
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
chaos-workers/chaos-experiments/scripts/disconnect-elastic.sh
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
chaos-workers/chaos-experiments/scripts/disconnect-leader-follower.sh
This file was deleted.
Oops, something went wrong.
106 changes: 0 additions & 106 deletions
106
chaos-workers/chaos-experiments/scripts/network-partition.sh
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
chaos-workers/chaos-experiments/scripts/turn-down-leader-regulary.sh
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
zbchaos | ||
dist/ |
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,20 @@ | ||
#!/bin/bash -xeu | ||
|
||
OS=( linux windows darwin ) | ||
BINARY=( zbchaos zbchaos.exe zbchaos.darwin ) | ||
SRC_DIR=$(dirname "${BASH_SOURCE[0]}") | ||
DIST_DIR="$SRC_DIR/dist" | ||
|
||
VERSION=${RELEASE_VERSION:-development} | ||
COMMIT=${RELEASE_HASH:-$(git rev-parse HEAD)} | ||
|
||
mkdir -p ${DIST_DIR} | ||
rm -rf ${DIST_DIR}/* | ||
|
||
for i in "${!OS[@]}"; do | ||
if [ $# -eq 0 ] || [ ${OS[$i]} = $1 ]; then | ||
CGO_ENABLED=0 GOOS="${OS[$i]}" GOARCH=amd64 go build -a -tags netgo -ldflags "-w -X github.com/zeebe-io/zeebe-chaos/go-chaos/cmd.Version=${VERSION} -X github.com/zeebe-io/zeebe-chaos/go-chaos/cmd.Commit=${COMMIT}" -o "${DIST_DIR}/${BINARY[$i]}" "${SRC_DIR}/main.go" # & | ||
fi | ||
done | ||
|
||
# wait |
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,71 @@ | ||
// Copyright 2022 Camunda Services GmbH | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/zeebe-io/zeebe-chaos/go-chaos/internal" | ||
) | ||
|
||
func init() { | ||
rootCmd.AddCommand(connect) | ||
connect.AddCommand(connectBrokers) | ||
} | ||
|
||
var connect = &cobra.Command{ | ||
Use: "connect", | ||
Short: "Connect Zeebe nodes", | ||
Long: `Connect all Zeebe nodes again, after they have been disconnected uses sub-commands to connect brokers, gateways, etc.`, | ||
} | ||
|
||
var connectBrokers = &cobra.Command{ | ||
Use: "brokers", | ||
Short: "Connect Zeebe Brokers", | ||
Long: `Connect all Zeebe Brokers again, after they have been disconnected.`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
internal.Verbosity = Verbose | ||
k8Client, err := internal.CreateK8Client() | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
// No patch is need, since we expect that disconnect was executed before. | ||
// If not all fine and the pods are already connected. | ||
|
||
// We run connect on all nodes, since roles can have been changed in between so it is easier to run the commands on all nodes. | ||
|
||
podNames, err := k8Client.GetBrokerPodNames() | ||
if err != nil { | ||
panic(err.Error()) | ||
} | ||
|
||
if len(podNames) <= 0 { | ||
panic(fmt.Sprintf("Expected to find brokers in current namespace %s, but found nothing\n", k8Client.GetCurrentNamespace())) | ||
} | ||
|
||
for _, pod := range podNames { | ||
err = internal.MakeIpReachableForPod(k8Client, pod) | ||
if err != nil { | ||
if Verbose { | ||
fmt.Printf("Error on connection Broker: %s. Error: %s\n", pod, err.Error()) | ||
} | ||
} else { | ||
fmt.Printf("Connected %s again, removed unreachable routes.\n", pod) | ||
} | ||
} | ||
}, | ||
} |
Oops, something went wrong.