feat(meshcentral): allow additiional custom config on UI (#4228)

* update questions

* feat(meshcentral): move to stable

* feat(meshcentral): allow additiional custom config on UI

* update docs

* update image

* add some comments

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
This commit is contained in:
Stavros Kois 2022-10-29 14:24:32 +03:00 committed by GitHub
parent 84e5f523ac
commit 3e72412b5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 150 additions and 3 deletions

View File

@ -1,8 +1,8 @@
apiVersion: v2
kubeVersion: ">=1.16.0-0"
name: meshcentral
version: 5.0.16
appVersion: "1.0.92"
version: 5.0.15
description: MeshCentral is a full computer management web site
type: application
deprecated: false

View File

@ -23,3 +23,51 @@ The above will only be applied when installed in TrueNAS Scale as an App
Native Helm users won't be affected with the above.
In both Native Helm and TrueNAS Scale, keys that start with `_` are **unset**.
For SCALE users, you can add additional configuration options that are not exposed in the UI
by using the `Additional MeshCentral Configuration` section.
::: tip
However, if you think an option would be used by a lot of users, it would be best to ask us to expose it.
:::
For example to set this:
```json
"settings": {
"sms": {
"provider": "twillio"
}
}
```
Set like this:
- Key: `settigns.sms.provider`
- Value: `twillio`
For lists:
```json
"domains": {
"": {
"newAccoutnsRights": [
"item1",
"item2"
]
}
}
```
Set like this:
- Key: `domains."".newAccountsRights`
- Value: `[ "item1", "item2" ]`
::: warn
Please use the exact casing as in the [MeshCentral's json schema](https://github.com/Ylianst/MeshCentral/blob/master/meshcentral-config-schema.json).
:::

View File

@ -381,6 +381,42 @@ questions:
schema:
type: string
default: ""
- variable: _setupXMPP
label: Setup XMPP
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: xmpp
label: xmpp
description: Configure XMPP messaging system
schema:
additional_attrs: true
type: dict
attrs:
- variable: service
label: service
schema:
type: string
default: ""
- variable: credentials
label: credentials
schema:
additional_attrs: true
type: dict
attrs:
- variable: username
label: username
schema:
type: string
default: ""
- variable: password
label: password
schema:
type: string
private: true
default: ""
- variable: domains
label: Section <domains>
schema:
@ -567,6 +603,31 @@ questions:
schema:
type: string
default: ""
- variable: additional_meshcentral
group: Container Configuration
label: Additional MeshCentral Configuration
schema:
type: list
default: []
items:
- variable: entry
label: Key - Value Pair
schema:
additional_attrs: true
type: dict
attrs:
- variable: key
label: Key
schema:
type: string
required: true
default: ""
- variable: value
label: Value
schema:
type: string
required: true
default: ""
# Include{containerConfig}
# Include{serviceRoot}
- variable: main

View File

@ -5,6 +5,7 @@
{{- $secretStorageName := printf "%s-storage-secret" (include "tc.common.names.fullname" .) }}
{{- $config := .Values.meshcentral }}
{{- $mc_custom := .Values.additional_meshcentral }}
{{- $isScale := false }}
{{- if hasKey .Values.global "isSCALE" }}
@ -13,6 +14,20 @@
{{- $isScale = false }}
{{- end }}
{{- if $isScale }}
{{- if .Values.additional_meshcentral }}
{{- $mc_custom = (include "render.custom.scale.values" $mc_custom) }}
{{- $mc_custom_merged := dict }}
{{/* We created a new unique section# for each key we parsed */}}
{{/* And we merge them here, as without it we would have multiple */}}
{{/* same top level keys */}}
{{- range $section := (fromYaml $mc_custom) }}
{{- $mc_custom_merged = mergeOverwrite $mc_custom_merged $section }}
{{- end }}
{{- $config = mergeOverwrite $config $mc_custom_merged }}
{{- end }}
{{- end }}
{{- $sessionKey := "" }}
{{- with (lookup "v1" "Secret" .Release.Namespace $secretStorageName) }}
{{- $sessionKey = (index .data "session_key") }}
@ -40,7 +55,7 @@
{{- range $domain := $config.domains }}
{{- if not (hasKey $domain "myServer") }}
{{- $_ := set $domain "myServer" dict }}
{{- end -}}
{{- end }}
{{- $_ := set $domain.myServer "Upgrade" false }}
{{- end }}
@ -138,3 +153,20 @@ data:
{{- $_ := unset $values.domains "tcdefaultdomain" }}
{{- toYaml $values }}
{{- end }}
{{/* Takes a list of dicts with a value and a */}}
{{/* key formatted in dot notaion and converts it to yaml */}}
{{- define "render.custom.scale.values" }}
{{- $values := . }}
{{- $section := 1 }}
{{- range $item := $values }}
{{- $indent := 2 }}
{{- printf "section%v" $section | nindent 0 }}:
{{- $section = (add 1 (int $section)) }}
{{- range (split "." $item.key) }}
{{- . | nindent (int $indent) }}:
{{- $indent = (add 2 (int $indent)) }}
{{- end -}}
{{- printf " %v" $item.value }}
{{- end }}
{{- end }}

View File

@ -18,7 +18,7 @@ podSecurityContext:
# - Values with the character _ in-front of them are pruned. Add or remove _ to disable or enable options
# - More in-depth info for each options can be found here: https://github.com/Ylianst/MeshCentral/blob/master/meshcentral-config-schema.json
# - Check for this chart's specific info in our webpage https://truecharts.org
# - Last sync with upstream config schema: Oct 22, 2022
# - Last sync with upstream config schema: Oct 29, 2022
# - Any service that uses port other than 443, need to be manually configured.
meshcentral:
settings:
@ -290,6 +290,12 @@ meshcentral:
serverurl: ""
# - A Discord bot token that MeshCentral will use to login to Discord.
token: ""
# - Configure XMPP messaging system
_xmpp:
service: ""
credentials:
username: ""
password: ""
# - Any settings in this section is used as default setting for all domains
_domaindefaults: