Skip to content

Commit b4ed717

Browse files
committed
Add services functionality to operator
Signed-off-by: Tommy Hughes <tohughes@redhat.com>
1 parent 138176e commit b4ed717

File tree

14 files changed

+3303
-327
lines changed

14 files changed

+3303
-327
lines changed

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

Lines changed: 94 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20+
corev1 "k8s.io/api/core/v1"
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122
)
2223

@@ -27,20 +28,26 @@ const (
2728
FailedPhase = "Failed"
2829

2930
// Feast condition types:
30-
ClientReadyType = "Client"
31-
RegistryReadyType = "Registry"
32-
ReadyType = "FeatureStore"
31+
ClientReadyType = "Client"
32+
OfflineStoreReadyType = "OfflineStore"
33+
OnlineStoreReadyType = "OnlineStore"
34+
RegistryReadyType = "Registry"
35+
ReadyType = "FeatureStore"
3336

3437
// Feast condition reasons:
35-
ReadyReason = "Ready"
36-
FailedReason = "FeatureStoreFailed"
37-
RegistryFailedReason = "RegistryDeploymentFailed"
38-
ClientFailedReason = "ClientDeploymentFailed"
38+
ReadyReason = "Ready"
39+
FailedReason = "FeatureStoreFailed"
40+
OfflineStoreFailedReason = "OfflineStoreDeploymentFailed"
41+
OnlineStoreFailedReason = "OnlineStoreDeploymentFailed"
42+
RegistryFailedReason = "RegistryDeploymentFailed"
43+
ClientFailedReason = "ClientDeploymentFailed"
3944

4045
// Feast condition messages:
41-
ReadyMessage = "FeatureStore installation complete"
42-
RegistryReadyMessage = "Registry installation complete"
43-
ClientReadyMessage = "Client installation complete"
46+
ReadyMessage = "FeatureStore installation complete"
47+
OfflineStoreReadyMessage = "Offline Store installation complete"
48+
OnlineStoreReadyMessage = "Online Store installation complete"
49+
RegistryReadyMessage = "Registry installation complete"
50+
ClientReadyMessage = "Client installation complete"
4451

4552
// entity_key_serialization_version
4653
SerializationVersion = 3
@@ -50,22 +57,89 @@ const (
5057
type FeatureStoreSpec struct {
5158
// +kubebuilder:validation:Pattern="^[A-Za-z0-9][A-Za-z0-9_]*$"
5259
// FeastProject is the Feast project id. This can be any alphanumeric string with underscores, but it cannot start with an underscore. Required.
53-
FeastProject string `json:"feastProject"`
60+
FeastProject string `json:"feastProject"`
61+
Services *FeatureStoreServices `json:"services,omitempty"`
62+
}
63+
64+
// FeatureStoreServices defines the desired feast services. ephemeral registry is deployed by default.
65+
type FeatureStoreServices struct {
66+
OfflineStore *OfflineStore `json:"offlineStore,omitempty"`
67+
OnlineStore *OnlineStore `json:"onlineStore,omitempty"`
68+
Registry *Registry `json:"registry,omitempty"`
69+
}
70+
71+
// OfflineStore configures the deployed offline store service
72+
type OfflineStore struct {
73+
ServiceConfigs `json:",inline"`
74+
}
75+
76+
// OnlineStore configures the deployed online store service
77+
type OnlineStore struct {
78+
ServiceConfigs `json:",inline"`
79+
}
80+
81+
// LocalRegistryConfig configures the deployed registry service
82+
type LocalRegistryConfig struct {
83+
ServiceConfigs `json:",inline"`
84+
}
85+
86+
// Registry configures the registry service. One selection is required. Local is the default setting.
87+
// +kubebuilder:validation:XValidation:rule="[has(self.local), has(self.remote)].exists_one(c, c)",message="One selection required."
88+
type Registry struct {
89+
Local *LocalRegistryConfig `json:"local,omitempty"`
90+
Remote *RemoteRegistryConfig `json:"remote,omitempty"`
91+
}
92+
93+
// RemoteRegistryConfig points to a remote feast registry server. When set, the operator will not deploy a registry for this FeatureStore CR.
94+
// Instead, this FeatureStore CR's online/offline services will use a remote registry. One selection is required.
95+
// +kubebuilder:validation:XValidation:rule="[has(self.hostname), has(self.feastRef)].exists_one(c, c)",message="One selection required."
96+
type RemoteRegistryConfig struct {
97+
// Service host address - <domain>:<port>, e.g. `registry.namespace.svc.cluster.local:80`
98+
Hostname *string `json:"hostname,omitempty"`
99+
// Reference to an existing `FeatureStore` CR in the same k8s cluster.
100+
FeastRef *FeatureStoreRef `json:"feastRef,omitempty"`
101+
}
102+
103+
// FeatureStoreRef defines which existing FeatureStore's registry should be used
104+
type FeatureStoreRef struct {
105+
// Name of the FeatureStore
106+
Name string `json:"name"`
107+
// Namespace of the FeatureStore
108+
Namespace string `json:"namespace,omitempty"`
109+
}
110+
111+
// ServiceConfig k8s container settings
112+
type ServiceConfigs struct {
113+
DefaultConfigs `json:",inline"`
114+
OptionalConfigs `json:",inline"`
115+
}
116+
117+
// OptionalConfigs k8s container settings that are applied by default
118+
type DefaultConfigs struct {
119+
Image *string `json:"image,omitempty"`
120+
}
121+
122+
// OptionalConfigs k8s container settings that are optional
123+
type OptionalConfigs struct {
124+
ImagePullPolicy *corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
125+
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
54126
}
55127

56128
// FeatureStoreStatus defines the observed state of FeatureStore
57129
type FeatureStoreStatus struct {
58-
Applied FeatureStoreSpec `json:"applied,omitempty"`
59-
ClientConfigMap string `json:"clientConfigMap,omitempty"`
60-
Conditions []metav1.Condition `json:"conditions,omitempty"`
61-
FeastVersion string `json:"feastVersion,omitempty"`
62-
Phase string `json:"phase,omitempty"`
63-
ServiceUrls ServiceUrls `json:"serviceUrls,omitempty"`
130+
Applied FeatureStoreSpec `json:"applied,omitempty"`
131+
ClientConfigMap string `json:"clientConfigMap,omitempty"`
132+
Conditions []metav1.Condition `json:"conditions,omitempty"`
133+
FeastVersion string `json:"feastVersion,omitempty"`
134+
Phase string `json:"phase,omitempty"`
135+
ServiceHostnames ServiceHostnames `json:"serviceHostnames,omitempty"`
64136
}
65137

66-
// ServiceUrls
67-
type ServiceUrls struct {
68-
Registry string `json:"registry,omitempty"`
138+
// ServiceHostnames defines the service hostnames in the format of <domain>:<port>, e.g. example.svc.cluster.local:80
139+
type ServiceHostnames struct {
140+
OfflineStore string `json:"offlineStore,omitempty"`
141+
OnlineStore string `json:"onlineStore,omitempty"`
142+
Registry string `json:"registry,omitempty"`
69143
}
70144

71145
//+kubebuilder:object:root=true

0 commit comments

Comments
 (0)