Skip to content

Commit

Permalink
Merge pull request #462 from entando/ENDOC-438-pt2
Browse files Browse the repository at this point in the history
ENDOC-438 Refine the config profiles, add doc on the config map, exte…
  • Loading branch information
nshaw authored Mar 28, 2022
2 parents 834c225 + d5200ce commit 1353589
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 24 deletions.
8 changes: 8 additions & 0 deletions vuepress/docs/.vuepress/next.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,14 @@ module.exports = {
title: 'Manage NGINX',
path: path + 'devops/manage-nginx.md',
},
{
title: 'Plugin Configuration',
path: path + 'devops/plugin-configuration.md',
},
{
title: 'Configure the Entando Operator',
path: path + 'devops/entando-operator.md',
},
]
},
]
Expand Down
13 changes: 12 additions & 1 deletion vuepress/docs/next/docs/reference/entando-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,19 @@ ent prj be-test-run
``` sh
ent prj fe-test-run
```

See [this tutorial](../../tutorials/create/ms/run-local.md) for more details.

### Get the Bundle ID and Plugin ID
Entando will use a unique identifier for your bundle as a way to provide additional security controls around bundle-specific resources. You can determine this identifier with this command
```sh
ent prj get-bundle-id --auto
```

If you have a microservice plugin in your project, a unique identifier will be calculated for it as well.
```sh
ent prj get-plugin-id --auto --repo=<BUNDLE-REPO-URL>
```

## Bundle Commands
Use the `ent bundler` command to prepare a bundle for publication or extract a bundle from an application

Expand Down
32 changes: 32 additions & 0 deletions vuepress/docs/next/tutorials/devops/entando-operator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Configure the Entando Operator
This tutorial demonstrates how to provide a ```ConfigMap``` for the Entando Operator to customize its behavior.

## Prerequisites
The Entando Operator makes use of an optional ```ConfigMap``` named ```entando-operator-config```. It must be present in the same namespace. In a quickstart environment, you can check for its presence with this command:
```sh
kubectl get configmap -n entando
```

## Add a new ConfigMap
If the ```ConfigMap``` doesn't already exist, you can use a template as a starting point.
```sh
curl -sfL "https://raw.githubusercontent.com/entando/entando-releases/v7.0.0/dist/ge-1-1-6/samples/entando-operator-config.yaml"
```

Edit ```entando-operator-config.yaml``` to adjust existing settings or add new ones. You can then apply it to Kubernetes.

```sh
kubectl apply -f entando-operator-config.yaml -n entando
```

The Entando Operator automatically reloads the settings from the new ```ConfigMap```. You can verify the reload by checking the logs in the operator pod.

## Update an existing ConfigMap
If the ```ConfigMap``` already exists, you can edit the ```ConfigMap``` to adjust existing settings or add new ones.
```sh
kubectl edit configmap/entando-operator-config -n entando
```

The Entando Operator automatically reloads the settings from the ```ConfigMap```. You can verify the reload by checking the logs in the operator pod. Some settings may only take effect when a deployment is first created, e.g. timeout settings or cpu limits.


57 changes: 34 additions & 23 deletions vuepress/docs/next/tutorials/devops/plugin-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,97 @@
sidebarDepth: 2
---

# Customize Deployment with Plugin Configuration Profiles
# Plugin Configuration Profiles

This tutorial describes three methods to utilize configuration profiles to specify resource allocation for Entando plugins. This provides a simple way to customize plugin deployment parameters for improved efficiency.
This tutorial describes three methods to utilize configuration profiles to specify resource allocation for Entando plugins. This provides a simple way to customize plugin deployment parameters for improved efficiency.

## Prerequisites
* [Add an Entando Operator ConfigMap](./entando-operator.md) if needed
* Enable this property under the `data` section so that the Entando Operator can manage resource settings.
```yaml
entando.k8s.operator.impose.limits: "true"
```
## Profile Options
The three methods to insert configuration profiles are:
1. [Inline Profile](#method-1-inline-profile)
2. [Mapped Profile](#method-2-mapped-profile)
3. [Default Profile](#method-3-default-profile)
Currently, the following resources for memory and CPU can be specified. When you specify a `limit` on a resource, it is the maximum allowed for the container. The `request` is the basic amount required of each resource for a container in a pod. These determine which node a pod is assigned to.
Currently, the following resources for memory and CPU can be specified. When you specify a `limit` on a resource, it is the maximum allowed for the container. Resource settings help Kubernetes determine in which node a pod should be created.

```yaml
resources.limits.cpu: integer, millicpus
resources.limits.memory: integer, mebibytes
resources.requests.cpu: integer, millicpus
resources.requests.memory: integer, mebibytes
```

## Configuration
A profile is a set of configurations encoded as YAML but embedded in the `OperatorConfigMap` as a string, as ConfigMaps can't be multilevel. The examples below use `[your-plugin-id]` and `[your-profile]` as placeholders for your names. Also note `|-` in the sample codes to specify each new line is read as such.
A profile is a set of configurations encoded as YAML but embedded in the `OperatorConfigMap` as a string, since ConfigMaps cannot be multilevel. The examples below use `YOUR-PLUGIN-ID` and `YOUR-PROFILE-NAME` as placeholders for your names. Also note `|-` in the sample codes to specify each new line is read as such.

### Retrieve the Plugin ID
First you will need to retrieve the Plugin ID which is calculated during installation and written to the EntandoPlugin Custom Resource as part of the deployment of the plugin micro-service. Use the following command:
You will need to [retrieve the Plugin ID](../../docs/reference/entando-cli.md) which is calculated during installation and written to the EntandoPlugin Custom Resource as part of the deployment of the plugin microservice. Use the following command from the project directory
```sh
ent prj get-plugin-id --auto
```
ent prj get-plugin-id

If you just have a bundle, use this command with the appropriate parameters
```sh
ent ecr get-plugin-id --autho --repo=BUNDLE-REPO-URL
```
Example:
```sh
$ ent ecr get-plugin-id --auto --repo=https://github.com/entando-samples/entando-hub-application-bundle.git
pn-cee95efc-77ff566e-entandopsdh-entando-hub-catalog-ms
```

### Method 1: Inline Profile
Add the parameters to the `OperatorConfigMap` as an inline profile at `data/entando.profile.plugins.[your-plugin-id]`.
Add the parameters to the `OperatorConfigMap` as an inline profile at `data/entando.profile.plugins.YOUR-PLUGIN-ID`.

Example:

```yaml
data:
entando.profile.plugins.your-plugin-id: |-
entando.profile.plugins.YOUR-PLUGIN-ID: |-
resources.limits.cpu: "1000"
resources.limits.memory: "2000"
resources.requests.cpu: "500"
resources.requests.memory: "500"
```
### Method 2: Mapped Profile
1. Create the parameter profile in the `OperatorConfigMap` of the data profile at `data/entando.profile.[your-profile]`.
1. Create the parameter profile in the `OperatorConfigMap` of the data profile at `data/entando.profile.YOUR-PROFILE-NAME`.

Example:
```yaml
data:
entando.profile.your-profile: |-
entando.profile.YOUR-PROFILE-NAME: |-
resources.limits.cpu: "1000"
resources.limits.memory: "2000"
resources.requests.cpu: "500"
resources.requests.memory: "500"
```
2. Add a reference in the `profileMapping` file at `data/entando.plugins.profileMapping`:

```yaml
data:
entando.plugins.profileMapping: |-
your-plugin-id: your-profile
your-plugin-id: YOUR-PROFILE-NAME
```

### Method 3: Default Profile
1. Create the parameter profile in the `OperatorConfigMap` in the data profile file at `data/entando.profile.[your-profile]`.
1. Create the parameter profile in the `OperatorConfigMap` in the data section at `data/entando.profile.YOUR-PROFILE-NAME`.

```yaml
data:
entando.profile.your-profile: |-
entando.profile.YOUR-PROFILE-NAME: |-
resources.limits.cpu: "1000"
resources.limits.memory: "2000"
resources.requests.cpu: "500"
resources.requests.memory: "500"
```

2. Add a reference to the profile at data/entando.plugins.defaultProfile:
2. Add a reference to the profile at ```data/entando.plugins.defaultProfile```:

```yaml
data:
entando.plugins.defaultProfile: your-profile
entando.plugins.defaultProfile: YOUR-PROFILE-NAME
```

## References
Please refer to the [Kubernetes documentation on Resources](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) for more details.


Expand Down

0 comments on commit 1353589

Please sign in to comment.