Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The files in this GitHub repository refer to commercial software products and se

The following license terms apply only to the files in this GitHub repository, including files in this folder and its subfolders, and do not apply to MathWorks Programs. References to “software” and “code” in the following license terms refer to the files in this GitHub repository.

Copyright (c) 2023, The MathWorks, Inc.
Copyright (c) 2024, The MathWorks, Inc.

All rights reserved.

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Before starting, you need the following:
* [Git™](https://git-scm.com/)
* [Docker®](https://www.docker.com/)
* Running [Kubernetes](https://kubernetes.io/) cluster that meets the following conditions:
* Uses Kubernetes version 1.26 or later.
* Uses Kubernetes version 1.27 or later.
* Each MATLAB Production Server container in the Kubernetes cluster requires at least 1 CPU core and 2 GiB RAM.
* [kubectl](https://kubernetes.io/docs/reference/kubectl/overview/) command-line tool that can access your Kubernetes cluster
* [Helm](https://helm.sh/) package manager to install Helm charts that contain preconfigured Kubernetes resources for MATLAB Production Server
Expand All @@ -43,7 +43,7 @@ The MATLAB Production Server on Kubernetes GitHub repository contains Helm chart
```
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.

2. Navigate to the Helm chart folder for the release you want to use. Replace `<release>` with the release version, for example, `R2023b`.
2. Navigate to the Helm chart folder for the release you want to use. Replace `<release>` with the release version, for example, `R2024a`.
```
cd matlab-production-server-on-kubernetes/releases/<release>/matlab-prodserver
```
Expand All @@ -60,7 +60,7 @@ The MATLAB Production Server on Kubernetes GitHub repository contains Helm chart
```
* `containers.mathworks.com` is the name of the container registry.
* `matlab-production-server` is the name of the repository.
* `<release-tag>` is the tag name of the MATLAB Production Server release, for example, `r2023b`.
* `<release-tag>` is the tag name of the MATLAB Production Server release, for example, `r2024a`.

The `values.yaml` file specifies these values in the `productionServer` section, in the `registry`, `repository`, and `tag` variables, respectively.

Expand All @@ -71,7 +71,7 @@ The MATLAB Production Server on Kubernetes GitHub repository contains Helm chart
```
* `containers.mathworks.com` is the name of the container registry.
* `matlab-runtime` is the name of the repository.
* `<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.
* `<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, `r2024a`. MATLAB Production Server supports MATLAB Runtime versions up to six releases back from the MATLAB Production Server version you are using.

The `values.yaml` file specifies these values in the `matlabRuntime` section, in the `registry`, `repository`, and `tag` variables, respectively.

Expand Down Expand Up @@ -159,5 +159,5 @@ If you require assistance, contact [MathWorks Technical Support](https://www.mat

## License

MATHWORKS CLOUD REFERENCE ARCHITECTURE LICENSE © 2023 The MathWorks, Inc.
MATHWORKS CLOUD REFERENCE ARCHITECTURE LICENSE © 2024 The MathWorks, Inc.

5 changes: 5 additions & 0 deletions releases/R2024a/matlab-prodserver/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v2
appVersion: "R2024a"
description: MATLAB Production Server Helm chart for Kubernetes
name: matlab-prodserver-k8s
version: 1.0.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#
# Expose MATLAB Production Server internal endpoint
#
kind: Service
apiVersion: v1
metadata:
name: matlab-production-server
namespace: {{ .Release.Namespace }}
labels:
app: mps
release: {{ .Release.Name }}
spec:
selector:
app: mps
ports:
- name: mps-port
port: 9910
targetPort: 9910
type: ClusterIP

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: matlab-production-server-ingress
namespace: {{ .Release.Namespace }}
labels:
release: {{ .Release.Name }}
annotations:
{{ if .Values.global.ingressController }}
## set ingress-conroller vendor-specific annotations:
{{- range $key, $value := .Values.global.ingressController.annotations }}
{{ $key }}: {{ quote $value }}
{{- end }}
{{ end }}
spec:
ingressClassName: {{ .Values.global.ingressController.name }}
{{ if .Values.global.ingressController.tls.enabled }}
tls:
- hosts:
- {{ .Values.global.ingressController.domainBase }}
{{- if .Values.global.ingressController.tls.secretName }}
secretName: {{ .Values.global.ingressController.tls.secretName }}
{{- end }}
{{ end }}

rules:
- host: {{ .Values.global.ingressController.domainBase }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: matlab-production-server
port:
number: 9910

---
{{ if and (.Values.optionalSettings.Prometheus.enabled) (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1/ServiceMonitor") }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: matlab-production-server-monitor
labels:
app: mps
app.kubernetes.io/part-of: {{ .Values.optionalSettings.Prometheus.matchOn }}
release: {{ .Values.optionalSettings.Prometheus.matchOn }}
spec:
selector:
matchLabels:
app: mps
release: {{ .Release.Name }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
endpoints:
- port: mps-port
path: /api/metrics
{{ end }}

67 changes: 67 additions & 0 deletions releases/R2024a/matlab-prodserver/templates/mps-2-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: matlab-production-server-config
namespace: {{ .Release.Namespace }}
labels:
release: {{ .Release.Name }}
data:
main_config: |
--http 9910
--ssl-verify-peer-mode no-verify-peer
--ssl-protocols TLSv1.2
--ssl-ciphers ALL
--mcr-root /opt/matlabruntime/{{ .Values.images.matlabRuntime.variant }}
--num-workers {{ .Values.matlabProductionServerSettings.numWorkers | default 1 }}
--worker-restart-interval 12:00:00
--worker-memory-check-interval 0:00:30
--queue-time-trigger 0:00:00.25
--queue-time-target 0:00:00.25
--num-threads 1
--auto-deploy-root ./auto_deploy
--request-size-limit 64MB
--log-severity information
--log-rotation-size 100MB
--log-archive-root ./old_logs
--log-archive-max-size 1GB
--log-root ./log
--log-stdout
--license {{ .Values.global.licenseServer | default "27000@hostname" }}
--license-grace-period 2:30
--license-poll-interval 0:10
--pid-root ./pid
--endpoint-root ./endpoint
--extract-root .
--socket-root ./.mps_socket
--main-log-format text/plain
--disable-control-c
--enable-graceful-shutdown
--no-display
--enable-http-pipelining
--server-memory-threshold 2GB
--server-memory-threshold-overflow-action purge_responses
--enable-discovery
--enable-metrics
--routes-file ./config/routes.json

{{- if .Values.optionalSettings.Redis.host }}
mps_cache_config: |
{"Connections":
{"{{ .Values.optionalSettings.Redis.name }}":
{"Provider":"Redis",
"Host":{{ .Values.optionalSettings.Redis.host | quote }},
"Port":{{ .Values.optionalSettings.Redis.port | default 6379 }}
{{- if .Values.optionalSettings.Redis.auth }}
,"Key":{{ .Values.optionalSettings.Redis.auth | quote }}
{{- end }}
}
}
}
{{- end }}

routes.json: |
{
"version": "1.0.0",
"pathmap": []
}

146 changes: 146 additions & 0 deletions releases/R2024a/matlab-prodserver/templates/mps-3-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
#
# MATLAB Production Server instance
#
apiVersion: apps/v1
kind: Deployment
metadata:
name: matlab-production-server
namespace: {{ .Release.Namespace }}
labels:
app: mps
release: {{ .Release.Name }}
spec:
replicas: {{ .Values.deploymentSettings.replicaCount }}
selector:
matchLabels:
app: mps
template:
metadata:
labels:
app: mps
annotations:
{{ if not .Values.optionalSettings.Prometheus.enabled }}
prometheus.io/scrape: 'true'
prometheus.io/path: '/api/metrics'
prometheus.io/port: '9910'
{{ end }}
spec:
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000

containers:
- name: mps
image: {{ .Values.global.images.registry | default .Values.images.productionServer.registry }}/{{ .Values.images.productionServer.repository }}:{{ .Values.images.productionServer.tag }}
env:
- name: AGREE_TO_MATHWORKS_SOFTWARE_LICENSE
value: {{ required "agreeToLicense must be set to \"yes\"." .Values.global.agreeToLicense | default "no" | lower | quote }}
- name: AGREE_TO_MATLAB_RUNTIME_LICENSE
value: {{ required "agreeToLicense must be set to \"yes\"." .Values.global.agreeToLicense | default "no" | lower | quote }}
- name: LD_LIBRARY_PATH
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"
{{ if .Values.optionalSettings.Redis.secretName }}
- name: MPS_REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.optionalSettings.Redis.secretName }}
key: {{ .Values.optionalSettings.Redis.secretKey | default "redis-password" }}
{{ end }}

ports:
- containerPort: 9910

resources:
requests:
cpu: {{ .Values.deploymentSettings.cpuRequest | default "1" | quote }}
memory: {{ .Values.deploymentSettings.memoryRequest | default "2Gi" | quote }}
limits:
cpu: {{ .Values.matlabProductionServerSettings.numWorkers | default "1" | quote }}
memory: "8Gi"

volumeMounts:
- name: auto-deploy
mountPath: "/opt/mpsinstance/auto_deploy"
- name: mcr-root
mountPath: "/opt/matlabruntime"
- name: mps-config
mountPath: "/opt/mpsinstance/config"

startupProbe:
exec:
command:
- ls
- /opt/matlabruntime/{{ .Values.images.matlabRuntime.variant }}/matlabruntime_license_agreement.pdf
initialDelaySeconds: 10
periodSeconds: 30

livenessProbe:
httpGet:
path: /api/health
port: 9910
initialDelaySeconds: 10
periodSeconds: 10

lifecycle:
preStop:
exec:
command: ["sh", "/opt/mpsinstance/stopmps.sh"]

imagePullPolicy: {{ .Values.images.productionServer.pullPolicy }}

initContainers:
- name: matlab-runtime
image: {{ .Values.global.images.registry | default .Values.images.matlabRuntime.registry }}/{{ .Values.images.matlabRuntime.repository }}:{{ .Values.images.matlabRuntime.tag }}

command:
- /bin/sh
- -c
- "cp -r /opt/matlabruntime/* /mnt/"

volumeMounts:
- name: mcr-root
mountPath: "/mnt"

imagePullPolicy: {{ .Values.images.matlabRuntime.pullPolicy }}

restartPolicy: {{ .Values.deploymentSettings.restartPolicy }}
imagePullSecrets:
{{- if .Values.global.images.pullSecret }}
- name: {{ .Values.global.images.pullSecret }}
{{- end }}
{{- if .Values.images.productionServer.pullSecret }}
- name: {{ .Values.images.productionServer.pullSecret }}
{{- end }}
{{- if and .Values.images.matlabRuntime.pullSecret (ne .Values.images.matlabRuntime.pullSecret .Values.images.productionServer.pullSecret) }}
- name: {{ .Values.images.matlabRuntime.pullSecret }}
{{- end }}

volumes:
- name: mcr-root
emptyDir: {}
- name: mps-config
configMap:
name: matlab-production-server-config
- name: auto-deploy
{{- if eq .Values.matlabProductionServerSettings.autoDeploy.volumeType "hostpath" }}
hostPath:
path: {{ .Values.matlabProductionServerSettings.autoDeploy.hostpath }}
type: Directory
{{- else if eq .Values.matlabProductionServerSettings.autoDeploy.volumeType "nfs" }}
nfs:
server: {{ .Values.matlabProductionServerSettings.autoDeploy.server }}
path: {{ .Values.matlabProductionServerSettings.autoDeploy.path }}
readOnly: true
{{- else if eq .Values.matlabProductionServerSettings.autoDeploy.volumeType "pvc" }}
persistentVolumeClaim:
claimName: {{ .Values.matlabProductionServerSettings.autoDeploy.claimName }}
{{- else if eq .Values.matlabProductionServerSettings.autoDeploy.volumeType "azurefileshare" }}
azureFile:
shareName: {{ .Values.matlabProductionServerSettings.autoDeploy.shareName }}
secretName: {{ .Values.matlabProductionServerSettings.autoDeploy.secretName }}
readOnly: true
{{ else }}
emptyDir: {}
{{- end }}

Loading