mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #1058 from vishh/add_list_minions
Adding ListMinions() API to pkg/client.
This commit is contained in:
commit
0766e7a411
@ -41,6 +41,7 @@ type Interface interface {
|
||||
ReplicationControllerInterface
|
||||
ServiceInterface
|
||||
VersionInterface
|
||||
MinionInterface
|
||||
}
|
||||
|
||||
// PodInterface has methods to work with Pod resources
|
||||
@ -78,6 +79,10 @@ type VersionInterface interface {
|
||||
ServerVersion() (*version.Info, error)
|
||||
}
|
||||
|
||||
type MinionInterface interface {
|
||||
ListMinions() (api.MinionList, error)
|
||||
}
|
||||
|
||||
// Client is the actual implementation of a Kubernetes client.
|
||||
type Client struct {
|
||||
*RESTClient
|
||||
@ -369,3 +374,9 @@ func (c *Client) ServerVersion() (*version.Info, error) {
|
||||
}
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// Lists all the minions in the cluster.
|
||||
func (c *Client) ListMinions() (minionList api.MinionList, err error) {
|
||||
err = c.Get().Path("minions").Do().Into(&minionList)
|
||||
return
|
||||
}
|
||||
|
@ -542,3 +542,12 @@ func TestGetServerVersion(t *testing.T) {
|
||||
t.Errorf("expected %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
func TestListMinions(t *testing.T) {
|
||||
c := &testClient{
|
||||
Request: testRequest{Method: "GET", Path: "/minions"},
|
||||
Response: Response{StatusCode: 200, Body: &api.MinionList{JSONBase: api.JSONBase{ID: "minion-1"}}},
|
||||
}
|
||||
response, err := c.Setup().ListMinions()
|
||||
c.Validate(t, &response, err)
|
||||
}
|
||||
|
@ -128,3 +128,8 @@ func (c *Fake) ServerVersion() (*version.Info, error) {
|
||||
versionInfo := version.Get()
|
||||
return &versionInfo, nil
|
||||
}
|
||||
|
||||
func (c *Fake) ListMinions() (api.MinionList, error) {
|
||||
c.Actions = append(c.Actions, FakeAction{Action: "list-minions", Value: nil})
|
||||
return api.MinionList{}, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user