代码拉取完成,页面将自动刷新
package networkpolicy
import (
"context"
"github.com/rancher/types/config"
"github.com/sirupsen/logrus"
)
// Register initializes the controllers and registers
func Register(ctx context.Context, cluster *config.UserContext) {
logrus.Infof("Registering project network policy")
pnpLister := cluster.Management.Management.ProjectNetworkPolicies("").Controller().Lister()
pnps := cluster.Management.Management.ProjectNetworkPolicies("")
projectLister := cluster.Management.Management.Projects("").Controller().Lister()
projects := cluster.Management.Management.Projects("")
clusterLister := cluster.Management.Management.Clusters("").Controller().Lister()
clusters := cluster.Management.Management.Clusters("")
nodeLister := cluster.Core.Nodes("").Controller().Lister()
nsLister := cluster.Core.Namespaces("").Controller().Lister()
nses := cluster.Core.Namespaces("")
serviceLister := cluster.Core.Services("").Controller().Lister()
services := cluster.Core.Services("")
podLister := cluster.Core.Pods("").Controller().Lister()
pods := cluster.Core.Pods("")
npLister := cluster.Networking.NetworkPolicies("").Controller().Lister()
npClient := cluster.Networking
npmgr := &netpolMgr{nsLister, nodeLister, pods, projects,
npLister, npClient, projectLister, cluster.ClusterName}
ps := &projectSyncer{pnpLister, pnps, projects, clusterLister, cluster.ClusterName}
nss := &nsSyncer{npmgr, clusterLister, serviceLister, podLister,
services, pods, cluster.ClusterName}
pnpsyncer := &projectNetworkPolicySyncer{npmgr}
podHandler := &podHandler{npmgr, pods, clusterLister, cluster.ClusterName}
serviceHandler := &serviceHandler{npmgr, clusterLister, cluster.ClusterName}
nodeHandler := &nodeHandler{npmgr, clusterLister, cluster.ClusterName}
clusterHandler := &clusterHandler{cluster, pnpLister, podLister,
serviceLister, projectLister, clusters, pnps, npmgr, cluster.ClusterName}
clusterNetAnnHandler := &clusterNetAnnHandler{clusters, cluster.ClusterName}
projects.Controller().AddClusterScopedHandler(ctx, "projectSyncer", cluster.ClusterName, ps.Sync)
pnps.AddClusterScopedHandler(ctx, "projectNetworkPolicySyncer", cluster.ClusterName, pnpsyncer.Sync)
nses.AddHandler(ctx, "namespaceLifecycle", nss.Sync)
pods.AddHandler(ctx, "podHandler", podHandler.Sync)
services.AddHandler(ctx, "serviceHandler", serviceHandler.Sync)
cluster.Management.Management.Nodes(cluster.ClusterName).Controller().AddHandler(ctx, "nodeHandler", nodeHandler.Sync)
clusters.AddHandler(ctx, "clusterHandler", clusterHandler.Sync)
clusters.AddHandler(ctx, "clusterNetAnnHandler", clusterNetAnnHandler.Sync)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。