kruize / autotune

Autonomous Performance Tuning for Kubernetes!
Apache License 2.0
153 stars 52 forks source link

[WIP] Adding Objects for Namespace Data #1221

Open shekhar316 opened 1 week ago

shekhar316 commented 1 week ago

Description

This PR adds the necessary Java classes to support namespace-level metrics storage within the kubernetes object. Currently, k8sObj manages container-level metrics data through the containerData class. To extend this functionality to namespace-level queries, we need to generate nameSpaceData class. This PR implements these new classes, enabling k8sObj to store and manage namespace metrics data effectively.

Namespace JSON Obj:

{
    "type": "deployment",
    "name": "tfb-qrh-deployment",
    "namespace": "default",
    "namespace_metrics": [
        {
            "name": "cpuRequest",
            "results": {
                "value": 1.1,
                "format": "cores"
            }
        },
        {
            "name": "cpuLimit",
            "results": {
                "value": 0.5,
                "format": "cores"
            }
        },
        {
            "name": "cpuUsage",
            "results": {
                "aggregation_info": {
                    "min": 0.14,
                    "max": 0.84,
                    "avg": 0.12,
                    "format": "cores"
                }
            }
        },
        {
            "name": "cpuThrottle",
            "results": {
                "aggregation_info": {
                    "max": 0.09,
                    "avg": 0.045,
                    "format": "cores"
                }
            }
        },
        {
            "name": "memoryRequest",
            "results": {
                "value": 50.12,
                "format": "MiB"
            }
        },
        {
            "name": "memoryLimit",
            "results": {
                "value": 100,
                "format": "MiB"
            }
        },
        {
            "name": "memoryUsage",
            "results": {
                "aggregation_info": {
                    "min": 50.6,
                    "max": 198.5,
                    "avg": 40.1,
                    "format": "MiB"
                }
            }
        },
        {
            "name": "memoryRSS",
            "results": {
                "aggregation_info": {
                    "min": 50.6,
                    "max": 123.6,
                    "avg": 31.91,
                    "format": "MiB"
                }
            }
        }
    ]
}

Type of change

How has this been tested?

On minikube with kruize-demos

Test Configuration

Checklist :dart:

Additional information

NA