Skip to content

Commit 77e7073

Browse files
committed
Merge branch 'mike-aws-chaos' into release-07-07-23
2 parents a752022 + 6bfa422 commit 77e7073

21 files changed

+1667
-26
lines changed

api/v1alpha1/awschaos_types.go

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ type AWSChaosSpec struct {
6565
// +optional
6666
Duration *string `json:"duration,omitempty" webhook:"Duration"`
6767

68-
// SecretName defines the name of kubernetes secret.
69-
// +optional
70-
SecretName *string `json:"secretName,omitempty" webhook:",nilable"`
71-
7268
AWSSelector `json:",inline"`
7369

7470
// RemoteCluster represents the remote cluster where the chaos will be deployed
@@ -93,6 +89,10 @@ type AWSSelector struct {
9389
// AWSRegion defines the region of aws.
9490
AWSRegion string `json:"awsRegion"`
9591

92+
// SecretName defines the name of kubernetes secret.
93+
// +optional
94+
SecretName *string `json:"secretName,omitempty" webhook:",nilable"`
95+
9696
// Ec2Instance indicates the ID of the ec2 instance.
9797
Ec2Instance string `json:"ec2Instance"`
9898

@@ -107,6 +107,30 @@ type AWSSelector struct {
107107
// +ui:form:when=action=='detach-volume'
108108
// +optional
109109
DeviceName *string `json:"deviceName,omitempty" webhook:"AWSDeviceName,nilable"`
110+
111+
// Filters defines the filters to pass to the AWS api to query the list of instances.
112+
// Can be specified instead of Ec2Instance, in order to specify instances by tag or other attributes
113+
// Any parameter supported by AWS DescribeInstances method can be used.
114+
// For details see: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html
115+
Filters []*AWSFilter `json:"filters,omitempty"`
116+
117+
// Mode defines the mode to run chaos action.
118+
// Used only if Filters is specified.
119+
// Supported mode: one / all / fixed / fixed-percent / random-max-percent
120+
// +kubebuilder:validation:Enum=one;all;fixed;fixed-percent;random-max-percent
121+
Mode SelectorMode `json:"mode"`
122+
123+
// Value is required when the mode is set to `FixedMode` / `FixedPercentMode` / `RandomMaxPercentMode`.
124+
// If `FixedMode`, provide an integer of pods to do chaos action.
125+
// If `FixedPercentMode`, provide a number from 0-100 to specify the percent of pods the server can do chaos action.
126+
// IF `RandomMaxPercentMode`, provide a number from 0-100 to specify the max percent of pods to do chaos action
127+
// +optional
128+
Value string `json:"value,omitempty"`
129+
}
130+
131+
type AWSFilter struct {
132+
Name string `json:"name"`
133+
Values []string `json:"values"`
110134
}
111135

112136
func (obj *AWSChaos) GetSelectorSpecs() map[string]interface{} {

api/v1alpha1/awschaos_types_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@ var _ = Describe("AWSChaos", func() {
5858
Spec: AWSChaosSpec{
5959
Action: Ec2Stop,
6060
AWSSelector: AWSSelector{
61+
SecretName: &testSecretName,
6162
Ec2Instance: testInstance,
63+
Mode: OneMode,
6264
},
63-
SecretName: &testSecretName,
6465
},
6566
}
6667

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 36 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/chaos-mesh.org_awschaos.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,51 @@ spec:
6868
description: Endpoint indicates the endpoint of the aws server. Just
6969
used it in test now.
7070
type: string
71+
filters:
72+
description: 'Filters defines the filters to pass to the AWS api to
73+
query the list of instances. Can be specified instead of Ec2Instance,
74+
in order to specify instances by tag or other attributes Any parameter
75+
supported by AWS DescribeInstances method can be used. For details
76+
see: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html'
77+
items:
78+
properties:
79+
name:
80+
type: string
81+
values:
82+
items:
83+
type: string
84+
type: array
85+
required:
86+
- name
87+
- values
88+
type: object
89+
type: array
90+
mode:
91+
description: 'Mode defines the mode to run chaos action. Used only
92+
if Filters is specified. Supported mode: one / all / fixed / fixed-percent
93+
/ random-max-percent'
94+
enum:
95+
- one
96+
- all
97+
- fixed
98+
- fixed-percent
99+
- random-max-percent
100+
type: string
71101
remoteCluster:
72102
description: RemoteCluster represents the remote cluster where the
73103
chaos will be deployed
74104
type: string
75105
secretName:
76106
description: SecretName defines the name of kubernetes secret.
77107
type: string
108+
value:
109+
description: Value is required when the mode is set to `FixedMode`
110+
/ `FixedPercentMode` / `RandomMaxPercentMode`. If `FixedMode`, provide
111+
an integer of pods to do chaos action. If `FixedPercentMode`, provide
112+
a number from 0-100 to specify the percent of pods the server can
113+
do chaos action. IF `RandomMaxPercentMode`, provide a number from
114+
0-100 to specify the max percent of pods to do chaos action
115+
type: string
78116
volumeID:
79117
description: EbsVolume indicates the ID of the EBS volume. Needed
80118
in detach-volume.
@@ -83,6 +121,7 @@ spec:
83121
- action
84122
- awsRegion
85123
- ec2Instance
124+
- mode
86125
type: object
87126
status:
88127
description: AWSChaosStatus represents the status of an AWSChaos

config/crd/bases/chaos-mesh.org_schedules.yaml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,52 @@ spec:
6666
description: Endpoint indicates the endpoint of the aws server.
6767
Just used it in test now.
6868
type: string
69+
filters:
70+
description: 'Filters defines the filters to pass to the AWS api
71+
to query the list of instances. Can be specified instead of
72+
Ec2Instance, in order to specify instances by tag or other attributes
73+
Any parameter supported by AWS DescribeInstances method can
74+
be used. For details see: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html'
75+
items:
76+
properties:
77+
name:
78+
type: string
79+
values:
80+
items:
81+
type: string
82+
type: array
83+
required:
84+
- name
85+
- values
86+
type: object
87+
type: array
88+
mode:
89+
description: 'Mode defines the mode to run chaos action. Used
90+
only if Filters is specified. Supported mode: one / all / fixed
91+
/ fixed-percent / random-max-percent'
92+
enum:
93+
- one
94+
- all
95+
- fixed
96+
- fixed-percent
97+
- random-max-percent
98+
type: string
6999
remoteCluster:
70100
description: RemoteCluster represents the remote cluster where
71101
the chaos will be deployed
72102
type: string
73103
secretName:
74104
description: SecretName defines the name of kubernetes secret.
75105
type: string
106+
value:
107+
description: Value is required when the mode is set to `FixedMode`
108+
/ `FixedPercentMode` / `RandomMaxPercentMode`. If `FixedMode`,
109+
provide an integer of pods to do chaos action. If `FixedPercentMode`,
110+
provide a number from 0-100 to specify the percent of pods the
111+
server can do chaos action. IF `RandomMaxPercentMode`, provide
112+
a number from 0-100 to specify the max percent of pods to do
113+
chaos action
114+
type: string
76115
volumeID:
77116
description: EbsVolume indicates the ID of the EBS volume. Needed
78117
in detach-volume.
@@ -81,6 +120,7 @@ spec:
81120
- action
82121
- awsRegion
83122
- ec2Instance
123+
- mode
84124
type: object
85125
awsazChaos:
86126
description: AWSAzChaosSpec is the content of the specification for
@@ -3331,6 +3371,37 @@ spec:
33313371
description: Endpoint indicates the endpoint of the
33323372
aws server. Just used it in test now.
33333373
type: string
3374+
filters:
3375+
description: 'Filters defines the filters to pass to
3376+
the AWS api to query the list of instances. Can be
3377+
specified instead of Ec2Instance, in order to specify
3378+
instances by tag or other attributes Any parameter
3379+
supported by AWS DescribeInstances method can be used.
3380+
For details see: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html'
3381+
items:
3382+
properties:
3383+
name:
3384+
type: string
3385+
values:
3386+
items:
3387+
type: string
3388+
type: array
3389+
required:
3390+
- name
3391+
- values
3392+
type: object
3393+
type: array
3394+
mode:
3395+
description: 'Mode defines the mode to run chaos action.
3396+
Used only if Filters is specified. Supported mode:
3397+
one / all / fixed / fixed-percent / random-max-percent'
3398+
enum:
3399+
- one
3400+
- all
3401+
- fixed
3402+
- fixed-percent
3403+
- random-max-percent
3404+
type: string
33343405
remoteCluster:
33353406
description: RemoteCluster represents the remote cluster
33363407
where the chaos will be deployed
@@ -3339,6 +3410,16 @@ spec:
33393410
description: SecretName defines the name of kubernetes
33403411
secret.
33413412
type: string
3413+
value:
3414+
description: Value is required when the mode is set
3415+
to `FixedMode` / `FixedPercentMode` / `RandomMaxPercentMode`.
3416+
If `FixedMode`, provide an integer of pods to do chaos
3417+
action. If `FixedPercentMode`, provide a number from
3418+
0-100 to specify the percent of pods the server can
3419+
do chaos action. IF `RandomMaxPercentMode`, provide
3420+
a number from 0-100 to specify the max percent of
3421+
pods to do chaos action
3422+
type: string
33423423
volumeID:
33433424
description: EbsVolume indicates the ID of the EBS volume.
33443425
Needed in detach-volume.
@@ -3347,6 +3428,7 @@ spec:
33473428
- action
33483429
- awsRegion
33493430
- ec2Instance
3431+
- mode
33503432
type: object
33513433
awsazChaos:
33523434
description: AWSAzChaosSpec is the content of the specification
@@ -6447,6 +6529,37 @@ spec:
64476529
description: Endpoint indicates the endpoint of
64486530
the aws server. Just used it in test now.
64496531
type: string
6532+
filters:
6533+
description: 'Filters defines the filters to pass
6534+
to the AWS api to query the list of instances.
6535+
Can be specified instead of Ec2Instance, in order
6536+
to specify instances by tag or other attributes
6537+
Any parameter supported by AWS DescribeInstances
6538+
method can be used. For details see: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html'
6539+
items:
6540+
properties:
6541+
name:
6542+
type: string
6543+
values:
6544+
items:
6545+
type: string
6546+
type: array
6547+
required:
6548+
- name
6549+
- values
6550+
type: object
6551+
type: array
6552+
mode:
6553+
description: 'Mode defines the mode to run chaos
6554+
action. Used only if Filters is specified. Supported
6555+
mode: one / all / fixed / fixed-percent / random-max-percent'
6556+
enum:
6557+
- one
6558+
- all
6559+
- fixed
6560+
- fixed-percent
6561+
- random-max-percent
6562+
type: string
64506563
remoteCluster:
64516564
description: RemoteCluster represents the remote
64526565
cluster where the chaos will be deployed
@@ -6455,6 +6568,16 @@ spec:
64556568
description: SecretName defines the name of kubernetes
64566569
secret.
64576570
type: string
6571+
value:
6572+
description: Value is required when the mode is
6573+
set to `FixedMode` / `FixedPercentMode` / `RandomMaxPercentMode`.
6574+
If `FixedMode`, provide an integer of pods to
6575+
do chaos action. If `FixedPercentMode`, provide
6576+
a number from 0-100 to specify the percent of
6577+
pods the server can do chaos action. IF `RandomMaxPercentMode`, provide
6578+
a number from 0-100 to specify the max percent
6579+
of pods to do chaos action
6580+
type: string
64586581
volumeID:
64596582
description: EbsVolume indicates the ID of the EBS
64606583
volume. Needed in detach-volume.
@@ -6463,6 +6586,7 @@ spec:
64636586
- action
64646587
- awsRegion
64656588
- ec2Instance
6589+
- mode
64666590
type: object
64676591
awsazChaos:
64686592
description: AWSAzChaosSpec is the content of the specification

0 commit comments

Comments
 (0)