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

@ -59,8 +59,8 @@ requests to the first port of this Service.`)
ingressClass = flags.String("ingress-class", "",
`Name of the ingress class this controller satisfies.
The class of an Ingress object is set using the annotation "kubernetes.io/ingress.class".
All ingress classes are satisfied if this parameter is left empty.`)
The class of an Ingress object is set using the field IngressClassName in Kubernetes clusters version v1.18.0 or higher or the annotation "kubernetes.io/ingress.class" (deprecated).
All ingress classes are satisfied if this parameter is not set.`)
configMap = flags.String("configmap", "",
`Name of the ConfigMap containing custom global configurations for the controller.`)

View file

@ -102,11 +102,15 @@ func main() {
conf.FakeCertificate = ssl.GetFakeSSLCert()
klog.Infof("SSL fake certificate created %v", conf.FakeCertificate.PemFileName)
k8s.IsNetworkingIngressAvailable = k8s.NetworkingIngressAvailable(kubeClient)
k8s.IsNetworkingIngressAvailable, k8s.IsIngressV1Ready = k8s.NetworkingIngressAvailable(kubeClient)
if !k8s.IsNetworkingIngressAvailable {
klog.Warningf("Using deprecated \"k8s.io/api/extensions/v1beta1\" package because Kubernetes version is < v1.14.0")
}
if !k8s.IsIngressV1Ready {
klog.Infof("Enabling new Ingress features availables since v1.18.0")
}
conf.Client = kubeClient
reg := prometheus.NewRegistry()