Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rewrite annotation parser #265

Merged
merged 1 commit into from
Feb 14, 2017
Merged

Conversation

aledbf
Copy link
Member

@aledbf aledbf commented Feb 11, 2017

We need to return a Redirect type and not an error in order to get information about the SSL redirect defined in the backend

fixes #264
fixes #160

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 11, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) to 45.971% when pulling eb69a1d on aledbf:fix-redirect into 037120e on kubernetes:master.

return nil, err
}

rt, _ := parser.GetStringAnnotation(rewriteTo, ing)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we eating this error instead of logging it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bprashanth after this PR I will refactor the parser to not consider error when the annotation is missing (that is why I'm eating the error)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah recommend returning errAnnotationNotFound or something and ignoring the error just based on the type, eg:

type errAnnotationMissing struct {
  errMsg string
}

func (e *errAnnotationMissing) Error() string { return e.errMsg}


rt, err := parser.GetStringAnnotation(rewriteTo, ing)
 switch t := err.(type) {
 case *errAnnotationMissing:
    break
 default:
     glog.Errorf("Failed to parse annotation, %v", err)
}

@bprashanth
Copy link
Contributor

LGTM

@bprashanth bprashanth merged commit a9b5770 into kubernetes:master Feb 14, 2017
@aledbf aledbf deleted the fix-redirect branch February 16, 2017 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA.
Projects
None yet
6 participants