Skip to content

Commit

Permalink
add replica support to operator
Browse files Browse the repository at this point in the history
Signed-off-by: dandawg <[email protected]>
  • Loading branch information
dandawg committed Dec 5, 2024
1 parent dc9f825 commit 9313b2b
Show file tree
Hide file tree
Showing 13 changed files with 354 additions and 92 deletions.
40 changes: 26 additions & 14 deletions infra/feast-operator/api/v1alpha1/featurestore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ type FeatureStoreServices struct {

// OfflineStore configures the deployed offline store service
type OfflineStore struct {
ServiceConfigs `json:",inline"`
Persistence *OfflineStorePersistence `json:"persistence,omitempty"`
TLS *OfflineTlsConfigs `json:"tls,omitempty"`
StoreServiceConfigs `json:",inline"`
Persistence *OfflineStorePersistence `json:"persistence,omitempty"`
TLS *OfflineTlsConfigs `json:"tls,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 @@ -127,9 +127,9 @@ var ValidOfflineStoreDBStorePersistenceTypes = []string{

// OnlineStore configures the deployed online store service
type OnlineStore struct {
ServiceConfigs `json:",inline"`
Persistence *OnlineStorePersistence `json:"persistence,omitempty"`
TLS *TlsConfigs `json:"tls,omitempty"`
StoreServiceConfigs `json:",inline"`
Persistence *OnlineStorePersistence `json:"persistence,omitempty"`
TLS *TlsConfigs `json:"tls,omitempty"`
}

// OnlineStorePersistence configures the persistence settings for the online store service
Expand Down Expand Up @@ -174,9 +174,9 @@ var ValidOnlineStoreDBStorePersistenceTypes = []string{

// LocalRegistryConfig configures the deployed registry service
type LocalRegistryConfig struct {
ServiceConfigs `json:",inline"`
Persistence *RegistryPersistence `json:"persistence,omitempty"`
TLS *TlsConfigs `json:"tls,omitempty"`
RegistryServiceConfigs `json:",inline"`
Persistence *RegistryPersistence `json:"persistence,omitempty"`
TLS *TlsConfigs `json:"tls,omitempty"`
}

// RegistryPersistence configures the persistence settings for the registry service
Expand Down Expand Up @@ -267,10 +267,15 @@ type FeatureStoreRef struct {
Namespace string `json:"namespace,omitempty"`
}

// ServiceConfigs k8s container settings
type ServiceConfigs struct {
DefaultConfigs `json:",inline"`
OptionalConfigs `json:",inline"`
// ServiceConfigs k8s settings
type StoreServiceConfigs struct {
DefaultConfigs `json:",inline"`
StoreOptionalConfigs `json:",inline"`
}

type RegistryServiceConfigs struct {
DefaultConfigs `json:",inline"`
RegistryOptionalConfigs `json:",inline"`
}

// DefaultConfigs k8s container settings that are applied by default
Expand All @@ -279,7 +284,14 @@ type DefaultConfigs struct {
}

// OptionalConfigs k8s container settings that are optional
type OptionalConfigs struct {
type RegistryOptionalConfigs struct {
Env *[]corev1.EnvVar `json:"env,omitempty"`
ImagePullPolicy *corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
}

type StoreOptionalConfigs struct {
Replicas *int32 `json:"replicas,omitempty"`
Env *[]corev1.EnvVar `json:"env,omitempty"`
ImagePullPolicy *corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
Expand Down
156 changes: 107 additions & 49 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.

12 changes: 12 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 @@ -355,6 +355,9 @@ spec:
x-kubernetes-validations:
- message: One selection required between file or store.
rule: '[has(self.file), has(self.store)].exists_one(c, c)'
replicas:
format: int32
type: integer
resources:
description: ResourceRequirements describes the compute resource
requirements.
Expand Down Expand Up @@ -716,6 +719,9 @@ spec:
x-kubernetes-validations:
- message: One selection required between file or store.
rule: '[has(self.file), has(self.store)].exists_one(c, c)'
replicas:
format: int32
type: integer
resources:
description: ResourceRequirements describes the compute resource
requirements.
Expand Down Expand Up @@ -1560,6 +1566,9 @@ spec:
- message: One selection required between file or store.
rule: '[has(self.file), has(self.store)].exists_one(c,
c)'
replicas:
format: int32
type: integer
resources:
description: ResourceRequirements describes the compute
resource requirements.
Expand Down Expand Up @@ -1928,6 +1937,9 @@ spec:
- message: One selection required between file or store.
rule: '[has(self.file), has(self.store)].exists_one(c,
c)'
replicas:
format: int32
type: integer
resources:
description: ResourceRequirements describes the compute
resource requirements.
Expand Down
12 changes: 12 additions & 0 deletions infra/feast-operator/dist/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ spec:
x-kubernetes-validations:
- message: One selection required between file or store.
rule: '[has(self.file), has(self.store)].exists_one(c, c)'
replicas:
format: int32
type: integer
resources:
description: ResourceRequirements describes the compute resource
requirements.
Expand Down Expand Up @@ -724,6 +727,9 @@ spec:
x-kubernetes-validations:
- message: One selection required between file or store.
rule: '[has(self.file), has(self.store)].exists_one(c, c)'
replicas:
format: int32
type: integer
resources:
description: ResourceRequirements describes the compute resource
requirements.
Expand Down Expand Up @@ -1568,6 +1574,9 @@ spec:
- message: One selection required between file or store.
rule: '[has(self.file), has(self.store)].exists_one(c,
c)'
replicas:
format: int32
type: integer
resources:
description: ResourceRequirements describes the compute
resource requirements.
Expand Down Expand Up @@ -1936,6 +1945,9 @@ spec:
- message: One selection required between file or store.
rule: '[has(self.file), has(self.store)].exists_one(c,
c)'
replicas:
format: int32
type: integer
resources:
description: ResourceRequirements describes the compute
resource requirements.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ var _ = Describe("FeatureStore Controller - db storage services", func() {
Context("When deploying a resource with all db storage services", func() {
const resourceName = "cr-name"
var pullPolicy = corev1.PullAlways
var replicas = int32(1)

ctx := context.Background()

Expand Down Expand Up @@ -205,7 +206,7 @@ var _ = Describe("FeatureStore Controller - db storage services", func() {
By("creating the custom resource for the Kind FeatureStore")
err = k8sClient.Get(ctx, typeNamespacedName, featurestore)
if err != nil && errors.IsNotFound(err) {
resource := createFeatureStoreResource(resourceName, image, pullPolicy, &[]corev1.EnvVar{})
resource := createFeatureStoreResource(resourceName, image, pullPolicy, replicas, &[]corev1.EnvVar{})
resource.Spec.Services.OfflineStore.Persistence = &feastdevv1alpha1.OfflineStorePersistence{
DBPersistence: &feastdevv1alpha1.OfflineStoreDBStorePersistence{
Type: string(offlineType),
Expand Down
Loading

0 comments on commit 9313b2b

Please sign in to comment.