Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Daisy Guo committed Oct 6, 2020
1 parent 8224cc7 commit 610519d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
10 changes: 5 additions & 5 deletions pkg/kn/flags/podspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,18 +290,18 @@ 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") {
UpdateImagePullSecrets(podSpec, p.ImagePullSecrets)
}

if cmd.Flags().Changed("user") {
UpdateUser(podSpec, p.User)
err = UpdateUser(podSpec, p.User)
if err != nil {
return err
}
}

return nil
Expand Down
7 changes: 1 addition & 6 deletions pkg/kn/flags/podspec_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 610519d

Please sign in to comment.