# 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
- A working instance of Entando
- Verify dependencies with the Entando CLI:
ent check-env develop
- Add an Entando Operator ConfigMap if needed, then
- Enable this property under the
data
section so the Entando Operator can manage the resource settings:
entando.k8s.operator.impose.limits: "true"
- Enable this property under the
# 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:
# 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-ORG/YOUR-PLUGIN-NAME --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
- Create the resource parameter profile in the
OperatorConfigMap
of the data profile atdata/entando.profile.YOUR-PROFILE-NAME
:
data:
entando.profile.YOUR-PROFILE-NAME: |-
resources.limits.cpu: "1000"
resources.limits.memory: "2000"
- Add a reference in the
profileMapping
file atdata/entando.plugins.profileMapping
:
data:
entando.plugins.profileMapping: |-
YOUR-PLUGIN-CODE: YOUR-PROFILE-NAME
# Method 3: Default Profile
- Add the resource parameter profile to the
OperatorConfigMap
in the data section atdata/entando.profile.YOUR-PROFILE-NAME
:
data:
entando.profile.YOUR-PROFILE-NAME: |-
resources.limits.cpu: "1000"
resources.limits.memory: "2000"
- Add a reference to the profile at
data/entando.plugins.defaultProfile
:
data:
entando.plugins.defaultProfile: YOUR-PROFILE-NAME
Note: If a resourceRequirement was specified in the plugin custom resource, that will override a profile.
# References
Please refer to the Kubernetes documentation on Resources (opens new window) for more details.