Commit ec0d104f authored by Nikolay Mahotkin's avatar Nikolay Mahotkin

Reformatting changes

  * Run gofmt on all changed files
    so they formatted properly now
parent fdac5e8a
......@@ -206,8 +206,8 @@ message RollbackReleaseRequest {
bool disable_hooks = 3;
// Version is the version of the release to deploy.
int32 version = 4;
// Performs pods restart for resources if applicable
bool restart = 5;
// Performs pods restart for resources if applicable
bool restart = 5;
}
// RollbackReleaseResponse is the response to an update request.
......
......@@ -35,7 +35,7 @@ type rollbackCmd struct {
name string
revision int32
dryRun bool
restart bool
restart bool
disableHooks bool
out io.Writer
client helm.Interface
......
......@@ -40,8 +40,8 @@ type options struct {
dryRun bool
// if set, re-use an existing name
reuseName bool
//
restart bool
// if set, performs pod restart during upgrade/rollback
restart bool
// if set, skip running hooks
disableHooks bool
// name of release
......
......@@ -27,21 +27,21 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/apimachinery/registered"
apps "k8s.io/kubernetes/pkg/apis/apps/v1beta1"
"k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/kubectl"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/resource"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/strategicpatch"
"k8s.io/kubernetes/pkg/watch"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
apps "k8s.io/kubernetes/pkg/apis/apps/v1beta1"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
)
// ErrNoObjectsVisited indicates that during a visit operation, no matching objects were found.
......@@ -326,11 +326,11 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
helper := resource.NewHelper(target.Client, target.Mapping)
_, err = helper.Patch(target.Namespace, target.Name, api.StrategicMergePatchType, patch)
if err != nil {
if err != nil {
return err
}
if restart {
if restart {
kind := target.Mapping.GroupVersionKind.Kind
client, _ := c.ClientSet()
......@@ -353,36 +353,34 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
return err
}
func restartPods(client *internalclientset.Clientset, namespace string, selector map[string]string) error {
pods, err := client.Pods(namespace).List(api.ListOptions{
FieldSelector: fields.Everything(),
LabelSelector: labels.Set(selector).AsSelector(),
})
if err != nil {
return err
}
// Restart pods
for _, pod := range pods.Items {
log.Printf("Restarting pod: %v/%v", pod.Namespace, pod.Name)
// Delete each pod for get them restarted with changed spec.
err := client.Pods(pod.Namespace).Delete(pod.Name, &api.DeleteOptions{
Preconditions: &api.Preconditions{
UID: &pod.UID,
},
})
if err != nil {
return err
}
}
return nil
}
pods, err := client.Pods(namespace).List(api.ListOptions{
FieldSelector: fields.Everything(),
LabelSelector: labels.Set(selector).AsSelector(),
})
if err != nil {
return err
}
// Restart pods
for _, pod := range pods.Items {
log.Printf("Restarting pod: %v/%v", pod.Namespace, pod.Name)
// Delete each pod for get them restarted with changed spec.
err := client.Pods(pod.Namespace).Delete(pod.Name, &api.DeleteOptions{
Preconditions: &api.Preconditions{
UID: &pod.UID,
},
})
if err != nil {
return err
}
}
return nil
}
func watchUntilReady(info *resource.Info) error {
w, err := resource.NewHelper(info.Client, info.Mapping).WatchSingle(info.Namespace, info.Name, info.ResourceVersion)
......
......@@ -246,8 +246,8 @@ type UpdateReleaseRequest struct {
DryRun bool `protobuf:"varint,4,opt,name=dry_run,json=dryRun" json:"dry_run,omitempty"`
// DisableHooks causes the server to skip running any hooks for the upgrade.
DisableHooks bool `protobuf:"varint,5,opt,name=disable_hooks,json=disableHooks" json:"disable_hooks,omitempty"`
// Performs pods restart for resources if applicable
Restart bool `protobuf:"varint,6,opt,name=restart,json=restart" json:"restart,omitempty"`
// Performs pods restart for resources if applicable
Restart bool `protobuf:"varint,6,opt,name=restart,json=restart" json:"restart,omitempty"`
}
func (m *UpdateReleaseRequest) Reset() { *m = UpdateReleaseRequest{} }
......@@ -296,7 +296,7 @@ type RollbackReleaseRequest struct {
// Version is the version of the release to deploy.
Version int32 `protobuf:"varint,4,opt,name=version" json:"version,omitempty"`
// Performs pods restart for resources if applicable
Restart bool `protobuf:"varint,5,opt,name=restart,json=restart" json:"restart,omitempty"`
Restart bool `protobuf:"varint,5,opt,name=restart,json=restart" json:"restart,omitempty"`
}
func (m *RollbackReleaseRequest) Reset() { *m = RollbackReleaseRequest{} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment