Skip to content

Commit 2687314

Browse files
authored
Add support to run baremetal node disruptions (#202)
This commit enables users to run disrupt baremetal using IPMI to be able to understand the impact on OpenShift as well as applications running on it. Signed-off-by: Naga Ravi Chaitanya Elluri <[email protected]>
1 parent cc1304b commit 2687314

File tree

5 files changed

+39
-7
lines changed

5 files changed

+39
-7
lines changed

docs/node-scenarios.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,14 @@ LABEL_SELECTOR | Node label to target
3636
NODE_NAME | Node name to inject faults in case of targeting a specific node; Can set multiple node names separated by a comma | "" |
3737
INSTANCE_COUNT | Targeted instance count matching the label selector | 1 |
3838
RUNS | Iterations to perform action on a single node | 1 |
39-
CLOUD_TYPE | Cloud platform on top of which cluster is running, supported platforms - aws or vmware | aws |
39+
CLOUD_TYPE | Cloud platform on top of which cluster is running, supported platforms - aws, vmware, ibmcloud, bm | aws |
4040
TIMEOUT | Duration to wait for completion of node scenario injection | 180 |
4141
DURATION | Duration to stop the node before running the start action - not supported for vmware and ibm cloud type | 120 |
4242
VERIFY_SESSION | Only needed for vmware - Set to True if you want to verify the vSphere client session using certificates | False |
4343
SKIP_OPENSHIFT_CHECKS | Only needed for vmware - Set to True if you don't want to wait for the status of the nodes to change on OpenShift before passing the scenario | False |
44+
BMC_USER | Only needed for Baremetal ( bm ) - IPMI/bmc username | "" |
45+
BMC_PASSWORD | Only needed for Baremetal ( bm ) - IPMI/bmc password | "" |
46+
BMC_ADDR | Only needed for Baremetal ( bm ) - IPMI/bmc username | "" |
4447

4548
#### Demo
4649
You can find a link to a demo of the scenario [here](https://asciinema.org/a/ANZY7HhPdWTNaWt4xMFanF6Q5)
@@ -74,6 +77,13 @@ $ export IBMC_APIKEY=<ibmcloud_api_key>
7477
7578
```
7679

80+
Baremetal
81+
```
82+
$ export BMC_USER=<bmc/IPMI user>
83+
$ export BMC_PASSWORD=<bmc/IPMI password>
84+
$ export BMC_ADDR=<bmc address>
85+
```
86+
7787
Google Cloud Platform
7888
```
7989
TBD
@@ -93,11 +103,6 @@ OpenStack
93103
TBD
94104
```
95105

96-
Baremetal
97-
```
98-
TBD
99-
```
100-
101106
**NOTE** In case of using custom metrics profile or alerts profile when `CAPTURE_METRICS` or `ENABLE_ALERTS` is enabled, mount the metrics profile from the host on which the container is run using podman/docker under `/home/krkn/kraken/config/metrics-aggregated.yaml` and `/home/krkn/kraken/config/alerts`. For example:
102107
```
103108
$ podman run --name=<container_name> --net=host --env-host=true -v <path-to-custom-metrics-profile>:/home/krkn/kraken/config/metrics-aggregated.yaml -v <path-to-custom-alerts-profile>:/home/krkn/kraken/config/alerts -v <path-to-kube-config>:/home/krkn/.kube/config:Z -d quay.io/krkn-chaos/krkn-hub:container-scenarios

node-scenarios/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ FROM quay.io/krkn-chaos/krkn:latest
44

55
ENV KUBECONFIG /home/krkn/.kube/config
66

7+
USER root
8+
RUN yum install -y OpenIPMI ipmitool
9+
USER krkn
10+
711
# Copy configurations
812
COPY config.yaml.template /home/krkn/kraken/config/config.yaml.template
913
COPY metrics_config.yaml.template /home/krkn/kraken/config/kube_burner.yaml.template
@@ -13,4 +17,5 @@ COPY node-scenarios/run.sh /home/krkn/run.sh
1317
COPY common_run.sh /home/krkn/common_run.sh
1418
COPY node-scenarios/node_scenario.yaml.template /home/krkn/kraken/scenarios/node_scenario.yaml.template
1519
COPY node-scenarios/plugin_node_scenario.yaml.template /home/krkn/kraken/scenarios/plugin_node_scenario.yaml.template
20+
COPY node-scenarios/baremetal_node_scenario.yaml.template /home/krkn/kraken/scenarios/baremetal_node_scenario.yaml.template
1621
ENTRYPOINT /home/krkn/run.sh
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
node_scenarios:
2+
- actions: # Node chaos scenarios to be injected.
3+
- $ACTION
4+
node_name: $NODE_NAME # Node on which scenario has to be injected.
5+
label_selector: $LABEL_SELECTOR # When node_name is not specified, a node with matching label_selector is selected for node chaos scenario injection.
6+
instance_count: $INSTANCE_COUNT # Number of nodes to perform action/select that match the label selector.
7+
runs: $RUNS # Number of times to inject each scenario under actions (will perform on same node each time).
8+
timeout: $TIMEOUT # Duration to wait for completion of node scenario injection.
9+
cloud_type: $CLOUD_TYPE # Cloud type on which Kubernetes/OpenShift runs.
10+
bmc_user: $BMC_USER # For baremetal (bm) cloud type. The default IPMI username. Optional if specified for all machines.
11+
bmc_password: $BMC_PASSWORD # For baremetal (bm) cloud type. The default IPMI password. Optional if specified for all machines.
12+
bmc_info: # This section is here to specify baremetal per-machine info, so it is optional if there is no per-machine info.
13+
$NODE_NAME: # The node name for the baremetal machine
14+
bmc_addr: $BMC_ADDR # Optional. For baremetal nodes with the IPMI BMC address missing from 'oc get bmh'.

node-scenarios/env.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@ export SCENARIO_FILE=${SCENARIO_FILE:=scenarios/node_scenario.yaml}
1414
export SCENARIO_POST_ACTION=${SCENARIO_POST_ACTION:=""}
1515
export VERIFY_SESSION=${VERIFY_SESSION:="false"}
1616
export SKIP_OPENSHIFT_CHECKS=${SKIP_OPENSHIFT_CHECKS:="false"}
17+
18+
# Baremetal vars
19+
export BMC_USER=${BMC_USER:=""}
20+
export BMC_PASSWORD=${BMC_PASSWORD:=""}
21+
export BMC_ADDR=${BMC_ADDR:=""}

node-scenarios/run.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ if [[ "$CLOUD_TYPE" == "vmware" || "$CLOUD_TYPE" == "ibmcloud" ]]; then
2626
fi
2727
envsubst < /home/krkn/kraken/scenarios/plugin_node_scenario.yaml.template > /home/krkn/kraken/scenarios/node_scenario.yaml
2828

29-
29+
elif [[ "$CLOUD_TYPE" == "bm" ]]; then
30+
envsubst < /home/krkn/kraken/scenarios/baremetal_node_scenario.yaml.template > /home/krkn/kraken/scenarios/node_scenario.yaml
3031
else
3132
envsubst < /home/krkn/kraken/scenarios/node_scenario.yaml.template > /home/krkn/kraken/scenarios/node_scenario.yaml
3233
fi
34+
35+
# Setup config
3336
envsubst < /home/krkn/kraken/config/config.yaml.template > /home/krkn/kraken/config/node_scenario_config.yaml
3437

3538
# Run Kraken

0 commit comments

Comments
 (0)