diff --git a/pkg/kn/commands/service/configuration_edit_flags.go b/pkg/kn/commands/service/configuration_edit_flags.go index 624f24283d..603f70b856 100644 --- a/pkg/kn/commands/service/configuration_edit_flags.go +++ b/pkg/kn/commands/service/configuration_edit_flags.go @@ -138,7 +138,9 @@ func (p *ConfigurationEditFlags) Apply( } if anyMutation { err = servinglib.UpdateName(template, name) - if err != nil { + if err == servinglib.ApiTooOldError && !cmd.Flags().Changed("revision-name") { + // pass + } else if err != nil { return err } } diff --git a/pkg/serving/config_changes.go b/pkg/serving/config_changes.go index ec9784d349..5e69aef8de 100644 --- a/pkg/serving/config_changes.go +++ b/pkg/serving/config_changes.go @@ -15,6 +15,7 @@ package serving import ( + "errors" "fmt" "strconv" @@ -62,8 +63,13 @@ func UpdateAnnotation(template *servingv1alpha1.RevisionTemplateSpec, annotation annoMap[annotation] = value } +var ApiTooOldError = errors.New("The service is using too old of an API format for the operation") + // UpdateName updates the revision name. func UpdateName(template *servingv1alpha1.RevisionTemplateSpec, name string) error { + if template.Spec.DeprecatedContainer != nil { + return ApiTooOldError + } template.Name = name return nil }