Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
moved the logLevel under LocalRegistryConfig and updated testcase to …
…validate it

Signed-off-by: Abdul Hameed <ahameed@redhat.com>
  • Loading branch information
redhatHameed committed Dec 5, 2024
commit fc4fc791bb8dc06bbf755831a769ea2cea14d5c4
8 changes: 4 additions & 4 deletions infra/feast-operator/api/v1alpha1/featurestore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ type LocalRegistryConfig struct {
ServiceConfigs `json:",inline"`
Persistence *RegistryPersistence `json:"persistence,omitempty"`
TLS *TlsConfigs `json:"tls,omitempty"`
// LogLevel sets the logging level for the registry service
// Allowed values: "debug", "info", "warning", "error", "critical".
// +kubebuilder:validation:Enum=debug;info;warning;error;critical
LogLevel string `json:"logLevel,omitempty"`
}

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

// RemoteRegistryConfig points to a remote feast registry server. When set, the operator will not deploy a registry for this FeatureStore CR.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,17 @@ spec:
description: PullPolicy describes a policy for if/when
to pull a container image
type: string
logLevel:
description: |-
LogLevel sets the logging level for the registry service
Allowed values: "debug", "info", "warning", "error", "critical".
enum:
- debug
- info
- warning
- error
- critical
type: string
persistence:
description: RegistryPersistence configures the persistence
settings for the registry service
Expand Down Expand Up @@ -1202,17 +1213,6 @@ spec:
rule: '(!has(self.disable) || !self.disable) ? has(self.secretRef)
: true'
type: object
logLevel:
description: |-
LogLevel sets the logging level for the registry service
Allowed values: "debug", "info", "warning", "error", "critical".
enum:
- debug
- info
- warning
- error
- critical
type: string
remote:
description: |-
RemoteRegistryConfig points to a remote feast registry server. When set, the operator will not deploy a registry for this FeatureStore CR.
Expand Down Expand Up @@ -2210,6 +2210,17 @@ spec:
description: PullPolicy describes a policy for if/when
to pull a container image
type: string
logLevel:
description: |-
LogLevel sets the logging level for the registry service
Allowed values: "debug", "info", "warning", "error", "critical".
enum:
- debug
- info
- warning
- error
- critical
type: string
persistence:
description: RegistryPersistence configures the persistence
settings for the registry service
Expand Down Expand Up @@ -2455,17 +2466,6 @@ spec:
rule: '(!has(self.disable) || !self.disable) ? has(self.secretRef)
: true'
type: object
logLevel:
description: |-
LogLevel sets the logging level for the registry service
Allowed values: "debug", "info", "warning", "error", "critical".
enum:
- debug
- info
- warning
- error
- critical
type: string
remote:
description: |-
RemoteRegistryConfig points to a remote feast registry server. When set, the operator will not deploy a registry for this FeatureStore CR.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ spec:
offlineStore:
logLevel: debug
registry:
logLevel: info
local:
persistence:
file:
path: /data/registry.db
logLevel: info

46 changes: 23 additions & 23 deletions infra/feast-operator/dist/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,17 @@ spec:
description: PullPolicy describes a policy for if/when
to pull a container image
type: string
logLevel:
description: |-
LogLevel sets the logging level for the registry service
Allowed values: "debug", "info", "warning", "error", "critical".
enum:
- debug
- info
- warning
- error
- critical
type: string
persistence:
description: RegistryPersistence configures the persistence
settings for the registry service
Expand Down Expand Up @@ -1210,17 +1221,6 @@ spec:
rule: '(!has(self.disable) || !self.disable) ? has(self.secretRef)
: true'
type: object
logLevel:
description: |-
LogLevel sets the logging level for the registry service
Allowed values: "debug", "info", "warning", "error", "critical".
enum:
- debug
- info
- warning
- error
- critical
type: string
remote:
description: |-
RemoteRegistryConfig points to a remote feast registry server. When set, the operator will not deploy a registry for this FeatureStore CR.
Expand Down Expand Up @@ -2218,6 +2218,17 @@ spec:
description: PullPolicy describes a policy for if/when
to pull a container image
type: string
logLevel:
description: |-
LogLevel sets the logging level for the registry service
Allowed values: "debug", "info", "warning", "error", "critical".
enum:
- debug
- info
- warning
- error
- critical
type: string
persistence:
description: RegistryPersistence configures the persistence
settings for the registry service
Expand Down Expand Up @@ -2463,17 +2474,6 @@ spec:
rule: '(!has(self.disable) || !self.disable) ? has(self.secretRef)
: true'
type: object
logLevel:
description: |-
LogLevel sets the logging level for the registry service
Allowed values: "debug", "info", "warning", "error", "critical".
enum:
- debug
- info
- warning
- error
- critical
type: string
remote:
description: |-
RemoteRegistryConfig points to a remote feast registry server. When set, the operator will not deploy a registry for this FeatureStore CR.
Expand Down Expand Up @@ -2960,7 +2960,7 @@ spec:
- --leader-elect
command:
- /manager
image: feastdev/feast-operator:0.41.0
image: feastdev/feast-operator:0.42.0
livenessProbe:
httpGet:
path: /healthz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ var _ = Describe("FeatureStore Controller - Feast service LogLevel", func() {
FeastProject: feastProject,
Services: &feastdevv1alpha1.FeatureStoreServices{
Registry: &feastdevv1alpha1.Registry{
Local: &feastdevv1alpha1.LocalRegistryConfig{},
Local: &feastdevv1alpha1.LocalRegistryConfig{
LogLevel: "error",
},
},
OnlineStore: &feastdevv1alpha1.OnlineStore{
LogLevel: "debug",
Expand All @@ -83,7 +85,7 @@ var _ = Describe("FeatureStore Controller - Feast service LogLevel", func() {
Expect(k8sClient.Delete(ctx, resource)).To(Succeed())
})

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

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

It("should not include --log-level parameter when logLevel is not specified for any service", func() {
By("Updating the FeatureStore resource without specifying logLevel for any service")
resource := &feastdevv1alpha1.FeatureStore{}
err := k8sClient.Get(ctx, typeNamespacedName, resource)
Expect(err).NotTo(HaveOccurred())

resource.Spec.Services = &feastdevv1alpha1.FeatureStoreServices{
Registry: &feastdevv1alpha1.Registry{
Local: &feastdevv1alpha1.LocalRegistryConfig{},
},
OnlineStore: &feastdevv1alpha1.OnlineStore{},
OfflineStore: &feastdevv1alpha1.OfflineStore{},
}
Expect(k8sClient.Update(ctx, resource)).To(Succeed())

controllerReconciler := &FeatureStoreReconciler{
Client: k8sClient,
Scheme: k8sClient.Scheme(),
}

_, err = controllerReconciler.Reconcile(ctx, reconcile.Request{
NamespacedName: typeNamespacedName,
})
Expect(err).NotTo(HaveOccurred())

feast := services.FeastServices{
Handler: handler.FeastHandler{
Client: controllerReconciler.Client,
Context: ctx,
Scheme: controllerReconciler.Scheme,
FeatureStore: resource,
},
}

deploy := &appsv1.Deployment{}
err = k8sClient.Get(ctx, types.NamespacedName{
Name: feast.GetFeastServiceName(services.RegistryFeastType),
Namespace: resource.Namespace,
}, deploy)
Expect(err).NotTo(HaveOccurred())
Expect(deploy.Spec.Template.Spec.Containers).To(HaveLen(1))
command := deploy.Spec.Template.Spec.Containers[0].Command
Expect(command).NotTo(ContainElement("--log-level"))

err = k8sClient.Get(ctx, types.NamespacedName{
Name: feast.GetFeastServiceName(services.OfflineFeastType),
Namespace: resource.Namespace,
}, deploy)
Expect(err).NotTo(HaveOccurred())
Expect(deploy.Spec.Template.Spec.Containers).To(HaveLen(1))
command = deploy.Spec.Template.Spec.Containers[0].Command
Expect(command).NotTo(ContainElement("--log-level"))

err = k8sClient.Get(ctx, types.NamespacedName{
Name: feast.GetFeastServiceName(services.OnlineFeastType),
Namespace: resource.Namespace,
}, deploy)
Expect(err).NotTo(HaveOccurred())
Expect(deploy.Spec.Template.Spec.Containers).To(HaveLen(1))
command = deploy.Spec.Template.Spec.Containers[0].Command
Expect(command).NotTo(ContainElement("--log-level"))
})

})
})
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,8 @@ func (feast *FeastServices) getLogLevelForType(feastType FeastServiceType) *stri
return &services.OnlineStore.LogLevel
}
case RegistryFeastType:
if services.Registry != nil && services.Registry.LogLevel != "" {
return &services.Registry.LogLevel
if services.Registry != nil && services.Registry.Local.LogLevel != "" {
return &services.Registry.Local.LogLevel
}
}
return nil
Expand Down