-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathdeploy-packages-to-pv-with-job.yaml
63 lines (63 loc) · 1.58 KB
/
deploy-packages-to-pv-with-job.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# The PersistentVolumeClaim is used to pass on to the
# spotfire-pythonserivce Helm chart during installation.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: packages-pvc
spec:
accessModes:
- ReadWriteMany
storageClassName: nfs-client
resources:
requests:
storage: 1Gi
---
# A configmap contains your requirements.txt file containing the list of your
# packages.
apiVersion: v1
kind: ConfigMap
metadata:
name: requirements-txt
data:
requirements.txt: |
contourpy
cycler
fonttools
kiwisolver
matplotlib
packaging
pillow
pyparsing
scipy
seaborn
---
# The Job starts a Python container and runs 'pip', which reads
# 'requirements.txt' and installs the packages onto the PersistentVolume pointed
# to by the PersistentVolumeClaim 'packages-pvc'.
apiVersion: batch/v1
kind: Job
metadata:
name: populate-packages-job
spec:
ttlSecondsAfterFinished: 600
template:
spec:
containers:
- name: populate-packages
image: spotfire/spotfire-pythonservice:1.21.1
command: ['sh', '-c', 'python -m pip install -t /packages -r /requirements.txt']
imagePullPolicy: Always
volumeMounts:
- name: packages-volume
mountPath: /packages
- name: requirements-txt
mountPath: /requirements.txt
subPath: requirements.txt
volumes:
- name: packages-volume
persistentVolumeClaim:
claimName: packages-pvc
- name: requirements-txt
configMap:
name: requirements-txt
restartPolicy: Never