Skip to content

Commit 58f024b

Browse files
committed
feat : Feast Operator support log level configuration for services
Signed-off-by: Abdul Hameed <ahameed@redhat.com>
1 parent 6089905 commit 58f024b

File tree

3 files changed

+100
-0
lines changed

3 files changed

+100
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ type OfflineStore struct {
7777
ServiceConfigs `json:",inline"`
7878
Persistence *OfflineStorePersistence `json:"persistence,omitempty"`
7979
TLS *OfflineTlsConfigs `json:"tls,omitempty"`
80+
// LogLevel sets the logging level for the offline store service
81+
// Allowed values: "debug", "info", "warning", "error", "critical".
82+
// +kubebuilder:validation:Enum=debug;info;warning;error;critical
83+
LogLevel string `json:"logLevel,omitempty"`
8084
}
8185

8286
// OfflineTlsConfigs configures server TLS for the offline feast service. in an openshift cluster, this is configured by default using service serving certificates.
@@ -128,6 +132,10 @@ type OnlineStore struct {
128132
ServiceConfigs `json:",inline"`
129133
Persistence *OnlineStorePersistence `json:"persistence,omitempty"`
130134
TLS *TlsConfigs `json:"tls,omitempty"`
135+
// LogLevel sets the logging level for the online store service
136+
// Allowed values: "debug", "info", "warning", "error", "critical".
137+
// +kubebuilder:validation:Enum=debug;info;warning;error;critical
138+
LogLevel string `json:"logLevel,omitempty"`
131139
}
132140

133141
// OnlineStorePersistence configures the persistence settings for the online store service
@@ -240,6 +248,10 @@ type PvcCreate struct {
240248
type Registry struct {
241249
Local *LocalRegistryConfig `json:"local,omitempty"`
242250
Remote *RemoteRegistryConfig `json:"remote,omitempty"`
251+
// LogLevel sets the logging level for the registry service
252+
// Allowed values: "debug", "info", "warning", "error", "critical".
253+
// +kubebuilder:validation:Enum=debug;info;warning;error;critical
254+
LogLevel string `json:"logLevel,omitempty"`
243255
}
244256

245257
// RemoteRegistryConfig points to a remote feast registry server. When set, the operator will not deploy a registry for this FeatureStore CR.

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

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,17 @@ spec:
203203
description: PullPolicy describes a policy for if/when to
204204
pull a container image
205205
type: string
206+
logLevel:
207+
description: |-
208+
LogLevel sets the logging level for the offline store service
209+
Allowed values: "debug", "info", "warning", "error", "critical".
210+
enum:
211+
- debug
212+
- info
213+
- warning
214+
- error
215+
- critical
216+
type: string
206217
persistence:
207218
description: OfflineStorePersistence configures the persistence
208219
settings for the offline store service
@@ -550,6 +561,17 @@ spec:
550561
description: PullPolicy describes a policy for if/when to
551562
pull a container image
552563
type: string
564+
logLevel:
565+
description: |-
566+
LogLevel sets the logging level for the online store service
567+
Allowed values: "debug", "info", "warning", "error", "critical".
568+
enum:
569+
- debug
570+
- info
571+
- warning
572+
- error
573+
- critical
574+
type: string
553575
persistence:
554576
description: OnlineStorePersistence configures the persistence
555577
settings for the online store service
@@ -1149,6 +1171,17 @@ spec:
11491171
rule: '(!has(self.disable) || !self.disable) ? has(self.secretRef)
11501172
: true'
11511173
type: object
1174+
logLevel:
1175+
description: |-
1176+
LogLevel sets the logging level for the registry service
1177+
Allowed values: "debug", "info", "warning", "error", "critical".
1178+
enum:
1179+
- debug
1180+
- info
1181+
- warning
1182+
- error
1183+
- critical
1184+
type: string
11521185
remote:
11531186
description: |-
11541187
RemoteRegistryConfig points to a remote feast registry server. When set, the operator will not deploy a registry for this FeatureStore CR.
@@ -1373,6 +1406,17 @@ spec:
13731406
description: PullPolicy describes a policy for if/when
13741407
to pull a container image
13751408
type: string
1409+
logLevel:
1410+
description: |-
1411+
LogLevel sets the logging level for the offline store service
1412+
Allowed values: "debug", "info", "warning", "error", "critical".
1413+
enum:
1414+
- debug
1415+
- info
1416+
- warning
1417+
- error
1418+
- critical
1419+
type: string
13761420
persistence:
13771421
description: OfflineStorePersistence configures the persistence
13781422
settings for the offline store service
@@ -1725,6 +1769,17 @@ spec:
17251769
description: PullPolicy describes a policy for if/when
17261770
to pull a container image
17271771
type: string
1772+
logLevel:
1773+
description: |-
1774+
LogLevel sets the logging level for the online store service
1775+
Allowed values: "debug", "info", "warning", "error", "critical".
1776+
enum:
1777+
- debug
1778+
- info
1779+
- warning
1780+
- error
1781+
- critical
1782+
type: string
17281783
persistence:
17291784
description: OnlineStorePersistence configures the persistence
17301785
settings for the online store service
@@ -2335,6 +2390,17 @@ spec:
23352390
rule: '(!has(self.disable) || !self.disable) ? has(self.secretRef)
23362391
: true'
23372392
type: object
2393+
logLevel:
2394+
description: |-
2395+
LogLevel sets the logging level for the registry service
2396+
Allowed values: "debug", "info", "warning", "error", "critical".
2397+
enum:
2398+
- debug
2399+
- info
2400+
- warning
2401+
- error
2402+
- critical
2403+
type: string
23382404
remote:
23392405
description: |-
23402406
RemoteRegistryConfig points to a remote feast registry server. When set, the operator will not deploy a registry for this FeatureStore CR.

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ func (feast *FeastServices) getContainerCommand(feastType FeastServiceType) []st
358358
deploySettings := FeastServiceConstants[feastType]
359359
targetPort := deploySettings.TargetHttpPort
360360
tls := feast.getTlsConfigs(feastType)
361+
logLevel := feast.getLogLevelForType(feastType)
361362
if tls.IsTLS() {
362363
targetPort = deploySettings.TargetHttpsPort
363364
feastTlsPath := GetTlsPath(feastType)
@@ -372,6 +373,7 @@ func (feast *FeastServices) getContainerCommand(feastType FeastServiceType) []st
372373
[]string{"--verify_client", strconv.FormatBool(*feast.Handler.FeatureStore.Status.Applied.Services.OfflineStore.TLS.VerifyClient)}...)
373374
}
374375
}
376+
deploySettings.Command = append(deploySettings.Command, "--log-level="+strings.ToUpper(logLevel))
375377

376378
return deploySettings.Command
377379
}
@@ -474,6 +476,26 @@ func (feast *FeastServices) getServiceConfigs(feastType FeastServiceType) feastd
474476
return feastdevv1alpha1.ServiceConfigs{}
475477
}
476478

479+
func (feast *FeastServices) getLogLevelForType(feastType FeastServiceType) string {
480+
services := feast.Handler.FeatureStore.Status.Applied.Services
481+
defaultLogLevel := "info"
482+
switch feastType {
483+
case OfflineFeastType:
484+
if services.OfflineStore != nil && services.OfflineStore.LogLevel != "" {
485+
return services.OfflineStore.LogLevel
486+
}
487+
case OnlineFeastType:
488+
if services.OnlineStore != nil && services.OnlineStore.LogLevel != "" {
489+
return services.OnlineStore.LogLevel
490+
}
491+
case RegistryFeastType:
492+
if services.Registry != nil && services.Registry.LogLevel != "" {
493+
return services.Registry.LogLevel
494+
}
495+
}
496+
return defaultLogLevel
497+
}
498+
477499
// GetObjectMeta returns the feast k8s object metadata
478500
func (feast *FeastServices) GetObjectMeta(feastType FeastServiceType) metav1.ObjectMeta {
479501
return metav1.ObjectMeta{Name: feast.GetFeastServiceName(feastType), Namespace: feast.Handler.FeatureStore.Namespace}

0 commit comments

Comments
 (0)