Skip to content

Commit

Permalink
authz rbac fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Tommy Hughes <[email protected]>
  • Loading branch information
tchughesiv committed Dec 1, 2024
1 parent 648f519 commit 759ed2f
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 23 deletions.
2 changes: 1 addition & 1 deletion infra/feast-operator/api/v1alpha1/featurestore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
OnlineStoreReadyType = "OnlineStore"
RegistryReadyType = "Registry"
ReadyType = "FeatureStore"
AuthorizationReadyType = "AuthorizationReadyType"
AuthorizationReadyType = "Authorization"

// Feast condition reasons:
ReadyReason = "Ready"
Expand Down
1 change: 1 addition & 0 deletions infra/feast-operator/config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ rules:
- apiGroups:
- rbac.authorization.k8s.io
resources:
- rolebindings
- roles
verbs:
- create
Expand Down
1 change: 1 addition & 0 deletions infra/feast-operator/dist/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2667,6 +2667,7 @@ rules:
- apiGroups:
- rbac.authorization.k8s.io
resources:
- rolebindings
- roles
verbs:
- create
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type FeatureStoreReconciler struct {
//+kubebuilder:rbac:groups=feast.dev,resources=featurestores/finalizers,verbs=update
//+kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;create;update;watch;delete
//+kubebuilder:rbac:groups=core,resources=services;configmaps;persistentvolumeclaims;serviceaccounts,verbs=get;list;create;update;watch;delete
//+kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=roles,verbs=get;list;create;update;watch;delete
//+kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=roles;rolebindings,verbs=get;list;create;update;watch;delete
//+kubebuilder:rbac:groups=core,resources=secrets,verbs=get;list

// Reconcile is part of the main kubernetes reconciliation loop which aims to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ var _ = Describe("FeatureStore Controller-Ephemeral services", func() {
Expect(resource.Status.FeastVersion).To(Equal(feastversion.FeastVersion))
Expect(resource.Status.ClientConfigMap).To(Equal(feast.GetFeastServiceName(services.ClientFeastType)))
Expect(resource.Status.Applied.FeastProject).To(Equal(resource.Spec.FeastProject))
Expect(resource.Status.Applied.AuthzConfig).To(Equal(&feastdevv1alpha1.AuthzConfig{}))
Expect(resource.Status.Applied.AuthzConfig).To(BeNil())
Expect(resource.Status.Applied.Services).NotTo(BeNil())
Expect(resource.Status.Applied.Services.OfflineStore).NotTo(BeNil())
Expect(resource.Status.Applied.Services.OfflineStore.Persistence).NotTo(BeNil())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ var _ = Describe("FeatureStore Controller-Ephemeral services", func() {
Expect(resource.Status.FeastVersion).To(Equal(feastversion.FeastVersion))
Expect(resource.Status.ClientConfigMap).To(Equal(feast.GetFeastServiceName(services.ClientFeastType)))
Expect(resource.Status.Applied.FeastProject).To(Equal(resource.Spec.FeastProject))
Expect(resource.Status.Applied.AuthzConfig).To(Equal(&feastdevv1alpha1.AuthzConfig{}))
Expect(resource.Status.Applied.AuthzConfig).To(BeNil())
Expect(resource.Status.Applied.Services).NotTo(BeNil())
Expect(resource.Status.Applied.Services.OfflineStore).To(BeNil())
Expect(resource.Status.Applied.Services.OnlineStore).To(BeNil())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ var _ = Describe("FeatureStore Controller-Ephemeral services", func() {
Expect(resource.Status.FeastVersion).To(Equal(feastversion.FeastVersion))
Expect(resource.Status.ClientConfigMap).To(Equal(feast.GetFeastServiceName(services.ClientFeastType)))
Expect(resource.Status.Applied.FeastProject).To(Equal(resource.Spec.FeastProject))
Expect(resource.Status.Applied.AuthzConfig).To(Equal(&feastdevv1alpha1.AuthzConfig{}))
Expect(resource.Status.Applied.AuthzConfig).To(BeNil())
Expect(resource.Status.Applied.Services).NotTo(BeNil())
Expect(resource.Status.Applied.Services.OfflineStore).NotTo(BeNil())
Expect(resource.Status.Applied.Services.OfflineStore.Persistence).NotTo(BeNil())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ var _ = Describe("FeatureStore Controller", func() {
Expect(resource.Status.ServiceHostnames.OnlineStore).To(BeEmpty())
Expect(resource.Status.ServiceHostnames.Registry).To(Equal(feast.GetFeastServiceName(services.RegistryFeastType) + "." + resource.Namespace + ".svc.cluster.local:80"))
Expect(resource.Status.Applied.FeastProject).To(Equal(resource.Spec.FeastProject))
Expect(resource.Status.Applied.AuthzConfig).To(Equal(&feastdevv1alpha1.AuthzConfig{}))
Expect(resource.Status.Applied.AuthzConfig).To(BeNil())
Expect(resource.Status.Applied.Services).NotTo(BeNil())
Expect(resource.Status.Applied.Services.OfflineStore).To(BeNil())
Expect(resource.Status.Applied.Services.OnlineStore).To(BeNil())
Expand Down Expand Up @@ -459,7 +459,7 @@ var _ = Describe("FeatureStore Controller", func() {
Expect(resource.Status.FeastVersion).To(Equal(feastversion.FeastVersion))
Expect(resource.Status.ClientConfigMap).To(Equal(feast.GetFeastServiceName(services.ClientFeastType)))
Expect(resource.Status.Applied.FeastProject).To(Equal(resource.Spec.FeastProject))
Expect(resource.Status.Applied.AuthzConfig).To(Equal(&feastdevv1alpha1.AuthzConfig{}))
Expect(resource.Status.Applied.AuthzConfig).To(BeNil())
Expect(resource.Status.Applied.Services).NotTo(BeNil())
Expect(resource.Status.Applied.Services.OfflineStore).NotTo(BeNil())
Expect(resource.Status.Applied.Services.OfflineStore.Persistence).NotTo(BeNil())
Expand Down
15 changes: 5 additions & 10 deletions infra/feast-operator/internal/controller/services/repo_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,11 @@ func getClientRepoConfig(featureStore *feastdevv1alpha1.FeatureStore) RepoConfig
}
}

if status.Applied.AuthzConfig.KubernetesAuthz == nil {
clientRepoConfig.AuthzConfig = AuthzConfig{
Type: NoAuthAuthType,
}
} else {
if status.Applied.AuthzConfig.KubernetesAuthz != nil {
clientRepoConfig.AuthzConfig = AuthzConfig{
Type: KubernetesAuthType,
}
}
clientRepoConfig.AuthzConfig = AuthzConfig{
Type: NoAuthAuthType,
}
if status.Applied.AuthzConfig != nil && status.Applied.AuthzConfig.KubernetesAuthz != nil {
clientRepoConfig.AuthzConfig.Type = KubernetesAuthType
}
return clientRepoConfig
}
Expand Down
4 changes: 0 additions & 4 deletions infra/feast-operator/internal/controller/services/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ func ApplyDefaultsToStatus(cr *feastdevv1alpha1.FeatureStore) {
cr.Status.FeastVersion = feastversion.FeastVersion
applied := cr.Spec.DeepCopy()

if applied.AuthzConfig == nil {
applied.AuthzConfig = &feastdevv1alpha1.AuthzConfig{}
}

if applied.Services == nil {
applied.Services = &feastdevv1alpha1.FeatureStoreServices{}
}
Expand Down
3 changes: 1 addition & 2 deletions infra/feast-operator/test/api/featurestore_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,7 @@ var _ = Describe("FeatureStore API", func() {
It("should set the default AuthzConfig", func() {
resource := featurestore
services.ApplyDefaultsToStatus(resource)
Expect(resource.Status.Applied.AuthzConfig).ToNot(BeNil())
Expect(resource.Status.Applied.AuthzConfig).To(Equal(&feastdevv1alpha1.AuthzConfig{}))
Expect(resource.Status.Applied.AuthzConfig).To(BeNil())
})
})
})

0 comments on commit 759ed2f

Please sign in to comment.