# Microservice Configuration Profiles

This tutorial describes three methods to utilize configuration profiles to specify resource allocation for Entando microservices. These provide a simple way to customize microservice deployment parameters for improved efficiency.

# Prerequisites

 entando.k8s.operator.impose.limits: "true"

# Profile Options

A profile is a set of configurations encoded as YAML embedded in the OperatorConfigMap as a string, since ConfigMaps cannot be multilevel.

The three methods to insert configuration profiles are:

  1. Inline Profile
  2. Mapped Profile
  3. Default Profile

# Configuration

Currently, the resources for memory and CPU can be specified. When you specify a limit on a resource, it is the upper limit allowed for the container. The units for the resources are listed below but should not be included in the specification. Resource settings help Kubernetes determine in which node a pod should be created.

resources.limits.cpu:       integer, millicpus
resources.limits.memory:    integer, mebibytes

The examples below use YOUR-PLUGIN, YOUR-PLUGIN-CODE, YOUR-ORG, YOUR-BUNDLE and YOUR-PROFILE-NAME as placeholders. Also note the use of |- to designate a new line in the code.

# Retrieve the Plugin Code

You will need to retrieve the plugin code, which is calculated during installation and written to the EntandoPlugin custom resource as part of the deployment of the microservice.

Use the following command from the root bundle project directory, where YOUR-ORG is your Docker organization and YOUR-BUNDLE contains the microservice:

ent ecr get-plugin-code YOUR-PLUGIN --repo=docker://registry.hub.docker.com/YOUR-ORG/YOUR-BUNDLE

# Method 1: Inline Profile

Add the resource parameters to the OperatorConfigMap as an inline profile at data/entando.profile.plugins.YOUR-PLUGIN-CODE:

data:
  entando.profile.plugins.YOUR-PLUGIN-CODE: |-
    resources.limits.cpu: "1000"
    resources.limits.memory: "2000"

# Method 2: Mapped Profile

  1. Create the resource parameter profile in the OperatorConfigMap of the data profile at data/entando.profile.YOUR-PROFILE-NAME:
data:
  entando.profile.YOUR-PROFILE-NAME: |-
    resources.limits.cpu: "1000"
    resources.limits.memory: "2000"
  1. Add a reference in the profileMapping file at data/entando.plugins.profileMapping:
data:
  entando.plugins.profileMapping: |-
    YOUR-PLUGIN-CODE: YOUR-PROFILE-NAME

# Method 3: Default Profile

  1. Add the resource parameter profile to the OperatorConfigMap in the data section at data/entando.profile.YOUR-PROFILE-NAME:
data:
  entando.profile.YOUR-PROFILE-NAME: |-
    resources.limits.cpu: "1000"
    resources.limits.memory: "2000"
  1. Add a reference to the profile at data/entando.plugins.defaultProfile:
data:
  entando.plugins.defaultProfile: YOUR-PROFILE-NAME

# References

Please refer to the Kubernetes documentation on Resources (opens new window) for more details.