Skip to content

Commit

Permalink
fix: use Label Selector
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Sukhin <[email protected]>
  • Loading branch information
vsukhin committed Nov 14, 2024
1 parent fb46a3a commit e69a2f9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion api/v1/testkube.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
8 changes: 4 additions & 4 deletions pkg/mapper/testworkflows/kube_openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/mapper/testworkflows/openapi_kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -846,15 +846,15 @@ 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),
Values: v.Values,
}
}

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),
Expand Down

0 comments on commit e69a2f9

Please sign in to comment.