mirror of
https://github.com/go-micro/go-micro.git
synced 2025-06-18 22:17:44 +02:00
K8s list deployments (#921)
* Outline of ListDeployments method * Added implementation of DeploymentList
This commit is contained in:
@ -90,7 +90,7 @@ func detectNamespace() (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateDeployment
|
||||
// UpdateDeployment patches kubernetes deployment with metadata provided in body
|
||||
func (c *client) UpdateDeployment(name string, body interface{}) error {
|
||||
return api.NewRequest(c.opts).
|
||||
Patch().
|
||||
@ -100,3 +100,16 @@ func (c *client) UpdateDeployment(name string, body interface{}) error {
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// ListDeployments lists all kubernetes deployments with given labels
|
||||
func (c *client) ListDeployments(labels map[string]string) (*DeploymentList, error) {
|
||||
var deployments DeploymentList
|
||||
err := api.NewRequest(c.opts).
|
||||
Get().
|
||||
Resource("deployments").
|
||||
Params(&api.Params{LabelSelector: labels}).
|
||||
Do().
|
||||
Into(&deployments)
|
||||
|
||||
return &deployments, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user