Skip to content

Commit

Permalink
feat: disable caching for v1.secrets, avoid listing secrets cluster w…
Browse files Browse the repository at this point in the history
…ide (#217)

Co-authored-by: Barahona José Luis (IT-PTR-BDE16) <jose_luis.barahona@sbb.ch>
  • Loading branch information
jolbax and jolbax authored May 19, 2023
1 parent e454ce0 commit efd060b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 0 additions & 2 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ rules:
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- redhatcop.redhat.io
resources:
Expand Down
2 changes: 1 addition & 1 deletion controllers/groupsync_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type GroupSyncReconciler struct {
// +kubebuilder:rbac:groups=redhatcop.redhat.io,resources=groupsyncs,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=redhatcop.redhat.io,resources=groupsyncs/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=user.openshift.io,resources=groups,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch
// +kubebuilder:rbac:groups="",resources=secrets,verbs=get
// +kubebuilder:rbac:groups="",resources=configmaps,verbs=get;list;watch

func (r *GroupSyncReconciler) Reconcile(context context.Context, req ctrl.Request) (ctrl.Result, error) {
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ package main

import (
"flag"
v1 "k8s.io/api/core/v1"
"os"
"sigs.k8s.io/controller-runtime/pkg/client"
"time"

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

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
ClientDisableCacheFor: []client.Object{&v1.Secret{}},
MetricsBindAddress: metricsAddr,
Port: 9443,
HealthProbeBindAddress: probeAddr,
Expand Down

0 comments on commit efd060b

Please sign in to comment.