K8s list deployments (#921)

* Outline of ListDeployments method

* Added implementation of DeploymentList
This commit is contained in:
Milos Gajdos
2019-11-07 07:44:57 +00:00
committed by Asim Aslam
parent 0e3550229b
commit 6f28852e1b
4 changed files with 73 additions and 14 deletions

View File

@@ -4,9 +4,30 @@ package client
type Kubernetes interface {
// UpdateDeployment patches deployment annotations with new metadata
UpdateDeployment(string, interface{}) error
// ListDeployments lists all micro deployments
ListDeployments(labels map[string]string) (*DeploymentList, error)
}
// Metadata defines api request metadata
type Metadata struct {
Name string `json:"name,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}
// DeploymentList
type DeploymentList struct {
Items []Deployment `json:"items"`
}
// Deployment is Kubernetes deployment
type Deployment struct {
Metadata *Metadata `json:"metadata"`
Status *Status `json:"status"`
}
// Status is Kubernetes deployment status
type Status struct {
Replicas int `json:"replicas"`
AvailableReplicas int `json:"availablereplicas"`
}