37 Star 396 Fork 71

GVPrancher / rancher

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
approuter.go 1.36 KB
一键复制 编辑 原始数据 按行查看 历史
Mars 提交于 2018-05-22 15:20 . Add dynamic DNS
package approuter
import (
"context"
"github.com/rancher/types/config"
)
// This controller is responsible for watching all the ingress resources in the cluster and creates the following DNS entries
// in <rancher_root_domain>:
// <$ingress_name>.<$namespace>.<$cluster_id>.<rancher_root_domain> => [ingress IPs]
// When an ingress resource has more than 10 IPs, only 10 IPs will be returned by DNS.
// In an RKE cluster, when a node becomes unhealthy and the corresponding nginx ingress resource becomes unavailable,
// the dynamic DNS controller updates the DNS mapping to remove that node IP from the list.
// Every once in a while (default 24h), the dynamic DNS controller will call renew to update the expiration time
func Register(ctx context.Context, cluster *config.UserContext) {
secrets := cluster.Management.Core.Secrets("")
secretLister := cluster.Management.Core.Secrets("").Controller().Lister()
workload := cluster.UserOnlyContext()
c := &Controller{
ingressInterface: workload.Extensions.Ingresses(""),
ingressLister: workload.Extensions.Ingresses("").Controller().Lister(),
dnsClient: NewClient(secrets, secretLister, workload.ClusterName),
clusterName: workload.ClusterName,
managementSecretLister: secretLister,
}
workload.Extensions.Ingresses("").AddHandler("approuterController", c.sync)
go c.renew(ctx)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/rancher/rancher.git
git@gitee.com:rancher/rancher.git
rancher
rancher
rancher
v2.0.12-rc3

搜索帮助

344bd9b3 5694891 D2dac590 5694891