mirror of https://github.com/kubernetes/kops.git
Log and aggregate errors from rolling update
Rather than just returning the error from the first failing IG
This commit is contained in:
parent
4546cafdcb
commit
b45968c992
|
@ -23,6 +23,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/util/errors"
|
||||||
"k8s.io/kops/pkg/client/simple"
|
"k8s.io/kops/pkg/client/simple"
|
||||||
|
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
|
@ -186,9 +187,10 @@ func (c *RollingUpdateCluster) RollingUpdate(groups map[string]*cloudinstances.C
|
||||||
|
|
||||||
for _, k := range sortGroups(apiServerGroups) {
|
for _, k := range sortGroups(apiServerGroups) {
|
||||||
err := c.rollingUpdateInstanceGroup(apiServerGroups[k], c.NodeInterval)
|
err := c.rollingUpdateInstanceGroup(apiServerGroups[k], c.NodeInterval)
|
||||||
|
|
||||||
results[k] = err
|
results[k] = err
|
||||||
|
if err != nil {
|
||||||
|
klog.Errorf("failed to roll InstanceGroup %q: %v", k, err)
|
||||||
|
}
|
||||||
// TODO: Bail on error?
|
// TODO: Bail on error?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,21 +209,23 @@ func (c *RollingUpdateCluster) RollingUpdate(groups map[string]*cloudinstances.C
|
||||||
|
|
||||||
for _, k := range sortGroups(nodeGroups) {
|
for _, k := range sortGroups(nodeGroups) {
|
||||||
err := c.rollingUpdateInstanceGroup(nodeGroups[k], c.NodeInterval)
|
err := c.rollingUpdateInstanceGroup(nodeGroups[k], c.NodeInterval)
|
||||||
|
|
||||||
results[k] = err
|
results[k] = err
|
||||||
|
if err != nil {
|
||||||
|
klog.Errorf("failed to roll InstanceGroup %q: %v", k, err)
|
||||||
|
}
|
||||||
// TODO: Bail on error?
|
// TODO: Bail on error?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
errs := []error{}
|
||||||
for _, err := range results {
|
for _, err := range results {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
errs = append(errs, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
klog.Infof("Rolling update completed for cluster %q!", c.ClusterName)
|
klog.Infof("Rolling update completed for cluster %q!", c.ClusterName)
|
||||||
return nil
|
return errors.NewAggregate(errs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func sortGroups(groupMap map[string]*cloudinstances.CloudInstanceGroup) []string {
|
func sortGroups(groupMap map[string]*cloudinstances.CloudInstanceGroup) []string {
|
||||||
|
|
Loading…
Reference in New Issue