mirror of https://github.com/k3s-io/k3s
ignore unknown resource version in scaler error
parent
775f5d232d
commit
638a641e7d
|
@ -104,9 +104,11 @@ type ScaleError struct {
|
|||
}
|
||||
|
||||
func (c ScaleError) Error() string {
|
||||
return fmt.Sprintf(
|
||||
"Scaling the resource failed with: %v; Current resource version %s",
|
||||
c.ActualError, c.ResourceVersion)
|
||||
msg := fmt.Sprintf("Scaling the resource failed with: %v", c.ActualError)
|
||||
if len(c.ResourceVersion) > 0 {
|
||||
msg += fmt.Sprintf("; Current resource version %s", c.ResourceVersion)
|
||||
}
|
||||
return msg
|
||||
}
|
||||
|
||||
// RetryParams encapsulates the retry parameters used by kubectl's scaler.
|
||||
|
@ -169,7 +171,7 @@ type ReplicationControllerScaler struct {
|
|||
func (scaler *ReplicationControllerScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) (string, error) {
|
||||
controller, err := scaler.c.ReplicationControllers(namespace).Get(name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return "", ScaleError{ScaleGetFailure, "Unknown", err}
|
||||
return "", ScaleError{ScaleGetFailure, "", err}
|
||||
}
|
||||
if preconditions != nil {
|
||||
if err := preconditions.ValidateReplicationController(controller); err != nil {
|
||||
|
@ -267,7 +269,7 @@ type ReplicaSetScaler struct {
|
|||
func (scaler *ReplicaSetScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) (string, error) {
|
||||
rs, err := scaler.c.ReplicaSets(namespace).Get(name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return "", ScaleError{ScaleGetFailure, "Unknown", err}
|
||||
return "", ScaleError{ScaleGetFailure, "", err}
|
||||
}
|
||||
if preconditions != nil {
|
||||
if err := preconditions.ValidateReplicaSet(rs); err != nil {
|
||||
|
@ -338,7 +340,7 @@ type StatefulSetScaler struct {
|
|||
func (scaler *StatefulSetScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) (string, error) {
|
||||
ss, err := scaler.c.StatefulSets(namespace).Get(name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return "", ScaleError{ScaleGetFailure, "Unknown", err}
|
||||
return "", ScaleError{ScaleGetFailure, "", err}
|
||||
}
|
||||
if preconditions != nil {
|
||||
if err := preconditions.ValidateStatefulSet(ss); err != nil {
|
||||
|
@ -391,7 +393,7 @@ type JobScaler struct {
|
|||
func (scaler *JobScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) (string, error) {
|
||||
job, err := scaler.c.Jobs(namespace).Get(name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return "", ScaleError{ScaleGetFailure, "Unknown", err}
|
||||
return "", ScaleError{ScaleGetFailure, "", err}
|
||||
}
|
||||
if preconditions != nil {
|
||||
if err := preconditions.ValidateJob(job); err != nil {
|
||||
|
@ -460,7 +462,7 @@ type DeploymentScaler struct {
|
|||
func (scaler *DeploymentScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) (string, error) {
|
||||
deployment, err := scaler.c.Deployments(namespace).Get(name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return "", ScaleError{ScaleGetFailure, "Unknown", err}
|
||||
return "", ScaleError{ScaleGetFailure, "", err}
|
||||
}
|
||||
if preconditions != nil {
|
||||
if err := preconditions.ValidateDeployment(deployment); err != nil {
|
||||
|
|
Loading…
Reference in New Issue