代码拉取完成,页面将自动刷新
package endpoints
import (
"strings"
workloadutil "github.com/rancher/rancher/pkg/controllers/user/workload"
"github.com/rancher/types/apis/extensions/v1beta1"
managementv3 "github.com/rancher/types/apis/management.cattle.io/v3"
"github.com/sirupsen/logrus"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
)
type IngressEndpointsController struct {
workloadController workloadutil.CommonController
ingressInterface v1beta1.IngressInterface
machinesLister managementv3.NodeLister
isRKE bool
clusterName string
}
func (c *IngressEndpointsController) sync(key string, obj *extensionsv1beta1.Ingress) (runtime.Object, error) {
namespace := ""
if obj != nil {
namespace = obj.Namespace
} else {
split := strings.Split(key, "/")
if len(split) == 2 {
namespace = split[0]
}
}
c.workloadController.EnqueueAllWorkloads(namespace)
if obj == nil || obj.DeletionTimestamp != nil {
return nil, nil
}
if _, err := c.reconcileEndpointsForIngress(obj); err != nil {
return nil, err
}
return nil, nil
}
func (c *IngressEndpointsController) reconcileEndpointsForIngress(obj *extensionsv1beta1.Ingress) (bool, error) {
fromObj := convertIngressToPublicEndpoints(obj, c.isRKE)
fromAnnotation := getPublicEndpointsFromAnnotations(obj.Annotations)
if areEqualEndpoints(fromAnnotation, fromObj) {
return false, nil
}
epsToUpdate, err := publicEndpointsToString(fromObj)
if err != nil {
return false, err
}
logrus.Infof("Updating ingress [%s:%s] with public endpoints [%v]", obj.Namespace, obj.Name, epsToUpdate)
toUpdate := obj.DeepCopy()
if toUpdate.Annotations == nil {
toUpdate.Annotations = make(map[string]string)
}
toUpdate.Annotations[endpointsAnnotation] = epsToUpdate
_, err = c.ingressInterface.Update(toUpdate)
return false, err
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。