mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Rename metadata.NewConfigOrDie to be consistent
Updated name to match dynamic client
This commit is contained in:
parent
637cc83341
commit
98d87a4f03
@ -70,9 +70,9 @@ func ConfigFor(inConfig *rest.Config) *rest.Config {
|
|||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewConfigOrDie creates a new metadata client for the given config and
|
// NewForConfigOrDie creates a new metadata client for the given config and
|
||||||
// panics if there is an error in the config.
|
// panics if there is an error in the config.
|
||||||
func NewConfigOrDie(c *rest.Config) Interface {
|
func NewForConfigOrDie(c *rest.Config) Interface {
|
||||||
ret, err := NewForConfig(c)
|
ret, err := NewForConfig(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -236,7 +236,7 @@ func TestClient(t *testing.T) {
|
|||||||
defer s.Close()
|
defer s.Close()
|
||||||
|
|
||||||
cfg := ConfigFor(&rest.Config{Host: s.URL})
|
cfg := ConfigFor(&rest.Config{Host: s.URL})
|
||||||
client := NewConfigOrDie(cfg).(*Client)
|
client := NewForConfigOrDie(cfg).(*Client)
|
||||||
tt.want(t, client)
|
tt.want(t, client)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -545,7 +545,7 @@ func TestMetadataClient(t *testing.T) {
|
|||||||
return wrapper
|
return wrapper
|
||||||
})
|
})
|
||||||
|
|
||||||
client := metadata.NewConfigOrDie(cfg).Resource(v1.SchemeGroupVersion.WithResource("services"))
|
client := metadata.NewForConfigOrDie(cfg).Resource(v1.SchemeGroupVersion.WithResource("services"))
|
||||||
items, err := client.Namespace(ns).List(metav1.ListOptions{})
|
items, err := client.Namespace(ns).List(metav1.ListOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@ -622,7 +622,7 @@ func TestMetadataClient(t *testing.T) {
|
|||||||
return wrapper
|
return wrapper
|
||||||
})
|
})
|
||||||
|
|
||||||
client := metadata.NewConfigOrDie(cfg).Resource(crdGVR)
|
client := metadata.NewForConfigOrDie(cfg).Resource(crdGVR)
|
||||||
items, err := client.Namespace(ns).List(metav1.ListOptions{})
|
items, err := client.Namespace(ns).List(metav1.ListOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@ -688,7 +688,7 @@ func TestMetadataClient(t *testing.T) {
|
|||||||
return wrapper
|
return wrapper
|
||||||
})
|
})
|
||||||
|
|
||||||
client := metadata.NewConfigOrDie(cfg).Resource(v1.SchemeGroupVersion.WithResource("services"))
|
client := metadata.NewForConfigOrDie(cfg).Resource(v1.SchemeGroupVersion.WithResource("services"))
|
||||||
w, err := client.Namespace(ns).Watch(metav1.ListOptions{ResourceVersion: svc.ResourceVersion, Watch: true})
|
w, err := client.Namespace(ns).Watch(metav1.ListOptions{ResourceVersion: svc.ResourceVersion, Watch: true})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@ -744,7 +744,7 @@ func TestMetadataClient(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cfg := metadata.ConfigFor(config)
|
cfg := metadata.ConfigFor(config)
|
||||||
client := metadata.NewConfigOrDie(cfg).Resource(crdGVR)
|
client := metadata.NewForConfigOrDie(cfg).Resource(crdGVR)
|
||||||
|
|
||||||
patched, err := client.Namespace(ns).Patch("test-2", types.MergePatchType, []byte(`{"metadata":{"annotations":{"test":"1"}}}`), metav1.PatchOptions{})
|
patched, err := client.Namespace(ns).Patch("test-2", types.MergePatchType, []byte(`{"metadata":{"annotations":{"test":"1"}}}`), metav1.PatchOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -759,7 +759,7 @@ func TestMetadataClient(t *testing.T) {
|
|||||||
wrapper.nested = rt
|
wrapper.nested = rt
|
||||||
return wrapper
|
return wrapper
|
||||||
})
|
})
|
||||||
client = metadata.NewConfigOrDie(cfg).Resource(crdGVR)
|
client = metadata.NewForConfigOrDie(cfg).Resource(crdGVR)
|
||||||
|
|
||||||
w, err := client.Namespace(ns).Watch(metav1.ListOptions{ResourceVersion: cr.GetResourceVersion(), Watch: true})
|
w, err := client.Namespace(ns).Watch(metav1.ListOptions{ResourceVersion: cr.GetResourceVersion(), Watch: true})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user