Skip to content

Commit e9c4f10

Browse files
authored
adding exclude label to app and container outage (#306)
Signed-off-by: Paige Patton <prubenda@redhat.com>
1 parent 5806067 commit e9c4f10

File tree

6 files changed

+106
-85
lines changed

6 files changed

+106
-85
lines changed

application-outages/app_outages.yaml.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ application_outage: # Scenario to create an out
22
duration: $DURATION # Duration in seconds after which the routes will be accessible
33
namespace: $NAMESPACE # Namespace to target - all application routes will go inaccessible if pod selector is empty
44
pod_selector: $POD_SELECTOR # Pods to target
5+
exclude_label: $EXCLUDE_LABEL
56
block:
67
$BLOCK_TRAFFIC_TYPE # It can be Ingress or Egress or Ingress, Egress

application-outages/env.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
export DURATION=${DURATION:=600}
55
export NAMESPACE=${NAMESPACE:=<namespace>}
66
export POD_SELECTOR=${POD_SELECTOR:="{}"}
7+
export EXCLUDE_LABEL=${EXCLUDE_LABEL:""}
78
export BLOCK_TRAFFIC_TYPE=${BLOCK_TRAFFIC_TYPE:=- Ingress}
89
export SCENARIO_TYPE=${SCENARIO_TYPE:=application_outages_scenarios}
910
export SCENARIO_FILE=${SCENARIO_FILE:=scenarios/app_outage.yaml}
Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,50 @@
11
[
22
{
3-
"name":"chaos-duration",
4-
"short_description":"Chaos Duration",
5-
"description":"Set chaos duration (in sec) as desired",
6-
"variable":"DURATION",
7-
"type":"number",
8-
"default":"600",
9-
"required":"false"
3+
"name": "chaos-duration",
4+
"short_description": "Chaos Duration",
5+
"description": "Set chaos duration (in sec) as desired",
6+
"variable": "DURATION",
7+
"type": "number",
8+
"default": "600",
9+
"required": "false"
1010
},
1111
{
12-
"name":"namespace",
13-
"short_description":"Namespace",
14-
"description":"Namespace to target - all application routes will go inaccessible if pod selector is empty ( Required )",
15-
"variable":"NAMESPACE",
16-
"type":"string",
17-
"required":"true"
12+
"name": "namespace",
13+
"short_description": "Namespace",
14+
"description": "Namespace to target - all application routes will go inaccessible if pod selector is empty ( Required )",
15+
"variable": "NAMESPACE",
16+
"type": "string",
17+
"required": "true"
1818
},
1919
{
20-
"name":"pod-selector",
21-
"short_description":"Pod Selector",
20+
"name": "pod-selector",
21+
"short_description": "Pod Selector",
2222
"description": "Pods to target. For example \"{app: foo}\"",
23-
"type":"string",
24-
"variable":"POD_SELECTOR",
23+
"type": "string",
24+
"variable": "POD_SELECTOR",
2525
"validator": "\\{[a-zA-Z0-9-_]+\\: [a-zA-Z0-9-_]+\\}",
2626
"validation_message": "Pod selector must be in the following format: \"{app: foo}\"",
27-
"required": "true"
27+
"required": "true"
2828
},
2929
{
30-
"name":"block-traffic-type",
31-
"short_description":"Block traffic direction",
32-
"description": "It can be [Ingress] or [Egress] or [Ingress, Egress]",
33-
"type":"string",
34-
"variable":"BLOCK_TRAFFIC_TYPE",
35-
"validator": "^\\[Ingress\\]$|^\\[Egress\\]$|^\\[Ingress, Egress\\]$",
36-
"validation_message": "Block traffic direction can be [Ingress] or [Egress] or [Ingress, Egress]",
37-
"default":"[Ingress, Egress]",
38-
"required": "false"
39-
}
30+
"name": "exclude-selector",
31+
"short_description": "Exclude Pod Selector",
32+
"description": "Pods to exclude from targetting. For example \"{app: foo}\"",
33+
"type": "string",
34+
"variable": "EXCLUDE_LABEL",
35+
"validator": "\\{[a-zA-Z0-9-_]+\\: [a-zA-Z0-9-_]+\\}",
36+
"validation_message": "Exclude Pod selector must be in the following format: \"{app: foo}\"",
37+
"required": "false"
38+
},
39+
{
40+
"name": "block-traffic-type",
41+
"short_description": "Block traffic direction",
42+
"description": "It can be [Ingress] or [Egress] or [Ingress, Egress]",
43+
"type": "string",
44+
"variable": "BLOCK_TRAFFIC_TYPE",
45+
"validator": "^\\[Ingress\\]$|^\\[Egress\\]$|^\\[Ingress, Egress\\]$",
46+
"validation_message": "Block traffic direction can be [Ingress] or [Egress] or [Ingress, Egress]",
47+
"default": "[Ingress, Egress]",
48+
"required": "false"
49+
}
4050
]

container-scenarios/container_scenario.yaml.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ scenarios:
66
action: $ACTION
77
count: $DISRUPTION_COUNT
88
expected_recovery_time: $EXPECTED_RECOVERY_TIME
9+
exclude_label: $EXCLUDE_LABEL

container-scenarios/env.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Vars and respective defaults
44
export NAMESPACE=${NAMESPACE:="openshift-etcd"}
55
export LABEL_SELECTOR=${LABEL_SELECTOR:="k8s-app=etcd"}
6+
export EXCLUDE_LABEL=${EXCLUDE_LABEL:""}
67
export EXPECTED_RECOVERY_TIME=${EXPECTED_RECOVERY_TIME:=60}
78
export DISRUPTION_COUNT=${DISRUPTION_COUNT:=1}
89
export CONTAINER_NAME=${CONTAINER_NAME:=etcd}
Lines changed: 64 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,70 @@
11
[
2-
3-
{
4-
"name":"namespace",
5-
"short_description":"Namespace",
6-
"description":"Targeted namespace in the cluster",
7-
"variable":"NAMESPACE",
8-
"type":"string",
9-
"default":"openshift-etcd",
10-
"required":"false"
11-
},
12-
{
13-
"name":"label-selector",
14-
"short_description":"Label Selector",
15-
"description":"Label of the container(s) to target",
16-
"variable":"LABEL_SELECTOR",
17-
"type":"string",
18-
"default":"k8s-app=etcd",
19-
"validator":"^.+\\=.+$",
20-
"validation_message": "Label selector must be in the format: key=value",
21-
"required":"false"
22-
},
23-
{
24-
"name":"disruption-count",
25-
"short_description":"Disruption Count",
26-
"description": "Number of container to disrupt",
27-
"type":"number",
28-
"variable":"DISRUPTION_COUNT",
29-
"default":"1",
30-
"required": "false"
31-
},
32-
{
33-
"name":"container-name",
34-
"short_description":"Container Name",
35-
"description": "Name of the container to disrupt",
36-
"type":"string",
37-
"variable":"CONTAINER_NAME",
38-
"default":"etcd",
39-
"required": "false"
40-
},
41-
{
42-
"name":"action",
43-
"short_description":"Action",
44-
"description":"kill signal to run. For example 1 ( hang up ) or 9",
45-
"variable":"ACTION",
46-
"type":"string",
47-
"default":"1",
48-
"validator":"^[1-9]$",
2+
{
3+
"name": "namespace",
4+
"short_description": "Namespace",
5+
"description": "Targeted namespace in the cluster",
6+
"variable": "NAMESPACE",
7+
"type": "string",
8+
"default": "openshift-etcd",
9+
"required": "false"
10+
},
11+
{
12+
"name": "label-selector",
13+
"short_description": "Label Selector",
14+
"description": "Label of the container(s) to target",
15+
"variable": "LABEL_SELECTOR",
16+
"type": "string",
17+
"default": "k8s-app=etcd",
18+
"validator": "^.+\\=.+$",
19+
"validation_message": "Label selector must be in the format: key=value",
20+
"required": "false"
21+
},
22+
{
23+
"name": "exclude-selector",
24+
"short_description": "Exclude Pod Selector",
25+
"description": "Pods to exclude from targetting. For example \"{app: foo}\"",
26+
"type": "string",
27+
"variable": "EXCLUDE_LABEL",
28+
"validator": "^.+\\=.+$",
29+
"validation_message": "Exclude Pod selector must be in the following format: \"{app: foo}\"",
30+
"required": "false"
31+
},
32+
{
33+
"name": "disruption-count",
34+
"short_description": "Disruption Count",
35+
"description": "Number of container to disrupt",
36+
"type": "number",
37+
"variable": "DISRUPTION_COUNT",
38+
"default": "1",
39+
"required": "false"
40+
},
41+
{
42+
"name": "container-name",
43+
"short_description": "Container Name",
44+
"description": "Name of the container to disrupt",
45+
"type": "string",
46+
"variable": "CONTAINER_NAME",
47+
"default": "etcd",
48+
"required": "false"
49+
},
50+
{
51+
"name": "action",
52+
"short_description": "Action",
53+
"description": "kill signal to run. For example 1 ( hang up ) or 9",
54+
"variable": "ACTION",
55+
"type": "string",
56+
"default": "1",
57+
"validator": "^[1-9]$",
4958
"validation_message": "Kill signal must be a number between 1 and 9",
50-
"required":"false"
59+
"required": "false"
5160
},
5261
{
53-
"name":"expected-recovery-time",
54-
"short_description":"Expected Recovery Time",
55-
"description":"Time to wait before checking if all containers that were affected recover properly",
56-
"variable":"EXPECTED_RECOVERY_TIME",
57-
"type":"number",
58-
"default":"60",
59-
"required":"false"
62+
"name": "expected-recovery-time",
63+
"short_description": "Expected Recovery Time",
64+
"description": "Time to wait before checking if all containers that were affected recover properly",
65+
"variable": "EXPECTED_RECOVERY_TIME",
66+
"type": "number",
67+
"default": "60",
68+
"required": "false"
6069
}
61-
62-
6370
]

0 commit comments

Comments
 (0)