mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
rollout restart: Change error message to more descriptive
`rollout restart` command calculates patches according to the `kubectl.kubernetes.io/restartedAt` annotation whose time format is RFC3339. That is sufficient for users. However, if automated scripts execute `rollout restart` in multiple times within second, commands fails by returning an error "empty patch". This PR changes error message to more descriptive format to warn users that rollout restart does not work subsequent execution within second.
This commit is contained in:
parent
23c65ec590
commit
fb3d9e3ac9
@ -18,7 +18,6 @@ package rollout
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
||||
@ -183,7 +182,8 @@ func (o RestartOptions) RunRestart() error {
|
||||
}
|
||||
|
||||
if string(patch.Patch) == "{}" || len(patch.Patch) == 0 {
|
||||
allErrs = append(allErrs, fmt.Errorf("failed to create patch for %v: empty patch", info.Name))
|
||||
allErrs = append(allErrs, fmt.Errorf("failed to create patch for %v: if restart has already been triggered within the past second, please wait before attempting to trigger another", info.Name))
|
||||
continue
|
||||
}
|
||||
|
||||
obj, err := resource.NewHelper(info.Client, info.Mapping).
|
||||
|
Loading…
Reference in New Issue
Block a user