Skip to content

Commit

Permalink
Merge branch 'feast-dev:master' into auth_k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
dmartinol authored Nov 28, 2024
2 parents 3e457f1 + e198b17 commit faf215f
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 36 deletions.
18 changes: 9 additions & 9 deletions infra/feast-operator/api/v1alpha1/featurestore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ var ValidOfflineStoreFilePersistenceTypes = []string{
// OfflineStoreDBStorePersistence configures the DB store persistence for the offline store service
type OfflineStoreDBStorePersistence struct {
// +kubebuilder:validation:Enum=snowflake.offline;bigquery;redshift;spark;postgres;feast_trino.trino.TrinoOfflineStore;redis
Type string `json:"type,omitempty"`
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty"`
SecretKeyName string `json:"secretKeyName,omitempty"`
Type string `json:"type"`
SecretRef corev1.LocalObjectReference `json:"secretRef"`
SecretKeyName string `json:"secretKeyName,omitempty"`
}

var ValidOfflineStoreDBStorePersistenceTypes = []string{
Expand Down Expand Up @@ -140,9 +140,9 @@ type OnlineStoreFilePersistence struct {
// OnlineStoreDBStorePersistence configures the DB store persistence for the offline store service
type OnlineStoreDBStorePersistence struct {
// +kubebuilder:validation:Enum=snowflake.online;redis;ikv;datastore;dynamodb;bigtable;postgres;cassandra;mysql;hazelcast;singlestore
Type string `json:"type,omitempty"`
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty"`
SecretKeyName string `json:"secretKeyName,omitempty"`
Type string `json:"type"`
SecretRef corev1.LocalObjectReference `json:"secretRef"`
SecretKeyName string `json:"secretKeyName,omitempty"`
}

var ValidOnlineStoreDBStorePersistenceTypes = []string{
Expand Down Expand Up @@ -185,9 +185,9 @@ type RegistryFilePersistence struct {
// RegistryDBStorePersistence configures the DB store persistence for the registry service
type RegistryDBStorePersistence struct {
// +kubebuilder:validation:Enum=sql;snowflake.registry
Type string `json:"type,omitempty"`
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty"`
SecretKeyName string `json:"secretKeyName,omitempty"`
Type string `json:"type"`
SecretRef corev1.LocalObjectReference `json:"secretRef"`
SecretKeyName string `json:"secretKeyName,omitempty"`
}

var ValidRegistryDBStorePersistenceTypes = []string{
Expand Down
24 changes: 6 additions & 18 deletions infra/feast-operator/api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 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 @@ -321,6 +321,9 @@ spec:
- feast_trino.trino.TrinoOfflineStore
- redis
type: string
required:
- secretRef
- type
type: object
type: object
x-kubernetes-validations:
Expand Down Expand Up @@ -636,6 +639,9 @@ spec:
- hazelcast
- singlestore
type: string
required:
- secretRef
- type
type: object
type: object
x-kubernetes-validations:
Expand Down Expand Up @@ -959,6 +965,9 @@ spec:
- sql
- snowflake.registry
type: string
required:
- secretRef
- type
type: object
type: object
resources:
Expand Down Expand Up @@ -1336,6 +1345,9 @@ spec:
- feast_trino.trino.TrinoOfflineStore
- redis
type: string
required:
- secretRef
- type
type: object
type: object
x-kubernetes-validations:
Expand Down Expand Up @@ -1656,6 +1668,9 @@ spec:
- hazelcast
- singlestore
type: string
required:
- secretRef
- type
type: object
type: object
x-kubernetes-validations:
Expand Down Expand Up @@ -1987,6 +2002,9 @@ spec:
- sql
- snowflake.registry
type: string
required:
- secretRef
- type
type: object
type: object
resources:
Expand Down
18 changes: 18 additions & 0 deletions infra/feast-operator/dist/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ spec:
- feast_trino.trino.TrinoOfflineStore
- redis
type: string
required:
- secretRef
- type
type: object
type: object
x-kubernetes-validations:
Expand Down Expand Up @@ -644,6 +647,9 @@ spec:
- hazelcast
- singlestore
type: string
required:
- secretRef
- type
type: object
type: object
x-kubernetes-validations:
Expand Down Expand Up @@ -967,6 +973,9 @@ spec:
- sql
- snowflake.registry
type: string
required:
- secretRef
- type
type: object
type: object
resources:
Expand Down Expand Up @@ -1344,6 +1353,9 @@ spec:
- feast_trino.trino.TrinoOfflineStore
- redis
type: string
required:
- secretRef
- type
type: object
type: object
x-kubernetes-validations:
Expand Down Expand Up @@ -1664,6 +1676,9 @@ spec:
- hazelcast
- singlestore
type: string
required:
- secretRef
- type
type: object
type: object
x-kubernetes-validations:
Expand Down Expand Up @@ -1995,6 +2010,9 @@ spec:
- sql
- snowflake.registry
type: string
required:
- secretRef
- type
type: object
type: object
resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ var _ = Describe("Repo Config", func() {
Persistence: &feastdevv1alpha1.OfflineStorePersistence{
DBPersistence: &feastdevv1alpha1.OfflineStoreDBStorePersistence{
Type: string(OfflineDBPersistenceSnowflakeConfigType),
SecretRef: &corev1.LocalObjectReference{
SecretRef: corev1.LocalObjectReference{
Name: "offline-test-secret",
},
},
Expand All @@ -269,7 +269,7 @@ var _ = Describe("Repo Config", func() {
Persistence: &feastdevv1alpha1.OnlineStorePersistence{
DBPersistence: &feastdevv1alpha1.OnlineStoreDBStorePersistence{
Type: string(OnlineDBPersistenceSnowflakeConfigType),
SecretRef: &corev1.LocalObjectReference{
SecretRef: corev1.LocalObjectReference{
Name: "online-test-secret",
},
},
Expand All @@ -280,7 +280,7 @@ var _ = Describe("Repo Config", func() {
Persistence: &feastdevv1alpha1.RegistryPersistence{
DBPersistence: &feastdevv1alpha1.RegistryDBStorePersistence{
Type: string(RegistryDBPersistenceSnowflakeConfigType),
SecretRef: &corev1.LocalObjectReference{
SecretRef: corev1.LocalObjectReference{
Name: "registry-test-secret",
},
},
Expand Down
6 changes: 3 additions & 3 deletions infra/feast-operator/internal/controller/services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (feast *FeastServices) validateRegistryPersistence(registryPersistence *fea
return err
}

if dbPersistence.SecretRef != nil {
if len(dbPersistence.SecretRef.Name) > 0 {
secretRef := dbPersistence.SecretRef.Name
if _, err := feast.getSecret(secretRef); err != nil {
return err
Expand All @@ -132,7 +132,7 @@ func (feast *FeastServices) validateOnlineStorePersistence(onlinePersistence *fe
return err
}

if dbPersistence.SecretRef != nil {
if len(dbPersistence.SecretRef.Name) > 0 {
secretRef := dbPersistence.SecretRef.Name
if _, err := feast.getSecret(secretRef); err != nil {
return err
Expand All @@ -159,7 +159,7 @@ func (feast *FeastServices) validateOfflineStorePersistence(offlinePersistence *
return err
}

if dbPersistence.SecretRef != nil {
if len(dbPersistence.SecretRef.Name) > 0 {
secretRef := dbPersistence.SecretRef.Name
if _, err := feast.getSecret(secretRef); err != nil {
return err
Expand Down
42 changes: 41 additions & 1 deletion sdk/python/feast/infra/online_stores/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import sqlite3
import struct
import sys
from datetime import datetime
from datetime import date, datetime
from pathlib import Path
from typing import Any, Callable, Dict, List, Literal, Optional, Sequence, Tuple, Union

Expand All @@ -39,6 +39,46 @@
from feast.utils import _build_retrieve_online_document_record, to_naive_utc


def adapt_date_iso(val: date):
"""Adapt datetime.date to ISO 8601 date."""
return val.isoformat()


def adapt_datetime_iso(val: datetime):
"""Adapt datetime.datetime to timezone-naive ISO 8601 date."""
return val.isoformat()


def adapt_datetime_epoch(val: datetime):
"""Adapt datetime.datetime to Unix timestamp."""
return int(val.timestamp())


sqlite3.register_adapter(date, adapt_date_iso)
sqlite3.register_adapter(datetime, adapt_datetime_iso)
sqlite3.register_adapter(datetime, adapt_datetime_epoch)


def convert_date(val: bytes):
"""Convert ISO 8601 date to datetime.date object."""
return date.fromisoformat(val.decode())


def convert_datetime(val: bytes):
"""Convert ISO 8601 datetime to datetime.datetime object."""
return datetime.fromisoformat(val.decode())


def convert_timestamp(val: bytes):
"""Convert Unix epoch timestamp to datetime.datetime object."""
return datetime.fromtimestamp(int(val))


sqlite3.register_converter("date", convert_date)
sqlite3.register_converter("datetime", convert_datetime)
sqlite3.register_converter("timestamp", convert_timestamp)


class SqliteOnlineStoreConfig(FeastConfigBaseModel, VectorStoreConfig):
"""Online store config for local (SQLite-based) store"""

Expand Down
2 changes: 1 addition & 1 deletion sdk/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ select = ["E","F","W","I"]
ignore = ["E203", "E266", "E501", "E721"]

[tool.ruff.lint.isort]
known-first-party = ["feast", "feast", "feast_serving_server", "feast_core_server"]
known-first-party = ["feast", "feast_serving_server", "feast_core_server"]
default-section = "third-party"

[tool.mypy]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"build",
"virtualenv==20.23.0",
"cryptography>=35.0,<43",
"ruff>=0.3.3",
"ruff>=0.8.0",
"mypy-protobuf>=3.1",
"grpcio-tools>=1.56.2,<2",
"grpcio-testing>=1.56.2,<2",
Expand Down

0 comments on commit faf215f

Please sign in to comment.