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 (#4881)

Signed-off-by: Rogério Brito <[email protected]>
Co-authored-by: Sayan Mondal <[email protected]>
  • Loading branch information
rogeriofbrito and S-ayanide authored Dec 20, 2024
1 parent b577b03 commit a5db094
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 @@ -811,6 +811,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 @@ -963,6 +964,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 @@ -1153,6 +1155,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 a5db094

Please sign in to comment.