Skip to content

Commit fc4fc79

Browse files
committed
moved the logLevel under LocalRegistryConfig and updated testcase to validate it
Signed-off-by: Abdul Hameed <[email protected]>
1 parent fa79e95 commit fc4fc79

File tree

6 files changed

+122
-58
lines changed

6 files changed

+122
-58
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ type LocalRegistryConfig struct {
185185
ServiceConfigs `json:",inline"`
186186
Persistence *RegistryPersistence `json:"persistence,omitempty"`
187187
TLS *TlsConfigs `json:"tls,omitempty"`
188+
// LogLevel sets the logging level for the registry service
189+
// Allowed values: "debug", "info", "warning", "error", "critical".
190+
// +kubebuilder:validation:Enum=debug;info;warning;error;critical
191+
LogLevel string `json:"logLevel,omitempty"`
188192
}
189193

190194
// RegistryPersistence configures the persistence settings for the registry service
@@ -254,10 +258,6 @@ type PvcCreate struct {
254258
type Registry struct {
255259
Local *LocalRegistryConfig `json:"local,omitempty"`
256260
Remote *RemoteRegistryConfig `json:"remote,omitempty"`
257-
// LogLevel sets the logging level for the registry service
258-
// Allowed values: "debug", "info", "warning", "error", "critical".
259-
// +kubebuilder:validation:Enum=debug;info;warning;error;critical
260-
LogLevel string `json:"logLevel,omitempty"`
261261
}
262262

263263
// 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: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,17 @@ spec:
961961
description: PullPolicy describes a policy for if/when
962962
to pull a container image
963963
type: string
964+
logLevel:
965+
description: |-
966+
LogLevel sets the logging level for the registry service
967+
Allowed values: "debug", "info", "warning", "error", "critical".
968+
enum:
969+
- debug
970+
- info
971+
- warning
972+
- error
973+
- critical
974+
type: string
964975
persistence:
965976
description: RegistryPersistence configures the persistence
966977
settings for the registry service
@@ -1202,17 +1213,6 @@ spec:
12021213
rule: '(!has(self.disable) || !self.disable) ? has(self.secretRef)
12031214
: true'
12041215
type: object
1205-
logLevel:
1206-
description: |-
1207-
LogLevel sets the logging level for the registry service
1208-
Allowed values: "debug", "info", "warning", "error", "critical".
1209-
enum:
1210-
- debug
1211-
- info
1212-
- warning
1213-
- error
1214-
- critical
1215-
type: string
12161216
remote:
12171217
description: |-
12181218
RemoteRegistryConfig points to a remote feast registry server. When set, the operator will not deploy a registry for this FeatureStore CR.
@@ -2210,6 +2210,17 @@ spec:
22102210
description: PullPolicy describes a policy for if/when
22112211
to pull a container image
22122212
type: string
2213+
logLevel:
2214+
description: |-
2215+
LogLevel sets the logging level for the registry service
2216+
Allowed values: "debug", "info", "warning", "error", "critical".
2217+
enum:
2218+
- debug
2219+
- info
2220+
- warning
2221+
- error
2222+
- critical
2223+
type: string
22132224
persistence:
22142225
description: RegistryPersistence configures the persistence
22152226
settings for the registry service
@@ -2455,17 +2466,6 @@ spec:
24552466
rule: '(!has(self.disable) || !self.disable) ? has(self.secretRef)
24562467
: true'
24572468
type: object
2458-
logLevel:
2459-
description: |-
2460-
LogLevel sets the logging level for the registry service
2461-
Allowed values: "debug", "info", "warning", "error", "critical".
2462-
enum:
2463-
- debug
2464-
- info
2465-
- warning
2466-
- error
2467-
- critical
2468-
type: string
24692469
remote:
24702470
description: |-
24712471
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/samples/v1alpha1_featurestore_services_loglevel.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ spec:
1010
offlineStore:
1111
logLevel: debug
1212
registry:
13-
logLevel: info
1413
local:
15-
persistence:
16-
file:
17-
path: /data/registry.db
14+
logLevel: info
15+

infra/feast-operator/dist/install.yaml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,17 @@ spec:
969969
description: PullPolicy describes a policy for if/when
970970
to pull a container image
971971
type: string
972+
logLevel:
973+
description: |-
974+
LogLevel sets the logging level for the registry service
975+
Allowed values: "debug", "info", "warning", "error", "critical".
976+
enum:
977+
- debug
978+
- info
979+
- warning
980+
- error
981+
- critical
982+
type: string
972983
persistence:
973984
description: RegistryPersistence configures the persistence
974985
settings for the registry service
@@ -1210,17 +1221,6 @@ spec:
12101221
rule: '(!has(self.disable) || !self.disable) ? has(self.secretRef)
12111222
: true'
12121223
type: object
1213-
logLevel:
1214-
description: |-
1215-
LogLevel sets the logging level for the registry service
1216-
Allowed values: "debug", "info", "warning", "error", "critical".
1217-
enum:
1218-
- debug
1219-
- info
1220-
- warning
1221-
- error
1222-
- critical
1223-
type: string
12241224
remote:
12251225
description: |-
12261226
RemoteRegistryConfig points to a remote feast registry server. When set, the operator will not deploy a registry for this FeatureStore CR.
@@ -2218,6 +2218,17 @@ spec:
22182218
description: PullPolicy describes a policy for if/when
22192219
to pull a container image
22202220
type: string
2221+
logLevel:
2222+
description: |-
2223+
LogLevel sets the logging level for the registry service
2224+
Allowed values: "debug", "info", "warning", "error", "critical".
2225+
enum:
2226+
- debug
2227+
- info
2228+
- warning
2229+
- error
2230+
- critical
2231+
type: string
22212232
persistence:
22222233
description: RegistryPersistence configures the persistence
22232234
settings for the registry service
@@ -2463,17 +2474,6 @@ spec:
24632474
rule: '(!has(self.disable) || !self.disable) ? has(self.secretRef)
24642475
: true'
24652476
type: object
2466-
logLevel:
2467-
description: |-
2468-
LogLevel sets the logging level for the registry service
2469-
Allowed values: "debug", "info", "warning", "error", "critical".
2470-
enum:
2471-
- debug
2472-
- info
2473-
- warning
2474-
- error
2475-
- critical
2476-
type: string
24772477
remote:
24782478
description: |-
24792479
RemoteRegistryConfig points to a remote feast registry server. When set, the operator will not deploy a registry for this FeatureStore CR.
@@ -2960,7 +2960,7 @@ spec:
29602960
- --leader-elect
29612961
command:
29622962
- /manager
2963-
image: feastdev/feast-operator:0.41.0
2963+
image: feastdev/feast-operator:0.42.0
29642964
livenessProbe:
29652965
httpGet:
29662966
path: /healthz

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

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ var _ = Describe("FeatureStore Controller - Feast service LogLevel", func() {
6060
FeastProject: feastProject,
6161
Services: &feastdevv1alpha1.FeatureStoreServices{
6262
Registry: &feastdevv1alpha1.Registry{
63-
Local: &feastdevv1alpha1.LocalRegistryConfig{},
63+
Local: &feastdevv1alpha1.LocalRegistryConfig{
64+
LogLevel: "error",
65+
},
6466
},
6567
OnlineStore: &feastdevv1alpha1.OnlineStore{
6668
LogLevel: "debug",
@@ -83,7 +85,7 @@ var _ = Describe("FeatureStore Controller - Feast service LogLevel", func() {
8385
Expect(k8sClient.Delete(ctx, resource)).To(Succeed())
8486
})
8587

86-
It("should successfully reconcile the resource", func() {
88+
It("should successfully reconcile the resource with logLevel", func() {
8789
By("Reconciling the created resource")
8890
controllerReconciler := &FeatureStoreReconciler{
8991
Client: k8sClient,
@@ -163,7 +165,8 @@ var _ = Describe("FeatureStore Controller - Feast service LogLevel", func() {
163165
Expect(controllerutil.HasControllerReference(deploy)).To(BeTrue())
164166
Expect(deploy.Spec.Template.Spec.Containers).To(HaveLen(1))
165167
command := deploy.Spec.Template.Spec.Containers[0].Command
166-
Expect(command).NotTo(ContainElement("--log-level"))
168+
Expect(command).To(ContainElement("--log-level"))
169+
Expect(command).To(ContainElement("ERROR"))
167170

168171
err = k8sClient.Get(ctx, types.NamespacedName{
169172
Name: feast.GetFeastServiceName(services.OfflineFeastType),
@@ -192,5 +195,68 @@ var _ = Describe("FeatureStore Controller - Feast service LogLevel", func() {
192195
Expect(command).To(ContainElement("DEBUG"))
193196
})
194197

198+
It("should not include --log-level parameter when logLevel is not specified for any service", func() {
199+
By("Updating the FeatureStore resource without specifying logLevel for any service")
200+
resource := &feastdevv1alpha1.FeatureStore{}
201+
err := k8sClient.Get(ctx, typeNamespacedName, resource)
202+
Expect(err).NotTo(HaveOccurred())
203+
204+
resource.Spec.Services = &feastdevv1alpha1.FeatureStoreServices{
205+
Registry: &feastdevv1alpha1.Registry{
206+
Local: &feastdevv1alpha1.LocalRegistryConfig{},
207+
},
208+
OnlineStore: &feastdevv1alpha1.OnlineStore{},
209+
OfflineStore: &feastdevv1alpha1.OfflineStore{},
210+
}
211+
Expect(k8sClient.Update(ctx, resource)).To(Succeed())
212+
213+
controllerReconciler := &FeatureStoreReconciler{
214+
Client: k8sClient,
215+
Scheme: k8sClient.Scheme(),
216+
}
217+
218+
_, err = controllerReconciler.Reconcile(ctx, reconcile.Request{
219+
NamespacedName: typeNamespacedName,
220+
})
221+
Expect(err).NotTo(HaveOccurred())
222+
223+
feast := services.FeastServices{
224+
Handler: handler.FeastHandler{
225+
Client: controllerReconciler.Client,
226+
Context: ctx,
227+
Scheme: controllerReconciler.Scheme,
228+
FeatureStore: resource,
229+
},
230+
}
231+
232+
deploy := &appsv1.Deployment{}
233+
err = k8sClient.Get(ctx, types.NamespacedName{
234+
Name: feast.GetFeastServiceName(services.RegistryFeastType),
235+
Namespace: resource.Namespace,
236+
}, deploy)
237+
Expect(err).NotTo(HaveOccurred())
238+
Expect(deploy.Spec.Template.Spec.Containers).To(HaveLen(1))
239+
command := deploy.Spec.Template.Spec.Containers[0].Command
240+
Expect(command).NotTo(ContainElement("--log-level"))
241+
242+
err = k8sClient.Get(ctx, types.NamespacedName{
243+
Name: feast.GetFeastServiceName(services.OfflineFeastType),
244+
Namespace: resource.Namespace,
245+
}, deploy)
246+
Expect(err).NotTo(HaveOccurred())
247+
Expect(deploy.Spec.Template.Spec.Containers).To(HaveLen(1))
248+
command = deploy.Spec.Template.Spec.Containers[0].Command
249+
Expect(command).NotTo(ContainElement("--log-level"))
250+
251+
err = k8sClient.Get(ctx, types.NamespacedName{
252+
Name: feast.GetFeastServiceName(services.OnlineFeastType),
253+
Namespace: resource.Namespace,
254+
}, deploy)
255+
Expect(err).NotTo(HaveOccurred())
256+
Expect(deploy.Spec.Template.Spec.Containers).To(HaveLen(1))
257+
command = deploy.Spec.Template.Spec.Containers[0].Command
258+
Expect(command).NotTo(ContainElement("--log-level"))
259+
})
260+
195261
})
196262
})

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,8 @@ func (feast *FeastServices) getLogLevelForType(feastType FeastServiceType) *stri
497497
return &services.OnlineStore.LogLevel
498498
}
499499
case RegistryFeastType:
500-
if services.Registry != nil && services.Registry.LogLevel != "" {
501-
return &services.Registry.LogLevel
500+
if services.Registry != nil && services.Registry.Local.LogLevel != "" {
501+
return &services.Registry.Local.LogLevel
502502
}
503503
}
504504
return nil

0 commit comments

Comments
 (0)