Skip to content

Commit

Permalink
Create template-matlab-cpu.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
seunAdeks authored Jan 14, 2025
1 parent 0a66cc0 commit a6b54c9
Showing 1 changed file with 196 additions and 0 deletions.
196 changes: 196 additions & 0 deletions applications/templates/template-matlab-cpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
---
apiVersion: template.openshift.io/v1
kind: Template
labels:
template: matlab-cpu
metadata:
annotations:
description: |-
Start Matlab with desktop UI.
Running on CPU, with admin privileges to install anything you need.
Matlab will be automatically enabled using the UM matlab license server.
You can choose between 2 types of deployment:
- Browser: access directly matlab in the browser, only available from r2024a and upn
- VNC: access matlab in a Linux desktop in the browser, highly unstable, Matlab devs
acknowledge themselves it is tricky to use
📂 Use the `/home/matlab/persistent` folder to store your data in the persistent storage automatically created.
You can find the persistent storage in the DSRI web UI, go to Administrator view
> Storage > Persistent Volume Claims
🐳 Visit https://hub.docker.com/r/mathworks/matlab for more details about the image'
iconClass: icon-beaker
openshift.io/display-name: Matlab
openshift.io/documentation-url: https://maastrichtu-ids.github.io/dsri-documentation/docs/deploy-matlab
openshift.io/provider-display-name: Institute of Data Science, UM
openshift.io/support-url: https://maastrichtu-ids.github.io/dsri-documentation/help
tags: matlab,cpu,root,persistent
name: matlab-cpu
namespace: openshift
objects:
- apiVersion: v1
kind: Secret
metadata:
annotations:
template.openshift.io/expose-password: "{.data['application-password']}"
labels:
app: "${APPLICATION_NAME}"
name: "${APPLICATION_NAME}"
stringData:
application-password: "${PASSWORD}"
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: "${APPLICATION_NAME}"
name: "${APPLICATION_NAME}"
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: "${STORAGE_SIZE}"
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
labels:
app: "${APPLICATION_NAME}"
template: matlab-cpu
name: "${APPLICATION_NAME}"
spec:
lookupPolicy:
local: true
tags:
- from:
kind: DockerImage
name: "${APPLICATION_IMAGE}"
importPolicy:
scheduled: false
name: latest
- apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
labels:
app: "${APPLICATION_NAME}"
name: "${APPLICATION_NAME}"
spec:
replicas: 1
selector:
app: "${APPLICATION_NAME}"
deploymentconfig: "${APPLICATION_NAME}"
strategy:
type: Recreate
template:
metadata:
labels:
app: "${APPLICATION_NAME}"
deploymentconfig: "${APPLICATION_NAME}"
spec:
automountServiceAccountToken: false
containers:
- args:
- "${DEPLOYMENT_TYPE}"
env:
- name: PASSWORD
valueFrom:
secretKeyRef:
key: application-password
name: "${APPLICATION_NAME}"
- name: MLM_LICENSE_FILE
value: [email protected]
image: "${APPLICATION_NAME}:latest"
name: matlab-container
ports:
- containerPort: 8888
protocol: TCP
volumeMounts:
- mountPath: "${PERSISTENT_FOLDER}"
name: data
- mountPath: "/dev/shm"
name: dshm
securityContext:
runAsUser: 0
serviceAccountName: anyuid
volumes:
- name: data
persistentVolumeClaim:
claimName: "${APPLICATION_NAME}"
- emptyDir:
medium: Memory
name: dshm
triggers:
- type: ConfigChange
- imageChangeParams:
automatic: true
containerNames:
- matlab-container
from:
kind: ImageStreamTag
name: "${APPLICATION_NAME}:latest"
type: ImageChange
- apiVersion: v1
kind: Service
metadata:
labels:
app: "${APPLICATION_NAME}"
name: "${APPLICATION_NAME}"
spec:
ports:
- name: 8888-tcp
port: 8888
protocol: TCP
targetPort: 8888
selector:
app: "${APPLICATION_NAME}"
deploymentconfig: "${APPLICATION_NAME}"
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
labels:
app: "${APPLICATION_NAME}"
name: "${APPLICATION_NAME}"
spec:
host: ''
port:
targetPort: 8888-tcp
tls:
insecureEdgeTerminationPolicy: Redirect
termination: edge
to:
kind: Service
name: "${APPLICATION_NAME}"
weight: 100
parameters:
- description: Must be unique in the project. It will be used to generate the application
URL.
displayName: Application name
name: APPLICATION_NAME
required: true
value: matlab
- description: The password to access the Matlab web UI
displayName: Matlab UI password
name: PASSWORD
required: true
- description: See https://hub.docker.com/r/mathworks/matlab for more details
displayName: Application Docker image
name: APPLICATION_IMAGE
required: true
value: mathworks/matlab:r2024b
- description: Size of the storage used for Matlab (approximate).
displayName: Storage size
name: STORAGE_SIZE
required: true
value: 10Gi
- description: Path to the persistent folder in the container
displayName: Persistent folder
name: PERSISTENT_FOLDER
required: true
value: "/home/matlab/persistent"
- description: "-browser or -vnc (virtual desktop)"
displayName: Type of deployment
name: DEPLOYMENT_TYPE
required: true
value: "-browser"

0 comments on commit a6b54c9

Please sign in to comment.