Skip to content

Commit

Permalink
Disable caching for PackageRevisionResources
Browse files Browse the repository at this point in the history
Signed-off-by: Kushal Harish Naidu <[email protected]>
  • Loading branch information
kushnaidu committed May 23, 2024
1 parent 25cf608 commit a1c92aa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
14 changes: 11 additions & 3 deletions controllers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"k8s.io/client-go/tools/leaderelection/resourcelock"
"k8s.io/klog/v2"
"k8s.io/klog/v2/klogr"
"sigs.k8s.io/controller-runtime/pkg/client"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"

Expand All @@ -41,6 +42,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/nephio-project/porch/api/porch"
"github.com/nephio-project/porch/controllers/fleetsyncs/pkg/controllers/fleetsync"
"github.com/nephio-project/porch/controllers/packagevariants/pkg/controllers/packagevariant"
"github.com/nephio-project/porch/controllers/packagevariantsets/pkg/controllers/packagevariantset"
Expand Down Expand Up @@ -118,18 +120,24 @@ func run(ctx context.Context) error {
}

managerOptions := ctrl.Options{
Scheme: scheme,
Metrics: metricsserver.Options{
Scheme: scheme,
Metrics: metricsserver.Options{
BindAddress: ":8080",
},
WebhookServer: webhook.NewServer(webhook.Options{
WebhookServer: webhook.NewServer(webhook.Options{
Port: 9443,
}),
HealthProbeBindAddress: ":8081",
LeaderElection: false,
LeaderElectionID: "porch-operators.config.porch.kpt.dev",
LeaderElectionResourceLock: resourcelock.LeasesResourceLock,
MapperProvider: controllerrestmapper.New,
Client: client.Options{
Cache: &client.CacheOptions{
DisableFor: []client.Object{
&porch.PackageRevisionResources{}},
},
},
}

ctrl.SetLogger(klogr.New())
Expand Down
8 changes: 8 additions & 0 deletions controllers/packagevariantsets/config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ rules:
- get
- patch
- update
- apiGroups:
- porch.kpt.dev
resources:
- packagerevisions
verbs:
- get
- list
- watch
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ const (
//+kubebuilder:rbac:groups=config.porch.kpt.dev,resources=packagevariantsets/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=config.porch.kpt.dev,resources=packagevariantsets/finalizers,verbs=update
//+kubebuilder:rbac:groups=config.porch.kpt.dev,resources=packagevariants,verbs=create;delete;get;list;patch;update;watch
//+kubebuilder:rbac:groups=porch.kpt.dev,resources=packagerevisions,verbs=create;delete;get;list;patch;update;watch
//+kubebuilder:rbac:groups=porch.kpt.dev,resources=packagerevisionresources,verbs=create;delete;get;list;patch;update;watch
//+kubebuilder:rbac:groups=porch.kpt.dev,resources=packagerevisions,verbs=get;list;watch
//+kubebuilder:rbac:groups=*,resources=*,verbs=list

// Reconcile implements the main kubernetes reconciliation loop.
Expand Down

0 comments on commit a1c92aa

Please sign in to comment.