mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-07-09 19:22:21 +02:00
Compare commits
2 Commits
fca31a984c
...
395891c5aa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
395891c5aa | ||
|
|
d05559a07f |
@ -25,13 +25,11 @@ import (
|
||||
|
||||
cnpgv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
|
||||
"github.com/cloudnative-pg/machinery/pkg/log"
|
||||
rbacv1 "k8s.io/api/rbac/v1"
|
||||
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/builder"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
|
||||
"sigs.k8s.io/controller-runtime/pkg/predicate"
|
||||
|
||||
barmancloudv1 "github.com/cloudnative-pg/plugin-barman-cloud/api/v1"
|
||||
@ -117,9 +115,7 @@ func (r *ObjectStoreReconciler) reconcileRBACForCluster(
|
||||
barmanObjects = append(barmanObjects, barmanObject)
|
||||
}
|
||||
|
||||
return rbac.EnsureRole(ctx, r.Client, cluster, barmanObjects, func(role *rbacv1.Role) error {
|
||||
return controllerutil.SetControllerReference(cluster, role, r.Scheme)
|
||||
})
|
||||
return rbac.EnsureRole(ctx, r.Client, cluster, barmanObjects)
|
||||
}
|
||||
|
||||
// referencesObjectStore checks if the given ObjectStore is in the list
|
||||
|
||||
@ -172,11 +172,6 @@ var _ = Describe("ObjectStoreReconciler", func() {
|
||||
// Verify the secrets rule contains the expected secret
|
||||
secretsRule := role.Rules[2]
|
||||
Expect(secretsRule.ResourceNames).To(ContainElement("aws-creds"))
|
||||
|
||||
// Verify owner reference is set to the Cluster
|
||||
Expect(role.OwnerReferences).To(HaveLen(1))
|
||||
Expect(role.OwnerReferences[0].Name).To(Equal("my-cluster"))
|
||||
Expect(role.OwnerReferences[0].Kind).To(Equal("Cluster"))
|
||||
})
|
||||
|
||||
It("should skip Clusters that don't reference the ObjectStore", func() {
|
||||
@ -268,10 +263,6 @@ var _ = Describe("ObjectStoreReconciler", func() {
|
||||
objectStoreRule := role.Rules[0]
|
||||
Expect(objectStoreRule.ResourceNames).To(ContainElement("store-a"))
|
||||
Expect(objectStoreRule.ResourceNames).NotTo(ContainElement("store-b"))
|
||||
|
||||
// Verify owner reference is set
|
||||
Expect(role.OwnerReferences).To(HaveLen(1))
|
||||
Expect(role.OwnerReferences[0].Name).To(Equal("my-cluster"))
|
||||
})
|
||||
|
||||
It("should update Role when ObjectStore credentials change", func() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user