Public Information
This commit is contained in:
51
samples/chart/build.sh
Executable file
51
samples/chart/build.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This sample script builds the example as described. It is also used to build the test environment in our lab,
|
||||
# so it should be well tested.
|
||||
#
|
||||
|
||||
# Make sure it fails immediately, if anything goes wrong
|
||||
set -e
|
||||
|
||||
# -- ENVironment variables:
|
||||
# CHARTS: The path to the source code
|
||||
# DEST: The path to the build destination
|
||||
# SAMPLE: The directory of the sample
|
||||
# NAME: The name of the sample, used as the .Release.Name
|
||||
# KUBE_CONTEXT: The name of the kube context, used to build this sample depending on where you run it against. You might have different Environments such as lab, dev, qa, prod, demo, local, ...
|
||||
|
||||
# Check, if we have the source code available
|
||||
if [ ! -d "$CHARTS" ]; then
|
||||
echo "ERROR Building $SAMPLE example: The Charts Sources folder is not set. Please make sure to run this script with the full Source Code available"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d "$DEST" ]; then
|
||||
echo "ERROR Building $SAMPLE example: DEST folder not found."
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d "$CHARTS/instance" ]; then
|
||||
echo "ERROR Building $SAMPLE example: Chart Sources in $CHARTS/instance not found. Are you running this script as a subscriber?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set the Variables
|
||||
SAMPLE="chart"
|
||||
NAME="sample-$SAMPLE"
|
||||
|
||||
# Output what is happening
|
||||
echo "Building $NAME"
|
||||
|
||||
# Create the manifest
|
||||
mkdir -p $DEST/instance
|
||||
helm template --debug \
|
||||
--values $SAMPLES/environment/$KUBE_CONTEXT.yaml \
|
||||
--values $SAMPLES/chart/resources.yaml \
|
||||
$NAME $SAMPLES/chart/tenant > $DEST/instance/$SAMPLE.yaml
|
||||
|
||||
# Create the manifest - argo version
|
||||
mkdir -p $DEST/instance-argo
|
||||
helm template --debug \
|
||||
--values $SAMPLES/environment/$KUBE_CONTEXT.yaml \
|
||||
--values $SAMPLES/chart/resources.yaml \
|
||||
$NAME-argo $SAMPLES/chart/tenant-argo > $DEST/instance-argo/$SAMPLE-argo.yaml
|
||||
|
||||
170
samples/chart/resources.yaml
Normal file
170
samples/chart/resources.yaml
Normal file
@@ -0,0 +1,170 @@
|
||||
instance:
|
||||
web:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "10m"
|
||||
memory: "1.5Gi"
|
||||
limits:
|
||||
cpu: "4000m"
|
||||
memory: "4Gi"
|
||||
prepper:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "10m"
|
||||
memory: "128Mi"
|
||||
limits:
|
||||
cpu: "1000m"
|
||||
memory: "128Mi"
|
||||
application:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "10m"
|
||||
memory: "1.5Gi"
|
||||
limits:
|
||||
cpu: "4000m"
|
||||
memory: "4Gi"
|
||||
nappl:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "10m"
|
||||
memory: "1.5Gi"
|
||||
limits:
|
||||
cpu: "4000m"
|
||||
memory: "4Gi"
|
||||
nappljobs:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "10m"
|
||||
memory: "2Gi"
|
||||
limits:
|
||||
cpu: "4000m"
|
||||
memory: "4Gi"
|
||||
administrator:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "2m"
|
||||
memory: "512Mi"
|
||||
limits:
|
||||
cpu: "2000m"
|
||||
memory: "2Gi"
|
||||
cmis:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "2m"
|
||||
memory: "512Mi"
|
||||
limits:
|
||||
cpu: "2000m"
|
||||
memory: "2Gi"
|
||||
database:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "2m"
|
||||
memory: "256Mi"
|
||||
limits:
|
||||
cpu: "4000m"
|
||||
memory: "8Gi"
|
||||
ilm:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "2m"
|
||||
memory: "256Mi"
|
||||
limits:
|
||||
cpu: "2000m"
|
||||
memory: "2Gi"
|
||||
mon:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "2m"
|
||||
memory: "512Mi"
|
||||
limits:
|
||||
cpu: "2000m"
|
||||
memory: "2Gi"
|
||||
nstl:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "5m"
|
||||
memory: "128Mi"
|
||||
limits:
|
||||
cpu: "2000m"
|
||||
memory: "1Gi"
|
||||
nstla:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "5m"
|
||||
memory: "128Mi"
|
||||
limits:
|
||||
cpu: "2000m"
|
||||
memory: "1Gi"
|
||||
nstlb:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "5m"
|
||||
memory: "128Mi"
|
||||
limits:
|
||||
cpu: "2000m"
|
||||
memory: "1Gi"
|
||||
nstlc:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "5m"
|
||||
memory: "128Mi"
|
||||
limits:
|
||||
cpu: "2000m"
|
||||
memory: "1Gi"
|
||||
nstld:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "5m"
|
||||
memory: "128Mi"
|
||||
limits:
|
||||
cpu: "2000m"
|
||||
memory: "1Gi"
|
||||
pam:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "5m"
|
||||
memory: "512Mi"
|
||||
limits:
|
||||
cpu: "2000m"
|
||||
memory: "1Gi"
|
||||
rs:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "2m"
|
||||
memory: "1Gi"
|
||||
limits:
|
||||
cpu: "4000m"
|
||||
memory: "8Gi"
|
||||
webdav:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "2m"
|
||||
memory: "512Mi"
|
||||
limits:
|
||||
cpu: "2000m"
|
||||
memory: "2Gi"
|
||||
|
||||
rms:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "2m"
|
||||
memory: "128Mi"
|
||||
limits:
|
||||
cpu: "1000m"
|
||||
memory: "512Mi"
|
||||
rmsa:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "2m"
|
||||
memory: "128Mi"
|
||||
limits:
|
||||
cpu: "1000m"
|
||||
memory: "512Mi"
|
||||
rmsb:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "2m"
|
||||
memory: "128Mi"
|
||||
limits:
|
||||
cpu: "1000m"
|
||||
memory: "512Mi"
|
||||
12
samples/chart/tenant-argo/Chart.yaml
Normal file
12
samples/chart/tenant-argo/Chart.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: v2
|
||||
name: sample-tenant-argo
|
||||
description: |
|
||||
ArgoCD Version of the sample tenant chart. It demonstrates the use of umbrella
|
||||
charts to customize default values for your environment or tenant templates.
|
||||
type: application
|
||||
dependencies:
|
||||
- name: nplus-instance-argo
|
||||
alias: instance-argo
|
||||
version: "*-0"
|
||||
repository: "file://../../../charts/instance-argo"
|
||||
version: 1.0.0
|
||||
93
samples/chart/tenant-argo/README.md
Normal file
93
samples/chart/tenant-argo/README.md
Normal file
@@ -0,0 +1,93 @@
|
||||
|
||||
|
||||
# sample-tenant-argo
|
||||
|
||||
ArgoCD Version of the sample tenant chart. It demonstrates the use of umbrella
|
||||
charts to customize default values for your environment or tenant templates.
|
||||
|
||||
## sample-tenant-argo Chart Configuration
|
||||
|
||||
You can customize / configure sample-tenant-argo 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 |
|
||||
|-----|-------------|---------|
|
||||
**global**​.meta​.isArgo | | `true` |
|
||||
**instance-argo**​.argocd​.chart | | `"sample-tenant"` |
|
||||
**instance-argo**​.argocd​.destinationServer | | `"https://kubernetes.default.svc"` |
|
||||
**instance-argo**​.argocd​.namespace | | `"argocd"` |
|
||||
**instance-argo**​.argocd​.project | | `"default"` |
|
||||
**instance-argo**​.argocd​.prune | | `true` |
|
||||
**instance-argo**​.argocd​.repo | | `"https://git.nplus.cloud"` |
|
||||
**instance-argo**​.argocd​.selfHeal | | `true` |
|
||||
|
||||
112
samples/chart/tenant-argo/values.schema.json
Normal file
112
samples/chart/tenant-argo/values.schema.json
Normal file
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"global": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"meta": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"isArgo": {
|
||||
"default": true,
|
||||
"title": "isArgo",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"title": "meta",
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"title": "global",
|
||||
"type": "object"
|
||||
},
|
||||
"instance-argo": {
|
||||
"description": "nplus Instance ArgoCD Edition, supporting the deployment of npus Instances through ArgoCD",
|
||||
"properties": {
|
||||
"argocd": {
|
||||
"additionalProperties": false,
|
||||
"description": "yaml-language-server: $schema=values.schema.json",
|
||||
"properties": {
|
||||
"chart": {
|
||||
"default": "nplus-instance",
|
||||
"description": "The name of the chart to use for the instance",
|
||||
"title": "chart"
|
||||
},
|
||||
"destinationNamespace": {
|
||||
"default": "{{ .Release.Namespace }}",
|
||||
"description": "ArgoCD can deploy to any Namespace on the destination Server. You have to specify it. Default is the release namespace",
|
||||
"title": "destinationNamespace"
|
||||
},
|
||||
"destinationServer": {
|
||||
"default": "https://kubernetes.default.svc",
|
||||
"description": "ArgoCD can also remote deploy Applications to alien clusters. The server specifies the API Endpoint of the Cluster, where the Application should be deployed",
|
||||
"title": "destinationServer"
|
||||
},
|
||||
"namespace": {
|
||||
"default": "argocd",
|
||||
"description": "The ArgoCD Namespace within the cluster. The ArgoCD Application will be deployed to this namespace You will need write privileges for this namespace",
|
||||
"title": "namespace"
|
||||
},
|
||||
"project": {
|
||||
"default": "default",
|
||||
"description": "ArgoCD organizes Applications in Projects. This is the name of the project, the application should be deployed to",
|
||||
"title": "project"
|
||||
},
|
||||
"prune": {
|
||||
"default": "true",
|
||||
"description": "Toggle pruning for this Application",
|
||||
"title": "prune"
|
||||
},
|
||||
"repo": {
|
||||
"default": "https://git.nplus.cloud",
|
||||
"description": "Specifiy the helm repo, from which ArgoCD should load the chart. Please make sure ArgoCD gets access rights to this repo",
|
||||
"title": "repo"
|
||||
},
|
||||
"selfHeal": {
|
||||
"default": "true",
|
||||
"description": "Toggle self healing feature for this Application",
|
||||
"title": "selfHeal"
|
||||
}
|
||||
},
|
||||
"title": "argocd",
|
||||
"type": "object"
|
||||
},
|
||||
"global": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"meta": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"isArgo": {
|
||||
"default": "true",
|
||||
"description": "specifies that this is an Argo Installation. Used to determine the correct handler in the chart @internal -- Do not change",
|
||||
"title": "isArgo"
|
||||
}
|
||||
},
|
||||
"title": "meta",
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"title": "global",
|
||||
"type": "object"
|
||||
},
|
||||
"globals": {
|
||||
"description": "nplus Global Functions Library Chart",
|
||||
"properties": {
|
||||
"global": {
|
||||
"description": "Global values are values that can be accessed from any chart or subchart by exactly the same name.",
|
||||
"title": "global",
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"title": "nplus-globals",
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"title": "nplus-instance-argo",
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
13
samples/chart/tenant-argo/values.yaml
Normal file
13
samples/chart/tenant-argo/values.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
# yaml-language-server: $schema=values.schema.json
|
||||
instance-argo:
|
||||
argocd:
|
||||
chart: sample-tenant
|
||||
namespace: argocd
|
||||
project: default
|
||||
destinationServer: "https://kubernetes.default.svc"
|
||||
selfHeal: true
|
||||
prune: true
|
||||
repo: "https://git.nplus.cloud"
|
||||
global:
|
||||
meta:
|
||||
isArgo: true
|
||||
12
samples/chart/tenant/Chart.yaml
Normal file
12
samples/chart/tenant/Chart.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: v2
|
||||
name: sample-tenant
|
||||
description: |
|
||||
The sample tenant chart demonstrates how to use umbrella charts with default values,
|
||||
e.g. to define tenant templates
|
||||
type: application
|
||||
dependencies:
|
||||
- name: nplus-instance
|
||||
alias: instance
|
||||
version: "*-0"
|
||||
repository: "file://../../../charts/instance"
|
||||
version: 1.0.0
|
||||
88
samples/chart/tenant/README.md
Normal file
88
samples/chart/tenant/README.md
Normal file
@@ -0,0 +1,88 @@
|
||||
|
||||
|
||||
# sample-tenant
|
||||
|
||||
The sample tenant chart demonstrates how to use umbrella charts with default values,
|
||||
e.g. to define tenant templates
|
||||
|
||||
## sample-tenant Chart Configuration
|
||||
|
||||
You can customize / configure sample-tenant 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 |
|
||||
|-----|-------------|---------|
|
||||
**global**​.ingress​.domain | | `"{{ .instance.group | default .Release.Name }}.sample.nplus.cloud"` |
|
||||
**instance**​.application​.docAreas[0]​.id | | `"Sample"` |
|
||||
**instance**​.components​.application | | `true` |
|
||||
|
||||
29293
samples/chart/tenant/values.schema.json
Normal file
29293
samples/chart/tenant/values.schema.json
Normal file
File diff suppressed because it is too large
Load Diff
10
samples/chart/tenant/values.yaml
Normal file
10
samples/chart/tenant/values.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
# yaml-language-server: $schema=values.schema.json
|
||||
instance:
|
||||
components:
|
||||
application: true
|
||||
application:
|
||||
docAreas:
|
||||
- id: "Sample"
|
||||
global:
|
||||
ingress:
|
||||
domain: "{{ .instance.group | default .Release.Name }}.sample.nplus.cloud"
|
||||
Reference in New Issue
Block a user