Migrate to new networking.k8s.io/v1beta1 package

This commit is contained in:
Manuel Alejandro de Brito Fontes 2019-06-09 18:49:59 -04:00
parent 8cee8d5d9b
commit 84102eec2b
No known key found for this signature in database
GPG key ID: 786136016A8BA02A
113 changed files with 834 additions and 648 deletions

View file

@ -19,7 +19,7 @@ package sessionaffinity
import (
"regexp"
extensions "k8s.io/api/extensions/v1beta1"
networking "k8s.io/api/networking/v1beta1"
"k8s.io/klog"
"k8s.io/ingress-nginx/internal/ingress/annotations/parser"
@ -76,7 +76,7 @@ type Cookie struct {
// cookieAffinityParse gets the annotation values related to Cookie Affinity
// It also sets default values when no value or incorrect value is found
func (a affinity) cookieAffinityParse(ing *extensions.Ingress) *Cookie {
func (a affinity) cookieAffinityParse(ing *networking.Ingress) *Cookie {
var err error
cookie := &Cookie{}
@ -109,6 +109,11 @@ func (a affinity) cookieAffinityParse(ing *extensions.Ingress) *Cookie {
klog.V(3).Infof("Invalid or no annotation value found in Ingress %v: %v. Ignoring it", ing.Name, annotationAffinityCookieChangeOnFailure)
}
cookie.ChangeOnFailure, err = parser.GetBoolAnnotation(annotationAffinityCookieChangeOnFailure, ing)
if err != nil {
klog.V(3).Infof("Invalid or no annotation value found in Ingress %v: %v. Ignoring it", ing.Name, annotationAffinityCookieChangeOnFailure)
}
return cookie
}
@ -123,7 +128,7 @@ type affinity struct {
// ParseAnnotations parses the annotations contained in the ingress
// rule used to configure the affinity directives
func (a affinity) Parse(ing *extensions.Ingress) (interface{}, error) {
func (a affinity) Parse(ing *networking.Ingress) (interface{}, error) {
cookie := &Cookie{}
// Check the type of affinity that will be used
at, err := parser.GetStringAnnotation(annotationAffinityType, ing)