Skip to content

Commit

Permalink
feat : Feast Operator support log level configuration for services
Browse files Browse the repository at this point in the history
Signed-off-by: Abdul Hameed <[email protected]>
  • Loading branch information
redhatHameed committed Dec 4, 2024
1 parent 6089905 commit 09dab11
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 5 deletions.
8 changes: 4 additions & 4 deletions infra/feast-operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
#
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
# feast.dev/feast-operator-bundle:$VERSION and feast.dev/feast-operator-catalog:$VERSION.
IMAGE_TAG_BASE ?= feastdev/feast-operator
IMAGE_TAG_BASE ?= quay.io/ahameed/feast-operator

# BUNDLE_IMG defines the image:tag used for the bundle.
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
Expand Down Expand Up @@ -65,7 +65,7 @@ endif
# Be aware that the target commands are only tested with Docker which is
# scaffolded by default. However, you might want to replace it to use other
# tools. (i.e. podman)
CONTAINER_TOOL ?= docker
CONTAINER_TOOL ?= podman

# Setting SHELL to bash allows bash commands to be executed by recipes.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
Expand Down Expand Up @@ -142,7 +142,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
.PHONY: docker-build
docker-build: ## Build docker image with the manager.
$(CONTAINER_TOOL) build -t ${IMG} .
$(CONTAINER_TOOL) build --platform linux/arm64 -t ${IMG} .

## Build feast docker image.
.PHONY: feast-docker-build
Expand Down Expand Up @@ -280,7 +280,7 @@ bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metada

.PHONY: bundle-build
bundle-build: ## Build the bundle image.
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
docker build --platform linux/arm64 -f bundle.Dockerfile -t $(BUNDLE_IMG) .

.PHONY: bundle-push
bundle-push: ## Push the bundle image.
Expand Down
12 changes: 12 additions & 0 deletions infra/feast-operator/api/v1alpha1/featurestore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ type OfflineStore struct {
ServiceConfigs `json:",inline"`
Persistence *OfflineStorePersistence `json:"persistence,omitempty"`
TLS *OfflineTlsConfigs `json:"tls,omitempty"`
// LogLevel sets the logging level for the offline store service
// Allowed values: "debug", "info", "warning", "error", "critical".
// +kubebuilder:validation:Enum=debug;info;warning;error;critical
LogLevel string `json:"logLevel,omitempty"`
}

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

// OnlineStorePersistence configures the persistence settings for the online store service
Expand Down Expand Up @@ -240,6 +248,10 @@ 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
66 changes: 66 additions & 0 deletions infra/feast-operator/config/crd/bases/feast.dev_featurestores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,17 @@ spec:
in an openshift cluster, for example, where TLS is configured
by default
type: boolean
logLevel:
description: |-
LogLevel sets the logging level for the offline store service
Allowed values: "debug", "info", "warning", "error", "critical".
enum:
- debug
- info
- warning
- error
- critical
type: string
secretKeyNames:
description: SecretKeyNames defines the secret key names
for the TLS key and cert.
Expand Down Expand Up @@ -550,6 +561,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 online store service
Allowed values: "debug", "info", "warning", "error", "critical".
enum:
- debug
- info
- warning
- error
- critical
type: string
persistence:
description: OnlineStorePersistence configures the persistence
settings for the online store service
Expand Down Expand Up @@ -1149,6 +1171,17 @@ 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 @@ -1569,6 +1602,17 @@ spec:
useful in an openshift cluster, for example, where
TLS is configured by default
type: boolean
logLevel:
description: |-
LogLevel sets the logging level for the offline store service
Allowed values: "debug", "info", "warning", "error", "critical".
enum:
- debug
- info
- warning
- error
- critical
type: string
secretKeyNames:
description: SecretKeyNames defines the secret key
names for the TLS key and cert.
Expand Down Expand Up @@ -1725,6 +1769,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 online store service
Allowed values: "debug", "info", "warning", "error", "critical".
enum:
- debug
- info
- warning
- error
- critical
type: string
persistence:
description: OnlineStorePersistence configures the persistence
settings for the online store service
Expand Down Expand Up @@ -2335,6 +2390,17 @@ 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
2 changes: 1 addition & 1 deletion infra/feast-operator/config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: feastdev/feast-operator
newName: quay.io/ahameed/feast-operator
newTag: 0.41.0
22 changes: 22 additions & 0 deletions infra/feast-operator/internal/controller/services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ func (feast *FeastServices) getContainerCommand(feastType FeastServiceType) []st
deploySettings := FeastServiceConstants[feastType]
targetPort := deploySettings.TargetHttpPort
tls := feast.getTlsConfigs(feastType)
logLevel := feast.getLogLevelForType(feastType)
if tls.IsTLS() {
targetPort = deploySettings.TargetHttpsPort
feastTlsPath := GetTlsPath(feastType)
Expand All @@ -372,6 +373,7 @@ func (feast *FeastServices) getContainerCommand(feastType FeastServiceType) []st
[]string{"--verify_client", strconv.FormatBool(*feast.Handler.FeatureStore.Status.Applied.Services.OfflineStore.TLS.VerifyClient)}...)
}
}
deploySettings.Command = append(deploySettings.Command, "--log-level="+strings.ToUpper(logLevel))

return deploySettings.Command
}
Expand Down Expand Up @@ -474,6 +476,26 @@ func (feast *FeastServices) getServiceConfigs(feastType FeastServiceType) feastd
return feastdevv1alpha1.ServiceConfigs{}
}

func (feast *FeastServices) getLogLevelForType(feastType FeastServiceType) string {
services := feast.Handler.FeatureStore.Status.Applied.Services
defaultLogLevel := "info"
switch feastType {
case OfflineFeastType:
if services.OfflineStore != nil && services.OfflineStore.LogLevel != "" {
return services.OfflineStore.LogLevel
}
case OnlineFeastType:
if services.OnlineStore != nil && services.OnlineStore.LogLevel != "" {
return services.OnlineStore.LogLevel
}
case RegistryFeastType:
if services.Registry != nil && services.Registry.LogLevel != "" {
return services.Registry.LogLevel
}
}
return defaultLogLevel
}

// GetObjectMeta returns the feast k8s object metadata
func (feast *FeastServices) GetObjectMeta(feastType FeastServiceType) metav1.ObjectMeta {
return metav1.ObjectMeta{Name: feast.GetFeastServiceName(feastType), Namespace: feast.Handler.FeatureStore.Namespace}
Expand Down

0 comments on commit 09dab11

Please sign in to comment.