

# nplus-environment

Installs Namespace-Wide Resources such as the conf PVC, the toolbox and the nplus monitoring service

This Environment Chart provides a common config pool and administrative tools to
operate all nplus instances in this namespace.
There must be exactly one deployed instance of this environment chart per kubernetes namespace.
Without the environment, the instance and component charts will fail to deploy.

It also deployes the operator, which is a monitoring component to observe all instances and provide
healthyness information to the administrator and third party dashboards

## nplus-environment Chart Configuration

You can customize / configure nplus-environment by setting configuration values on the command line or in values files,
that you can pass to helm. Please see the samples directory for details.

In case there is no value set, the key will not be used in the manifest, resulting in values taken from the config files of the component.

### Template Functions

You can use template functions in the values files. If you do so, make sure you quote correctly (single quotes, if you have double quotes in the template,
or escaped quotes).

### Global Values

All values can be set per component, per instance or globally per environment.

Example: `global.ingress.domain` sets the domain on instance level. You can still set a different domain on a component, such as administrator.
In that case, simply set `ingress.domain` for the administrator chart and that setting will have priority:

- Prio 1 - Component Level: `ingress.domain`
- Prio 2 - Instance Level: `global.ingress.domain`
- Prio 3 - Environment Level: `global.environment.ingress.domain`

### Using Values in Templates

As it would be a lot of typing to write `.Values.ingress.domain | default .Values.global.ingress.domain | default .Values.global.environment.ingress.domain`in your
template code, this is automatically done by nplus. You can simply type `.this.ingress.domain` and you will get a condensed and defaulted version
of your Values.

So an example in your `values.yaml` would be:

```
administrator:
  waitFor:
    - '-service {{ .component.prefix }}nappljobs.{{ .Release.Namespace }}.svc.cluster.local:\{{ .this.nappl.port }} -timeout 600'
```

This example shows `.this.nappl.port` which might come from a component, instance or global setting. You do not need to care.
The `.Release.Namespace` is set by helm. You have access to all Release and Chart Metadata, just like in your chart code.

The `.component.prefix` is calculated by nplus and gives you some handy shortcuts to internal variables:

- `.component.chartName` 
  The name of the chart as in `.Chart.Name`, but with override by `.Values.nameOverride`
- `.component.shortChartName` 
  A shorter Version of the name - `nappl` instead of `nplus-component-nappl`
- `.component.prefix` 
  The instance Prefix used to name the resources including `-`. This prefix is dropped, if the
  `.Release.Name` equals `.Release.Namespace` for those of you that only
  run one nplus Instance per namespace
- `.component.name` 
  The name of the component, including `.Values.nameOverride` and some logic
- `.component.fullName` 
  The fullName inlcuding `.Values.fullnameOverride` and some logic
- `.component.chart` 
  Mainly the `Chart.Name` and `Chart.Version`
- `.component.storagePath` 
  The path where the component config is stored in the conf PVC
- `.component.handler` 
  The handler (either helm, argoCD or manual)

- `.instance.name` 
  The name of the instance, but with override by `.Values.instanceOverride`
- `.instance.group` 
  The group, this instance belongs to. Override by `.Values.groupOverride`
- `.instance.version` 
  The *nscale* version (mostly taken from Application Layer), this instance is deploying.

- `.environment.name` 
  The name of the environment, but with override by `.Values.environmentNameOverride`

### Keys

You can set any of the following values for this component:

| Key | Description | Default |
|-----|-------------|---------|
**components**&#8203;.dav | Enables WebDAV access to conf and ptemp |  `true` |
**components**&#8203;.prepper | enables an optional prepper that you can use to deploy fonts, scripts etc. during environment setup |  `false` |
**components**&#8203;.toolbox | enables the toolbox |  `true` |
environmentNameOverride | If you want to override the name of the Environment for display purposes, do it here. |   |
**global**&#8203;.environment&#8203;.storage&#8203;.conf&#8203;.name | this is the name of the common config storage. please see section "Storage" for more information |  `"conf"` |
**global**&#8203;.environment&#8203;.storage&#8203;.conf&#8203;.size | this is the size of the common config storage. please see section "Storage" for more information |  `"10Gi"` |
**global**&#8203;.environment&#8203;.storage&#8203;.conf&#8203;.volumeName | you can set the volumeName to the value of a pre-existing volume to avoid having the PV created for you by the csi driver provisioner |   |
**global**&#8203;.environment&#8203;.storage&#8203;.ptemp&#8203;.name | this is the name of the common persistant temp storage. please see section "Storage" for more information |  `"ptemp"` |
**global**&#8203;.environment&#8203;.storage&#8203;.ptemp&#8203;.size | this is the size of the common ptemp storage. please see section "Storage" for more information |  `"10Gi"` |
**global**&#8203;.environment&#8203;.storage&#8203;.ptemp&#8203;.volumeName | you can set the volumeName to the value of a pre-existing volume to avoid having the PV created for you by the csi driver provisioner |   |
**global**&#8203;.meta&#8203;.isEnvironment | specifies that this is deployment is part of an Environment. Used to determine the correct  name of the deployment <br>Do not change | **info only**, do not change<br> `true` |

