forked from kubernetes-sigs/kubebuilder-declarative-pattern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfactory_cr15.go
31 lines (24 loc) · 1.12 KB
/
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
31
//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/reconcile"
"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]{})
}
// SourceKind is a version-indendenent abstraction over calling source.Kind
func SourceKindWithHandler(cache cache.Cache, obj client.Object, handler handler.TypedEventHandler[client.Object, reconcile.Request]) source.Source {
return source.Kind(cache, obj, handler)
}
// 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