35 Star 389 Fork 70

GVPrancher / rancher

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
catalog_sync.go 1.16 KB
一键复制 编辑 原始数据 按行查看 历史
Dan Ramich 提交于 2019-06-12 13:38 . goimport linting changes
package manager
import (
"github.com/sirupsen/logrus"
helmlib "github.com/rancher/rancher/pkg/catalog/helm"
"github.com/rancher/rancher/pkg/namespace"
v3 "github.com/rancher/types/apis/management.cattle.io/v3"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
func (m *Manager) updateCatalogError(catalog *v3.Catalog, err error) (runtime.Object, error) {
setRefreshedError(catalog, err)
m.catalogClient.Update(catalog)
return nil, err
}
func (m *Manager) Sync(key string, obj *v3.Catalog) (runtime.Object, error) {
if obj == nil {
return nil, m.deleteTemplates(key, namespace.GlobalNamespace)
}
// always get a refresh catalog from etcd
catalog, err := m.catalogClient.Get(key, metav1.GetOptions{})
if err != nil {
return nil, err
}
commit, helm, err := helmlib.NewForceUpdate(catalog)
if err != nil {
return m.updateCatalogError(catalog, err)
}
if isUpToDate(commit, catalog) {
if setRefreshed(catalog) {
m.catalogClient.Update(catalog)
}
return nil, nil
}
cmt := &CatalogInfo{
catalog: catalog,
}
logrus.Infof("Updating global catalog %s", catalog.Name)
return nil, m.traverseAndUpdate(helm, commit, cmt)
}
Go
1
https://gitee.com/rancher/rancher.git
git@gitee.com:rancher/rancher.git
rancher
rancher
rancher
v2.2.13

搜索帮助