Skip to content

Commit

Permalink
refractor: use update manifest function in cronworkflow
Browse files Browse the repository at this point in the history
Signed-off-by: SohamRatnaparkhi <[email protected]>
  • Loading branch information
SohamRatnaparkhi committed Jul 2, 2023
1 parent 97ea86a commit bf885d3
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions litmus-portal/graphql-server/pkg/chaos-workflow/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,18 +444,12 @@ func processCronWorkflowManifest(workflow *model.ChaosWorkFlowRequest, weights m
cronWorkflowManifest.Labels = updateManifestLabels(cronWorkflowManifest.Labels, *workflow.WorkflowID, workflow.ClusterID, false)

if cronWorkflowManifest.Spec.WorkflowMetadata == nil {
cronWorkflowManifest.Spec.WorkflowMetadata = &v1.ObjectMeta{
Labels: map[string]string{
"workflow_id": *workflow.WorkflowID,
"cluster_id": workflow.ClusterID,
"workflows.argoproj.io/controller-instanceid": workflow.ClusterID,
},
}
} else {
cronWorkflowManifest.Spec.WorkflowMetadata.Labels = updateManifestLabels(cronWorkflowManifest.Spec.WorkflowMetadata.Labels, *workflow.WorkflowID, workflow.ClusterID, false)
cronWorkflowManifest.Spec.WorkflowMetadata = &v1.ObjectMeta{}
}
cronWorkflowManifest.Spec.WorkflowMetadata.Labels = updateManifestLabels(cronWorkflowManifest.Spec.WorkflowMetadata.Labels, *workflow.WorkflowID, workflow.ClusterID, false)

cronWorkflowManifest.Spec.WorkflowSpec.Templates, newWeights, err = generateFaultWeights(cronWorkflowManifest.Spec.WorkflowSpec.Templates, weights)

if err != nil {
return err
}
Expand Down

0 comments on commit bf885d3

Please sign in to comment.