forked from kubernetes-sigs/kubebuilder-declarative-pattern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfactory_cr15.go
30 lines (23 loc) · 989 Bytes
/
factory_cr15.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//go:build !(controllerruntime_11 || controllerruntime_12 || controllerruntime_13 || controllerruntime_14)
package commonclient
import (
"net/http"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/cluster"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/source"
)
// SourceKind is a version-indendenent abstraction over calling source.Kind
func SourceKind(cache cache.Cache, obj client.Object) source.Source {
return source.Kind(cache, obj, &handler.TypedEnqueueRequestForObject[client.Object]{})
}
// WrapEventHandler is a version-indendenent abstraction over handler.EventHandler
func WrapEventHandler(h handler.EventHandler) handler.EventHandler {
return h
}
// GetHTTPClient returns the http.Client associated with the Cluster
func GetHTTPClient(c cluster.Cluster) (*http.Client, error) {
return c.GetHTTPClient(), nil
}
type EventHandler = handler.EventHandler