Migrate ingress.class annotation to new IngressClassName field

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-03-31 11:14:03 -03:00
parent 461aa93d13
commit 04ef782c57
7 changed files with 46 additions and 27 deletions

View file

@ -949,12 +949,22 @@ func toIngress(obj interface{}) (*networkingv1beta1.Ingress, bool) {
return nil, false
}
ing.Spec.IngressClassName = extractClassName(ing)
return ing, true
}
if ing, ok := obj.(*networkingv1beta1.Ingress); ok {
ing.Spec.IngressClassName = extractClassName(ing)
return ing, true
}
return nil, false
}
func extractClassName(ing *networkingv1beta1.Ingress) *string {
if c, ok := ing.Annotations[class.IngressKey]; ok {
return &c
}
return nil
}