Annotations cannot being empty

This commit is contained in:
Manuel Alejandro de Brito Fontes 2018-12-02 15:35:12 -03:00
parent f78e2e3849
commit 497246f8ba
No known key found for this signature in database
GPG key ID: 786136016A8BA02A
9 changed files with 28 additions and 26 deletions

View file

@ -52,6 +52,10 @@ func (a ingAnnotations) parseBool(name string) (bool, error) {
func (a ingAnnotations) parseString(name string) (string, error) {
val, ok := a[name]
if ok {
if len(val) == 0 {
return "", errors.NewInvalidAnnotationContent(name, val)
}
return val, nil
}
return "", errors.ErrMissingAnnotations
@ -97,6 +101,7 @@ func GetStringAnnotation(name string, ing *extensions.Ingress) (string, error) {
if err != nil {
return "", err
}
return ingAnnotations(ing.GetAnnotations()).parseString(v)
}