From 33c6cb90c62ea413e0e9be614bf4325d3586530c Mon Sep 17 00:00:00 2001 From: Josh Salomon <jsalomon@redhat.com> Date: Thu, 26 Oct 2023 16:07:38 +0300 Subject: [PATCH] Change resource parameters to string to fit k8s convention Signed-off-by: Josh Salomon <jsalomon@redhat.com> --- api/v1alpha1/codecoapp_types.go | 12 ++++------ .../bases/codeco.he-codeco.eu_codecoapps.yaml | 24 +++++++------------ config/manager/kustomization.yaml | 2 +- config/samples/codeco_v1alpha1_codecoapp.yaml | 12 +++++----- 4 files changed, 19 insertions(+), 31 deletions(-) diff --git a/api/v1alpha1/codecoapp_types.go b/api/v1alpha1/codecoapp_types.go index 50afdbe..0ccc016 100644 --- a/api/v1alpha1/codecoapp_types.go +++ b/api/v1alpha1/codecoapp_types.go @@ -49,21 +49,17 @@ const ( // CodecoAppResource defines the resource consumption of CodecoApp type CodecoAppResource struct { - //+kubebuilder:validation:Minimum=0 //+kubebuilder:validation:default=100 - CpuUsagePct uint64 `json:"cpu-usage-pct,omitempty"` + CpuUsagePct string `json:"cpu,omitempty"` - //+kubebuilder:validation:Minimum=0 //+kubebuilder:validation:default=8 - MemUsageGB uint64 `json:"mem-usage-GB,omitempty"` + MemUsageGB string `json:"mem,omitempty"` - //+kubebuilder:validation:Minimum=0 //+kubebuilder:validation:default=25 - NWBandwidthMbs uint64 `json:"nwbandwidth-Mbs,omitempty"` + NWBandwidthMbs string `json:"nwbandwidth,omitempty"` - //+kubebuilder:validation:Minimum=0 //+kubebuilder:validation:default=10 - NWLatencyMs uint64 `json:"nwlatency-ms,omitempty"` + NWLatencyMs string `json:"nwlatency,omitempty"` } // CodecoAppMSSpec defines the desired state of CodecoApp micro service diff --git a/config/crd/bases/codeco.he-codeco.eu_codecoapps.yaml b/config/crd/bases/codeco.he-codeco.eu_codecoapps.yaml index 0cbe415..c8d0bfe 100644 --- a/config/crd/bases/codeco.he-codeco.eu_codecoapps.yaml +++ b/config/crd/bases/codeco.he-codeco.eu_codecoapps.yaml @@ -55,22 +55,14 @@ spec: micro service required resources. Edit codecoapp_types.go to remove/update properties: - cpu-usage-pct: - format: int64 - minimum: 0 - type: integer - mem-usage-GB: - format: int64 - minimum: 0 - type: integer - nwbandwidth-Mbs: - format: int64 - minimum: 0 - type: integer - nwlatency-ms: - format: int64 - minimum: 0 - type: integer + cpu: + type: string + mem: + type: string + nwbandwidth: + type: string + nwlatency: + type: string type: object required: - name diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 6beebd8..97b3504 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -5,4 +5,4 @@ kind: Kustomization images: - name: controller newName: quay.io/jsalomon/codecoapp-test - newTag: v0.0.4 + newTag: v0.0.5 diff --git a/config/samples/codeco_v1alpha1_codecoapp.yaml b/config/samples/codeco_v1alpha1_codecoapp.yaml index 18f2b49..dd2ea28 100644 --- a/config/samples/codeco_v1alpha1_codecoapp.yaml +++ b/config/samples/codeco_v1alpha1_codecoapp.yaml @@ -16,18 +16,18 @@ spec: name: "CODECO micro service 1", podspecname: "MicroService1", required-resources: { - cpu-usage-pct: 200, - mem-usage-GB: 120, - nwbandwidth-Mbs: 10 + cpu: "2", + mem: 120G, + nwbandwidth: 10M } }, { name: "CODECO micro service 2", podspecname: "MicroService2", required-resources: { - cpu-usage-pct: 150, - mem-usage-GB: 80, - nwbandwidth-Mbs: 20 + cpu: 1500m, + mem: 80G, + nwbandwidth: 20M } }, ] -- GitLab