Skip to content

Commit 99afd6d

Browse files
feat: Allow to set registry server rest/grpc mode in operator (#5364)
* feat: Allow to set registry server rest/grpc mode in operator Signed-off-by: ntkathole <[email protected]> * Apply suggestions from code review Use isRegistryServer Co-authored-by: Tommy Hughes IV <[email protected]> Signed-off-by: ntkathole <[email protected]> * chore: rename RestAPIEnabled to RestAPI Signed-off-by: ntkathole <[email protected]> * test: Added test to verify registry with REST API enabled Signed-off-by: ntkathole <[email protected]> * test: Extend test to assert rest-api container args Signed-off-by: ntkathole <[email protected]> * feat: Added both grpc and rest flags Signed-off-by: ntkathole <[email protected]> * feat: Support seperate ports and service for rest-api Signed-off-by: ntkathole <[email protected]> * feat: Added check for remote registry of referenced FeatureStore Signed-off-by: ntkathole <[email protected]> * Apply suggestions from code review Co-authored-by: Tommy Hughes IV <[email protected]> Signed-off-by: ntkathole <[email protected]> * fix: Created GetFeastRestServiceName method Signed-off-by: ntkathole <[email protected]> * fix: Refactor createRestService to reuse setService Signed-off-by: ntkathole <[email protected]> * fix: Handle service and port on grpc disable Signed-off-by: ntkathole <[email protected]> * feat: Added isRegistryRestEnabled and isRegistryGrpcEnabled methods Signed-off-by: ntkathole <[email protected]> * fix: Fixed rest server port Signed-off-by: ntkathole <[email protected]> * fix: Changes as per comments Signed-off-by: ntkathole <[email protected]> * fix: Handle tls mount for rest server Signed-off-by: ntkathole <[email protected]> * test: Added tests for field validations Signed-off-by: ntkathole <[email protected]> * test: Added tests for svc probe, container port and registry validations Signed-off-by: ntkathole <[email protected]> --------- Signed-off-by: ntkathole <[email protected]> Co-authored-by: Tommy Hughes IV <[email protected]>
1 parent b512a74 commit 99afd6d

18 files changed

Lines changed: 997 additions & 49 deletions

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,8 @@ var ValidOnlineStoreDBStorePersistenceTypes = []string{
392392
// LocalRegistryConfig configures the registry service
393393
type LocalRegistryConfig struct {
394394
// Creates a registry server container
395-
Server *ServerConfigs `json:"server,omitempty"`
396-
Persistence *RegistryPersistence `json:"persistence,omitempty"`
395+
Server *RegistryServerConfigs `json:"server,omitempty"`
396+
Persistence *RegistryPersistence `json:"persistence,omitempty"`
397397
}
398398

399399
// RegistryPersistence configures the persistence settings for the registry service
@@ -502,6 +502,18 @@ type ServerConfigs struct {
502502
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
503503
}
504504

505+
// RegistryServerConfigs creates a registry server for the feast service, with specified container configurations.
506+
// +kubebuilder:validation:XValidation:rule="self.restAPI == true || self.grpc == true || !has(self.grpc)", message="At least one of restAPI or grpc must be true"
507+
type RegistryServerConfigs struct {
508+
ServerConfigs `json:",inline"`
509+
510+
// Enable REST API registry server.
511+
RestAPI *bool `json:"restAPI,omitempty"`
512+
513+
// Enable gRPC registry server. Defaults to true if unset.
514+
GRPC *bool `json:"grpc,omitempty"`
515+
}
516+
505517
// CronJobContainerConfigs k8s container settings for the CronJob
506518
type CronJobContainerConfigs struct {
507519
ContainerConfigs `json:",inline"`
@@ -613,6 +625,7 @@ type ServiceHostnames struct {
613625
OfflineStore string `json:"offlineStore,omitempty"`
614626
OnlineStore string `json:"onlineStore,omitempty"`
615627
Registry string `json:"registry,omitempty"`
628+
RegistryRest string `json:"registryRest,omitempty"`
616629
UI string `json:"ui,omitempty"`
617630
}
618631

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

Lines changed: 27 additions & 1 deletion
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: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,6 +1924,10 @@ spec:
19241924
x-kubernetes-map-type: atomic
19251925
type: object
19261926
type: array
1927+
grpc:
1928+
description: Enable gRPC registry server. Defaults
1929+
to true if unset.
1930+
type: boolean
19271931
image:
19281932
type: string
19291933
imagePullPolicy:
@@ -1987,6 +1991,9 @@ spec:
19871991
of compute resources required.
19881992
type: object
19891993
type: object
1994+
restAPI:
1995+
description: Enable REST API registry server.
1996+
type: boolean
19901997
tls:
19911998
description: TlsConfigs configures server TLS for
19921999
a feast service.
@@ -2071,6 +2078,9 @@ spec:
20712078
type: object
20722079
type: array
20732080
type: object
2081+
x-kubernetes-validations:
2082+
- message: At least one of restAPI or grpc must be true
2083+
rule: self.restAPI == true || self.grpc == true || !has(self.grpc)
20742084
type: object
20752085
remote:
20762086
description: RemoteRegistryConfig points to a remote feast
@@ -5902,6 +5912,10 @@ spec:
59025912
x-kubernetes-map-type: atomic
59035913
type: object
59045914
type: array
5915+
grpc:
5916+
description: Enable gRPC registry server. Defaults
5917+
to true if unset.
5918+
type: boolean
59055919
image:
59065920
type: string
59075921
imagePullPolicy:
@@ -5965,6 +5979,9 @@ spec:
59655979
amount of compute resources required.
59665980
type: object
59675981
type: object
5982+
restAPI:
5983+
description: Enable REST API registry server.
5984+
type: boolean
59685985
tls:
59695986
description: TlsConfigs configures server TLS
59705987
for a feast service.
@@ -6053,6 +6070,11 @@ spec:
60536070
type: object
60546071
type: array
60556072
type: object
6073+
x-kubernetes-validations:
6074+
- message: At least one of restAPI or grpc must be
6075+
true
6076+
rule: self.restAPI == true || self.grpc == true
6077+
|| !has(self.grpc)
60566078
type: object
60576079
remote:
60586080
description: RemoteRegistryConfig points to a remote feast
@@ -8051,6 +8073,8 @@ spec:
80518073
type: string
80528074
registry:
80538075
type: string
8076+
registryRest:
8077+
type: string
80548078
ui:
80558079
type: string
80568080
type: object

‎infra/feast-operator/dist/install.yaml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,6 +1932,10 @@ spec:
19321932
x-kubernetes-map-type: atomic
19331933
type: object
19341934
type: array
1935+
grpc:
1936+
description: Enable gRPC registry server. Defaults
1937+
to true if unset.
1938+
type: boolean
19351939
image:
19361940
type: string
19371941
imagePullPolicy:
@@ -1995,6 +1999,9 @@ spec:
19951999
of compute resources required.
19962000
type: object
19972001
type: object
2002+
restAPI:
2003+
description: Enable REST API registry server.
2004+
type: boolean
19982005
tls:
19992006
description: TlsConfigs configures server TLS for
20002007
a feast service.
@@ -2079,6 +2086,9 @@ spec:
20792086
type: object
20802087
type: array
20812088
type: object
2089+
x-kubernetes-validations:
2090+
- message: At least one of restAPI or grpc must be true
2091+
rule: self.restAPI == true || self.grpc == true || !has(self.grpc)
20822092
type: object
20832093
remote:
20842094
description: RemoteRegistryConfig points to a remote feast
@@ -5910,6 +5920,10 @@ spec:
59105920
x-kubernetes-map-type: atomic
59115921
type: object
59125922
type: array
5923+
grpc:
5924+
description: Enable gRPC registry server. Defaults
5925+
to true if unset.
5926+
type: boolean
59135927
image:
59145928
type: string
59155929
imagePullPolicy:
@@ -5973,6 +5987,9 @@ spec:
59735987
amount of compute resources required.
59745988
type: object
59755989
type: object
5990+
restAPI:
5991+
description: Enable REST API registry server.
5992+
type: boolean
59765993
tls:
59775994
description: TlsConfigs configures server TLS
59785995
for a feast service.
@@ -6061,6 +6078,11 @@ spec:
60616078
type: object
60626079
type: array
60636080
type: object
6081+
x-kubernetes-validations:
6082+
- message: At least one of restAPI or grpc must be
6083+
true
6084+
rule: self.restAPI == true || self.grpc == true
6085+
|| !has(self.grpc)
60646086
type: object
60656087
remote:
60666088
description: RemoteRegistryConfig points to a remote feast
@@ -8059,6 +8081,8 @@ spec:
80598081
type: string
80608082
registry:
80618083
type: string
8084+
registryRest:
8085+
type: string
80628086
ui:
80638087
type: string
80648088
type: object

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

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ ContainerConfigs k8s container settings for the server
3636

3737
_Appears in:_
3838
- [CronJobContainerConfigs](#cronjobcontainerconfigs)
39+
- [RegistryServerConfigs](#registryserverconfigs)
3940
- [ServerConfigs](#serverconfigs)
4041

4142
| Field | Description |
@@ -76,6 +77,7 @@ DefaultCtrConfigs k8s container settings that are applied by default
7677
_Appears in:_
7778
- [ContainerConfigs](#containerconfigs)
7879
- [CronJobContainerConfigs](#cronjobcontainerconfigs)
80+
- [RegistryServerConfigs](#registryserverconfigs)
7981
- [ServerConfigs](#serverconfigs)
8082

8183
| Field | Description |
@@ -405,7 +407,7 @@ _Appears in:_
405407

406408
| Field | Description |
407409
| --- | --- |
408-
| `server` _[ServerConfigs](#serverconfigs)_ | Creates a registry server container |
410+
| `server` _[RegistryServerConfigs](#registryserverconfigs)_ | Creates a registry server container |
409411
| `persistence` _[RegistryPersistence](#registrypersistence)_ | |
410412

411413

@@ -555,6 +557,7 @@ OptionalCtrConfigs k8s container settings that are optional
555557
_Appears in:_
556558
- [ContainerConfigs](#containerconfigs)
557559
- [CronJobContainerConfigs](#cronjobcontainerconfigs)
560+
- [RegistryServerConfigs](#registryserverconfigs)
558561
- [ServerConfigs](#serverconfigs)
559562

560563
| Field | Description |
@@ -669,6 +672,33 @@ _Appears in:_
669672
| `store` _[RegistryDBStorePersistence](#registrydbstorepersistence)_ | |
670673

671674

675+
#### RegistryServerConfigs
676+
677+
678+
679+
RegistryServerConfigs creates a registry server for the feast service, with specified container configurations.
680+
681+
_Appears in:_
682+
- [LocalRegistryConfig](#localregistryconfig)
683+
684+
| Field | Description |
685+
| --- | --- |
686+
| `image` _string_ | |
687+
| `env` _[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core)_ | |
688+
| `envFrom` _[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core)_ | |
689+
| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#pullpolicy-v1-core)_ | |
690+
| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core)_ | |
691+
| `tls` _[TlsConfigs](#tlsconfigs)_ | |
692+
| `logLevel` _string_ | LogLevel sets the logging level for the server
693+
Allowed values: "debug", "info", "warning", "error", "critical". |
694+
| `volumeMounts` _[VolumeMount](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#volumemount-v1-core) array_ | VolumeMounts defines the list of volumes that should be mounted into the feast container.
695+
This allows attaching persistent storage, config files, secrets, or other resources
696+
required by the Feast components. Ensure that each volume mount has a corresponding
697+
volume definition in the Volumes field. |
698+
| `restAPI` _boolean_ | Enable REST API registry server. |
699+
| `grpc` _boolean_ | Enable gRPC registry server. Defaults to true if unset. |
700+
701+
672702
#### RemoteRegistryConfig
673703

674704

@@ -709,9 +739,9 @@ ServerConfigs creates a server for the feast service, with specified container c
709739

710740
_Appears in:_
711741
- [FeatureStoreServices](#featurestoreservices)
712-
- [LocalRegistryConfig](#localregistryconfig)
713742
- [OfflineStore](#offlinestore)
714743
- [OnlineStore](#onlinestore)
744+
- [RegistryServerConfigs](#registryserverconfigs)
715745

716746
| Field | Description |
717747
| --- | --- |
@@ -743,6 +773,7 @@ _Appears in:_
743773
| `offlineStore` _string_ | |
744774
| `onlineStore` _string_ | |
745775
| `registry` _string_ | |
776+
| `registryRest` _string_ | |
746777
| `ui` _string_ | |
747778

748779

@@ -753,6 +784,7 @@ _Appears in:_
753784
TlsConfigs configures server TLS for a feast service. in an openshift cluster, this is configured by default using service serving certificates.
754785

755786
_Appears in:_
787+
- [RegistryServerConfigs](#registryserverconfigs)
756788
- [ServerConfigs](#serverconfigs)
757789

758790
| Field | Description |

‎infra/feast-operator/internal/controller/featurestore_controller_loglevel_test.go‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ var _ = Describe("FeatureStore Controller - Feast service LogLevel", func() {
6161
Services: &feastdevv1alpha1.FeatureStoreServices{
6262
Registry: &feastdevv1alpha1.Registry{
6363
Local: &feastdevv1alpha1.LocalRegistryConfig{
64-
Server: &feastdevv1alpha1.ServerConfigs{
65-
LogLevel: strPtr("error"),
64+
Server: &feastdevv1alpha1.RegistryServerConfigs{
65+
ServerConfigs: feastdevv1alpha1.ServerConfigs{
66+
LogLevel: strPtr("error"),
67+
},
6668
},
6769
},
6870
},
@@ -196,7 +198,9 @@ var _ = Describe("FeatureStore Controller - Feast service LogLevel", func() {
196198
resource.Spec.Services = &feastdevv1alpha1.FeatureStoreServices{
197199
Registry: &feastdevv1alpha1.Registry{
198200
Local: &feastdevv1alpha1.LocalRegistryConfig{
199-
Server: &feastdevv1alpha1.ServerConfigs{},
201+
Server: &feastdevv1alpha1.RegistryServerConfigs{
202+
ServerConfigs: feastdevv1alpha1.ServerConfigs{},
203+
},
200204
},
201205
},
202206
OfflineStore: &feastdevv1alpha1.OfflineStore{},

0 commit comments

Comments
 (0)