Skip to content

Commit efd060b

Browse files
authored
feat: disable caching for v1.secrets, avoid listing secrets cluster wide (#217)
Co-authored-by: Barahona José Luis (IT-PTR-BDE16) <[email protected]>
1 parent e454ce0 commit efd060b

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

config/rbac/role.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ rules:
1919
- secrets
2020
verbs:
2121
- get
22-
- list
23-
- watch
2422
- apiGroups:
2523
- redhatcop.redhat.io
2624
resources:

controllers/groupsync_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type GroupSyncReconciler struct {
5151
// +kubebuilder:rbac:groups=redhatcop.redhat.io,resources=groupsyncs,verbs=get;list;watch;create;update;patch;delete
5252
// +kubebuilder:rbac:groups=redhatcop.redhat.io,resources=groupsyncs/status,verbs=get;update;patch
5353
// +kubebuilder:rbac:groups=user.openshift.io,resources=groups,verbs=get;list;watch;create;update;patch;delete
54-
// +kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch
54+
// +kubebuilder:rbac:groups="",resources=secrets,verbs=get
5555
// +kubebuilder:rbac:groups="",resources=configmaps,verbs=get;list;watch
5656

5757
func (r *GroupSyncReconciler) Reconcile(context context.Context, req ctrl.Request) (ctrl.Result, error) {

main.go

+3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ package main
1818

1919
import (
2020
"flag"
21+
v1 "k8s.io/api/core/v1"
2122
"os"
23+
"sigs.k8s.io/controller-runtime/pkg/client"
2224
"time"
2325

2426
userv1 "github.com/openshift/api/user/v1"
@@ -86,6 +88,7 @@ func main() {
8688

8789
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
8890
Scheme: scheme,
91+
ClientDisableCacheFor: []client.Object{&v1.Secret{}},
8992
MetricsBindAddress: metricsAddr,
9093
Port: 9443,
9194
HealthProbeBindAddress: probeAddr,

0 commit comments

Comments
 (0)