Skip to content

Commit

Permalink
Address comments about consistency in the code
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf committed Jan 12, 2017
1 parent 8191245 commit 4a2146b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
10 changes: 9 additions & 1 deletion core/pkg/ingress/annotations/authtls/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package authtls

import (
"github.com/pkg/errors"
"k8s.io/kubernetes/pkg/apis/extensions"

"k8s.io/ingress/core/pkg/ingress/annotations/parser"
Expand Down Expand Up @@ -56,5 +57,12 @@ func (a authTLS) Parse(ing *extensions.Ingress) (interface{}, error) {
return nil, ing_errors.NewLocationDenied("an empty string is not a valid secret name")
}

return a.certResolver.GetAuthCertificate(str)
authCert, err := a.certResolver.GetAuthCertificate(str)
if err != nil {
return nil, ing_errors.LocationDenied{
Reason: errors.Wrap(err, "error obtaining certificate"),
}
}

return authCert, nil
}
11 changes: 6 additions & 5 deletions core/pkg/ingress/controller/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,17 @@ func (e *annotationExtractor) Extract(ing *extensions.Ingress) map[string]interf
val, err := annotationParser.Parse(ing)
glog.V(5).Infof("annotation %v in Ingress %v/%v: %v", name, ing.GetNamespace(), ing.GetName(), val)
if err != nil {
_, de := anns["Denied"]
if errors.IsLocationDenied(err) && !de {
anns["Denied"] = err
glog.Errorf("error reading %v annotation in Ingress %v/%v: %v", name, ing.GetNamespace(), ing.GetName(), err)
if errors.IsMissingAnnotations(err) {
continue
}
if !errors.IsMissingAnnotations(err) {

_, alreadyDenied := anns[DeniedKeyName]
if !alreadyDenied {
anns[DeniedKeyName] = err
glog.Errorf("error reading %v annotation in Ingress %v/%v: %v", name, ing.GetNamespace(), ing.GetName(), err)
continue
}

glog.V(5).Infof("error reading %v annotation in Ingress %v/%v: %v", name, ing.GetNamespace(), ing.GetName(), err)
}

Expand Down

0 comments on commit 4a2146b

Please sign in to comment.