本文整理汇总了Golang中k8s/io/kubernetes/pkg/client/unversioned.IngressInterface.Get方法的典型用法代码示例。如果您正苦于以下问题:Golang IngressInterface.Get方法的具体用法?Golang IngressInterface.Get怎么用?Golang IngressInterface.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类k8s/io/kubernetes/pkg/client/unversioned.IngressInterface
的用法示例。
在下文中一共展示了IngressInterface.Get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: updateLbIp
// updateLbIp updates the loadbalancer status ip if required.
func updateLbIp(
ingClient client.IngressInterface, ing extensions.Ingress, ip string) error {
lbIPs := ing.Status.LoadBalancer.Ingress
if len(lbIPs) > 0 && lbIPs[0].IP == ip {
glog.Infof("Ingress %v/%v: %v doesn't require status update",
ing.Namespace, ing.Name, lbIPs)
return nil
}
glog.Infof("Updating Ingress %v/%v with ip %v",
ing.Namespace, ing.Name, ip)
currIng, err := ingClient.Get(ing.Name)
if err != nil {
return err
}
currIng.Status = extensions.IngressStatus{
LoadBalancer: api.LoadBalancerStatus{
Ingress: []api.LoadBalancerIngress{
{IP: ip},
},
},
}
// TODO: If this update fails it's probably resource version related,
// which means it's advantageous to retry right away vs requeuing,
// which will lead to a full sync.
if _, err := ingClient.UpdateStatus(currIng); err != nil {
return err
}
return nil
}