Patch deployment spec metadata (#928)
This commit is contained in:
parent
8227206208
commit
68419cc024
@ -8,6 +8,16 @@ type Kubernetes interface {
|
|||||||
ListDeployments(labels map[string]string) (*DeploymentList, error)
|
ListDeployments(labels map[string]string) (*DeploymentList, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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"`
|
||||||
|
}
|
||||||
|
|
||||||
// Metadata defines api request metadata
|
// Metadata defines api request metadata
|
||||||
type Metadata struct {
|
type Metadata struct {
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
|
@ -116,7 +116,7 @@ func (k *kubernetes) Delete(s *runtime.Service) error {
|
|||||||
// Update the service in place
|
// Update the service in place
|
||||||
func (k *kubernetes) Update(s *runtime.Service) error {
|
func (k *kubernetes) Update(s *runtime.Service) error {
|
||||||
type body struct {
|
type body struct {
|
||||||
Metadata *client.Metadata `json:"metadata"`
|
Spec *client.Spec `json:"spec"`
|
||||||
}
|
}
|
||||||
// parse version into human readable timestamp
|
// parse version into human readable timestamp
|
||||||
updateTimeStamp, err := strconv.ParseInt(s.Version, 10, 64)
|
updateTimeStamp, err := strconv.ParseInt(s.Version, 10, 64)
|
||||||
@ -126,9 +126,13 @@ func (k *kubernetes) Update(s *runtime.Service) error {
|
|||||||
unixTimeUTC := time.Unix(updateTimeStamp, 0)
|
unixTimeUTC := time.Unix(updateTimeStamp, 0)
|
||||||
// metada which we will PATCH deployment with
|
// metada which we will PATCH deployment with
|
||||||
reqBody := body{
|
reqBody := body{
|
||||||
Metadata: &client.Metadata{
|
Spec: &client.Spec{
|
||||||
Annotations: map[string]string{
|
Template: &client.Template{
|
||||||
"build": unixTimeUTC.Format(time.RFC3339),
|
Metadata: &client.Metadata{
|
||||||
|
Annotations: map[string]string{
|
||||||
|
"build": unixTimeUTC.Format(time.RFC3339),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user