Fetch the repository succeeded.
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
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。