# Configuring Add On Resource Requests And Limits

PMK allows the users to set the request and limits of an add-on. This guide walks through the steps involved in setting these resources, as well as, describes the available resource fields per add-on.

## How to use this feature

* On the workload cluster, list the add-ons to ensure that the add-on you are looking to modify is available.
* Pick the add-on you wish to add resource specifications to. In this example, we will use `metalLB`. Edit the `metalLB` add-on object, and add the following fields to it under the `override.params` section:
* Save and exit.

{% tabs %}
{% tab title="YAML" %}

```yaml
kubectl get addons -n pf9-addons
NAME                                                        AGE
700213ef-3a4b-4777-8d42-ca4017494b52-coredns                20d
700213ef-3a4b-4777-8d42-ca4017494b52-kubernetes-dashboard   20d
700213ef-3a4b-4777-8d42-ca4017494b52-metallb                20d
700213ef-3a4b-4777-8d42-ca4017494b52-metrics-server         20d
700213ef-3a4b-4777-8d42-ca4017494b52-monitoring             20d
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="YAML" %}

```yaml
apiVersion: agent.pf9.io/v1
kind: Addon
metadata:
  creationTimestamp: "2024-04-15T20:46:04Z"
  finalizers:
  - addons.pf9.io
  generation: 2
  name: 700213ef-3a4b-4777-8d42-ca4017494b52-metallb
  namespace: pf9-addons
  resourceVersion: "2657929"
  uid: 5aa4a33f-1869-4ae2-a606-c04143272988
spec:
  clusterID: 700213ef-3a4b-4777-8d42-ca4017494b52
  override:
    params:
    - name: MetallbIpRange
      value: 192.168.78.79-192.168.78.99
    - name: controllerCPULimit      #<----------
      value: 534m                   #<----------
    - name: controllerMemoryLimit   #<----------
      value: 525Mi                  #<----------
    - name: speakerCPULimit         #<----------
      value: 546m                   #<----------
    - name: speakerMemoryLimit      #<----------
      value: 533Mi                  #<----------
    - name: controllerCPURequest    #<----------
      value: 34m                    #<----------
    - name: controllerMemoryRequest #<---------- 
      value: 25Mi                   #<----------
    - name: speakerCPURequest       #<----------
      value: 46m                    #<----------
    - name: speakerMemoryRequest    #<----------
      value: 33Mi                   #<----------
    - name: localOverride           #<----------
      value: "true"                 #<----------
  type: metallb
  version: 0.13.11
  watch: true
status:
  healthy: true
  observedGeneration: 2
  phase: Installed
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
**Important**

It is important to set the `localOverride` field in the addon object. Without this set, the default behavior of sunpike being the source of truth will continue.

If there is a key in the override list that the addon operator does not recognize, it will simply ignore it.
{% endhint %}

* Once these fields are set, you will see the values showing up on the actual addon objects.

{% tabs %}
{% tab title="YAML" %}

```yaml
kubectl get ds -n metallb-system speaker -o yaml | yq .spec.template.spec.containers[0].resources
limits:
  cpu: 546m
  memory: 533Mi
requests:
  cpu: 46m
  memory: 33Mi
kubectl get deploy -n metallb-system controller -o yaml | yq .spec.template.spec.containers[0].resources
limits:
  cpu: 534m
  memory: 525Mi
requests:
  cpu: 34m
  memory: 25Mi
```

{% endtab %}
{% endtabs %}

## Reference

The list of supported resource field names per addon is as follows:

#### Cluster Autoscaler (AWS)

{% tabs %}
{% tab title="YAML" %}

```yaml
limit:
        cpuLimit | default "200m"
        memoryLimit | default "600Mi"
requests:
          cpuRequest | default "100m"
          memoryRequest | default "300Mi"
```

{% endtab %}
{% endtabs %}

#### CoreDNS

{% tabs %}
{% tab title="YAML" %}

```yaml
limits:
        dnsCPULimit | default "1"
        dnsMemoryLimit (this is a required field; left as is to maintain backward compatibility)
        dnsAutoscalerCPULimit | default "200m"
        dnsAutoscalerMemoryLimit | default "600Mi"
requests:
          dnsCPURequest | default "100m"
          dnsMemoryRequest | default "70Mi"
          dnsAutoscalerCPURequest | default "20m"
          dnsAutoscalerMemoryRequest | default "10Mi"
```

{% endtab %}
{% endtabs %}

#### Kubernetes Dashboard

{% tabs %}
{% tab title="YAML" %}

```yaml
limits:
        metricsScraperCPULimit | default "100m"
        metricsScraperMemoryLimit | default "300Mi"
        dashboardCPULimit | default "2000m"
        dashboardMemoryLimit | default "2Gi"
requests:
        metricsScraperCPURequest | default "10m"
        metricsScraperMemoryRequest | default "50Mi"
        dashboardCPURequest | default "200m"
        dashboardMemoryRequest | default "100Mi"
```

{% endtab %}
{% endtabs %}

#### Kubevirt

{% tabs %}
{% tab title="YAML" %}

```yaml
limits:
        CDIOperatorCPULimit | default "100m"
        CDIOperatorMemoryLimit | default "300Mi"
        virtOperatorCPULimit | default "100m"
        virtOperatorMemoryLimit | default "1Gi"
        vncCPULimit | default "500m"
        vncMemoryLimit | default "500Mi"
requests:
            CDIOperatorCPURequest | default "10m"
            CDIOperatorMemoryRequest | default "150Mi"
            virtOperatorCPURequest | default "10m"
            virtOperatorMemoryRequest | default "450Mi"
            vncCPURequest | default "10m"
            vncMemoryRequest | default "10Mi"
```

{% endtab %}
{% endtabs %}

#### Luigi (Advanced Networking Operator)

{% tabs %}
{% tab title="YAML" %}

```yaml
limits:
        luigiCPULimit | default "100m"
        luigiMemoryLimit | default "128Mi"
requests:
          luigiCPURequest | default "50m"
          luigiMemoryRequest | default "64Mi"
```

{% endtab %}
{% endtabs %}

#### MetalLB

{% tabs %}
{% tab title="YAML" %}

```yaml
limits:
        controllerCPULimit | default "500m"
        controllerMemoryLimit | default "500Mi"
        speakerCPULimit | default "500m"
        speakerMemoryLimit | default "500Mi"
requests:
          controllerCPURequest | default "100m"
          controllerMemoryRequest | default "100Mi"
          speakerCPURequest | default "100m"
          speakerMemoryRequest | default "100Mi"
```

{% endtab %}
{% endtabs %}

#### Metrics Server

{% tabs %}
{% tab title="YAML" %}

```yaml
limits:
        metricsCpuLimit | default "100m"
        metricsMemoryLimit | default "300Mi"
requests:
          metricsCpuRequest | default "5m"
          metricsMemoryRequest | default "50Mi"
```

{% endtab %}
{% endtabs %}

#### Monitoring

{% tabs %}
{% tab title="YAML" %}

```yaml
limits:
        grafanaCPULimit | default "1000m"
        grafanaMemoryLimit | default "512Mi"
        ksmCPULimit | default "300m"
        ksmMemoryLimit | default "300Mi"
        monhelperCPULimit | default "200m"
        monhelperMemoryLimit | default "100Mi
        nodeExporterCPULimit | default "250m"
        nodeExporterMemoryLimit | default "180Mi"
        prometheusOperatorCPULimit | default "200m"
        prometheusOperatorMemoryLimit | default "200Mi"
requests:
          grafanaCPURequest | default "100m"
          grafanaMemoryRequest | default "256Mi"
          ksmCPURequest | default "100m"
          ksmMemoryRequest | default "150Mi"
          monhelperCPURequest | default "25m"
          monhelperMemoryRequest | default "25Mi"
          nodeExporterCPURequest | default "100m"
          nodeExporterMemoryRequest | default "100Mi"
          prometheusOperatorCPURequest | default "100m"
          prometheusOperatorMemoryRequest | default "100Mi"
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.platform9.com/managed-kubernetes/5.14/platform9-managed-add-ons/platform9-managed-add-ons-overview/configuring-add-on-resource-requests-and-limits.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
