Skip to content

Commit f051d5a

Browse files
authored
Rename env to EC2_INSTANCE_TAG (#708)
Signed-off-by: Jongwoo Han <[email protected]>
1 parent 10e9b77 commit f051d5a

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

chaoslib/litmus/ec2-terminate-by-tag/lib/ec2-terminate-by-tag.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,14 @@ func injectChaosInParallelMode(experimentsDetails *experimentTypes.ExperimentDet
221221
// SetTargetInstance will select the target instance which are in running state and filtered from the given instance tag
222222
func SetTargetInstance(experimentsDetails *experimentTypes.ExperimentDetails) error {
223223

224-
instanceIDList, err := awslib.GetInstanceList(experimentsDetails.InstanceTag, experimentsDetails.Region)
224+
instanceIDList, err := awslib.GetInstanceList(experimentsDetails.Ec2InstanceTag, experimentsDetails.Region)
225225
if err != nil {
226226
return stacktrace.Propagate(err, "failed to get the instance id list")
227227
}
228228
if len(instanceIDList) == 0 {
229229
return cerrors.Error{
230230
ErrorCode: cerrors.ErrorTypeTargetSelection,
231-
Reason: fmt.Sprintf("no instance found with the given tag %v, in region %v", experimentsDetails.InstanceTag, experimentsDetails.Region),
231+
Reason: fmt.Sprintf("no instance found with the given tag %v, in region %v", experimentsDetails.Ec2InstanceTag, experimentsDetails.Region),
232232
}
233233
}
234234

@@ -246,7 +246,7 @@ func SetTargetInstance(experimentsDetails *experimentTypes.ExperimentDetails) er
246246
return cerrors.Error{
247247
ErrorCode: cerrors.ErrorTypeChaosInject,
248248
Reason: "failed to get any running instance",
249-
Target: fmt.Sprintf("EC2 Instance Tag: %v", experimentsDetails.InstanceTag)}
249+
Target: fmt.Sprintf("EC2 Instance Tag: %v", experimentsDetails.Ec2InstanceTag)}
250250
}
251251

252252
log.InfoWithValues("[Info]: Targeting the running instances filtered from instance tag", logrus.Fields{

experiments/kube-aws/ec2-terminate-by-tag/experiment/ec2-terminate-tag.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func EC2TerminateByTag(clients clients.ClientSets) {
7171
log.InfoWithValues("The instance information is as follows", logrus.Fields{
7272
"Chaos Duration": experimentsDetails.ChaosDuration,
7373
"Chaos Namespace": experimentsDetails.ChaosNamespace,
74-
"Instance Tag": experimentsDetails.InstanceTag,
74+
"Instance Tag": experimentsDetails.Ec2InstanceTag,
7575
"Instance Affected Percentage": experimentsDetails.InstanceAffectedPerc,
7676
"Sequence": experimentsDetails.Sequence,
7777
})

experiments/kube-aws/ec2-terminate-by-tag/test/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spec:
2222
- "3600"
2323
env:
2424
# value: key:value ex: team:devops
25-
- name: INSTANCE_TAG
25+
- name: EC2_INSTANCE_TAG
2626
value: ''
2727

2828
- name: CHAOS_NAMESPACE

pkg/kube-aws/ec2-terminate-by-tag/environment/environment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func GetENV(experimentDetails *experimentTypes.ExperimentDetails) {
2525
experimentDetails.Timeout, _ = strconv.Atoi(types.Getenv("STATUS_CHECK_TIMEOUT", "180"))
2626
experimentDetails.Region = types.Getenv("REGION", "")
2727
experimentDetails.ManagedNodegroup = types.Getenv("MANAGED_NODEGROUP", "disable")
28-
experimentDetails.InstanceTag = strings.TrimSpace(types.Getenv("INSTANCE_TAG", ""))
28+
experimentDetails.Ec2InstanceTag = strings.TrimSpace(types.Getenv("EC2_INSTANCE_TAG", ""))
2929
experimentDetails.InstanceAffectedPerc, _ = strconv.Atoi(types.Getenv("INSTANCE_AFFECTED_PERC", "0"))
3030
experimentDetails.Sequence = types.Getenv("SEQUENCE", "parallel")
3131
}

pkg/kube-aws/ec2-terminate-by-tag/types/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type ExperimentDetails struct {
1717
ChaosPodName string
1818
Timeout int
1919
Delay int
20-
InstanceTag string
20+
Ec2InstanceTag string
2121
Region string
2222
InstanceAffectedPerc int
2323
ManagedNodegroup string

0 commit comments

Comments
 (0)