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

fix: provide workflow name to parallel workers, so it will properly build path for artifacts #5953

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions cmd/tcl/testworkflow-toolkit/commands/parallel.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

"github.com/pkg/errors"
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

testworkflowsv1 "github.com/kubeshop/testkube-operator/api/testworkflows/v1"
commontcl "github.com/kubeshop/testkube/cmd/tcl/testworkflow-toolkit/common"
Expand Down Expand Up @@ -220,10 +221,10 @@ func NewParallelCmd() *cobra.Command {
result, err := spawn.ExecutionWorker().Execute(context.Background(), executionworkertypes.ExecuteRequest{
ResourceId: cfg.Resource.Id,
Execution: cfg.Execution,
Workflow: testworkflowsv1.TestWorkflow{Spec: *spec},
Workflow: testworkflowsv1.TestWorkflow{ObjectMeta: metav1.ObjectMeta{Name: cfg.Workflow.Name, Labels: cfg.Workflow.Labels}, Spec: *spec},
ScheduledAt: &scheduledAt,
ControlPlane: cfg.ControlPlane,
ArtifactsPathPrefix: cfg.Resource.FsPrefix,
ArtifactsPathPrefix: spawn.CreateResourceConfig("", index).FsPrefix, // Omit duplicated reference for FS prefix
})
if err != nil {
fmt.Printf("%d: failed to prepare resources: %s\n", index, err.Error())
Expand Down
3 changes: 2 additions & 1 deletion cmd/tcl/testworkflow-toolkit/commands/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/pkg/errors"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

testworkflowsv1 "github.com/kubeshop/testkube-operator/api/testworkflows/v1"
commontcl "github.com/kubeshop/testkube/cmd/tcl/testworkflow-toolkit/common"
Expand Down Expand Up @@ -271,7 +272,7 @@ func NewServicesCmd() *cobra.Command {
ResourceId: cfg.Resource.Id,
GroupId: groupRef,
Execution: cfg.Execution,
Workflow: testworkflowsv1.TestWorkflow{Spec: instance.Spec},
Workflow: testworkflowsv1.TestWorkflow{ObjectMeta: metav1.ObjectMeta{Name: cfg.Workflow.Name, Labels: cfg.Workflow.Labels}, Spec: instance.Spec},
ScheduledAt: &scheduledAt,
RestartPolicy: string(instance.RestartPolicy),
ReadinessProbe: common.MapPtr(instance.ReadinessProbe, testworkflows.MapProbeKubeToAPI),
Expand Down
5 changes: 4 additions & 1 deletion pkg/testworkflows/executionworker/registry/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ func (r *controllersRegistry) unsafeGet(id string) (ctrl controller.Controller,
func (r *controllersRegistry) deregister(id string) {
r.mu.Lock()
r.controllerReservations[id]--
if r.controllerReservations[id] == 0 {
if r.controllerReservations[id] < 0 {
r.controllerReservations[id] = 0
}
if r.controllerReservations[id] == 0 && r.controllers[id] != nil {
podIp, err := r.controllers[id].PodIP()
if err == nil && podIp != "" {
r.ips.Register(id, podIp)
Expand Down
Loading