diff --git a/api/v1alpha1/codecoapp_types.go b/api/v1alpha1/codecoapp_types.go index bedfe7df90fddf302526e5e0056b090103dd7133..f32a65650424981607eb0b76f48b90a15267855e 100644 --- a/api/v1alpha1/codecoapp_types.go +++ b/api/v1alpha1/codecoapp_types.go @@ -70,24 +70,6 @@ const ( ServiceClassAssured = "ASSURED" ) -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// CodecoAppResource defines the resource consumption of CodecoApp -type CodecoAppResource struct { - //+kubebuilder:validation:default=100 - CpuUsagePct string `json:"cpu,omitempty"` - - //+kubebuilder:validation:default=8 - MemUsageGB string `json:"mem,omitempty"` - - //+kubebuilder:validation:default=25 - NWBandwidthMbs string `json:"nwbandwidth,omitempty"` - - //+kubebuilder:validation:default=10 - NWLatencyMs string `json:"nwlatency,omitempty"` -} - // CodecoAppMSSpec defines the desired state of CodecoApp micro service type CodecoAppMSSpec struct { // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster @@ -102,8 +84,11 @@ type CodecoAppMSSpec struct { // A reference to the PodSpec of the microservice. Edit codecoapp_types.go to remove/update Template v1.PodSpec `json:"podspec,omitempty"` - // RequiredResources is used to identify the CODECO micro service required resources. Edit codecoapp_types.go to remove/update - RequiredResources CodecoAppResource `json:"requiredResources,omitempty"` + //+kubebuilder:validation:default=25 + NWBandwidthMbs string `json:"nwbandwidth,omitempty"` + + //+kubebuilder:validation:default=10 + NWLatencyMs string `json:"nwlatency,omitempty"` } // ServiceId is a combination of a service name and an application name. @@ -197,11 +182,23 @@ type CodecoAppSpec struct { FailureTolerance CodecoFailureTolerance `json:"appFailureTolerance,omitempty"` } +type ServiceStatusMetrics struct { + ServiceName string `json:"service_name,omitempty"` + NodeName string `json:"node_name,omitempty"` + AvgServiceCpuUsage string `json:"service_cpu,omitempty"` + AvgServiceMemoryUsage string `json:"service_memory,omitempty"` + AvgServiceFailure string `json:"service_failure,omitempty"` + AvgServiceEnergyExpenditure string `json:"service_energy,omitempty"` + AvgServiceSecurity string `json:"service_security,omitempty"` +} + // CodecoAppStatusMetrics defines the observed metrics of CodecoApp type CodecoAppStatusMetrics struct { - Numpods int `json:"numpods,omitempty"` - AvgLoad uint64 `json:"avgload,omitempty"` - NetworkAvgLoad uint64 `json:"networkavgload,omitempty"` + Numpods int `json:"numpods,omitempty"` + AvgNetworkLoad uint64 `json:"network_load,omitempty"` + AvgAppCpuUsage string `json:"app_cpu,omitempty"` + AvgAppMemoryUsage string `json:"app_memory,omitempty"` + ServiceMetrics []ServiceStatusMetrics `json:"service_metrics,omitempty"` } // Observed and Aggregated metrics from Codeco App Nodes @@ -226,7 +223,7 @@ type CodecoAppStatus struct { // ErrorMsg describes the CODECO application error. Edit codecoapp_types.go to remove/update ErrorMsg string `json:"errormsg,omitempty"` //Observed and Aggregated metrics from Codeco App Nodes - NodeMetrics CodecoAppNodeStatusMetrics `json:"nodemetrics"` + NodeMetrics []CodecoAppNodeStatusMetrics `json:"nodemetrics"` AppMetrics CodecoAppStatusMetrics `json:"appmetrics"` } diff --git a/config/samples/codeco_v1alpha1_codecoapp_ver2.yaml b/config/samples/codeco_v1alpha1_codecoapp_ver2.yaml index 1178337da1623ba3e4c5aebcd43a7e4d85d8682e..ccf31859694c6aa7d1d6f695a4898b6c1fbff35c 100644 --- a/config/samples/codeco_v1alpha1_codecoapp_ver2.yaml +++ b/config/samples/codeco_v1alpha1_codecoapp_ver2.yaml @@ -26,11 +26,8 @@ spec: limits: memory: 4Gi cpu: "2" - requiredResources: - cpu: "50" # percentage - mem: "8" # GB - nwbandwidth: "1.2" #Mbs - nwlatency: "3" # Ms + nwbandwidth: "1.2" #Mbs + nwlatency: "3" # Ms serviceChannels: - chanelName: "" advancedChannelSettings: @@ -49,11 +46,8 @@ spec: image: nginx:1.14.2 ports: - containerPort: 80 - requiredResources: - cpu: "50" # percentage - mem: "8" # GB - nwbandwidth: "1.2" #Mbs - nwlatency: "3" # Ms + nwbandwidth: "1.2" #Mbs + nwlatency: "3" # Ms serviceChannels: - chanelName: "fe-db-channel" advancedChannelSettings: @@ -68,3 +62,39 @@ spec: complianceClass: "High" #expected level of compliance, based on a scale - High, Medium, Low qosClass: "Gold" # Preferred QoS level, Gold, Silver, BestEffort securityClass: "Good" #Desired level of security for the application, based on a likert scale, 5 levels -HIGH-GOOD-MEDIUM-LOW-NONE +status: + status: "OK" + errormsg: "" + nodemetrics: + - node_name: "c1" + node_cpu: "" + node_memory: "" + node_failure: "" + node_energy: "" + node_security: "" + - node_name: "c2" + node_cpu: "" + node_memory: "" + node_failure: "" + node_energy: "" + node_security: "" + appmetrics: + numpods: 2 + network_load: 2 + app_cpu: "" + app_memory: "" + service_metrics: + - service_name: "front-end" + node_name: "" + service_cpu: "" + service_memory: "" + service_failure: "" + service_energy: "" + service_security: "" + - service_name: "database" + node_name: "" + service_cpu: "" + service_memory: "" + service_failure: "" + service_energy: "" + service_security: ""