Skip to content

Commit 7bbf2ce

Browse files
vramanatMWesteinerMWEUdler
authored
Publish R2024b (#31)
* helm chart action - initial commit * deprecate chart older than 3 years * helm chart action - initial commit * Enable action for non-main branch * Added chart version check * Added chart version check * Added chart version check * Added chart version check * Added chart version check * Test run * Test run * Test run * Test run * Test run * Test run * Test run * Test run * Cleanup * Cleanup * Chart updates for R2024b * Add Quick Start instructions to readme (#30) * Add Quick Start instructions to readme * Update README.md --------- Co-authored-by: esteinerMW <[email protected]> Co-authored-by: Eitan Steiner <[email protected]> Co-authored-by: EUdler <[email protected]>
1 parent a3faedd commit 7bbf2ce

File tree

9 files changed

+234
-76
lines changed

9 files changed

+234
-76
lines changed

.github/workflows/helm-chart.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Prerelease Helm Chart
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- Helm_artifacts
8+
9+
env:
10+
HELM_CHART_VERSION: 1.1.0
11+
MATLAB_APP_VERSION: "R2024b"
12+
13+
jobs:
14+
release-helm-chart:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
steps:
21+
- name: Check out the repo
22+
uses: actions/checkout@v4
23+
24+
- name: Install Helm
25+
uses: azure/setup-helm@v4
26+
27+
- name: Check that chart exists
28+
run: |
29+
CHART_DIR="releases/${{ env.MATLAB_APP_VERSION }}/matlab-prodserver" && cat ${CHART_DIR}/Chart.yaml
30+
echo "CHART_DIR=${CHART_DIR}" >> $GITHUB_ENV # Add to env if exists
31+
32+
- name: Check chart versions
33+
run: |
34+
grep 'version: ${{ env.HELM_CHART_VERSION }}' ${CHART_DIR}/Chart.yaml && grep 'appVersion: "${{ env.MATLAB_APP_VERSION }}"' ${CHART_DIR}/Chart.yaml
35+
36+
- name: Package the chart
37+
run: helm package ${CHART_DIR} --version ${{ env.HELM_CHART_VERSION }} --app-version ${{ env.MATLAB_APP_VERSION }}
38+
39+
- name: Login to GitHub Container Registry
40+
run: echo ${{ secrets.CR_TOKEN }} | helm registry login ${{ secrets.MATHWORKS_REGISTRY }} --username ${{ secrets.CR_USER }} --password-stdin
41+
42+
- name: Deploy the chart
43+
run: helm push matlab-prodserver-k8s-${{ env.HELM_CHART_VERSION }}.tgz oci://${{ secrets.MATHWORKS_REGISTRY }}
44+

README.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,42 @@ 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.27 or later.
28+
* Uses Kubernetes version 1.28 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
32-
* Uses Helm version v3.13.0 or later.
32+
* Uses Helm version v3.14 or later.
3333

3434
If you do not have a license, please contact your MathWorks representative [here](https://www.mathworks.com/company/aboutus/contact_us/contact_sales.html) or [request a trial license](https://www.mathworks.com/campaigns/products/trials.html?prodcode=PR).
3535

36+
## Quick Start
37+
The Quick Start option is recommended for the following cases:
38+
* You are deploying MATLAB Production Server R2024b or newer
39+
* You don't require significant changes to the Helm chart
40+
* You are not running MATLAB Production server on Kubernetes as part of a CI/CD workflow
41+
For CI/CD workflows, we recommend that you cache docker images in your private container registry. For more complex workflows, use the [Deployment Steps](#Deployment-Steps)
42+
43+
The Quick Start option only requires you to download a single file, rather than cloning the full GitHub repository. For more complex workflows, use the [Deployment Steps](#Deployment-Steps)
44+
45+
1. Download the `values-overrides.yaml` file containing configuration options that apply across all release deployments from the MATLAB Production Server on Kubernetes GitHub repository. You can use the cURL command below or click the "Download Raw File" icon.
46+
```
47+
curl -O https://raw.githubusercontent.com/mathworks-ref-arch/matlab-production-server-on-kubernetes/main/values-overrides.yaml
48+
```
49+
50+
2. Complete the steps in [Provide Mapping for Deployable Archives](#Provide-Mapping-for-Deployable-Archives).
51+
52+
3. Before installing the chart, first set parameters that state your agreement to the MathWorks cloud reference architecture license and specify the address of the network license manager. In the top-level values-overrides.yaml file, set these parameters:
53+
54+
To accept the license terms, set global > agreeToLicense to "yes".
55+
To specify the address of the license server, set global > licenseServer using the format port_number@host.
56+
57+
Next, install the Helm chart for MATLAB Production Server by using the following `helm install` command:
58+
59+
```
60+
helm install -f <path/to/values-overrides.yaml> [-n <k8s-namespace>] --generate-name oci://containers.mathworks.com/matlab-prodserver-k8s --version 1.1.0
61+
```
62+
4. After the deployment is complete, upload the MATLAB Production Server deployable archive to your network file server or Azure file share. All users must have read permission to the deployable archive.
63+
3664
## Deployment Steps
3765
### Clone GitHub® Repository that Contains Helm Chart
3866
The MATLAB Production Server on Kubernetes GitHub repository contains Helm charts that reference Ubuntu-based Docker container images for MATLAB Production Server deployment.
@@ -43,7 +71,7 @@ The MATLAB Production Server on Kubernetes GitHub repository contains Helm chart
4371
```
4472
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.
4573
46-
2. Navigate to the Helm chart folder for the release you want to use. Replace `<release>` with the release version, for example, `R2024a`.
74+
2. Navigate to the Helm chart folder for the release you want to use. Replace `<release>` with the release version, for example, `R2024b`.
4775
```
4876
cd matlab-production-server-on-kubernetes/releases/<release>/matlab-prodserver
4977
```
@@ -60,7 +88,7 @@ The MATLAB Production Server on Kubernetes GitHub repository contains Helm chart
6088
```
6189
* `containers.mathworks.com` is the name of the container registry.
6290
* `matlab-production-server` is the name of the repository.
63-
* `<release-tag>` is the tag name of the MATLAB Production Server release, for example, `r2024a`.
91+
* `<release-tag>` is the tag name of the MATLAB Production Server release, for example, `r2024b`.
6492
6593
The `values.yaml` file specifies these values in the `productionServer` section, in the `registry`, `repository`, and `tag` variables, respectively.
6694
@@ -71,7 +99,7 @@ The MATLAB Production Server on Kubernetes GitHub repository contains Helm chart
7199
```
72100
* `containers.mathworks.com` is the name of the container registry.
73101
* `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, `r2024a`. MATLAB Production Server supports MATLAB Runtime versions up to six releases back from the MATLAB Production Server version you are using.
102+
* `<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, `r2024b`. MATLAB Production Server supports MATLAB Runtime versions up to six releases back from the MATLAB Production Server version you are using.
75103
76104
The `values.yaml` file specifies these values in the `matlabRuntime` section, in the `registry`, `repository`, and `tag` variables, respectively.
77105

releases/R2021b/matlab-prodserver/templates/mps-1-service-ingress.yaml

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: v2
2-
appVersion: "R2021b"
2+
appVersion: "R2024b"
33
description: MATLAB Production Server Helm chart for Kubernetes
44
name: matlab-prodserver-k8s
5-
version: 0.1.0
5+
version: 1.1.0
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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+
{{- if .Values.global.ingressController.enabled }}
23+
apiVersion: networking.k8s.io/v1
24+
kind: Ingress
25+
metadata:
26+
name: matlab-production-server-ingress
27+
namespace: {{ .Release.Namespace }}
28+
labels:
29+
release: {{ .Release.Name }}
30+
annotations:
31+
{{ if .Values.global.ingressController }}
32+
## set ingress-conroller vendor-specific annotations:
33+
{{- range $key, $value := .Values.global.ingressController.annotations }}
34+
{{ $key }}: {{ quote $value }}
35+
{{- end }}
36+
{{ end }}
37+
spec:
38+
ingressClassName: {{ .Values.global.ingressController.name }}
39+
{{ if .Values.global.ingressController.tls.enabled }}
40+
tls:
41+
- hosts:
42+
- {{ .Values.global.ingressController.domainBase }}
43+
{{- if .Values.global.ingressController.tls.secretName }}
44+
secretName: {{ .Values.global.ingressController.tls.secretName }}
45+
{{- end }}
46+
{{ end }}
47+
48+
rules:
49+
- host: {{ .Values.global.ingressController.domainBase }}
50+
http:
51+
paths:
52+
- path: /
53+
pathType: Prefix
54+
backend:
55+
service:
56+
name: matlab-production-server
57+
port:
58+
number: 9910
59+
{{- end }}
60+
61+
---
62+
{{ if and (.Values.optionalSettings.Prometheus.enabled) (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1/ServiceMonitor") }}
63+
apiVersion: monitoring.coreos.com/v1
64+
kind: ServiceMonitor
65+
metadata:
66+
name: matlab-production-server-monitor
67+
labels:
68+
app: mps
69+
app.kubernetes.io/part-of: {{ .Values.optionalSettings.Prometheus.matchOn }}
70+
release: {{ .Values.optionalSettings.Prometheus.matchOn }}
71+
spec:
72+
selector:
73+
matchLabels:
74+
app: mps
75+
release: {{ .Release.Name }}
76+
namespaceSelector:
77+
matchNames:
78+
- {{ .Release.Namespace }}
79+
endpoints:
80+
- port: mps-port
81+
path: /api/metrics
82+
{{ end }}
83+

releases/R2021b/matlab-prodserver/templates/mps-2-configmap.yaml renamed to releases/R2024b/matlab-prodserver/templates/mps-2-configmap.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ data:
99
main_config: |
1010
--http 9910
1111
--ssl-verify-peer-mode no-verify-peer
12-
--ssl-protocols TLSv1.1,TLSv1.2
12+
--ssl-protocols TLSv1.2
1313
--ssl-ciphers ALL
1414
--mcr-root /opt/matlabruntime/{{ .Values.images.matlabRuntime.variant }}
1515
--num-workers {{ .Values.matlabProductionServerSettings.numWorkers | default 1 }}
@@ -42,15 +42,26 @@ data:
4242
--server-memory-threshold-overflow-action purge_responses
4343
--enable-discovery
4444
--enable-metrics
45+
--routes-file ./config/routes.json
4546
4647
{{- if .Values.optionalSettings.Redis.host }}
4748
mps_cache_config: |
4849
{"Connections":
4950
{"{{ .Values.optionalSettings.Redis.name }}":
5051
{"Provider":"Redis",
5152
"Host":{{ .Values.optionalSettings.Redis.host | quote }},
52-
"Port":{{ .Values.optionalSettings.Redis.port | default 6379 }}}
53+
"Port":{{ .Values.optionalSettings.Redis.port | default 6379 }}
54+
{{- if .Values.optionalSettings.Redis.auth }}
55+
,"Key":{{ .Values.optionalSettings.Redis.auth | quote }}
56+
{{- end }}
57+
}
5358
}
5459
}
5560
{{- end }}
5661

62+
routes.json: |
63+
{
64+
"version": "1.0.0",
65+
"pathmap": []
66+
}
67+

releases/R2021b/matlab-prodserver/templates/mps-3-deployment.yaml renamed to releases/R2024b/matlab-prodserver/templates/mps-3-deployment.yaml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,34 @@ spec:
1919
labels:
2020
app: mps
2121
annotations:
22+
{{ if not .Values.optionalSettings.Prometheus.enabled }}
2223
prometheus.io/scrape: 'true'
2324
prometheus.io/path: '/api/metrics'
2425
prometheus.io/port: '9910'
26+
{{ end }}
2527
spec:
2628
securityContext:
2729
runAsNonRoot: true
28-
runAsUser: 1000
29-
runAsGroup: 1000
30+
runAsUser: 1001
31+
runAsGroup: 1001
3032

3133
containers:
3234
- name: mps
33-
image: {{ .Values.images.productionServer.registry }}/{{ .Values.images.productionServer.repository }}:{{ .Values.images.productionServer.tag }}
35+
image: {{ .Values.global.images.registry | default .Values.images.productionServer.registry }}/{{ .Values.images.productionServer.repository }}:{{ .Values.images.productionServer.tag }}
3436
env:
3537
- name: AGREE_TO_MATHWORKS_SOFTWARE_LICENSE
36-
value: {{ .Values.global.agreeToLicense | default "no" | lower | quote }}
38+
value: {{ required "agreeToLicense must be set to \"yes\"." .Values.global.agreeToLicense | default "no" | lower | quote }}
3739
- name: AGREE_TO_MATLAB_RUNTIME_LICENSE
38-
value: {{ .Values.global.agreeToLicense | default "no" | lower | quote }}
40+
value: {{ required "agreeToLicense must be set to \"yes\"." .Values.global.agreeToLicense | default "no" | lower | quote }}
3941
- name: LD_LIBRARY_PATH
4042
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 }}
4150

4251
ports:
4352
- containerPort: 9910
@@ -62,8 +71,8 @@ spec:
6271
exec:
6372
command:
6473
- ls
65-
- /opt/matlabruntime/{{ .Values.images.matlabRuntime.variant }}/MCR_license.txt
66-
initialDelaySeconds: 30
74+
- /opt/matlabruntime/{{ .Values.images.matlabRuntime.variant }}/matlabruntime_license_agreement.pdf
75+
initialDelaySeconds: 10
6776
periodSeconds: 30
6877

6978
livenessProbe:
@@ -82,7 +91,7 @@ spec:
8291

8392
initContainers:
8493
- name: matlab-runtime
85-
image: {{ .Values.images.matlabRuntime.registry }}/{{ .Values.images.matlabRuntime.repository }}:{{ .Values.images.matlabRuntime.tag }}
94+
image: {{ .Values.global.images.registry | default .Values.images.matlabRuntime.registry }}/{{ .Values.images.matlabRuntime.repository }}:{{ .Values.images.matlabRuntime.tag }}
8695

8796
command:
8897
- /bin/sh
@@ -97,10 +106,13 @@ spec:
97106

98107
restartPolicy: {{ .Values.deploymentSettings.restartPolicy }}
99108
imagePullSecrets:
109+
{{- if .Values.global.images.pullSecret }}
110+
- name: {{ .Values.global.images.pullSecret }}
111+
{{- end }}
100112
{{- if .Values.images.productionServer.pullSecret }}
101113
- name: {{ .Values.images.productionServer.pullSecret }}
102114
{{- end }}
103-
{{- if .Values.images.matlabRuntime.pullSecret }}
115+
{{- if and .Values.images.matlabRuntime.pullSecret (ne .Values.images.matlabRuntime.pullSecret .Values.images.productionServer.pullSecret) }}
104116
- name: {{ .Values.images.matlabRuntime.pullSecret }}
105117
{{- end }}
106118

@@ -120,6 +132,9 @@ spec:
120132
server: {{ .Values.matlabProductionServerSettings.autoDeploy.server }}
121133
path: {{ .Values.matlabProductionServerSettings.autoDeploy.path }}
122134
readOnly: true
135+
{{- else if eq .Values.matlabProductionServerSettings.autoDeploy.volumeType "pvc" }}
136+
persistentVolumeClaim:
137+
claimName: {{ .Values.matlabProductionServerSettings.autoDeploy.claimName }}
123138
{{- else if eq .Values.matlabProductionServerSettings.autoDeploy.volumeType "azurefileshare" }}
124139
azureFile:
125140
shareName: {{ .Values.matlabProductionServerSettings.autoDeploy.shareName }}

0 commit comments

Comments
 (0)