|
| 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