-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: Feast Operator support log level configuration for services #4808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a7af314
fix: Feast Operator updated the kustomize version to v5.5.0
redhatHameed 609e9a8
feat : Feast Operator support log level configuration for services
redhatHameed 94acc49
Update infra/feast-operator/internal/controller/services/services.go
redhatHameed 7ea29c5
Update infra/feast-operator/internal/controller/services/services.go
redhatHameed 9fb5339
added unit test for loglevel
redhatHameed fa79e95
fix the loglevel command
redhatHameed fc4fc79
moved the logLevel under LocalRegistryConfig and updated testcase to …
redhatHameed File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
added unit test for loglevel
Signed-off-by: Abdul Hameed <ahameed@redhat.com>
- Loading branch information
commit 9fb533930c51dcc471b2df3a1ba6db811a4c4fe4
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
196 changes: 196 additions & 0 deletions
196
infra/feast-operator/internal/controller/featurestore_controller_loglevel_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,196 @@ | ||
| /* | ||
| Copyright 2024 Feast Community. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package controller | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| . "github.com/onsi/ginkgo/v2" | ||
| . "github.com/onsi/gomega" | ||
| appsv1 "k8s.io/api/apps/v1" | ||
| "k8s.io/apimachinery/pkg/api/errors" | ||
| apimeta "k8s.io/apimachinery/pkg/api/meta" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| "k8s.io/apimachinery/pkg/types" | ||
| "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" | ||
| "sigs.k8s.io/controller-runtime/pkg/reconcile" | ||
|
|
||
| "github.com/feast-dev/feast/infra/feast-operator/api/feastversion" | ||
| feastdevv1alpha1 "github.com/feast-dev/feast/infra/feast-operator/api/v1alpha1" | ||
| "github.com/feast-dev/feast/infra/feast-operator/internal/controller/handler" | ||
| "github.com/feast-dev/feast/infra/feast-operator/internal/controller/services" | ||
| ) | ||
|
|
||
| var _ = Describe("FeatureStore Controller - Feast service LogLevel", func() { | ||
| Context("When reconciling a FeatureStore resource", func() { | ||
| const resourceName = "test-loglevel" | ||
|
|
||
| ctx := context.Background() | ||
|
|
||
| typeNamespacedName := types.NamespacedName{ | ||
| Name: resourceName, | ||
| Namespace: "default", | ||
| } | ||
| featurestore := &feastdevv1alpha1.FeatureStore{} | ||
|
|
||
| BeforeEach(func() { | ||
| By("creating the custom resource for the Kind FeatureStore") | ||
| err := k8sClient.Get(ctx, typeNamespacedName, featurestore) | ||
| if err != nil && errors.IsNotFound(err) { | ||
| resource := &feastdevv1alpha1.FeatureStore{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: resourceName, | ||
| Namespace: "default", | ||
| }, | ||
| Spec: feastdevv1alpha1.FeatureStoreSpec{ | ||
| FeastProject: feastProject, | ||
| Services: &feastdevv1alpha1.FeatureStoreServices{ | ||
| Registry: &feastdevv1alpha1.Registry{ | ||
| Local: &feastdevv1alpha1.LocalRegistryConfig{}, | ||
| }, | ||
| OnlineStore: &feastdevv1alpha1.OnlineStore{ | ||
| LogLevel: "debug", | ||
| }, | ||
| OfflineStore: &feastdevv1alpha1.OfflineStore{ | ||
| LogLevel: "info", | ||
| }, | ||
| }, | ||
| }, | ||
| } | ||
| Expect(k8sClient.Create(ctx, resource)).To(Succeed()) | ||
| } | ||
| }) | ||
| AfterEach(func() { | ||
| resource := &feastdevv1alpha1.FeatureStore{} | ||
| err := k8sClient.Get(ctx, typeNamespacedName, resource) | ||
| Expect(err).NotTo(HaveOccurred()) | ||
|
|
||
| By("Cleanup the specific resource instance FeatureStore") | ||
| Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) | ||
| }) | ||
|
|
||
| It("should successfully reconcile the resource", func() { | ||
| By("Reconciling the created resource") | ||
| controllerReconciler := &FeatureStoreReconciler{ | ||
| Client: k8sClient, | ||
| Scheme: k8sClient.Scheme(), | ||
| } | ||
|
|
||
| _, err := controllerReconciler.Reconcile(ctx, reconcile.Request{ | ||
| NamespacedName: typeNamespacedName, | ||
| }) | ||
| Expect(err).NotTo(HaveOccurred()) | ||
|
|
||
| resource := &feastdevv1alpha1.FeatureStore{} | ||
| err = k8sClient.Get(ctx, typeNamespacedName, resource) | ||
| Expect(err).NotTo(HaveOccurred()) | ||
| feast := services.FeastServices{ | ||
| Handler: handler.FeastHandler{ | ||
| Client: controllerReconciler.Client, | ||
| Context: ctx, | ||
| Scheme: controllerReconciler.Scheme, | ||
| FeatureStore: resource, | ||
| }, | ||
| } | ||
|
|
||
| Expect(resource.Status).NotTo(BeNil()) | ||
| Expect(resource.Status.FeastVersion).To(Equal(feastversion.FeastVersion)) | ||
| Expect(resource.Status.Applied.FeastProject).To(Equal(resource.Spec.FeastProject)) | ||
| Expect(resource.Status.Applied.Services).NotTo(BeNil()) | ||
| Expect(resource.Status.Applied.Services.OfflineStore).NotTo(BeNil()) | ||
| Expect(resource.Status.Applied.Services.OnlineStore).NotTo(BeNil()) | ||
| Expect(resource.Status.Applied.Services.Registry).NotTo(BeNil()) | ||
|
|
||
| Expect(resource.Status.Conditions).NotTo(BeEmpty()) | ||
| cond := apimeta.FindStatusCondition(resource.Status.Conditions, feastdevv1alpha1.ReadyType) | ||
| Expect(cond).ToNot(BeNil()) | ||
| Expect(cond.Status).To(Equal(metav1.ConditionTrue)) | ||
| Expect(cond.Reason).To(Equal(feastdevv1alpha1.ReadyReason)) | ||
| Expect(cond.Type).To(Equal(feastdevv1alpha1.ReadyType)) | ||
| Expect(cond.Message).To(Equal(feastdevv1alpha1.ReadyMessage)) | ||
|
|
||
| cond = apimeta.FindStatusCondition(resource.Status.Conditions, feastdevv1alpha1.RegistryReadyType) | ||
| Expect(cond).ToNot(BeNil()) | ||
| Expect(cond.Status).To(Equal(metav1.ConditionTrue)) | ||
| Expect(cond.Reason).To(Equal(feastdevv1alpha1.ReadyReason)) | ||
| Expect(cond.Type).To(Equal(feastdevv1alpha1.RegistryReadyType)) | ||
| Expect(cond.Message).To(Equal(feastdevv1alpha1.RegistryReadyMessage)) | ||
|
|
||
| cond = apimeta.FindStatusCondition(resource.Status.Conditions, feastdevv1alpha1.ClientReadyType) | ||
| Expect(cond).ToNot(BeNil()) | ||
| Expect(cond.Status).To(Equal(metav1.ConditionTrue)) | ||
| Expect(cond.Reason).To(Equal(feastdevv1alpha1.ReadyReason)) | ||
| Expect(cond.Type).To(Equal(feastdevv1alpha1.ClientReadyType)) | ||
| Expect(cond.Message).To(Equal(feastdevv1alpha1.ClientReadyMessage)) | ||
|
|
||
| cond = apimeta.FindStatusCondition(resource.Status.Conditions, feastdevv1alpha1.OfflineStoreReadyType) | ||
| Expect(cond).ToNot(BeNil()) | ||
| Expect(cond.Status).To(Equal(metav1.ConditionTrue)) | ||
| Expect(cond.Reason).To(Equal(feastdevv1alpha1.ReadyReason)) | ||
| Expect(cond.Type).To(Equal(feastdevv1alpha1.OfflineStoreReadyType)) | ||
| Expect(cond.Message).To(Equal(feastdevv1alpha1.OfflineStoreReadyMessage)) | ||
|
|
||
| cond = apimeta.FindStatusCondition(resource.Status.Conditions, feastdevv1alpha1.OnlineStoreReadyType) | ||
| Expect(cond).ToNot(BeNil()) | ||
| Expect(cond.Status).To(Equal(metav1.ConditionTrue)) | ||
| Expect(cond.Reason).To(Equal(feastdevv1alpha1.ReadyReason)) | ||
| Expect(cond.Type).To(Equal(feastdevv1alpha1.OnlineStoreReadyType)) | ||
| Expect(cond.Message).To(Equal(feastdevv1alpha1.OnlineStoreReadyMessage)) | ||
| Expect(resource.Status.Phase).To(Equal(feastdevv1alpha1.ReadyPhase)) | ||
|
|
||
| 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.Replicas).To(Equal(&services.DefaultReplicas)) | ||
| 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")) | ||
|
|
||
| err = k8sClient.Get(ctx, types.NamespacedName{ | ||
| Name: feast.GetFeastServiceName(services.OfflineFeastType), | ||
| Namespace: resource.Namespace, | ||
| }, | ||
| deploy) | ||
| Expect(err).NotTo(HaveOccurred()) | ||
| Expect(deploy.Spec.Replicas).To(Equal(&services.DefaultReplicas)) | ||
| 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).To(ContainElement("--log-level")) | ||
| Expect(command).To(ContainElement("INFO")) | ||
|
|
||
| err = k8sClient.Get(ctx, types.NamespacedName{ | ||
| Name: feast.GetFeastServiceName(services.OnlineFeastType), | ||
| Namespace: resource.Namespace, | ||
| }, | ||
| deploy) | ||
| Expect(err).NotTo(HaveOccurred()) | ||
| Expect(deploy.Spec.Replicas).To(Equal(&services.DefaultReplicas)) | ||
| 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).To(ContainElement("--log-level")) | ||
| Expect(command).To(ContainElement("DEBUG")) | ||
| }) | ||
|
|
||
| }) | ||
| }) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.