37 Star 411 Fork 76

GVPrancher/rancher

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
project.go 819 Bytes
一键复制 编辑 原始数据 按行查看 历史
Aiwantaozi 提交于 2019-01-09 12:03 . Refactor logging
package project
import (
mgmtv3 "github.com/rancher/types/apis/management.cattle.io/v3"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/labels"
)
const (
System = "System"
Default = "Default"
)
const (
SystemImageVersionAnn = "field.cattle.io/systemImageVersion"
ProjectIDAnn = "field.cattle.io/projectId"
)
var (
SystemProjectLabel = map[string]string{"authz.management.cattle.io/system-project": "true"}
)
func GetSystemProject(clusterName string, projectLister mgmtv3.ProjectLister) (*mgmtv3.Project, error) {
projects, err := projectLister.List(clusterName, labels.Set(SystemProjectLabel).AsSelector())
if err != nil {
return nil, errors.Wrapf(err, "list project failed")
}
if len(projects) == 0 {
return nil, errors.New("can't find system project")
}
return projects[0], nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/rancher/rancher.git
git@gitee.com:rancher/rancher.git
rancher
rancher
rancher
v2.3.0-alpha2

搜索帮助

0d507c66 1850385 C8b1a773 1850385