mirror of
https://github.com/kubernetes/client-go.git
synced 2026-07-16 00:10:39 +00:00
client-go: expose all discovery methods
The underlying implementation has both. Exposing that in the result of Discovery() makes it easier for consumers to call the WithContext methods because they don't need to wrap with ToDiscoveryInterfaceWithContext(). This is a breaking Go API change because tests which implement the interface have to be updated. Kubernetes-commit: d8f70b87cec6888420e778bca1ea8022a6617140
This commit is contained in:
committed by
Kubernetes Publisher
parent
07eaa8b369
commit
6ecbabc519
@@ -109,6 +109,12 @@ type DiscoveryInterfaceWithContext interface {
|
||||
WithLegacyWithContext(ctx context.Context) DiscoveryInterfaceWithContext
|
||||
}
|
||||
|
||||
// DiscoveryInterfaces combines both interface variants.
|
||||
type DiscoveryInterfaces interface {
|
||||
DiscoveryInterface
|
||||
DiscoveryInterfaceWithContext
|
||||
}
|
||||
|
||||
func ToDiscoveryInterfaceWithContext(i DiscoveryInterface) DiscoveryInterfaceWithContext {
|
||||
if i == nil {
|
||||
return nil
|
||||
|
||||
@@ -81,7 +81,7 @@ import (
|
||||
)
|
||||
|
||||
type Interface interface {
|
||||
Discovery() discovery.DiscoveryInterface
|
||||
Discovery() discovery.DiscoveryInterfaces
|
||||
AdmissionregistrationV1() admissionregistrationv1.AdmissionregistrationV1Interface
|
||||
AdmissionregistrationV1alpha1() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface
|
||||
AdmissionregistrationV1beta1() admissionregistrationv1beta1.AdmissionregistrationV1beta1Interface
|
||||
@@ -461,7 +461,7 @@ func (c *Clientset) StoragemigrationV1beta1() storagemigrationv1beta1.Storagemig
|
||||
}
|
||||
|
||||
// Discovery retrieves the DiscoveryClient
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterfaces {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ type Clientset struct {
|
||||
tracker testing.ObjectTracker
|
||||
}
|
||||
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterfaces {
|
||||
return c.discovery
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user