Skip to content

Commit 6b31a43

Browse files
authored
feat: Add feast apply init container to automate registry population on pod start (#6106)
* feat: Add feast apply init container to automate registry population on pod start Signed-off-by: ntkathole <nikhilkathole2683@gmail.com> * fix: Replicas is not required Signed-off-by: ntkathole <nikhilkathole2683@gmail.com> * fix: Fixed race condition in _apply_object Signed-off-by: ntkathole <nikhilkathole2683@gmail.com> * fix: Improve error messaging Signed-off-by: ntkathole <nikhilkathole2683@gmail.com> --------- Signed-off-by: ntkathole <nikhilkathole2683@gmail.com>
1 parent 4ea9b32 commit 6b31a43

18 files changed

Lines changed: 302 additions & 26 deletions

.secrets.baseline

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@
934934
"filename": "infra/feast-operator/api/v1/featurestore_types.go",
935935
"hashed_secret": "44e17306b837162269a410204daaa5ecee4ec22c",
936936
"is_verified": false,
937-
"line_number": 727
937+
"line_number": 729
938938
}
939939
],
940940
"infra/feast-operator/api/v1/zz_generated.deepcopy.go": [
@@ -943,21 +943,21 @@
943943
"filename": "infra/feast-operator/api/v1/zz_generated.deepcopy.go",
944944
"hashed_secret": "f914fc9324de1bec1ad13dec94a8ea2ddb41fc87",
945945
"is_verified": false,
946-
"line_number": 681
946+
"line_number": 686
947947
},
948948
{
949949
"type": "Secret Keyword",
950950
"filename": "infra/feast-operator/api/v1/zz_generated.deepcopy.go",
951951
"hashed_secret": "44e17306b837162269a410204daaa5ecee4ec22c",
952952
"is_verified": false,
953-
"line_number": 1249
953+
"line_number": 1254
954954
},
955955
{
956956
"type": "Secret Keyword",
957957
"filename": "infra/feast-operator/api/v1/zz_generated.deepcopy.go",
958958
"hashed_secret": "c2028031c154bbe86fd69bef740855c74b927dcf",
959959
"is_verified": false,
960-
"line_number": 1254
960+
"line_number": 1259
961961
}
962962
],
963963
"infra/feast-operator/api/v1alpha1/featurestore_types.go": [
@@ -966,7 +966,7 @@
966966
"filename": "infra/feast-operator/api/v1alpha1/featurestore_types.go",
967967
"hashed_secret": "44e17306b837162269a410204daaa5ecee4ec22c",
968968
"is_verified": false,
969-
"line_number": 647
969+
"line_number": 649
970970
}
971971
],
972972
"infra/feast-operator/api/v1alpha1/zz_generated.deepcopy.go": [
@@ -975,21 +975,21 @@
975975
"filename": "infra/feast-operator/api/v1alpha1/zz_generated.deepcopy.go",
976976
"hashed_secret": "f914fc9324de1bec1ad13dec94a8ea2ddb41fc87",
977977
"is_verified": false,
978-
"line_number": 590
978+
"line_number": 595
979979
},
980980
{
981981
"type": "Secret Keyword",
982982
"filename": "infra/feast-operator/api/v1alpha1/zz_generated.deepcopy.go",
983983
"hashed_secret": "44e17306b837162269a410204daaa5ecee4ec22c",
984984
"is_verified": false,
985-
"line_number": 1098
985+
"line_number": 1103
986986
},
987987
{
988988
"type": "Secret Keyword",
989989
"filename": "infra/feast-operator/api/v1alpha1/zz_generated.deepcopy.go",
990990
"hashed_secret": "c2028031c154bbe86fd69bef740855c74b927dcf",
991991
"is_verified": false,
992-
"line_number": 1103
992+
"line_number": 1108
993993
}
994994
],
995995
"infra/feast-operator/config/samples/v1_featurestore_db_persistence.yaml": [
@@ -1539,5 +1539,5 @@
15391539
}
15401540
]
15411541
},
1542-
"generated_at": "2026-03-10T18:11:57Z"
1542+
"generated_at": "2026-03-14T16:01:28Z"
15431543
}

infra/feast-operator/api/v1/featurestore_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ type FeatureStoreSpec struct {
8686
// Mutually exclusive with services.scaling.autoscaling.
8787
// +kubebuilder:default=1
8888
// +kubebuilder:validation:Minimum=1
89-
Replicas *int32 `json:"replicas"`
89+
Replicas *int32 `json:"replicas,omitempty"`
9090
}
9191

9292
// FeastProjectDir defines how to create the feast project directory.
@@ -310,6 +310,8 @@ type FeatureStoreServices struct {
310310
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
311311
// Disable the 'feast repo initialization' initContainer
312312
DisableInitContainers bool `json:"disableInitContainers,omitempty"`
313+
// Runs feast apply on pod start to populate the registry. Defaults to true. Ignored when DisableInitContainers is true.
314+
RunFeastApplyOnInit *bool `json:"runFeastApplyOnInit,omitempty"`
313315
// Volumes specifies the volumes to mount in the FeatureStore deployment. A corresponding `VolumeMount` should be added to whichever feast service(s) require access to said volume(s).
314316
Volumes []corev1.Volume `json:"volumes,omitempty"`
315317
// Scaling configures horizontal scaling for the FeatureStore deployment (e.g. HPA autoscaling).

infra/feast-operator/api/v1/zz_generated.deepcopy.go

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

infra/feast-operator/api/v1alpha1/featurestore_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ type FeatureStoreServices struct {
289289
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
290290
// Disable the 'feast repo initialization' initContainer
291291
DisableInitContainers bool `json:"disableInitContainers,omitempty"`
292+
// Runs feast apply on pod start to populate the registry. Defaults to true. Ignored when DisableInitContainers is true.
293+
RunFeastApplyOnInit *bool `json:"runFeastApplyOnInit,omitempty"`
292294
// Volumes specifies the volumes to mount in the FeatureStore deployment. A corresponding `VolumeMount` should be added to whichever feast service(s) require access to said volume(s).
293295
Volumes []corev1.Volume `json:"volumes,omitempty"`
294296
}

infra/feast-operator/api/v1alpha1/zz_generated.deepcopy.go

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

infra/feast-operator/config/crd/bases/feast.dev_featurestores.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3129,6 +3129,10 @@ spec:
31293129
x-kubernetes-validations:
31303130
- message: One selection required.
31313131
rule: '[has(self.local), has(self.remote)].exists_one(c, c)'
3132+
runFeastApplyOnInit:
3133+
description: Runs feast apply on pod start to populate the registry.
3134+
Defaults to true. Ignored when DisableInitContainers is true.
3135+
type: boolean
31323136
scaling:
31333137
description: Scaling configures horizontal scaling for the FeatureStore
31343138
deployment (e.g. HPA autoscaling).
@@ -5695,7 +5699,6 @@ spec:
56955699
type: object
56965700
required:
56975701
- feastProject
5698-
- replicas
56995702
type: object
57005703
x-kubernetes-validations:
57015704
- message: replicas > 1 and services.scaling.autoscaling are mutually
@@ -8871,6 +8874,11 @@ spec:
88718874
- message: One selection required.
88728875
rule: '[has(self.local), has(self.remote)].exists_one(c,
88738876
c)'
8877+
runFeastApplyOnInit:
8878+
description: Runs feast apply on pod start to populate the
8879+
registry. Defaults to true. Ignored when DisableInitContainers
8880+
is true.
8881+
type: boolean
88748882
scaling:
88758883
description: Scaling configures horizontal scaling for the
88768884
FeatureStore deployment (e.g. HPA autoscaling).
@@ -11458,7 +11466,6 @@ spec:
1145811466
type: object
1145911467
required:
1146011468
- feastProject
11461-
- replicas
1146211469
type: object
1146311470
x-kubernetes-validations:
1146411471
- message: replicas > 1 and services.scaling.autoscaling are mutually
@@ -13920,6 +13927,10 @@ spec:
1392013927
x-kubernetes-validations:
1392113928
- message: One selection required.
1392213929
rule: '[has(self.local), has(self.remote)].exists_one(c, c)'
13930+
runFeastApplyOnInit:
13931+
description: Runs feast apply on pod start to populate the registry.
13932+
Defaults to true. Ignored when DisableInitContainers is true.
13933+
type: boolean
1392313934
securityContext:
1392413935
description: PodSecurityContext holds pod-level security attributes
1392513936
and common container settings.
@@ -18163,6 +18174,11 @@ spec:
1816318174
- message: One selection required.
1816418175
rule: '[has(self.local), has(self.remote)].exists_one(c,
1816518176
c)'
18177+
runFeastApplyOnInit:
18178+
description: Runs feast apply on pod start to populate the
18179+
registry. Defaults to true. Ignored when DisableInitContainers
18180+
is true.
18181+
type: boolean
1816618182
securityContext:
1816718183
description: PodSecurityContext holds pod-level security attributes
1816818184
and common container settings.

infra/feast-operator/dist/install.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3137,6 +3137,10 @@ spec:
31373137
x-kubernetes-validations:
31383138
- message: One selection required.
31393139
rule: '[has(self.local), has(self.remote)].exists_one(c, c)'
3140+
runFeastApplyOnInit:
3141+
description: Runs feast apply on pod start to populate the registry.
3142+
Defaults to true. Ignored when DisableInitContainers is true.
3143+
type: boolean
31403144
scaling:
31413145
description: Scaling configures horizontal scaling for the FeatureStore
31423146
deployment (e.g. HPA autoscaling).
@@ -5703,7 +5707,6 @@ spec:
57035707
type: object
57045708
required:
57055709
- feastProject
5706-
- replicas
57075710
type: object
57085711
x-kubernetes-validations:
57095712
- message: replicas > 1 and services.scaling.autoscaling are mutually
@@ -8879,6 +8882,11 @@ spec:
88798882
- message: One selection required.
88808883
rule: '[has(self.local), has(self.remote)].exists_one(c,
88818884
c)'
8885+
runFeastApplyOnInit:
8886+
description: Runs feast apply on pod start to populate the
8887+
registry. Defaults to true. Ignored when DisableInitContainers
8888+
is true.
8889+
type: boolean
88828890
scaling:
88838891
description: Scaling configures horizontal scaling for the
88848892
FeatureStore deployment (e.g. HPA autoscaling).
@@ -11466,7 +11474,6 @@ spec:
1146611474
type: object
1146711475
required:
1146811476
- feastProject
11469-
- replicas
1147011477
type: object
1147111478
x-kubernetes-validations:
1147211479
- message: replicas > 1 and services.scaling.autoscaling are mutually
@@ -13928,6 +13935,10 @@ spec:
1392813935
x-kubernetes-validations:
1392913936
- message: One selection required.
1393013937
rule: '[has(self.local), has(self.remote)].exists_one(c, c)'
13938+
runFeastApplyOnInit:
13939+
description: Runs feast apply on pod start to populate the registry.
13940+
Defaults to true. Ignored when DisableInitContainers is true.
13941+
type: boolean
1393113942
securityContext:
1393213943
description: PodSecurityContext holds pod-level security attributes
1393313944
and common container settings.
@@ -18171,6 +18182,11 @@ spec:
1817118182
- message: One selection required.
1817218183
rule: '[has(self.local), has(self.remote)].exists_one(c,
1817318184
c)'
18185+
runFeastApplyOnInit:
18186+
description: Runs feast apply on pod start to populate the
18187+
registry. Defaults to true. Ignored when DisableInitContainers
18188+
is true.
18189+
type: boolean
1817418190
securityContext:
1817518191
description: PodSecurityContext holds pod-level security attributes
1817618192
and common container settings.

infra/feast-operator/docs/api/markdown/ref.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ _Appears in:_
240240
| `deploymentStrategy` _[DeploymentStrategy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentstrategy-v1-apps)_ | |
241241
| `securityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#podsecuritycontext-v1-core)_ | |
242242
| `disableInitContainers` _boolean_ | Disable the 'feast repo initialization' initContainer |
243+
| `runFeastApplyOnInit` _boolean_ | Runs feast apply on pod start to populate the registry. Defaults to true. Ignored when DisableInitContainers is true. |
243244
| `volumes` _[Volume](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#volume-v1-core) array_ | Volumes specifies the volumes to mount in the FeatureStore deployment. A corresponding `VolumeMount` should be added to whichever feast service(s) require access to said volume(s). |
244245
| `scaling` _[ScalingConfig](#scalingconfig)_ | Scaling configures horizontal scaling for the FeatureStore deployment (e.g. HPA autoscaling).
245246
For static replicas, use spec.replicas instead. |

infra/feast-operator/internal/controller/featurestore_controller.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,15 @@ func (r *FeatureStoreReconciler) deployFeast(ctx context.Context, cr *feastdevv1
196196
} else {
197197
isDeployAvailable := services.IsDeploymentAvailable(deployment.Status.Conditions)
198198
if !isDeployAvailable {
199+
msg := feastdevv1.DeploymentNotAvailableMessage
200+
if podMsg := feast.GetPodContainerFailureMessage(deployment); podMsg != "" {
201+
msg = msg + ": " + podMsg
202+
}
199203
condition = metav1.Condition{
200204
Type: feastdevv1.ReadyType,
201205
Status: metav1.ConditionUnknown,
202206
Reason: feastdevv1.DeploymentNotAvailableReason,
203-
Message: feastdevv1.DeploymentNotAvailableMessage,
207+
Message: msg,
204208
}
205209

206210
result = errResult

infra/feast-operator/internal/controller/featurestore_controller_cronjob_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ var _ = Describe("FeatureStore Controller - Feast CronJob", func() {
9898
Expect(resource.Status).NotTo(BeNil())
9999
Expect(resource.Status.CronJob).To(Equal(objMeta.Name))
100100
Expect(resource.Status.Applied.CronJob.Schedule).NotTo(BeEmpty())
101+
Expect(resource.Status.Applied.Services.RunFeastApplyOnInit).NotTo(BeNil())
102+
Expect(*resource.Status.Applied.Services.RunFeastApplyOnInit).To(BeTrue())
101103

102104
Expect(resource.Status.Conditions).NotTo(BeEmpty())
103105
cond := apimeta.FindStatusCondition(resource.Status.Conditions, feastdevv1.CronJobReadyType)

0 commit comments

Comments
 (0)