From a5db094db2ad6bc9d2ac2d91d6109c20a4d80ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= Date: Fri, 20 Dec 2024 04:47:43 -0300 Subject: [PATCH] Add probe source part to kubernetes cmd properties of ChaosEngine manifest (#4881) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rogério Brito Co-authored-by: Sayan Mondal --- .../graphql/server/pkg/probe/handler/handler.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/chaoscenter/graphql/server/pkg/probe/handler/handler.go b/chaoscenter/graphql/server/pkg/probe/handler/handler.go index 193b81147d2..559e57e7ba0 100644 --- a/chaoscenter/graphql/server/pkg/probe/handler/handler.go +++ b/chaoscenter/graphql/server/pkg/probe/handler/handler.go @@ -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, @@ -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, @@ -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