Skip to content

Commit

Permalink
fix: format methods
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Sukhin <[email protected]>
  • Loading branch information
vsukhin committed Dec 18, 2024
1 parent 19fadbf commit f242e45
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/mapper/testworkflows/kube_openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -1246,15 +1246,19 @@ func MapResourcesListKubeCoreToAPI(v corev1.ResourceList) *testkube.TestWorkflow
if q, ok := v[corev1.ResourceCPU]; ok {
res.Cpu = q.String()
}

if q, ok := v[corev1.ResourceMemory]; ok {
res.Memory = q.String()
}

if q, ok := v[corev1.ResourceStorage]; ok {
res.Storage = q.String()
}

if q, ok := v[corev1.ResourceEphemeralStorage]; ok {
res.EphemeralStorage = q.String()
}

return res
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/mapper/testworkflows/openapi_kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -1524,19 +1524,24 @@ func MapResourcesListAPIToKubeCore(v *testkube.TestWorkflowResourcesList) corev1
if v == nil {
return nil
}

res := make(map[corev1.ResourceName]resource.Quantity)
if v.Cpu != "" {
res[corev1.ResourceCPU], _ = resource.ParseQuantity(v.Cpu)
}

if v.Memory != "" {
res[corev1.ResourceMemory], _ = resource.ParseQuantity(v.Memory)
}

if v.Storage != "" {
res[corev1.ResourceStorage], _ = resource.ParseQuantity(v.Storage)
}

if v.EphemeralStorage != "" {
res[corev1.ResourceEphemeralStorage], _ = resource.ParseQuantity(v.EphemeralStorage)
}

return res
}

Expand Down

0 comments on commit f242e45

Please sign in to comment.