Skip to content

Commit

Permalink
improved CRD comments and using IsLocalRegistry
Browse files Browse the repository at this point in the history
Signed-off-by: Daniele Martinoli <[email protected]>
  • Loading branch information
dmartinol committed Nov 25, 2024
1 parent 7484764 commit 0788dc5
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 5 deletions.
8 changes: 8 additions & 0 deletions infra/feast-operator/api/v1alpha1/featurestore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,15 @@ type AuthConfig struct {
KubernetesAuth *KubernetesAuth `json:"kubernetes,omitempty"`
}

// KubernetesAuth provides a way to define the authorization settings using Kubernetes RBAC resources.
// https://kubernetes.io/docs/reference/access-authn-authz/rbac/
type KubernetesAuth struct {
// The Kubernetes RBAC roles to be deployed in the same namespace of the FeatureStore.
// Roles are managed by the operator and created with an empty list of rules.
// See the Feast permission model at https://docs.feast.dev/getting-started/concepts/permission
// The feature store admin is not obligated to manage roles using the Feast operator, roles can be managed independently.
// This configuration option is only providing a way to automate this procedure.
// Important note: the operator cannot ensure that these roles will match the ones used in the configured Feast permissions.
Roles []string `json:"roles,omitempty"`
}

Expand Down
20 changes: 20 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 @@ -53,8 +53,18 @@ spec:
deployed Feast services.
properties:
kubernetes:
description: |-
KubernetesAuth provides a way to define the authorization settings using Kubernetes RBAC resources.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/
properties:
roles:
description: |-
The Kubernetes RBAC roles to be deployed in the same namespace of the FeatureStore.
Roles are managed by the operator and created with an empty list of rules.
See the Feast permission model at https://docs.feast.dev/getting-started/concepts/permission
The feature store admin is not obligated to manage roles using the Feast operator, roles can be managed independently.
This configuration option is only providing a way to automate this procedure.
Important note: the operator cannot ensure that these roles will match the ones used in the configured Feast permissions.
items:
type: string
type: array
Expand Down Expand Up @@ -961,8 +971,18 @@ spec:
the deployed Feast services.
properties:
kubernetes:
description: |-
KubernetesAuth provides a way to define the authorization settings using Kubernetes RBAC resources.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/
properties:
roles:
description: |-
The Kubernetes RBAC roles to be deployed in the same namespace of the FeatureStore.
Roles are managed by the operator and created with an empty list of rules.
See the Feast permission model at https://docs.feast.dev/getting-started/concepts/permission
The feature store admin is not obligated to manage roles using the Feast operator, roles can be managed independently.
This configuration option is only providing a way to automate this procedure.
Important note: the operator cannot ensure that these roles will match the ones used in the configured Feast permissions.
items:
type: string
type: array
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 @@ -61,8 +61,17 @@ spec:
deployed Feast services.
properties:
kubernetes:
description: |-
KubernetesAuth defines the authorization settings using Kubernetes RBAC.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/
properties:
roles:
description: |-
The Kubernetes RBAC roles to be deployed in the same namespace of the FeatureStore.
See the Feast permission model https://docs.feast.dev/getting-started/concepts/permission
Please note that the feature store admin is not obligated to manage roles using the Feast operator.
Roles can be managed independently. This configuration is only providing a way to automate this step.
Note that the operator cannot ensure that these roles will match the ones used in the configured Feast permissions.
items:
type: string
type: array
Expand Down Expand Up @@ -969,8 +978,17 @@ spec:
the deployed Feast services.
properties:
kubernetes:
description: |-
KubernetesAuth defines the authorization settings using Kubernetes RBAC.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/
properties:
roles:
description: |-
The Kubernetes RBAC roles to be deployed in the same namespace of the FeatureStore.
See the Feast permission model https://docs.feast.dev/getting-started/concepts/permission
Please note that the feature store admin is not obligated to manage roles using the Feast operator.
Roles can be managed independently. This configuration is only providing a way to automate this step.
Note that the operator cannot ensure that these roles will match the ones used in the configured Feast permissions.
items:
type: string
type: array
Expand Down
2 changes: 1 addition & 1 deletion infra/feast-operator/internal/controller/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (auth *FeastAuth) setFeastRoleBinding(roleBinding *rbacv1.RoleBinding) erro
Namespace: auth.Handler.FeatureStore.Namespace,
})
}
if auth.Handler.FeatureStore.Status.Applied.Services.Registry != nil {
if services.IsLocalRegistry(auth.Handler.FeatureStore) {
roleBinding.Subjects = append(roleBinding.Subjects, rbacv1.Subject{
Kind: rbacv1.ServiceAccountKind,
Name: services.GetFeastServiceName(auth.Handler.FeatureStore, services.RegistryFeastType),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func getServiceRepoConfig(feastType FeastServiceType, featureStore *feastdevv1al
appliedSpec := featureStore.Status.Applied

repoConfig := getClientRepoConfig(featureStore)
isLocalRegistry := isLocalRegistry(featureStore)
isLocalRegistry := IsLocalRegistry(featureStore)
if appliedSpec.Services != nil {
services := appliedSpec.Services
switch feastType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ func (feast *FeastServices) setRemoteRegistryURL() error {
}

func (feast *FeastServices) isLocalRegistry() bool {
return isLocalRegistry(feast.Handler.FeatureStore)
return IsLocalRegistry(feast.Handler.FeatureStore)
}

func (feast *FeastServices) isRemoteRegistry() bool {
Expand Down
4 changes: 2 additions & 2 deletions infra/feast-operator/internal/controller/services/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
)

func isLocalRegistry(featureStore *feastdevv1alpha1.FeatureStore) bool {
func IsLocalRegistry(featureStore *feastdevv1alpha1.FeatureStore) bool {
appliedServices := featureStore.Status.Applied.Services
return appliedServices != nil && appliedServices.Registry != nil && appliedServices.Registry.Local != nil
}
Expand All @@ -28,7 +28,7 @@ func hasPvcConfig(featureStore *feastdevv1alpha1.FeatureStore, feastType FeastSe
pvcConfig = services.OfflineStore.Persistence.FilePersistence.PvcConfig
}
case RegistryFeastType:
if isLocalRegistry(featureStore) && services.Registry.Local.Persistence.FilePersistence != nil {
if IsLocalRegistry(featureStore) && services.Registry.Local.Persistence.FilePersistence != nil {
pvcConfig = services.Registry.Local.Persistence.FilePersistence.PvcConfig
}
}
Expand Down

0 comments on commit 0788dc5

Please sign in to comment.