feast-dev / feast

The Open Source Feature Store for Machine Learning
https://feast.dev
Apache License 2.0
5.62k stars 1k forks source link

feat: Add services functionality to Operator #4723

Closed tchughesiv closed 3 weeks ago

tchughesiv commented 3 weeks ago

What this PR does / why we need it:

This PR provides Operator users the ability to deploy the following ephemeral feast services:

Any k8s services related to these feast service types, that are created/owned by the Operator CR, will be cleaned up should a user change their mind and remove said service from the CR config.

A user can affect several k8s container configs for each service type:

Additionally, we allow the user to point to a remote registry if they so choose. This would be instead of deploying a local registry with the FeatureStore CR.

Which issue(s) this PR fixes:

Relates to https://github.com/feast-dev/feast/issues/4561

Misc

Deployed CR examples

CR w/ defaults set in status... this deploys an ephemeral registry server -

apiVersion: feast.dev/v1alpha1
kind: FeatureStore
metadata:
 name: sample
  namespace: feast-operator-system
spec:
  feastProject: my_project
status:
  applied:
    feastProject: my_project
    services:
      registry:
        local:
          image: 'feastdev/feature-server:0.41.0'
  clientConfigMap: feast-sample-client
  conditions:
    - lastTransitionTime: '2024-10-31T18:02:46Z'
      message: Registry installation complete
      reason: Ready
      status: 'True'
      type: Registry
    - lastTransitionTime: '2024-10-31T18:02:46Z'
      message: Client installation complete
      reason: Ready
      status: 'True'
      type: Client
    - lastTransitionTime: '2024-10-31T18:02:46Z'
      message: FeatureStore installation complete
      reason: Ready
      status: 'True'
      type: FeatureStore
  feastVersion: 0.41.0
  phase: Ready
  serviceHostnames:
    registry: 'feast-sample-registry.feast-operator-system.svc.cluster.local:80'

CR w/ onlineStore, offlineStore, and a remote registry set in status... this deploys ephemeral online & offline stores, both pointed to a remote registry running in a separate namespace -

apiVersion: feast.dev/v1alpha1
kind: FeatureStore
metadata:
  name: sample
  namespace: feast-operator-system
spec:
  feastProject: my_project
  services:
    offlineStore: {}
    onlineStore:
      imagePullPolicy: Always
    registry:
      remote:
        feastRef:
          name: example
          namespace: default
status:
  applied:
    feastProject: my_project
    services:
      offlineStore:
        image: 'feastdev/feature-server:0.41.0'
      onlineStore:
        image: 'feastdev/feature-server:0.41.0'
        imagePullPolicy: Always
      registry:
        remote:
          feastRef:
            name: example
            namespace: default
  clientConfigMap: feast-sample-client
  conditions:
    - lastTransitionTime: '2024-10-31T18:02:46Z'
      message: Client installation complete
      reason: Ready
      status: 'True'
      type: Client
    - lastTransitionTime: '2024-10-31T18:02:46Z'
      message: FeatureStore installation complete
      reason: Ready
      status: 'True'
      type: FeatureStore
    - lastTransitionTime: '2024-10-31T18:45:49Z'
      message: Offline Store installation complete
      reason: Ready
      status: 'True'
      type: OfflineStore
    - lastTransitionTime: '2024-10-31T18:45:49Z'
      message: Online Store installation complete
      reason: Ready
      status: 'True'
      type: OnlineStore
  feastVersion: 0.41.0
  phase: Ready
  serviceHostnames:
    offlineStore: 'feast-sample-offline.feast-operator-system.svc.cluster.local:80'
    onlineStore: 'feast-sample-online.feast-operator-system.svc.cluster.local:80'
    registry: 'feast-example-registry.default.svc.cluster.local:80'

The above CR, produces the following feature_store.yaml config for the running onlineStore service -

$ kubectl get deploy feast-sample-online -o jsonpath='{.spec.template.spec.containers[*].env[?(@.name=="FEATURE_STORE_YAML_BASE64")].value}' | base64 -d

project: my_project
provider: local
offline_store:
    host: feast-sample-offline.feast-operator-system.svc.cluster.local
    type: remote
    port: 80
online_store:
    path: /tmp/online_store.db
    type: sqlite
registry:
    path: feast-example-registry.default.svc.cluster.local:80
    registry_type: remote
entity_key_serialization_version: 3

It also produces the following ConfigMap w/ client feature_store.yaml -

$ kubectl get cm feast-sample-client -o jsonpath='{.data.feature\_store\.yaml}'

project: my_project
provider: local
offline_store:
    host: feast-sample-offline.feast-operator-system.svc.cluster.local
    type: remote
    port: 80
online_store:
    path: http://feast-sample-online.feast-operator-system.svc.cluster.local:80
    type: remote
registry:
    path: feast-example-registry.default.svc.cluster.local:80
    registry_type: remote
entity_key_serialization_version: 3
tmihalac commented 3 weeks ago

lgtm