2019-11-02 16:25:10 +03:00
|
|
|
package client
|
|
|
|
|
|
|
|
// Kubernetes client
|
|
|
|
type Kubernetes interface {
|
|
|
|
// UpdateDeployment patches deployment annotations with new metadata
|
|
|
|
UpdateDeployment(string, interface{}) error
|
2019-11-07 10:44:57 +03:00
|
|
|
// ListDeployments lists all micro deployments
|
|
|
|
ListDeployments(labels map[string]string) (*DeploymentList, error)
|
2019-11-02 16:25:10 +03:00
|
|
|
}
|
|
|
|
|
2019-11-08 17:12:03 +03:00
|
|
|
// Template is micro deployment template
|
|
|
|
type Template struct {
|
|
|
|
Metadata *Metadata `json:"metadata,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Spec defines micro deployment spec
|
|
|
|
type Spec struct {
|
|
|
|
Template *Template `json:"template,omitempty"`
|
|
|
|
}
|
|
|
|
|
2019-11-02 16:25:10 +03:00
|
|
|
// Metadata defines api request metadata
|
|
|
|
type Metadata struct {
|
2019-11-07 10:44:57 +03:00
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
Labels map[string]string `json:"labels,omitempty"`
|
2019-11-02 16:25:10 +03:00
|
|
|
Annotations map[string]string `json:"annotations,omitempty"`
|
|
|
|
}
|
2019-11-07 10:44:57 +03:00
|
|
|
|
|
|
|
// 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"`
|
|
|
|
}
|