-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(env): updated the env getter function & default jobCleanUpPolicy as retain #144
Conversation
Signed-off-by: shubhamchaudhary <shubham@chaosnative.com>
Just added @kazukousen for review - as author of a recent refactor of the same! |
07b4bd5
to
40c9045
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the env getter function
looks good to me, thanks
@@ -38,6 +38,20 @@ func (engineDetails *EngineDetails) SetEngineUID(clients ClientSets) error { | |||
|
|||
//SetENV sets ENV values in experimentDetails struct. | |||
func (expDetails *ExperimentDetails) SetENV(engineDetails EngineDetails, clients ClientSets) error { | |||
// Setting envs from engine fields other than env | |||
expDetails.setEnv("CHAOSENGINE", engineDetails.Name). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Do we really need builder for setting ENV's. I would suggest a slice of ENV variables, as in v1.EnvVar
, and then we don't have to do same function call again and again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Added function to exclude all the envs who contains an empty value
- as the number of envs increases the slice size increases which can fail bch guidelines(4x lines)
return "", errors.Errorf("unable to delete ChaosExperiment Job name: %v, in namespace: %v, error: %v", experiment.JobName, experiment.Namespace, err) | ||
} | ||
case v1alpha1.CleanUpPolicyRetain: | ||
log.Infof("[skip]: skipping the job deletion as jobCleanUpPolicy is set to {%v}", expEngine.Spec.JobCleanUpPolicy) | ||
default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handling for string(expEngine.Spec.JobCleanUpPolicy) == ""
is already in default, no need to create new variable for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is added to handle the cases, if someone added jobCleanUpPolicy to some wrong value other than delete or retain
Signed-off-by: shubhamchaudhary <shubham@chaosnative.com>
…y as retain (litmuschaos#144) * chore(env): improved the env getter function Signed-off-by: shubhamchaudhary <shubham@chaosnative.com> * marked default jobCleanupPolicy to retain Signed-off-by: shubhamchaudhary <shubham@chaosnative.com>
* rm(vendor): removing the vendor directory from litmus-go (#147) Signed-off-by: shubhamchaudhary <shubham@chaosnative.com> * chore(env): updated the env getter function & default jobCleanUpPolicy as retain (#144) * chore(env): improved the env getter function Signed-off-by: shubhamchaudhary <shubham@chaosnative.com> * marked default jobCleanupPolicy to retain Signed-off-by: shubhamchaudhary <shubham@chaosnative.com> * chore(chaosresult): updating verdict and status in chaosengine and chaosresult (#148) Signed-off-by: shubhamchaudhary <shubham@chaosnative.com> * chore(vendors): updating the target details vendors (#149) Signed-off-by: shubhamchaudhary <shubham@chaosnative.com> * Fix: Print error for some error events (#150) Signed-off-by: udit <udit@chaosnative.com> Co-authored-by: Shubham Chaudhary <shubham.chaudhary@mayadata.io> Co-authored-by: Udit Gaurav <35391335+uditgaurav@users.noreply.github.com>
Signed-off-by: shubhamchaudhary shubham@chaosnative.com
What this PR does / why we need it:
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
Checklist:
documentation
tagbreaking-changes
tagrequires-upgrade
tag