Skip to content
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

Add probe source part to kubernetes cmd properties of ChaosEngine manifest #4881

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading