Skip to content

Commit ea74be1

Browse files
redhatHameedtchughesiv
authored andcommitted
feat: Feast Operator support log level configuration for services (feast-dev#4808)
* fix: Feast Operator updated the kustomize version to v5.5.0 Signed-off-by: Abdul Hameed <ahameed@redhat.com> * feat : Feast Operator support log level configuration for services Signed-off-by: Abdul Hameed <ahameed@redhat.com> * Update infra/feast-operator/internal/controller/services/services.go Co-authored-by: Tommy Hughes IV <tchughesiv@gmail.com> Signed-off-by: Abdul Hameed <ahameed@redhat.com> * Update infra/feast-operator/internal/controller/services/services.go Co-authored-by: Tommy Hughes IV <tchughesiv@gmail.com> Signed-off-by: Abdul Hameed <ahameed@redhat.com> * added unit test for loglevel Signed-off-by: Abdul Hameed <ahameed@redhat.com> * fix the loglevel command Signed-off-by: Abdul Hameed <ahameed@redhat.com> * moved the logLevel under LocalRegistryConfig and updated testcase to validate it Signed-off-by: Abdul Hameed <ahameed@redhat.com> --------- Signed-off-by: Abdul Hameed <ahameed@redhat.com> Co-authored-by: Tommy Hughes IV <tchughesiv@gmail.com>
1 parent 07fae66 commit ea74be1

4 files changed

Lines changed: 121 additions & 4 deletions

File tree

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ type OfflineStore struct {
9292
LogLevel string `json:"logLevel,omitempty"`
9393
=======
9494
TLS *OfflineTlsConfigs `json:"tls,omitempty"`
95+
// LogLevel sets the logging level for the offline store service
96+
// Allowed values: "debug", "info", "warning", "error", "critical".
97+
// +kubebuilder:validation:Enum=debug;info;warning;error;critical
98+
LogLevel string `json:"logLevel,omitempty"`
9599
}
96100

97101
// OfflineTlsConfigs configures server TLS for the offline feast service. in an openshift cluster, this is configured by default using service serving certificates.
@@ -174,12 +178,18 @@ type OnlineStore struct {
174178
Persistence *OnlineStorePersistence `json:"persistence,omitempty"`
175179
TLS *TlsConfigs `json:"tls,omitempty"`
176180
<<<<<<< HEAD
181+
<<<<<<< HEAD
182+
=======
183+
>>>>>>> fb0874ae1 (feat: Feast Operator support log level configuration for services (#4808))
177184
// LogLevel sets the logging level for the online store service
178185
// Allowed values: "debug", "info", "warning", "error", "critical".
179186
// +kubebuilder:validation:Enum=debug;info;warning;error;critical
180187
LogLevel string `json:"logLevel,omitempty"`
188+
<<<<<<< HEAD
181189
=======
182190
>>>>>>> 668d47b8e (feat: Add TLS support to the Operator (#4796))
191+
=======
192+
>>>>>>> fb0874ae1 (feat: Feast Operator support log level configuration for services (#4808))
183193
}
184194

185195
// OnlineStorePersistence configures the persistence settings for the online store service
@@ -267,12 +277,18 @@ type LocalRegistryConfig struct {
267277
Persistence *RegistryPersistence `json:"persistence,omitempty"`
268278
TLS *TlsConfigs `json:"tls,omitempty"`
269279
<<<<<<< HEAD
280+
<<<<<<< HEAD
281+
=======
282+
>>>>>>> fb0874ae1 (feat: Feast Operator support log level configuration for services (#4808))
270283
// LogLevel sets the logging level for the registry service
271284
// Allowed values: "debug", "info", "warning", "error", "critical".
272285
// +kubebuilder:validation:Enum=debug;info;warning;error;critical
273286
LogLevel string `json:"logLevel,omitempty"`
287+
<<<<<<< HEAD
274288
=======
275289
>>>>>>> 668d47b8e (feat: Add TLS support to the Operator (#4796))
290+
=======
291+
>>>>>>> fb0874ae1 (feat: Feast Operator support log level configuration for services (#4808))
276292
}
277293

278294
// RegistryPersistence configures the persistence settings for the registry service

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

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ var _ = Describe("FeatureStore Controller - Feast service LogLevel", func() {
154154
Expect(cond.Message).To(Equal(feastdevv1alpha1.OnlineStoreReadyMessage))
155155
Expect(resource.Status.Phase).To(Equal(feastdevv1alpha1.ReadyPhase))
156156

157+
<<<<<<< HEAD
157158
// check deployment
158159
deploy := &appsv1.Deployment{}
159160
objMeta := feast.GetObjectMeta()
@@ -174,6 +175,45 @@ var _ = Describe("FeatureStore Controller - Feast service LogLevel", func() {
174175
Expect(command).To(ContainElement("INFO"))
175176

176177
command = services.GetOnlineContainer(deploy.Spec.Template.Spec.Containers).Command
178+
=======
179+
deploy := &appsv1.Deployment{}
180+
err = k8sClient.Get(ctx, types.NamespacedName{
181+
Name: feast.GetFeastServiceName(services.RegistryFeastType),
182+
Namespace: resource.Namespace,
183+
},
184+
deploy)
185+
Expect(err).NotTo(HaveOccurred())
186+
Expect(deploy.Spec.Replicas).To(Equal(&services.DefaultReplicas))
187+
Expect(controllerutil.HasControllerReference(deploy)).To(BeTrue())
188+
Expect(deploy.Spec.Template.Spec.Containers).To(HaveLen(1))
189+
command := deploy.Spec.Template.Spec.Containers[0].Command
190+
Expect(command).To(ContainElement("--log-level"))
191+
Expect(command).To(ContainElement("ERROR"))
192+
193+
err = k8sClient.Get(ctx, types.NamespacedName{
194+
Name: feast.GetFeastServiceName(services.OfflineFeastType),
195+
Namespace: resource.Namespace,
196+
},
197+
deploy)
198+
Expect(err).NotTo(HaveOccurred())
199+
Expect(deploy.Spec.Replicas).To(Equal(&services.DefaultReplicas))
200+
Expect(controllerutil.HasControllerReference(deploy)).To(BeTrue())
201+
Expect(deploy.Spec.Template.Spec.Containers).To(HaveLen(1))
202+
command = deploy.Spec.Template.Spec.Containers[0].Command
203+
Expect(command).To(ContainElement("--log-level"))
204+
Expect(command).To(ContainElement("INFO"))
205+
206+
err = k8sClient.Get(ctx, types.NamespacedName{
207+
Name: feast.GetFeastServiceName(services.OnlineFeastType),
208+
Namespace: resource.Namespace,
209+
},
210+
deploy)
211+
Expect(err).NotTo(HaveOccurred())
212+
Expect(deploy.Spec.Replicas).To(Equal(&services.DefaultReplicas))
213+
Expect(controllerutil.HasControllerReference(deploy)).To(BeTrue())
214+
Expect(deploy.Spec.Template.Spec.Containers).To(HaveLen(1))
215+
command = deploy.Spec.Template.Spec.Containers[0].Command
216+
>>>>>>> fb0874ae1 (feat: Feast Operator support log level configuration for services (#4808))
177217
Expect(command).To(ContainElement("--log-level"))
178218
Expect(command).To(ContainElement("DEBUG"))
179219
})
@@ -212,6 +252,7 @@ var _ = Describe("FeatureStore Controller - Feast service LogLevel", func() {
212252
},
213253
}
214254

255+
<<<<<<< HEAD
215256
// check deployment
216257
deploy := &appsv1.Deployment{}
217258
objMeta := feast.GetObjectMeta()
@@ -228,6 +269,34 @@ var _ = Describe("FeatureStore Controller - Feast service LogLevel", func() {
228269
Expect(command).NotTo(ContainElement("--log-level"))
229270

230271
command = services.GetOnlineContainer(deploy.Spec.Template.Spec.Containers).Command
272+
=======
273+
deploy := &appsv1.Deployment{}
274+
err = k8sClient.Get(ctx, types.NamespacedName{
275+
Name: feast.GetFeastServiceName(services.RegistryFeastType),
276+
Namespace: resource.Namespace,
277+
}, deploy)
278+
Expect(err).NotTo(HaveOccurred())
279+
Expect(deploy.Spec.Template.Spec.Containers).To(HaveLen(1))
280+
command := deploy.Spec.Template.Spec.Containers[0].Command
281+
Expect(command).NotTo(ContainElement("--log-level"))
282+
283+
err = k8sClient.Get(ctx, types.NamespacedName{
284+
Name: feast.GetFeastServiceName(services.OfflineFeastType),
285+
Namespace: resource.Namespace,
286+
}, deploy)
287+
Expect(err).NotTo(HaveOccurred())
288+
Expect(deploy.Spec.Template.Spec.Containers).To(HaveLen(1))
289+
command = deploy.Spec.Template.Spec.Containers[0].Command
290+
Expect(command).NotTo(ContainElement("--log-level"))
291+
292+
err = k8sClient.Get(ctx, types.NamespacedName{
293+
Name: feast.GetFeastServiceName(services.OnlineFeastType),
294+
Namespace: resource.Namespace,
295+
}, deploy)
296+
Expect(err).NotTo(HaveOccurred())
297+
Expect(deploy.Spec.Template.Spec.Containers).To(HaveLen(1))
298+
command = deploy.Spec.Template.Spec.Containers[0].Command
299+
>>>>>>> fb0874ae1 (feat: Feast Operator support log level configuration for services (#4808))
231300
Expect(command).NotTo(ContainElement("--log-level"))
232301
})
233302

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

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -724,25 +724,36 @@ func (feast *FeastServices) setService(svc *corev1.Service, feastType FeastServi
724724

725725
=======
726726
func (feast *FeastServices) getContainerCommand(feastType FeastServiceType) []string {
727+
baseCommand := "feast"
728+
options := []string{}
729+
logLevel := feast.getLogLevelForType(feastType)
730+
if logLevel != nil {
731+
options = append(options, "--log-level", strings.ToUpper(*logLevel))
732+
}
733+
727734
deploySettings := FeastServiceConstants[feastType]
728735
targetPort := deploySettings.TargetHttpPort
729736
tls := feast.getTlsConfigs(feastType)
730737
if tls.IsTLS() {
731738
targetPort = deploySettings.TargetHttpsPort
732739
feastTlsPath := GetTlsPath(feastType)
733-
deploySettings.Command = append(deploySettings.Command, []string{"--key", feastTlsPath + tls.SecretKeyNames.TlsKey,
740+
deploySettings.Args = append(deploySettings.Args, []string{"--key", feastTlsPath + tls.SecretKeyNames.TlsKey,
734741
"--cert", feastTlsPath + tls.SecretKeyNames.TlsCrt}...)
735742
}
736-
deploySettings.Command = append(deploySettings.Command, []string{"-p", strconv.Itoa(int(targetPort))}...)
743+
deploySettings.Args = append(deploySettings.Args, []string{"-p", strconv.Itoa(int(targetPort))}...)
737744

738745
if feastType == OfflineFeastType {
739746
if tls.IsTLS() && feast.Handler.FeatureStore.Status.Applied.Services.OfflineStore.TLS.VerifyClient != nil {
740-
deploySettings.Command = append(deploySettings.Command,
747+
deploySettings.Args = append(deploySettings.Args,
741748
[]string{"--verify_client", strconv.FormatBool(*feast.Handler.FeatureStore.Status.Applied.Services.OfflineStore.TLS.VerifyClient)}...)
742749
}
743750
}
744751

745-
return deploySettings.Command
752+
// Combine base command, options, and arguments
753+
feastCommand := append([]string{baseCommand}, options...)
754+
feastCommand = append(feastCommand, deploySettings.Args...)
755+
756+
return feastCommand
746757
}
747758

748759
func (feast *FeastServices) offlineClientPodConfigs(podSpec *corev1.PodSpec) {
@@ -897,6 +908,9 @@ func (feast *FeastServices) getServiceConfigs(feastType FeastServiceType) feastd
897908
}
898909

899910
<<<<<<< HEAD
911+
<<<<<<< HEAD
912+
=======
913+
>>>>>>> fb0874ae1 (feat: Feast Operator support log level configuration for services (#4808))
900914
func (feast *FeastServices) getLogLevelForType(feastType FeastServiceType) *string {
901915
services := feast.Handler.FeatureStore.Status.Applied.Services
902916
switch feastType {
@@ -916,6 +930,7 @@ func (feast *FeastServices) getLogLevelForType(feastType FeastServiceType) *stri
916930
return nil
917931
}
918932

933+
<<<<<<< HEAD
919934
// GetObjectMeta returns the feast k8s object metadata with type
920935
func (feast *FeastServices) GetObjectMeta() metav1.ObjectMeta {
921936
return metav1.ObjectMeta{Name: GetFeastName(feast.Handler.FeatureStore), Namespace: feast.Handler.FeatureStore.Namespace}
@@ -924,6 +939,8 @@ func (feast *FeastServices) GetObjectMeta() metav1.ObjectMeta {
924939
// GetObjectMeta returns the feast k8s object metadata with type
925940
func (feast *FeastServices) GetObjectMetaType(feastType FeastServiceType) metav1.ObjectMeta {
926941
=======
942+
=======
943+
>>>>>>> fb0874ae1 (feat: Feast Operator support log level configuration for services (#4808))
927944
// GetObjectMeta returns the feast k8s object metadata
928945
func (feast *FeastServices) GetObjectMeta(feastType FeastServiceType) metav1.ObjectMeta {
929946
>>>>>>> 39eb4d80c (feat: RBAC Authorization in Feast Operator (#4786))

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,29 +125,41 @@ var (
125125

126126
FeastServiceConstants = map[FeastServiceType]deploymentSettings{
127127
OfflineFeastType: {
128+
<<<<<<< HEAD
128129
<<<<<<< HEAD
129130
Args: []string{"serve_offline", "-h", "0.0.0.0"},
130131
=======
131132
Command: []string{"feast", "serve_offline", "-h", "0.0.0.0"},
132133
>>>>>>> 668d47b8e (feat: Add TLS support to the Operator (#4796))
134+
=======
135+
Args: []string{"serve_offline", "-h", "0.0.0.0"},
136+
>>>>>>> fb0874ae1 (feat: Feast Operator support log level configuration for services (#4808))
133137
TargetHttpPort: 8815,
134138
TargetHttpsPort: 8816,
135139
},
136140
OnlineFeastType: {
141+
<<<<<<< HEAD
137142
<<<<<<< HEAD
138143
Args: []string{"serve", "-h", "0.0.0.0"},
139144
=======
140145
Command: []string{"feast", "serve", "-h", "0.0.0.0"},
141146
>>>>>>> 668d47b8e (feat: Add TLS support to the Operator (#4796))
147+
=======
148+
Args: []string{"serve", "-h", "0.0.0.0"},
149+
>>>>>>> fb0874ae1 (feat: Feast Operator support log level configuration for services (#4808))
142150
TargetHttpPort: 6566,
143151
TargetHttpsPort: 6567,
144152
},
145153
RegistryFeastType: {
154+
<<<<<<< HEAD
146155
<<<<<<< HEAD
147156
Args: []string{"serve_registry"},
148157
=======
149158
Command: []string{"feast", "serve_registry"},
150159
>>>>>>> 668d47b8e (feat: Add TLS support to the Operator (#4796))
160+
=======
161+
Args: []string{"serve_registry"},
162+
>>>>>>> fb0874ae1 (feat: Feast Operator support log level configuration for services (#4808))
151163
TargetHttpPort: 6570,
152164
TargetHttpsPort: 6571,
153165
},
@@ -331,6 +343,7 @@ type AuthzConfig struct {
331343

332344
type deploymentSettings struct {
333345
Args []string
346+
<<<<<<< HEAD
334347
TargetHttpPort int32
335348
TargetHttpsPort int32
336349
=======
@@ -348,6 +361,8 @@ type deploymentSettings struct {
348361
>>>>>>> 39eb4d80c (feat: RBAC Authorization in Feast Operator (#4786))
349362
=======
350363
Command []string
364+
=======
365+
>>>>>>> fb0874ae1 (feat: Feast Operator support log level configuration for services (#4808))
351366
TargetHttpPort int32
352367
TargetHttpsPort int32
353368
>>>>>>> 668d47b8e (feat: Add TLS support to the Operator (#4796))

0 commit comments

Comments
 (0)