From b66f63028d2fabbf02f56d9a66b64cc3ff649fd9 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Sun, 16 Apr 2023 22:10:16 +0300 Subject: [PATCH] fix(meshcentral): fixup/port meshcentral (#8066) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes #8062 **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [ ] ⚖️ My code follows the style guidelines of this project - [ ] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [ ] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --- charts/stable/meshcentral/Chart.yaml | 6 +-- charts/stable/meshcentral/ci/ci-values.yaml | 2 +- charts/stable/meshcentral/questions.yaml | 47 ++++++++---------- .../stable/meshcentral/templates/_secret.tpl | 49 +++++++------------ .../stable/meshcentral/templates/common.yaml | 9 ++-- charts/stable/meshcentral/values.yaml | 32 ++++++------ 6 files changed, 66 insertions(+), 79 deletions(-) diff --git a/charts/stable/meshcentral/Chart.yaml b/charts/stable/meshcentral/Chart.yaml index d0758cab907..3c3c4a75695 100644 --- a/charts/stable/meshcentral/Chart.yaml +++ b/charts/stable/meshcentral/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 kubeVersion: ">=1.16.0-0" name: meshcentral -version: 9.0.33 +version: 10.0.0 appVersion: "1.1.4" description: MeshCentral is a full computer management web site type: application @@ -18,11 +18,11 @@ sources: dependencies: - name: common repository: https://library-charts.truecharts.org - version: 11.1.2 + version: 12.4.15 - condition: mongodb.enabled name: mongodb repository: https://deps.truecharts.org/ - version: 6.0.3 + version: 6.0.10 maintainers: - email: info@truecharts.org name: TrueCharts diff --git a/charts/stable/meshcentral/ci/ci-values.yaml b/charts/stable/meshcentral/ci/ci-values.yaml index c4ed0413ac1..764221039e8 100644 --- a/charts/stable/meshcentral/ci/ci-values.yaml +++ b/charts/stable/meshcentral/ci/ci-values.yaml @@ -2,4 +2,4 @@ service: main: ports: main: - protocol: HTTPS + protocol: https diff --git a/charts/stable/meshcentral/questions.yaml b/charts/stable/meshcentral/questions.yaml index dfbd0eba87c..597d8ab4cf5 100644 --- a/charts/stable/meshcentral/questions.yaml +++ b/charts/stable/meshcentral/questions.yaml @@ -629,13 +629,7 @@ questions: default: "" # Include{containerConfig} # Include{serviceRoot} - - variable: main - label: Main Service - description: The Primary service on which the healthcheck runs, often the webUI - schema: - additional_attrs: true - type: dict - attrs: +# Include{serviceMain} # Include{serviceSelectorLoadBalancer} # Include{serviceSelectorExtras} - variable: main @@ -701,28 +695,29 @@ questions: # Include{ingressTraefik} # Include{ingressList} -# Include{podSecurityContextRoot} - - variable: runAsUser - label: runAsUser - description: The UserID of the user running the application - schema: - type: int - default: 0 - - variable: runAsGroup - label: runAsGroup - description: The groupID this App of the user running the application - schema: - type: int - default: 0 +# Include{securityContextRoot} + + - variable: runAsUser + label: "runAsUser" + description: "The UserID of the user running the application" + schema: + type: int + default: 0 + - variable: runAsGroup + label: "runAsGroup" + description: "The groupID this App of the user running the application" + schema: + type: int + default: 0 # Include{securityContextContainer} # Include{securityContextAdvanced} # Include{securityContextPod} - - variable: fsGroup - label: fsGroup - description: The group that should own ALL storage. - schema: - type: int - default: 568 + - variable: fsGroup + label: "fsGroup" + description: "The group that should own ALL storage." + schema: + type: int + default: 568 # Include{resources} # Include{advanced} diff --git a/charts/stable/meshcentral/templates/_secret.tpl b/charts/stable/meshcentral/templates/_secret.tpl index d75108502e5..4709820c8a5 100644 --- a/charts/stable/meshcentral/templates/_secret.tpl +++ b/charts/stable/meshcentral/templates/_secret.tpl @@ -1,15 +1,16 @@ {{/* Define the secret */}} {{- define "meshcentral.secret" -}} -{{- $secretName := printf "%s-secret" (include "tc.common.names.fullname" .) -}} -{{- $secretStorageName := printf "%s-storage-secret" (include "tc.common.names.fullname" .) -}} +{{- $fullname := include "tc.v1.common.lib.chart.names.fullname" $ -}} +{{- $secretName := printf "%s-mesh-secret" $fullname -}} +{{- $secretStoreName := printf "%s-sec-store" $fullname -}} {{- $config := .Values.meshcentral -}} {{- $mc_custom := .Values.additional_meshcentral -}} {{- $isScale := false -}} -{{- if hasKey .Values.global "isSCALE" -}} - {{- $isScale = .Values.global.isSCALE -}} +{{- if hasKey .Values.global "ixChartContext" -}} + {{- $isScale = true -}} {{- else -}} {{- $isScale = false -}} {{- end -}} @@ -29,7 +30,7 @@ {{- end -}} {{- $sessionKey := "" -}} -{{- with (lookup "v1" "Secret" .Release.Namespace $secretStorageName) -}} +{{- with (lookup "v1" "Secret" .Release.Namespace $secretStoreName) -}} {{- $sessionKey = (index .data "session_key") | b64dec -}} {{- else -}} {{- $sessionKey = randAlphaNum 32 -}} @@ -42,7 +43,7 @@ {{- $_ := set $config "settings" dict -}} {{- end -}} -{{- $_ := set $config.settings "mongoDB" (.Values.mongodb.url.complete | trimAll "\"") -}} +{{- $_ := set $config.settings "mongoDB" (.Values.mongodb.creds.complete | trimAll "\"") -}} {{- $_ := set $config.settings "mongoDbName" .Values.mongodb.mongodbDatabase -}} {{- $_ := set $config.settings "sessionKey" $sessionKey -}} {{- $_ := set $config.settings "port" .Values.service.main.ports.main.port -}} @@ -66,30 +67,18 @@ {{- $config = (include "prune.keys" $config) -}} {{- end }} ---- -apiVersion: v1 -kind: Secret -type: Opaque -metadata: - name: {{ $secretStorageName }} - labels: - {{- include "tc.common.labels" . | nindent 4 }} -data: - {{/* Store session_key to reuse */}} - session_key: {{ $sessionKey | b64enc }} - ---- -apiVersion: v1 -kind: Secret -type: Opaque -metadata: - name: {{ $secretName }} - labels: - {{- include "tc.common.labels" . | nindent 4 }} -data: - {{/* The actual config */}} - config.json: | - {{- toPrettyJson (fromYaml $config) | b64enc | nindent 4 }} +secret: + sec-store: + enabled: true + data: + {{/* Store session_key to reuse */}} + session_key: {{ $sessionKey }} + mesh-secret: + enabled: true + data: + {{/* The actual config */}} + config.json: | + {{- toPrettyJson (fromYaml $config) | nindent 8 }} {{- end -}} {{/* Prunes keys that start with _ */}} diff --git a/charts/stable/meshcentral/templates/common.yaml b/charts/stable/meshcentral/templates/common.yaml index 5d43352c10f..c097596c46d 100644 --- a/charts/stable/meshcentral/templates/common.yaml +++ b/charts/stable/meshcentral/templates/common.yaml @@ -1,8 +1,7 @@ {{/* Make sure all variables are set properly */}} -{{- include "tc.common.loader.init" . }} +{{ include "tc.v1.common.loader.init" . }} -{{/* Render secret */}} -{{- include "meshcentral.secret" . }} +{{- $_ := mustMergeOverwrite .Values (include "meshcentral.secret" $ | fromYaml) -}} {{- define "meshcentral.probes" -}} probes: @@ -17,7 +16,7 @@ probes: path: /health.ashx {{- end -}} -{{- $_ := mergeOverwrite .Values (include "meshcentral.probes" . | fromYaml) -}} +{{- $_ := mergeOverwrite .Values.workload.main.podSpec.containers.main (include "meshcentral.probes" . | fromYaml) -}} {{/* Render the templates */}} -{{ include "tc.common.loader.apply" . }} +{{ include "tc.v1.common.loader.apply" . }} diff --git a/charts/stable/meshcentral/values.yaml b/charts/stable/meshcentral/values.yaml index 7aedc18417b..8fe1b059f93 100644 --- a/charts/stable/meshcentral/values.yaml +++ b/charts/stable/meshcentral/values.yaml @@ -1,19 +1,23 @@ image: repository: tccr.io/truecharts/meshcentral pullPolicy: IfNotPresent - tag: 1.1.4@sha256:897de1ed255c6f8587f1bc9af4b0e86bfd004c4659eedc2e5cd73de3f40deb0b + tag: 1.1.5@sha256:91564f7e1d65c007e732bb3e468bafb381ffd257fa85b6e5ef6691c89de0b3d0 -command: - - node - - meshcentral/meshcentral +workload: + main: + podSpec: + containers: + main: + command: + - node + - meshcentral/meshcentral securityContext: - readOnlyRootFilesystem: false - runAsNonRoot: false - -podSecurityContext: - runAsUser: 0 - runAsGroup: 0 + container: + readOnlyRootFilesystem: false + runAsNonRoot: false + runAsUser: 0 + runAsGroup: 0 # - 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 @@ -952,7 +956,7 @@ service: ports: main: # Only use HTTPS if meshcental handles the certs - protocol: HTTP + protocol: http port: 10205 # mps: # enabled: true @@ -973,7 +977,6 @@ mongodb: enabled: true mongodbUsername: meshcentral mongodbDatabase: meshcentral - existingSecret: mongodbcreds persistence: data: @@ -997,9 +1000,10 @@ persistence: type: secret readOnly: true defaultMode: "0600" - objectName: '{{ include "tc.common.names.fullname" . }}-secret' + objectName: mesh-secret mountPath: /opt/meshcentral/meshcentral-data/config.json subPath: config.json portal: - enabled: true + open: + enabled: true