37 Star 407 Fork 74

GVPrancher/rancher

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
nodedriver.go 754 Bytes
一键复制 编辑 原始数据 按行查看 历史
Nathan Jenan 提交于 2018-11-28 08:29 . Adding pluggable driver support
package nodedriver
import (
"context"
"github.com/rancher/rancher/server/whitelist"
"github.com/rancher/types/apis/management.cattle.io/v3"
"github.com/rancher/types/config"
"k8s.io/apimachinery/pkg/runtime"
)
func Register(ctx context.Context, management *config.ScaledContext) {
management.Management.NodeDrivers("").AddHandler(ctx, "whitelist-proxy", sync)
}
func sync(key string, nodeDriver *v3.NodeDriver) (runtime.Object, error) {
if key == "" || nodeDriver == nil {
return nil, nil
}
if nodeDriver.DeletionTimestamp != nil {
for _, d := range nodeDriver.Spec.WhitelistDomains {
whitelist.Proxy.Rm(d)
}
return nil, nil
}
for _, d := range nodeDriver.Spec.WhitelistDomains {
whitelist.Proxy.Add(d)
}
return nil, nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/rancher/rancher.git
git@gitee.com:rancher/rancher.git
rancher
rancher
rancher
v2.2.0-alpha1

搜索帮助