# Apply-Resource-Bundle-Cache-Config_688983031
## Purpose

The RDS CPU usage rate for resource bundle exceeds 5%. It is recommended to execute the runbook when the total RDS CPU rate is high.

## Introduction

There are 3 configmap keys added for Resource Bundle Local Cache in SMAX 24.3 version, this doc is used to provide scripts to apply this change.

## Add Configmap Keys

Run following cmd:

```
kubectl patch configmap itom-xruntime-infra-config -n <itsma_namespace> --type merge -p '{"data":{"RESOURCE_BUNDLE_HEAVY_TENANT": "<tenant_ids>", "RESOURCE_BUNDLE_MAX_SLIGHT_TENANT_SIZE": "10", "RESOURCE_BUNDLE_MAX_LOCALE_SIZE": "2"}}'
```

Replace <itsma\_namespace> and <tenant\_ids> with corresponding values. If there are multi heavy tenants, split them with space.

Here is a example:

```
kubectl patch configmap itom-xruntime-infra-config -n itsma-byqde --type merge -p '{"data":{"RESOURCE_BUNDLE_HEAVY_TENANT": "555500000", "RESOURCE_BUNDLE_MAX_SLIGHT_TENANT_SIZE": "10", "RESOURCE_BUNDLE_MAX_LOCALE_SIZE": "2"}}'
```

## Add env to platform pods

a.Create a patched yaml file and add env

```
spec:
  template:
    spec:
      containers:
        - name: itom-xruntime-platform
          env:
            - name: RESOURCE_BUNDLE_HEAVY_TENANT
              valueFrom:
                configMapKeyRef:
                  name: itom-xruntime-infra-config
                  key: RESOURCE_BUNDLE_HEAVY_TENANT
            - name: RESOURCE_BUNDLE_MAX_SLIGHT_TENANT_SIZE
              valueFrom:
                configMapKeyRef:
                  name: itom-xruntime-infra-config
                  key: RESOURCE_BUNDLE_MAX_SLIGHT_TENANT_SIZE
            - name: RESOURCE_BUNDLE_MAX_LOCALE_SIZE
              valueFrom:
                configMapKeyRef:
                  name: itom-xruntime-infra-config
                  key: RESOURCE_BUNDLE_MAX_LOCALE_SIZE
```

b.Apply patch-platform.yaml file for all platform pods

```
kubectl patch deployment itom-xruntime-platform -n <itsma_namespace> --patch-file patch-platform.yaml
```

All the platform pods(itom-xruntime-platform,itom-xruntime-platform-offline,itom-xruntime-platform-offline-ng,itom-xruntime-platform-readonly) need to apply this change.

## Validation

Go into platform pod, print env

```
echo $RESOURCE_BUNDLE_HEAVY_TENANT
```

Check the result is not empty.

## Verification

The RDS CPU usage rate for the resource bundle decreases compared to the value before applying the resolution after 1 working day.
