Require Kubernetes v1.14 or higher and deprecate extensions
This commit is contained in:
parent
f55a47e461
commit
b1f0d28634
5 changed files with 14 additions and 116 deletions
|
|
@ -266,32 +266,17 @@ func runUpdate(ing *ingress.Ingress, status []apiv1.LoadBalancerIngress,
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
if k8s.IsNetworkingIngressAvailable {
|
||||
ingClient := client.NetworkingV1beta1().Ingresses(ing.Namespace)
|
||||
currIng, err := ingClient.Get(context.TODO(), ing.Name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, fmt.Sprintf("unexpected error searching Ingress %v/%v", ing.Namespace, ing.Name))
|
||||
}
|
||||
ingClient := client.NetworkingV1beta1().Ingresses(ing.Namespace)
|
||||
currIng, err := ingClient.Get(context.TODO(), ing.Name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, fmt.Sprintf("unexpected error searching Ingress %v/%v", ing.Namespace, ing.Name))
|
||||
}
|
||||
|
||||
klog.Infof("updating Ingress %v/%v status from %v to %v", currIng.Namespace, currIng.Name, currIng.Status.LoadBalancer.Ingress, status)
|
||||
currIng.Status.LoadBalancer.Ingress = status
|
||||
_, err = ingClient.UpdateStatus(context.TODO(), currIng, metav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
klog.Warningf("error updating ingress rule: %v", err)
|
||||
}
|
||||
} else {
|
||||
ingClient := client.ExtensionsV1beta1().Ingresses(ing.Namespace)
|
||||
currIng, err := ingClient.Get(context.TODO(), ing.Name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, fmt.Sprintf("unexpected error searching Ingress %v/%v", ing.Namespace, ing.Name))
|
||||
}
|
||||
|
||||
klog.Infof("updating Ingress %v/%v status from %v to %v", currIng.Namespace, currIng.Name, currIng.Status.LoadBalancer.Ingress, status)
|
||||
currIng.Status.LoadBalancer.Ingress = status
|
||||
_, err = ingClient.UpdateStatus(context.TODO(), currIng, metav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
klog.Warningf("error updating ingress rule: %v", err)
|
||||
}
|
||||
klog.Infof("updating Ingress %v/%v status from %v to %v", currIng.Namespace, currIng.Name, currIng.Status.LoadBalancer.Ingress, status)
|
||||
currIng.Status.LoadBalancer.Ingress = status
|
||||
_, err = ingClient.UpdateStatus(context.TODO(), currIng, metav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
klog.Warningf("error updating ingress rule: %v", err)
|
||||
}
|
||||
|
||||
return true, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue