37 Star 411 Fork 76

GVPrancher/rancher

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
enqueue.go 914 Bytes
一键复制 编辑 原始数据 按行查看 历史
kinarashah 提交于 2019-02-07 16:02 . mcapp controller fixes
package multiclusterapp
import (
"context"
"github.com/rancher/rancher/pkg/namespace"
"github.com/rancher/types/apis/management.cattle.io/v3"
pv3 "github.com/rancher/types/apis/project.cattle.io/v3"
"github.com/rancher/types/config"
"k8s.io/apimachinery/pkg/runtime"
)
func StartMCAppEnqueueController(ctx context.Context, management *config.ManagementContext) {
m := MCAppEnqueueController{
mcApps: management.Management.MultiClusterApps(""),
}
management.Project.Apps("").AddHandler(ctx, "management-mcapp-enqueue-controller", m.sync)
}
type MCAppEnqueueController struct {
mcApps v3.MultiClusterAppInterface
}
func (m *MCAppEnqueueController) sync(key string, app *pv3.App) (runtime.Object, error) {
if app == nil {
return app, nil
}
if mcappName, ok := app.Labels[MultiClusterAppIDSelector]; ok {
m.mcApps.Controller().Enqueue(namespace.GlobalNamespace, mcappName)
}
return app, nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/rancher/rancher.git
git@gitee.com:rancher/rancher.git
rancher
rancher
rancher
v2.2.0-rc15

搜索帮助

0d507c66 1850385 C8b1a773 1850385