Skip to content

Commit

Permalink
Merge pull request #112 from openshift-cherrypick-robot/cherry-pick-1…
Browse files Browse the repository at this point in the history
…00-to-release-4.13

[release-4.13] OCPBUGS-13731: external template and route Informer
  • Loading branch information
openshift-merge-robot committed May 22, 2023
2 parents 20a4773 + 08178e0 commit 4aa5ecd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
14 changes: 0 additions & 14 deletions pkg/client/genericinformers/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package genericinformers
import (
"k8s.io/klog/v2"

"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/informers"
)
Expand All @@ -13,19 +12,6 @@ type GenericResourceInformer interface {
Start(stopCh <-chan struct{})
}

// GenericInternalResourceInformerFunc will return an internal informer for any resource matching
// its group resource, instead of the external version. Only valid for use where the type is accessed
// via generic interfaces, such as the garbage collector with ObjectMeta.
type GenericInternalResourceInformerFunc func(resource schema.GroupVersionResource) (informers.GenericInformer, error)

func (fn GenericInternalResourceInformerFunc) ForResource(resource schema.GroupVersionResource) (informers.GenericInformer, error) {
resource.Version = runtime.APIVersionInternal
return fn(resource)
}

// this is a temporary condition until we rewrite enough of generation to auto-conform to the required interface and no longer need the internal version shim
func (fn GenericInternalResourceInformerFunc) Start(stopCh <-chan struct{}) {}

// genericResourceInformerFunc will handle a cast to a matching type
type GenericResourceInformerFunc func(resource schema.GroupVersionResource) (informers.GenericInformer, error)

Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/controller/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ func (c *EnhancedControllerContext) ToGenericInformer() genericinformers.Generic
genericinformers.GenericResourceInformerFunc(func(resource schema.GroupVersionResource) (informers.GenericInformer, error) {
return c.ImageInformers.ForResource(resource)
}),
genericinformers.GenericInternalResourceInformerFunc(func(resource schema.GroupVersionResource) (informers.GenericInformer, error) {
genericinformers.GenericResourceInformerFunc(func(resource schema.GroupVersionResource) (informers.GenericInformer, error) {
return c.QuotaInformers.ForResource(resource)
}),
genericinformers.GenericResourceInformerFunc(func(resource schema.GroupVersionResource) (informers.GenericInformer, error) {
return c.RouteInformers.ForResource(resource)
}),
genericinformers.GenericInternalResourceInformerFunc(func(resource schema.GroupVersionResource) (informers.GenericInformer, error) {
genericinformers.GenericResourceInformerFunc(func(resource schema.GroupVersionResource) (informers.GenericInformer, error) {
return c.TemplateInformers.ForResource(resource)
}),
)
Expand Down

0 comments on commit 4aa5ecd

Please sign in to comment.