Skip to content

Commit

Permalink
fix: absent event in event interface
Browse files Browse the repository at this point in the history
Signed-off-by: SohamRatnaparkhi <[email protected]>
  • Loading branch information
SohamRatnaparkhi committed Nov 1, 2023
1 parent 269d5ac commit a9e271a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions chaoscenter/subscriber/pkg/events/chaosengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ func (ev *subscriberEvents) StopChaosEngineState(namespace string, workflowRunID
}

// StopWorkflow will patch the workflow based on workflow name using the shutdown strategy
func StopWorkflow(wfName string, namespace string) error {
func (ev *subscriberEvents) StopWorkflow(wfName string, namespace string) error {

conf, err := k8s.GetKubeConfig()
conf, err := ev.subscriberK8s.GetKubeConfig()
wfClient := wfclientset.NewForConfigOrDie(conf).ArgoprojV1alpha1().Workflows(namespace)
patch := []byte(`{"spec":{"shutdown":"Stop"}}`)
wf, err := wfClient.Patch(context.TODO(), wfName, mergeType.MergePatchType, patch, v1.PatchOptions{})
Expand Down
1 change: 1 addition & 0 deletions chaoscenter/subscriber/pkg/events/definations.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type SubscriberEvents interface {
WorkflowEventHandler(workflowObj *v1alpha1.Workflow, eventType string, startTime int64) (types.WorkflowEvent, error)
SendWorkflowUpdates(infraData map[string]string, event types.WorkflowEvent) (string, error)
WorkflowUpdates(infraData map[string]string, event chan types.WorkflowEvent)
StopWorkflow(wfName string, namespace string) error
}

type subscriberEvents struct {
Expand Down
6 changes: 3 additions & 3 deletions chaoscenter/subscriber/pkg/utils/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ func (utils *subscriberUtils) WorkflowRequest(agentData map[string]string, reque

logrus.Info("events delete name: ", wfOb.Name, "namespace: ", wfOb.Namespace)
} else if requestType == "workflow_run_stop" {
wfOb, err := events.GetWorkflowObj(externalData)
wfOb, err := utils.subscriberEventOperations.GetWorkflowObj(externalData)
if err != nil {
return err
}
err = events.StopChaosEngineState(agentData["INFRA_NAMESPACE"], &externalData)
err = utils.subscriberEventOperations.StopChaosEngineState(agentData["INFRA_NAMESPACE"], &externalData)
if err != nil {
logrus.Info("failed to stop chaosEngine for : ", wfOb.Name, " namespace: ", wfOb.Namespace, " : ", err)
}
err = events.StopWorkflow(wfOb.Name, wfOb.Namespace)
err = utils.subscriberEventOperations.StopWorkflow(wfOb.Name, wfOb.Namespace)
if err != nil {
logrus.Info("failed to stop experiment: ", wfOb.Name, " namespace: ", wfOb.Namespace, " : ", err)
}
Expand Down

0 comments on commit a9e271a

Please sign in to comment.