diff --git a/pkg/kn/flags/podspec.go b/pkg/kn/flags/podspec.go index b3ee4af613..083e3d0fd0 100644 --- a/pkg/kn/flags/podspec.go +++ b/pkg/kn/flags/podspec.go @@ -290,10 +290,7 @@ func (p *PodSpecFlags) ResolvePodSpec(podSpec *corev1.PodSpec, cmd *cobra.Comman } if cmd.Flags().Changed("service-account") { - err = UpdateServiceAccountName(podSpec, p.ServiceAccountName) - if err != nil { - return err - } + UpdateServiceAccountName(podSpec, p.ServiceAccountName) } if cmd.Flags().Changed("pull-secret") { @@ -301,7 +298,10 @@ func (p *PodSpecFlags) ResolvePodSpec(podSpec *corev1.PodSpec, cmd *cobra.Comman } if cmd.Flags().Changed("user") { - UpdateUser(podSpec, p.User) + err = UpdateUser(podSpec, p.User) + if err != nil { + return err + } } return nil diff --git a/pkg/kn/flags/podspec_helper.go b/pkg/kn/flags/podspec_helper.go index 05895a460e..757b488f95 100644 --- a/pkg/kn/flags/podspec_helper.go +++ b/pkg/kn/flags/podspec_helper.go @@ -35,10 +35,6 @@ const ( PortFormatErr = "the port specification '%s' is not valid. Please provide in the format 'NAME:PORT', where 'NAME' is optional. Examples: '--port h2c:8080' , '--port 8080'." ) -var ( - UserImageAnnotationKey = "client.knative.dev/user-image" -) - func (vt VolumeSourceType) String() string { names := [...]string{"config-map", "secret"} if vt < ConfigMapVolumeSourceType || vt > SecretVolumeSourceType { @@ -254,10 +250,9 @@ func UpdateResourcesDeprecated(spec *corev1.PodSpec, requestsResourceList corev1 } // UpdateServiceAccountName updates the service account name used for the corresponding knative service -func UpdateServiceAccountName(spec *corev1.PodSpec, serviceAccountName string) error { +func UpdateServiceAccountName(spec *corev1.PodSpec, serviceAccountName string) { serviceAccountName = strings.TrimSpace(serviceAccountName) spec.ServiceAccountName = serviceAccountName - return nil } // UpdateImagePullSecrets updates the image pull secrets used for the corresponding knative service