37 Star 403 Fork 75

GVPrancher/rancher

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
approuter.go 1.36 KB
Copy Edit Raw Blame History
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(ctx, "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.2.13

Search