Skip to content

Commit e5f9986

Browse files
committed
Version 1.3.0
1 parent d548cef commit e5f9986

File tree

61 files changed

+5126
-225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+5126
-225
lines changed

.github/workflows/helm-chart.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@ jobs:
2828
with:
2929
push: true
3030
tags: ghcr.io/mathworks-ref-arch/matlab-parallel-server-k8s/mjs-controller-image:${{ github.event.release.tag_name }}
31-
context: ./images/controller
31+
context: ./controller
3232

3333
release-helm-chart:
3434
runs-on: ubuntu-latest
3535
permissions:
3636
contents: read
3737
packages: write
38-
env:
39-
CHART_DIR: chart/mjs
4038

4139
steps:
4240
- name: Check out the repo
@@ -46,13 +44,13 @@ jobs:
4644
uses: azure/setup-helm@v4
4745

4846
- name: Lint chart
49-
run: helm lint ${CHART_DIR} --set maxWorkers=4,matlabPVC=test,checkpointPVC=test,logPVC=test,workerLogPVC=test
47+
run: helm lint mjs --set maxWorkers=4,matlabPVC=test,checkpointPVC=test,logPVC=test,workerLogPVC=test
5048

5149
- name: Check chart versions
52-
run: grep "version. ${{ github.event.release.tag_name }}" ${CHART_DIR}/Chart.yaml && grep "appVersion. ${{ github.event.release.tag_name }}" ${CHART_DIR}/Chart.yaml # Use "." (any character) rather than ":", since ":" breaks YAML parser
50+
run: grep "version. ${{ github.event.release.tag_name }}" mjs/Chart.yaml && grep "appVersion. ${{ github.event.release.tag_name }}" mjs/Chart.yaml # Use "." (any character) rather than ":", since ":" breaks YAML parser
5351

5452
- name: Package chart
55-
run: helm package ${CHART_DIR} --version ${{ github.event.release.tag_name }} --app-version ${{ github.event.release.tag_name }}
53+
run: helm package mjs --version ${{ github.event.release.tag_name }} --app-version ${{ github.event.release.tag_name }}
5654

5755
- name: Login to GitHub Container Registry
5856
run: echo ${{ secrets.HELM_TOKEN }} | helm registry login ghcr.io/mathworks-ref-arch --username hannahpullen --password-stdin

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,56 @@ kubectl create secret generic mjs-ldap-secret --namespace mjs --from-file=cert.p
449449

450450
If you use a persistent volume for the job manager pod (`matlabPVC` is set to a non-empty string and `jobManagerUsesPVC` is set to `true` in your `values.yaml` file), you must add your certificate to the Java trust store of the MATLAB Parallel Server installation in your persistent volume. For detailed instructions, see [Add Certificate to Java Trust Store](https://mathworks.com/help/matlab-parallel-server/configure-ldap-server-authentication-for-matlab-job-scheduler.html#mw_fe8d0f90-2854-42b9-9e04-a2f25a295e61) on the MathWorks website.
451451

452+
### Configure Cluster Monitoring Metrics
453+
454+
You can configure MATLAB Job Scheduler to export cluster monitoring metrics.
455+
This feature is supported for MATLAB Job Scheduler release R2024b or later.
456+
To export cluster monitoring metrics for MATLAB Job Scheduler releases older than R2024b, set the `jobManagerImageTag` parameter in your Helm values file to `r2024b` to use a newer release for the job manager.
457+
458+
To enable cluster monitoring metrics, set the following values in your `values.yaml` file:
459+
```yaml
460+
exportMetrics: true
461+
metricsPort: 8001
462+
useSecureMetrics: true
463+
openMetricsPortOutsideKubernetes: false
464+
```
465+
Modify the following values:
466+
- `metricsPort` — Specify the port for exporting metrics on the HTTP(S) server.
467+
- `useSecureMetrics` — Set this to true to export metrics over an encrypted HTTPS connection. Set to false to disable encryption and export metrics on an HTTP server.
468+
- `openMetricsPortOutsideKubernetes` — Set this to true to expose the metrics endpoint outside of the Kubernetes cluster. Set to false if you only want to scrape metrics from another pod inside the Kubernetes cluster.
469+
470+
If you set `useSecureMetrics` to true, by default the Helm chart generates SSL certificates for you.
471+
472+
Optionally, you can provide your own SSL certificates that the job manager uses to encrypt metrics.
473+
The server SSL certificate must include a Subject Alternative Name (SAN) that corresponds to a DNS name or domain directed at the job manager.
474+
- If you set `openMetricsPortOutsideKubernetes` to true, use the domain associated with the load balancer addresses generated within your Kubernetes cluster, or configure a static DNS name that routes to your load balancer after installing the MJS Helm Chart.
475+
- If you set `openMetricsPortOutsideKubernetes` to false, the DNS name of the job manager is `mjs-job-manager.mjs.svc.cluster.local`.
476+
477+
To use your own SSL certificates, create a Kubernetes secret.
478+
Using the `kubectl` command, specify the paths to the CA certificate used to sign your client certificate, the certificate to use for the server, and the private key to use for the server. For example, use the CA certificate `ca_cert`, server certificate `server_cert`, and server private key `server_key`:
479+
```
480+
kubectl create secret generic mjs-metrics-secret --from-file=ca.crt=ca_cert --from-file=jobmanager.crt=server_cert --from-file=jobmanager.key=server_key --namespace mjs
481+
```
482+
483+
Install the MATLAB Job Scheduler Helm chart.
484+
485+
#### Integrate with Grafana and Prometheus
486+
487+
To integrate your cluster with Grafana® and Prometheus®, follow the instructions in the [Cluster Monitoring Integration for MATLAB Job Scheduler](https://github.com/mathworks/cluster-monitoring-integration-for-matlab-job-scheduler) GitHub repository.
488+
489+
Configure Prometheus to target the metrics endpoint `job-manager-host:metricsPort`, where `metricsPort` is the value you set in your `values.yaml` file.
490+
- If you set `openMetricsPortOutsideKubernetes` to true, `job-manager-host` is the external IP address or DNS name of your load balancer service. Find this by running `kubectl get services -n mjs mjs-ingress-proxy`.
491+
- If you set `openMetricsPortOutsideKubernetes` to false, Prometheus must run inside the same Kubernetes cluster as MATLAB Job Scheduler. Set `job-manager-host` to `mjs-job-manager.mjs.svc.cluster.local`.
492+
493+
If you set `useSecureMetrics` to true, configure Prometheus with certificates to authenticate with the metrics server.
494+
- If you provided your own SSL certificates, use client certificates corresponding to the certificates you used to set up the metrics server.
495+
- If the Helm chart generated SSL certificates for you, download and use the generated client certificates from the Kubernetes secret `mjs-metrics-client-certs`:
496+
```
497+
kubectl get secrets mjs-metrics-client-certs --template="{{.data.ca.crt | base64decode}}" --namespace mjs > ca.crt
498+
kubectl get secrets mjs-metrics-client-certs --template="{{.data.prometheus.crt | base64decode}}" --namespace mjs > prometheus.crt
499+
kubectl get secrets mjs-metrics-client-certs --template="{{.data.prometheus.key | base64decode}}" --namespace mjs > prometheus.key
500+
```
501+
452502
### Customize Load Balancer
453503

454504
MATLAB Job Scheduler in Kubernetes uses a Kubernetes load balancer service to expose MATLAB Job Scheduler to MATLAB clients running outside of the Kubernetes cluster.

chart/mjs/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ apiVersion: v2
33
name: mjs
44
description: A Helm chart for MATLAB (R) Job Scheduler in Kubernetes
55
type: application
6-
version: 1.2.0
7-
appVersion: 1.2.0
6+
version: 1.3.0
7+
appVersion: 1.3.0

chart/mjs/templates/_paths.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,8 @@ haproxy.cfg
8181
{{- define "paths.ldapCert" -}}
8282
/mjs/ldap/cert.pem
8383
{{- end -}}
84+
85+
# Path to directory containing mounted metrics certificates
86+
{{- define "paths.metricsCertDir" -}}
87+
/mjs/metrics/
88+
{{- end -}}

chart/mjs/templates/controller-configmap.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ data:
3333
"ControllerLogfile": {{ include "paths.controllerLog" . | quote }},
3434
"DeploymentName": {{ include "resources.controller" . | quote}},
3535
"EnableServiceLinks": {{ include "derived.enableServiceLinks" . }},
36+
"OpenMetricsPortOutsideKubernetes": {{ .Values.openMetricsPortOutsideKubernetes }},
3637
"ExtraWorkerEnvironment": {
3738
{{- $comma := "" }}
3839
{{- range $key, $value := .Values.extraWorkerEnv }}
@@ -64,6 +65,7 @@ data:
6465
"LogPVC": {{ .Values.logPVC | quote }},
6566
"MatlabPVC": {{ .Values.matlabPVC | default "" | quote }},
6667
"MatlabRoot": {{ include "paths.matlabroot" . | quote }},
68+
"MetricsCertDir": {{ include "paths.metricsCertDir" . | quote }},
6769
"MaxWorkers": {{ .Values.maxWorkers }},
6870
"MinWorkers": {{ .Values.minWorkers }},
6971
"MJSDefConfigMap": {{ include "resources.mjsConfigMap" . | quote }},
@@ -99,6 +101,6 @@ data:
99101
"WorkerPassword": {{ .Values.workerPassword | quote }},
100102
"WorkersPerPoolProxy": {{ .Values.workersPerPoolProxy }},
101103
"WorkerUsername": {{ .Values.workerUsername | quote }},
102-
"UsePoolProxy": {{ .Values.usePoolProxy | default true }},
103-
"UseSecureCommunication": {{ .Values.useSecureCommunication }}
104+
"UseSecureCommunication": {{ .Values.useSecureCommunication }},
105+
"UseSecureMetrics": {{ and .Values.exportMetrics .Values.useSecureMetrics }}
104106
}

chart/mjs/templates/ingress-proxy-configmap.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ data:
2727
default_backend back-mjs-job-manager
2828
backend back-mjs-job-manager
2929
server mjs-job-manager mjs-job-manager
30+
{{- if and .Values.exportMetrics .Values.openMetricsPortOutsideKubernetes }}
31+
frontend front-jobmanager-metrics
32+
bind {{ printf "*:%d" (.Values.metricsPort | int) }}
33+
default_backend back-mjs-job-manager
34+
{{- end }}
3035
3136
# Rules for proxying traffic to the parallel pool proxies.
3237
# Each parallel pool proxy has a unique port, which should be mapped to the
@@ -40,4 +45,4 @@ data:
4045
backend back-{{ $poolProxyName }}
4146
server {{ $poolProxyName }} {{ $poolProxyName }}
4247
{{ end -}}
43-
{{ end -}}
48+
{{ end -}}

chart/mjs/templates/ingress-proxy-service.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,12 @@ spec:
3434
port: {{ $poolProxyPort }}
3535
targetPort: {{ $poolProxyPort }}
3636
{{ end -}}
37-
{{ end -}}
37+
{{- if and .Values.exportMetrics .Values.openMetricsPortOutsideKubernetes }}
38+
# Job manager metrics port
39+
- name: {{ printf "metrics-%.0f" .Values.metricsPort }}
40+
protocol: TCP
41+
appProtocol: TCP
42+
port: {{ .Values.metricsPort }}
43+
targetPort: {{ .Values.metricsPort }}
44+
{{- end }}
45+
{{ end -}}

chart/mjs/templates/job-manager-service.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,11 @@ spec:
2222
appProtocol: TCP
2323
port: {{ . }}
2424
targetPort: {{ . }}
25+
{{- end }}
26+
{{- if .Values.exportMetrics }}
27+
- name: {{ printf "metrics-%.0f" .Values.metricsPort }}
28+
protocol: TCP
29+
appProtocol: TCP
30+
port: {{ .Values.metricsPort }}
31+
targetPort: {{ .Values.metricsPort }}
2532
{{- end }}

chart/mjs/templates/mjs-configmap.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ data:
2929
LDAP_SECURITY_PRINCIPAL_FORMAT={{ .Values.ldapSecurityPrincipalFormat | quote }}
3030
LDAP_SYNCHRONIZATION_INTERVAL_SECS={{ .Values.ldapSynchronizationIntervalSecs | quote }}
3131
{{- end }}
32+
EXPORT_METRICS={{ .Values.exportMetrics }}
33+
METRICS_PORT={{ .Values.metricsPort }}
34+
USE_SECURE_METRICS={{ .Values.useSecureMetrics }}
35+
{{- if .Values.useSecureMetrics }}
36+
METRICS_CA_FILE={{ include "paths.metricsCertDir" . }}/ca.crt
37+
METRICS_CERT_FILE={{ include "paths.metricsCertDir" . }}/jobmanager.crt
38+
METRICS_KEY_FILE={{ include "paths.metricsCertDir" . }}/jobmanager.key
39+
{{- end }}
3240
3341
jobManager.sh: |
3442
# Script to run on the MATLAB Job Scheduler job manager pod

chart/mjs/templates/requirements.yaml

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)