Skip to content

Commit

Permalink
Add probe source part to kubernetes cmd properties of ChaosEngine man…
Browse files Browse the repository at this point in the history
…ifest (litmuschaos#4881)

Signed-off-by: Rogério Brito <[email protected]>
Co-authored-by: Sayan Mondal <[email protected]>
Signed-off-by: andoriyaprashant <[email protected]>
  • Loading branch information
2 people authored and andoriyaprashant committed Dec 26, 2024
1 parent fd9198e commit 97887e9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions chaoscenter/graphql/server/pkg/probe/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,7 @@ func (p *probeService) GenerateExperimentManifestWithProbes(manifest string, pro
CmdProbeInputs: &v1alpha1.CmdProbeInputs{
Command: cmdProbe.CmdProbeInputs.Command,
Comparator: cmdProbe.CmdProbeInputs.Comparator,
Source: cmdProbe.CmdProbeInputs.Source,
},
RunProperties: cmdProbe.RunProperties,
Mode: cmdProbe.Mode,
Expand Down Expand Up @@ -975,6 +976,7 @@ func (p *probeService) GenerateCronExperimentManifestWithProbes(manifest string,
CmdProbeInputs: &v1alpha1.CmdProbeInputs{
Command: cmdProbe.CmdProbeInputs.Command,
Comparator: cmdProbe.CmdProbeInputs.Comparator,
Source: cmdProbe.CmdProbeInputs.Source,
},
RunProperties: cmdProbe.RunProperties,
Mode: cmdProbe.Mode,
Expand Down Expand Up @@ -1165,6 +1167,15 @@ func (p *probeService) GenerateProbeManifest(probe *model.Probe, mode model.Mode
_probe.RunProperties.StopOnFailure = *probe.KubernetesCMDProperties.StopOnFailure
}

if probe.KubernetesCMDProperties.Source != nil {
var source v1alpha1.SourceDetails
err := json.Unmarshal([]byte(*probe.KubernetesCMDProperties.Source), &source)
if err != nil {
logrus.Warnf("error unmarshalling soruce: %s - the source part of the probe is being ignored", err.Error())
}
_probe.CmdProbeInputs.Source = &source
}

y, err := json.Marshal(_probe)
if err != nil {
return "", err
Expand Down

0 comments on commit 97887e9

Please sign in to comment.