2022-03-31 17:40:09 +00:00
|
|
|
image:
|
2022-04-22 10:27:50 +00:00
|
|
|
repository: tccr.io/truecharts/meshcentral
|
2022-03-31 17:40:09 +00:00
|
|
|
pullPolicy: IfNotPresent
|
2022-06-04 21:35:14 +00:00
|
|
|
tag: v1.0.31@sha256:7cf24b5d99c57bab086466313239acec0cde5272a97f25715fa92291226cd4d4
|
2022-03-31 17:40:09 +00:00
|
|
|
|
2022-05-01 16:43:55 +00:00
|
|
|
extraArgs: ["--cert", "$hostname"]
|
|
|
|
|
2022-03-31 17:40:09 +00:00
|
|
|
securityContext:
|
|
|
|
readOnlyRootFilesystem: false
|
|
|
|
runAsNonRoot: false
|
|
|
|
|
|
|
|
podSecurityContext:
|
|
|
|
runAsUser: 0
|
|
|
|
runAsGroup: 0
|
|
|
|
|
2022-05-01 16:43:55 +00:00
|
|
|
env:
|
|
|
|
hostname: "test.example.com"
|
|
|
|
reverseProxyUrl: "https://test.example.com"
|
|
|
|
|
2022-03-31 17:40:09 +00:00
|
|
|
service:
|
|
|
|
main:
|
|
|
|
ports:
|
|
|
|
main:
|
2022-04-01 18:27:33 +00:00
|
|
|
protocol: "HTTPS"
|
2022-03-31 17:40:09 +00:00
|
|
|
port: 10205
|
|
|
|
|
|
|
|
initContainers:
|
|
|
|
init:
|
|
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
|
|
|
volumeMounts:
|
2022-04-21 10:09:07 +00:00
|
|
|
- name: data
|
|
|
|
mountPath: "/home/node/meshcentral/meshcentral-data"
|
|
|
|
env:
|
2022-05-01 16:43:55 +00:00
|
|
|
- name: hostname
|
|
|
|
value: "{{ .Values.env.hostname }}"
|
|
|
|
- name: reverseProxyUrl
|
|
|
|
value: "{{ .Values.env.reverseProxyUrl }}"
|
2022-04-21 10:09:07 +00:00
|
|
|
- name: svcPort
|
|
|
|
value: "{{ .Values.service.main.ports.main.port }}"
|
|
|
|
- name: "mongodbURL"
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: mongodbcreds
|
|
|
|
key: url
|
2022-05-01 16:43:55 +00:00
|
|
|
command: ["/bin/bash", "-c"]
|
2022-04-21 10:09:07 +00:00
|
|
|
args:
|
|
|
|
- >
|
|
|
|
export configfile='/home/node/meshcentral/meshcentral-data/config.json';
|
2022-05-01 16:43:55 +00:00
|
|
|
export basePath='/home/node/meshcentral/meshcentral-data/truecharts';
|
|
|
|
mkdir -p $basePath;
|
2022-04-21 10:09:07 +00:00
|
|
|
if [ -f $configfile ]; then
|
2022-05-01 16:43:55 +00:00
|
|
|
echo 'Config File exists, updating values...';
|
|
|
|
|
|
|
|
# Update hostname
|
|
|
|
sed -i 's/^ "cert":.*,$/ "cert": "'$hostname'",/1' $configfile;
|
|
|
|
|
|
|
|
export lastreverse=$(cat $basePath/.lastreverse);
|
|
|
|
if [ ! -z $reverseProxyUrl ]; then
|
|
|
|
if [[ $lastreverse == "NOT_PROVIDED" ]]; then
|
|
|
|
# Update reverseProxyUrl
|
|
|
|
echo "Adding $reverseProxyUrl...";
|
|
|
|
sed -i 's/^ "_certUrl": "'$lastreverse'",'$/ "certUrl": "'$reverseProxyUrl'",'/1' $configfile;
|
|
|
|
echo $reverseProxyUrl > $basePath/.lastreverse;
|
|
|
|
else
|
|
|
|
echo "Updating $lastreverse to $reverseProxyUrl...";
|
|
|
|
sed -i 's/^ "certUrl": "'$lastreverse'",'$/ "certUrl": "'$reverseProxyUrl'",'/1' $configfile;
|
|
|
|
echo $reverseProxyUrl > $basePath/.lastreverse;
|
|
|
|
fi;
|
|
|
|
else
|
|
|
|
echo "Removing reverse proxy url..."
|
|
|
|
sed -i 's/^ "_?certUrl":.*,$/ "_certUrl": "NOT_PROVIDED",/1' $configfile;
|
|
|
|
echo "NOT_PROVIDED" > $basePath/.lastreverse;
|
|
|
|
fi;
|
|
|
|
|
|
|
|
export lastport=$(cat $basePath/.lastport);
|
|
|
|
if [ ! -z $lastport ]; then
|
|
|
|
# Update port
|
|
|
|
echo "Updating $lastport to $svcPort...";
|
|
|
|
sed -i 's/^ "port": '$lastport',$/ "port": '$svcPort',/1' $configfile;
|
|
|
|
# Save new port.
|
|
|
|
echo "$svcPort" > $basePath/.lastport;
|
|
|
|
fi;
|
2022-04-21 10:09:07 +00:00
|
|
|
else
|
2022-05-01 16:43:55 +00:00
|
|
|
echo "DO NOT DELETE DOT FILES IN THIS DIR" > $basePath/DO_NOT_DELETE_DOT_FILES_IN_THIS_DIR;
|
2022-04-21 10:09:07 +00:00
|
|
|
echo 'Creating basic config to $configfile...';
|
|
|
|
echo '{' >> $configfile;
|
2022-05-01 16:43:55 +00:00
|
|
|
echo ' "$schema": "http://info.meshcentral.com/downloads/meshcentral-config-schema.json",' >> $configfile;
|
2022-04-21 10:09:07 +00:00
|
|
|
echo ' "settings": {' >> $configfile;
|
2022-05-01 16:43:55 +00:00
|
|
|
# Save last port used
|
|
|
|
echo "$svcPort" > $basePath/.lastport;
|
2022-04-21 10:09:07 +00:00
|
|
|
echo ' "port": '$svcPort',' >> $configfile;
|
2022-05-01 16:43:55 +00:00
|
|
|
echo ' "mongoDb": "'$mongodbURL'",' >> $configfile;
|
|
|
|
echo ' "cert": "'$hostname'"' >> $configfile;
|
|
|
|
echo ' },' >> $configfile;
|
|
|
|
echo ' "domains": {' >> $configfile;
|
|
|
|
echo ' "": {' >> $configfile;
|
|
|
|
if [ ! -z $reverseProxyUrl ]; then
|
|
|
|
echo ' "certUrl": "'$reverseProxyUrl'"' >> $configfile;
|
|
|
|
# Save last reverse url used
|
|
|
|
echo $reverseProxyUrl > $basePath/.lastreverse;
|
|
|
|
else
|
|
|
|
# Underscore in front the the key is making it invisible to meshcentral
|
|
|
|
echo ' "_certUrl": "NOT_PROVIDED"' >> $configfile;
|
|
|
|
# Save last reverse url used
|
|
|
|
echo "NOT_PROVIDED" > $basePath/.lastreverse;
|
|
|
|
fi;
|
|
|
|
echo ' }' >> $configfile;
|
2022-04-21 10:09:07 +00:00
|
|
|
echo ' }' >> $configfile;
|
|
|
|
echo '}' >> $configfile;
|
|
|
|
fi;
|
2022-03-31 17:40:09 +00:00
|
|
|
|
|
|
|
mongodb:
|
|
|
|
enabled: true
|
|
|
|
mongodbUsername: meshcentral
|
|
|
|
mongodbDatabase: meshcentral
|
|
|
|
existingSecret: "mongodbcreds"
|
|
|
|
|
|
|
|
persistence:
|
|
|
|
data:
|
|
|
|
enabled: true
|
2022-04-21 10:09:07 +00:00
|
|
|
mountPath: "/home/node/meshcentral/meshcentral-data"
|
|
|
|
files:
|
2022-03-31 17:40:09 +00:00
|
|
|
enabled: true
|
2022-04-21 10:09:07 +00:00
|
|
|
mountPath: "/home/node/meshcentral/meshcentral-files"
|