Skip to content

Commit 2d999de

Browse files
authored
Publish R2023b (#22)
Co-authored-by: Eitan Steiner <[email protected]>
1 parent d8754f8 commit 2d999de

File tree

7 files changed

+379
-6
lines changed

7 files changed

+379
-6
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Before starting, you need the following:
2525
* [Git™](https://git-scm.com/)
2626
* [Docker®](https://www.docker.com/)
2727
* Running [Kubernetes](https://kubernetes.io/) cluster that meets the following conditions:
28-
* Uses Kubernetes version 1.24 or later.
28+
* Uses Kubernetes version 1.25 or later.
2929
* Each MATLAB Production Server container in the Kubernetes cluster requires at least 1 CPU core and 2 GiB RAM.
3030
* [kubectl](https://kubernetes.io/docs/reference/kubectl/overview/) command-line tool that can access your Kubernetes cluster
3131
* [Helm](https://helm.sh/) package manager to install Helm charts that contain preconfigured Kubernetes resources for MATLAB Production Server
@@ -43,7 +43,7 @@ The MATLAB Production Server on Kubernetes GitHub repository contains Helm chart
4343
```
4444
This repository includes Helm chart folders for each supported MATLAB Production Server release and a `values-overrides.yaml` file containing configuration options that apply across all release deployments.
4545
46-
2. Navigate to the Helm chart folder for the release you want to use. Replace `<release>` with the release version, for example, `R2023a`.
46+
2. Navigate to the Helm chart folder for the release you want to use. Replace `<release>` with the release version, for example, `R2023b`.
4747
```
4848
cd matlab-production-server-on-kubernetes/releases/<release>/matlab-prodserver
4949
```
@@ -60,7 +60,7 @@ The MATLAB Production Server on Kubernetes GitHub repository contains Helm chart
6060
```
6161
* `containers.mathworks.com` is the name of the container registry.
6262
* `matlab-production-server` is the name of the repository.
63-
* `<release-tag>` is the tag name of the MATLAB Production Server release, for example, `r2023a`.
63+
* `<release-tag>` is the tag name of the MATLAB Production Server release, for example, `r2023b`.
6464
6565
The `values.yaml` file specifies these values in the `productionServer` section, in the `registry`, `repository`, and `tag` variables, respectively.
6666
@@ -71,7 +71,7 @@ The MATLAB Production Server on Kubernetes GitHub repository contains Helm chart
7171
```
7272
* `containers.mathworks.com` is the name of the container registry.
7373
* `matlab-runtime` is the name of the repository.
74-
* `<release-tag>` is the tag name of the MATLAB Runtime release. Update this value to the release version of the MATLAB Runtime you are using, for example, `r2023a`. MATLAB Production Server supports MATLAB Runtime versions up to six releases back from the MATLAB Production Server version you are using.
74+
* `<release-tag>` is the tag name of the MATLAB Runtime release. Update this value to the release version of the MATLAB Runtime you are using, for example, `r2023b`. MATLAB Production Server supports MATLAB Runtime versions up to six releases back from the MATLAB Production Server version you are using.
7575
7676
The `values.yaml` file specifies these values in the `matlabRuntime` section, in the `registry`, `repository`, and `tag` variables, respectively.
7777
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v2
2+
appVersion: "R2023b"
3+
description: MATLAB Production Server Helm chart for Kubernetes
4+
name: matlab-prodserver-k8s
5+
version: 1.0.0
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#
2+
# Expose MATLAB Production Server internal endpoint
3+
#
4+
kind: Service
5+
apiVersion: v1
6+
metadata:
7+
name: matlab-production-server
8+
namespace: {{ .Release.Namespace }}
9+
labels:
10+
app: mps
11+
release: {{ .Release.Name }}
12+
spec:
13+
selector:
14+
app: mps
15+
ports:
16+
- name: mps-port
17+
port: 9910
18+
targetPort: 9910
19+
type: ClusterIP
20+
21+
---
22+
apiVersion: networking.k8s.io/v1
23+
kind: Ingress
24+
metadata:
25+
name: matlab-production-server-ingress
26+
namespace: {{ .Release.Namespace }}
27+
labels:
28+
release: {{ .Release.Name }}
29+
annotations:
30+
{{ if .Values.global.ingressController }}
31+
## set ingress-conroller vendor-specific annotations:
32+
{{- range $key, $value := .Values.global.ingressController.annotations }}
33+
{{ $key }}: {{ quote $value }}
34+
{{- end }}
35+
{{ end }}
36+
spec:
37+
ingressClassName: {{ .Values.global.ingressController.name }}
38+
rules:
39+
- host: {{ .Values.global.ingressController.domainBase }}
40+
http:
41+
paths:
42+
- path: /
43+
pathType: Prefix
44+
backend:
45+
service:
46+
name: matlab-production-server
47+
port:
48+
number: 9910
49+
50+
---
51+
{{ if and (.Values.optionalSettings.Prometheus.enabled) (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1/ServiceMonitor") }}
52+
apiVersion: monitoring.coreos.com/v1
53+
kind: ServiceMonitor
54+
metadata:
55+
name: matlab-production-server-monitor
56+
labels:
57+
app: mps
58+
app.kubernetes.io/part-of: {{ .Values.optionalSettings.Prometheus.matchOn }}
59+
release: {{ .Values.optionalSettings.Prometheus.matchOn }}
60+
spec:
61+
selector:
62+
matchLabels:
63+
app: mps
64+
release: {{ .Release.Name }}
65+
namespaceSelector:
66+
matchNames:
67+
- {{ .Release.Namespace }}
68+
endpoints:
69+
- port: mps-port
70+
path: /api/metrics
71+
{{ end }}
72+
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: matlab-production-server-config
5+
namespace: {{ .Release.Namespace }}
6+
labels:
7+
release: {{ .Release.Name }}
8+
data:
9+
main_config: |
10+
--http 9910
11+
--ssl-verify-peer-mode no-verify-peer
12+
--ssl-protocols TLSv1.1,TLSv1.2
13+
--ssl-ciphers ALL
14+
--mcr-root /opt/matlabruntime/{{ .Values.images.matlabRuntime.variant }}
15+
--num-workers {{ .Values.matlabProductionServerSettings.numWorkers | default 1 }}
16+
--worker-restart-interval 12:00:00
17+
--worker-memory-check-interval 0:00:30
18+
--queue-time-trigger 0:00:00.25
19+
--queue-time-target 0:00:00.25
20+
--num-threads 1
21+
--auto-deploy-root ./auto_deploy
22+
--request-size-limit 64MB
23+
--log-severity information
24+
--log-rotation-size 100MB
25+
--log-archive-root ./old_logs
26+
--log-archive-max-size 1GB
27+
--log-root ./log
28+
--log-stdout
29+
--license {{ .Values.global.licenseServer | default "27000@hostname" }}
30+
--license-grace-period 2:30
31+
--license-poll-interval 0:10
32+
--pid-root ./pid
33+
--endpoint-root ./endpoint
34+
--extract-root .
35+
--socket-root ./.mps_socket
36+
--main-log-format text/plain
37+
--disable-control-c
38+
--enable-graceful-shutdown
39+
--no-display
40+
--enable-http-pipelining
41+
--server-memory-threshold 2GB
42+
--server-memory-threshold-overflow-action purge_responses
43+
--enable-discovery
44+
--enable-metrics
45+
--routes-file ./config/routes.json
46+
47+
{{- if .Values.optionalSettings.Redis.host }}
48+
mps_cache_config: |
49+
{"Connections":
50+
{"{{ .Values.optionalSettings.Redis.name }}":
51+
{"Provider":"Redis",
52+
"Host":{{ .Values.optionalSettings.Redis.host | quote }},
53+
"Port":{{ .Values.optionalSettings.Redis.port | default 6379 }}
54+
{{- if .Values.optionalSettings.Redis.auth }}
55+
,"Key":{{ .Values.optionalSettings.Redis.auth | quote }}
56+
{{- end }}
57+
}
58+
}
59+
}
60+
{{- end }}
61+
62+
routes.json: |
63+
{
64+
"version": "1.0.0",
65+
"pathmap": []
66+
}
67+
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
#
2+
# MATLAB Production Server instance
3+
#
4+
apiVersion: apps/v1
5+
kind: Deployment
6+
metadata:
7+
name: matlab-production-server
8+
namespace: {{ .Release.Namespace }}
9+
labels:
10+
app: mps
11+
release: {{ .Release.Name }}
12+
spec:
13+
replicas: {{ .Values.deploymentSettings.replicaCount }}
14+
selector:
15+
matchLabels:
16+
app: mps
17+
template:
18+
metadata:
19+
labels:
20+
app: mps
21+
annotations:
22+
{{ if not .Values.optionalSettings.Prometheus.enabled }}
23+
prometheus.io/scrape: 'true'
24+
prometheus.io/path: '/api/metrics'
25+
prometheus.io/port: '9910'
26+
{{ end }}
27+
spec:
28+
securityContext:
29+
runAsNonRoot: true
30+
runAsUser: 1000
31+
runAsGroup: 1000
32+
33+
containers:
34+
- name: mps
35+
image: {{ .Values.global.images.registry | default .Values.images.productionServer.registry }}/{{ .Values.images.productionServer.repository }}:{{ .Values.images.productionServer.tag }}
36+
env:
37+
- name: AGREE_TO_MATHWORKS_SOFTWARE_LICENSE
38+
value: {{ required "agreeToLicense must be set to \"yes\"." .Values.global.agreeToLicense | default "no" | lower | quote }}
39+
- name: AGREE_TO_MATLAB_RUNTIME_LICENSE
40+
value: {{ required "agreeToLicense must be set to \"yes\"." .Values.global.agreeToLicense | default "no" | lower | quote }}
41+
- name: LD_LIBRARY_PATH
42+
value: "/opt/matlabruntime/{{ .Values.images.matlabRuntime.variant }}/runtime/glnxa64:/opt/matlabruntime/{{ .Values.images.matlabRuntime.variant }}/bin/glnxa64:/opt/matlabruntime/{{ .Values.images.matlabRuntime.variant }}/sys/os/glnxa64:/opt/matlabruntime/{{ .Values.images.matlabRuntime.variant }}/extern/bin/glnxa64:/opt/matlabruntime/{{ .Values.images.matlabRuntime.variant }}/sys/opengl/lib/glnxa64"
43+
{{ if .Values.optionalSettings.Redis.secretName }}
44+
- name: MPS_REDIS_PASSWORD
45+
valueFrom:
46+
secretKeyRef:
47+
name: {{ .Values.optionalSettings.Redis.secretName }}
48+
key: {{ .Values.optionalSettings.Redis.secretKey | default "redis-password" }}
49+
{{ end }}
50+
51+
ports:
52+
- containerPort: 9910
53+
54+
resources:
55+
requests:
56+
cpu: {{ .Values.deploymentSettings.cpuRequest | default "1" | quote }}
57+
memory: {{ .Values.deploymentSettings.memoryRequest | default "2Gi" | quote }}
58+
limits:
59+
cpu: {{ .Values.matlabProductionServerSettings.numWorkers | default "1" | quote }}
60+
memory: "8Gi"
61+
62+
volumeMounts:
63+
- name: auto-deploy
64+
mountPath: "/opt/mpsinstance/auto_deploy"
65+
- name: mcr-root
66+
mountPath: "/opt/matlabruntime"
67+
- name: mps-config
68+
mountPath: "/opt/mpsinstance/config"
69+
70+
startupProbe:
71+
exec:
72+
command:
73+
- ls
74+
- /opt/matlabruntime/{{ .Values.images.matlabRuntime.variant }}/matlabruntime_license_agreement.pdf
75+
initialDelaySeconds: 10
76+
periodSeconds: 30
77+
78+
livenessProbe:
79+
httpGet:
80+
path: /api/health
81+
port: 9910
82+
initialDelaySeconds: 10
83+
periodSeconds: 10
84+
85+
lifecycle:
86+
preStop:
87+
exec:
88+
command: ["sh", "/opt/mpsinstance/stopmps.sh"]
89+
90+
imagePullPolicy: {{ .Values.images.productionServer.pullPolicy }}
91+
92+
initContainers:
93+
- name: matlab-runtime
94+
image: {{ .Values.global.images.registry | default .Values.images.matlabRuntime.registry }}/{{ .Values.images.matlabRuntime.repository }}:{{ .Values.images.matlabRuntime.tag }}
95+
96+
command:
97+
- /bin/sh
98+
- -c
99+
- "cp -r /opt/matlabruntime/* /mnt/"
100+
101+
volumeMounts:
102+
- name: mcr-root
103+
mountPath: "/mnt"
104+
105+
imagePullPolicy: {{ .Values.images.matlabRuntime.pullPolicy }}
106+
107+
restartPolicy: {{ .Values.deploymentSettings.restartPolicy }}
108+
imagePullSecrets:
109+
{{- if .Values.global.images.pullSecret }}
110+
- name: {{ .Values.global.images.pullSecret }}
111+
{{- end }}
112+
{{- if .Values.images.productionServer.pullSecret }}
113+
- name: {{ .Values.images.productionServer.pullSecret }}
114+
{{- end }}
115+
{{- if and .Values.images.matlabRuntime.pullSecret (ne .Values.images.matlabRuntime.pullSecret .Values.images.productionServer.pullSecret) }}
116+
- name: {{ .Values.images.matlabRuntime.pullSecret }}
117+
{{- end }}
118+
119+
volumes:
120+
- name: mcr-root
121+
emptyDir: {}
122+
- name: mps-config
123+
configMap:
124+
name: matlab-production-server-config
125+
- name: auto-deploy
126+
{{- if eq .Values.matlabProductionServerSettings.autoDeploy.volumeType "hostpath" }}
127+
hostPath:
128+
path: {{ .Values.matlabProductionServerSettings.autoDeploy.hostpath }}
129+
type: Directory
130+
{{- else if eq .Values.matlabProductionServerSettings.autoDeploy.volumeType "nfs" }}
131+
nfs:
132+
server: {{ .Values.matlabProductionServerSettings.autoDeploy.server }}
133+
path: {{ .Values.matlabProductionServerSettings.autoDeploy.path }}
134+
readOnly: true
135+
{{- else if eq .Values.matlabProductionServerSettings.autoDeploy.volumeType "pvc" }}
136+
persistentVolumeClaim:
137+
claimName: {{ .Values.matlabProductionServerSettings.autoDeploy.claimName }}
138+
{{- else if eq .Values.matlabProductionServerSettings.autoDeploy.volumeType "azurefileshare" }}
139+
azureFile:
140+
shareName: {{ .Values.matlabProductionServerSettings.autoDeploy.shareName }}
141+
secretName: {{ .Values.matlabProductionServerSettings.autoDeploy.secretName }}
142+
readOnly: true
143+
{{ else }}
144+
emptyDir: {}
145+
{{- end }}
146+

0 commit comments

Comments
 (0)