Skip to content

Commit d2b8ebe

Browse files
authored
feat(sync): add pvc as extraVolumes support (#82)
Signed-off-by: Xuhui zhang <xuhui@juicedata.io>
1 parent 98e400b commit d2b8ebe

File tree

7 files changed

+287
-110
lines changed

7 files changed

+287
-110
lines changed

api/v1/sync_types.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,18 @@ type HostPath struct {
3636
MountPath string `json:"mountPath"`
3737
}
3838

39+
type PVCMountPath struct {
40+
// +kubebuilder:validation:Required
41+
ClaimName string `json:"claimName"`
42+
// +kubebuilder:validation:Required
43+
MountPath string `json:"mountPath"`
44+
}
45+
3946
type ExtraVolume struct {
4047
ConfigMap *nameMountPath `json:"configMap,omitempty"`
4148
Secret *nameMountPath `json:"secret,omitempty"`
4249
HostPath *HostPath `json:"hostPath,omitempty"`
50+
PVC *PVCMountPath `json:"pvc,omitempty"`
4351
}
4452

4553
type ParsedSyncSink struct {
@@ -110,13 +118,6 @@ type SyncSinkJuiceFSCE struct {
110118
ExtraVolumes []ExtraVolume `json:"extraVolumes,omitempty"`
111119
}
112120

113-
type SyncSinkPVC struct {
114-
// +kubebuilder:validation:Required
115-
Name string `json:"name,omitempty"`
116-
// +kubebuilder:validation:Required
117-
Namespace string `json:"namespace,omitempty"`
118-
}
119-
120121
type SyncSink struct {
121122
// Sync from external source
122123
External *SyncSinkExternal `json:"external,omitempty"`
@@ -126,9 +127,6 @@ type SyncSink struct {
126127

127128
// Sync from JuiceFS community edition
128129
JuiceFSCE *SyncSinkJuiceFSCE `json:"juicefsCE,omitempty"`
129-
130-
// Sync from PVC
131-
PVC *SyncSinkPVC `json:"pvc,omitempty"`
132130
}
133131

134132
// SyncSpec defines the desired state of Sync.

api/v1/zz_generated.deepcopy.go

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/juicefs.io_cronsyncs.yaml

Lines changed: 60 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,16 @@ spec:
615615
- mountPath
616616
- path
617617
type: object
618+
pvc:
619+
properties:
620+
claimName:
621+
type: string
622+
mountPath:
623+
type: string
624+
required:
625+
- claimName
626+
- mountPath
627+
type: object
618628
secret:
619629
properties:
620630
mountPath:
@@ -807,6 +817,16 @@ spec:
807817
- mountPath
808818
- path
809819
type: object
820+
pvc:
821+
properties:
822+
claimName:
823+
type: string
824+
mountPath:
825+
type: string
826+
required:
827+
- claimName
828+
- mountPath
829+
type: object
810830
secret:
811831
properties:
812832
mountPath:
@@ -996,6 +1016,16 @@ spec:
9961016
- mountPath
9971017
- path
9981018
type: object
1019+
pvc:
1020+
properties:
1021+
claimName:
1022+
type: string
1023+
mountPath:
1024+
type: string
1025+
required:
1026+
- claimName
1027+
- mountPath
1028+
type: object
9991029
secret:
10001030
properties:
10011031
mountPath:
@@ -1097,16 +1127,6 @@ spec:
10971127
required:
10981128
- metaURL
10991129
type: object
1100-
pvc:
1101-
properties:
1102-
name:
1103-
type: string
1104-
namespace:
1105-
type: string
1106-
required:
1107-
- name
1108-
- namespace
1109-
type: object
11101130
type: object
11111131
image:
11121132
type: string
@@ -1260,6 +1280,16 @@ spec:
12601280
- mountPath
12611281
- path
12621282
type: object
1283+
pvc:
1284+
properties:
1285+
claimName:
1286+
type: string
1287+
mountPath:
1288+
type: string
1289+
required:
1290+
- claimName
1291+
- mountPath
1292+
type: object
12631293
secret:
12641294
properties:
12651295
mountPath:
@@ -1452,6 +1482,16 @@ spec:
14521482
- mountPath
14531483
- path
14541484
type: object
1485+
pvc:
1486+
properties:
1487+
claimName:
1488+
type: string
1489+
mountPath:
1490+
type: string
1491+
required:
1492+
- claimName
1493+
- mountPath
1494+
type: object
14551495
secret:
14561496
properties:
14571497
mountPath:
@@ -1641,6 +1681,16 @@ spec:
16411681
- mountPath
16421682
- path
16431683
type: object
1684+
pvc:
1685+
properties:
1686+
claimName:
1687+
type: string
1688+
mountPath:
1689+
type: string
1690+
required:
1691+
- claimName
1692+
- mountPath
1693+
type: object
16441694
secret:
16451695
properties:
16461696
mountPath:
@@ -1742,16 +1792,6 @@ spec:
17421792
required:
17431793
- metaURL
17441794
type: object
1745-
pvc:
1746-
properties:
1747-
name:
1748-
type: string
1749-
namespace:
1750-
type: string
1751-
required:
1752-
- name
1753-
- namespace
1754-
type: object
17551795
type: object
17561796
tolerations:
17571797
items:

config/crd/bases/juicefs.io_syncs.yaml

Lines changed: 60 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,16 @@ spec:
574574
- mountPath
575575
- path
576576
type: object
577+
pvc:
578+
properties:
579+
claimName:
580+
type: string
581+
mountPath:
582+
type: string
583+
required:
584+
- claimName
585+
- mountPath
586+
type: object
577587
secret:
578588
properties:
579589
mountPath:
@@ -766,6 +776,16 @@ spec:
766776
- mountPath
767777
- path
768778
type: object
779+
pvc:
780+
properties:
781+
claimName:
782+
type: string
783+
mountPath:
784+
type: string
785+
required:
786+
- claimName
787+
- mountPath
788+
type: object
769789
secret:
770790
properties:
771791
mountPath:
@@ -955,6 +975,16 @@ spec:
955975
- mountPath
956976
- path
957977
type: object
978+
pvc:
979+
properties:
980+
claimName:
981+
type: string
982+
mountPath:
983+
type: string
984+
required:
985+
- claimName
986+
- mountPath
987+
type: object
958988
secret:
959989
properties:
960990
mountPath:
@@ -1056,16 +1086,6 @@ spec:
10561086
required:
10571087
- metaURL
10581088
type: object
1059-
pvc:
1060-
properties:
1061-
name:
1062-
type: string
1063-
namespace:
1064-
type: string
1065-
required:
1066-
- name
1067-
- namespace
1068-
type: object
10691089
type: object
10701090
image:
10711091
type: string
@@ -1219,6 +1239,16 @@ spec:
12191239
- mountPath
12201240
- path
12211241
type: object
1242+
pvc:
1243+
properties:
1244+
claimName:
1245+
type: string
1246+
mountPath:
1247+
type: string
1248+
required:
1249+
- claimName
1250+
- mountPath
1251+
type: object
12221252
secret:
12231253
properties:
12241254
mountPath:
@@ -1411,6 +1441,16 @@ spec:
14111441
- mountPath
14121442
- path
14131443
type: object
1444+
pvc:
1445+
properties:
1446+
claimName:
1447+
type: string
1448+
mountPath:
1449+
type: string
1450+
required:
1451+
- claimName
1452+
- mountPath
1453+
type: object
14141454
secret:
14151455
properties:
14161456
mountPath:
@@ -1600,6 +1640,16 @@ spec:
16001640
- mountPath
16011641
- path
16021642
type: object
1643+
pvc:
1644+
properties:
1645+
claimName:
1646+
type: string
1647+
mountPath:
1648+
type: string
1649+
required:
1650+
- claimName
1651+
- mountPath
1652+
type: object
16031653
secret:
16041654
properties:
16051655
mountPath:
@@ -1701,16 +1751,6 @@ spec:
17011751
required:
17021752
- metaURL
17031753
type: object
1704-
pvc:
1705-
properties:
1706-
name:
1707-
type: string
1708-
namespace:
1709-
type: string
1710-
required:
1711-
- name
1712-
- namespace
1713-
type: object
17141754
type: object
17151755
tolerations:
17161756
items:

config/samples/v1_sync.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ spec:
6666
# path: /data/jfs/
6767
# type: Directory
6868
# mountPath: /data/jfs/
69+
# - pvc:
70+
# claimName: data-jfs-pvc
71+
# mountPath: /data/jfs/
6972
to:
7073
juicefs:
7174
path: /sync-test/demo2/

0 commit comments

Comments
 (0)