@@ -37,15 +37,18 @@ func hasPvcConfig(featureStore *feastdevv1alpha1.FeatureStore, feastType FeastSe
37
37
if services != nil {
38
38
switch feastType {
39
39
case OnlineFeastType :
40
- if services .OnlineStore != nil && services .OnlineStore .Persistence .FilePersistence != nil {
40
+ if services .OnlineStore != nil && services .OnlineStore .Persistence != nil &&
41
+ services .OnlineStore .Persistence .FilePersistence != nil {
41
42
pvcConfig = services .OnlineStore .Persistence .FilePersistence .PvcConfig
42
43
}
43
44
case OfflineFeastType :
44
- if services .OfflineStore != nil && services .OfflineStore .Persistence .FilePersistence != nil {
45
+ if services .OfflineStore != nil && services .OfflineStore .Persistence != nil &&
46
+ services .OfflineStore .Persistence .FilePersistence != nil {
45
47
pvcConfig = services .OfflineStore .Persistence .FilePersistence .PvcConfig
46
48
}
47
49
case RegistryFeastType :
48
- if IsLocalRegistry (featureStore ) && services .Registry .Local .Persistence .FilePersistence != nil {
50
+ if IsLocalRegistry (featureStore ) && services .Registry .Local .Persistence != nil &&
51
+ services .Registry .Local .Persistence .FilePersistence != nil {
49
52
pvcConfig = services .Registry .Local .Persistence .FilePersistence .PvcConfig
50
53
}
51
54
}
@@ -66,18 +69,18 @@ func shouldMountEmptyDir(featureStore *feastdevv1alpha1.FeatureStore) bool {
66
69
}
67
70
68
71
func getOfflineMountPath (featureStore * feastdevv1alpha1.FeatureStore ) string {
69
- if featureStore .Status .Applied .Services != nil {
70
- if pvcConfig , ok := hasPvcConfig (featureStore , OfflineFeastType ); ok {
71
- return pvcConfig .MountPath
72
- }
72
+ if pvcConfig , ok := hasPvcConfig (featureStore , OfflineFeastType ); ok {
73
+ return pvcConfig .MountPath
73
74
}
74
75
return EphemeralPath
75
76
}
76
77
77
78
func ApplyDefaultsToStatus (cr * feastdevv1alpha1.FeatureStore ) {
79
+ // overwrite status.applied with every reconcile
80
+ cr .Spec .DeepCopyInto (& cr .Status .Applied )
78
81
cr .Status .FeastVersion = feastversion .FeastVersion
79
- applied := cr .Spec .DeepCopy ()
80
82
83
+ applied := & cr .Status .Applied
81
84
if applied .Services == nil {
82
85
applied .Services = & feastdevv1alpha1.FeatureStoreServices {}
83
86
}
@@ -106,10 +109,7 @@ func ApplyDefaultsToStatus(cr *feastdevv1alpha1.FeatureStore) {
106
109
services .Registry .Local .Persistence .FilePersistence .Path = defaultRegistryPath (cr )
107
110
}
108
111
109
- if services .Registry .Local .Persistence .FilePersistence .PvcConfig != nil {
110
- pvc := services .Registry .Local .Persistence .FilePersistence .PvcConfig
111
- ensurePVCDefaults (pvc , RegistryFeastType )
112
- }
112
+ ensurePVCDefaults (services .Registry .Local .Persistence .FilePersistence .PvcConfig , RegistryFeastType )
113
113
}
114
114
115
115
setServiceDefaultConfigs (& services .Registry .Local .ServiceConfigs .DefaultConfigs )
@@ -131,10 +131,7 @@ func ApplyDefaultsToStatus(cr *feastdevv1alpha1.FeatureStore) {
131
131
services .OfflineStore .Persistence .FilePersistence .Type = string (OfflineFilePersistenceDaskConfigType )
132
132
}
133
133
134
- if services .OfflineStore .Persistence .FilePersistence .PvcConfig != nil {
135
- pvc := services .OfflineStore .Persistence .FilePersistence .PvcConfig
136
- ensurePVCDefaults (pvc , OfflineFeastType )
137
- }
134
+ ensurePVCDefaults (services .OfflineStore .Persistence .FilePersistence .PvcConfig , OfflineFeastType )
138
135
}
139
136
140
137
setServiceDefaultConfigs (& services .OfflineStore .ServiceConfigs .DefaultConfigs )
@@ -154,16 +151,11 @@ func ApplyDefaultsToStatus(cr *feastdevv1alpha1.FeatureStore) {
154
151
services .OnlineStore .Persistence .FilePersistence .Path = defaultOnlineStorePath (cr )
155
152
}
156
153
157
- if services .OnlineStore .Persistence .FilePersistence .PvcConfig != nil {
158
- pvc := services .OnlineStore .Persistence .FilePersistence .PvcConfig
159
- ensurePVCDefaults (pvc , OnlineFeastType )
160
- }
154
+ ensurePVCDefaults (services .OnlineStore .Persistence .FilePersistence .PvcConfig , OnlineFeastType )
161
155
}
162
156
163
157
setServiceDefaultConfigs (& services .OnlineStore .ServiceConfigs .DefaultConfigs )
164
158
}
165
- // overwrite status.applied with every reconcile
166
- applied .DeepCopyInto (& cr .Status .Applied )
167
159
}
168
160
169
161
func setServiceDefaultConfigs (defaultConfigs * feastdevv1alpha1.DefaultConfigs ) {
@@ -189,19 +181,21 @@ func ensureRequestedStorage(resources *v1.VolumeResourceRequirements, requestedS
189
181
}
190
182
191
183
func ensurePVCDefaults (pvc * feastdevv1alpha1.PvcConfig , feastType FeastServiceType ) {
192
- var storageRequest string
193
- switch feastType {
194
- case OnlineFeastType :
195
- storageRequest = DefaultOnlineStorageRequest
196
- case OfflineFeastType :
197
- storageRequest = DefaultOfflineStorageRequest
198
- case RegistryFeastType :
199
- storageRequest = DefaultRegistryStorageRequest
200
- }
201
- if pvc .Create != nil {
202
- ensureRequestedStorage (& pvc .Create .Resources , storageRequest )
203
- if pvc .Create .AccessModes == nil {
204
- pvc .Create .AccessModes = DefaultPVCAccessModes
184
+ if pvc != nil {
185
+ var storageRequest string
186
+ switch feastType {
187
+ case OnlineFeastType :
188
+ storageRequest = DefaultOnlineStorageRequest
189
+ case OfflineFeastType :
190
+ storageRequest = DefaultOfflineStorageRequest
191
+ case RegistryFeastType :
192
+ storageRequest = DefaultRegistryStorageRequest
193
+ }
194
+ if pvc .Create != nil {
195
+ ensureRequestedStorage (& pvc .Create .Resources , storageRequest )
196
+ if pvc .Create .AccessModes == nil {
197
+ pvc .Create .AccessModes = DefaultPVCAccessModes
198
+ }
205
199
}
206
200
}
207
201
}
0 commit comments