From e69a2f94a8e641eba8d4a399c8a63442c08ccd7b Mon Sep 17 00:00:00 2001 From: Vladislav Sukhin Date: Thu, 14 Nov 2024 19:59:02 +0300 Subject: [PATCH] fix: use Label Selector Signed-off-by: Vladislav Sukhin --- api/v1/testkube.yaml | 2 +- .../model_test_workflow_step_execute_test_workflow_ref.go | 4 ++-- pkg/mapper/testworkflows/kube_openapi.go | 8 ++++---- pkg/mapper/testworkflows/openapi_kube.go | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/api/v1/testkube.yaml b/api/v1/testkube.yaml index 58d8d7ee55..26fafe0525 100644 --- a/api/v1/testkube.yaml +++ b/api/v1/testkube.yaml @@ -9042,7 +9042,7 @@ components: config: $ref: "#/components/schemas/TestWorkflowConfigValue" selector: - $ref: "https://raw.githubusercontent.com/garethr/kubernetes-json-schema/master/v1.7.8/_definitions.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector" + $ref: "#/components/schemas/LabelSelector" description: label selector for test workflow TestWorkflowStepExecuteTestRef: diff --git a/pkg/api/v1/testkube/model_test_workflow_step_execute_test_workflow_ref.go b/pkg/api/v1/testkube/model_test_workflow_step_execute_test_workflow_ref.go index e0c8f3156e..be1e4454f7 100644 --- a/pkg/api/v1/testkube/model_test_workflow_step_execute_test_workflow_ref.go +++ b/pkg/api/v1/testkube/model_test_workflow_step_execute_test_workflow_ref.go @@ -23,6 +23,6 @@ type TestWorkflowStepExecuteTestWorkflowRef struct { // matrix of parameters to spawn instances Matrix map[string]interface{} `json:"matrix,omitempty"` // parameters that should be distributed across sharded instances - Shards map[string]interface{} `json:"shards,omitempty"` - Selector *IoK8sApimachineryPkgApisMetaV1LabelSelector `json:"selector,omitempty"` + Shards map[string]interface{} `json:"shards,omitempty"` + Selector *LabelSelector `json:"selector,omitempty"` } diff --git a/pkg/mapper/testworkflows/kube_openapi.go b/pkg/mapper/testworkflows/kube_openapi.go index 5785762402..9076451da8 100644 --- a/pkg/mapper/testworkflows/kube_openapi.go +++ b/pkg/mapper/testworkflows/kube_openapi.go @@ -806,16 +806,16 @@ func MapStepExecuteTestKubeToAPI(v testworkflowsv1.StepExecuteTest) testkube.Tes } } -func MapLabelSelectorRequirementToAPI(v metav1.LabelSelectorRequirement) testkube.IoK8sApimachineryPkgApisMetaV1LabelSelectorRequirement { - return testkube.IoK8sApimachineryPkgApisMetaV1LabelSelectorRequirement{ +func MapLabelSelectorRequirementToAPI(v metav1.LabelSelectorRequirement) testkube.LabelSelectorRequirement { + return testkube.LabelSelectorRequirement{ Key: v.Key, Operator: string(v.Operator), Values: v.Values, } } -func MapSelectorToAPI(v metav1.LabelSelector) testkube.IoK8sApimachineryPkgApisMetaV1LabelSelector { - return testkube.IoK8sApimachineryPkgApisMetaV1LabelSelector{ +func MapSelectorToAPI(v metav1.LabelSelector) testkube.LabelSelector { + return testkube.LabelSelector{ MatchLabels: v.MatchLabels, MatchExpressions: common.MapSlice(v.MatchExpressions, MapLabelSelectorRequirementToAPI), } diff --git a/pkg/mapper/testworkflows/openapi_kube.go b/pkg/mapper/testworkflows/openapi_kube.go index 79b1b97d8f..86b9bf7ede 100644 --- a/pkg/mapper/testworkflows/openapi_kube.go +++ b/pkg/mapper/testworkflows/openapi_kube.go @@ -846,7 +846,7 @@ func MapStepExecuteTestAPIToKube(v testkube.TestWorkflowStepExecuteTestRef) test } } -func MapLabelSelectorRequirementToCRD(v testkube.IoK8sApimachineryPkgApisMetaV1LabelSelectorRequirement) metav1.LabelSelectorRequirement { +func MapLabelSelectorRequirementToCRD(v testkube.LabelSelectorRequirement) metav1.LabelSelectorRequirement { return metav1.LabelSelectorRequirement{ Key: v.Key, Operator: metav1.LabelSelectorOperator(v.Operator), @@ -854,7 +854,7 @@ func MapLabelSelectorRequirementToCRD(v testkube.IoK8sApimachineryPkgApisMetaV1L } } -func MapSelectorToCRD(v testkube.IoK8sApimachineryPkgApisMetaV1LabelSelector) metav1.LabelSelector { +func MapSelectorToCRD(v testkube.LabelSelector) metav1.LabelSelector { return metav1.LabelSelector{ MatchLabels: v.MatchLabels, MatchExpressions: common.MapSlice(v.MatchExpressions, MapLabelSelectorRequirementToCRD),