未验证 提交 0083a48e 编写于 作者: H hongming

add pvc filter

Signed-off-by: Nhongming <talonwan@yunify.com>
上级 af5f50ff
...@@ -54,10 +54,10 @@ const ( ...@@ -54,10 +54,10 @@ const (
var ( var (
log = logf.Log.WithName("namespace-controller") log = logf.Log.WithName("namespace-controller")
defaultRoles = []rbac.Role{ defaultRoles = []rbac.Role{
{ObjectMeta: metav1.ObjectMeta{Name: "admin", Annotations: map[string]string{constants.DescriptionAnnotationKey: adminDescription}}, Rules: []rbac.PolicyRule{{Verbs: []string{"*"}, APIGroups: []string{"*"}, Resources: []string{"*"}}}}, {ObjectMeta: metav1.ObjectMeta{Name: "admin", Annotations: map[string]string{constants.DescriptionAnnotationKey: adminDescription, constants.CreatorAnnotationKey: constants.System}}, Rules: []rbac.PolicyRule{{Verbs: []string{"*"}, APIGroups: []string{"*"}, Resources: []string{"*"}}}},
{ObjectMeta: metav1.ObjectMeta{Name: "operator", Annotations: map[string]string{constants.DescriptionAnnotationKey: operatorDescription}}, Rules: []rbac.PolicyRule{{Verbs: []string{"get", "list", "watch"}, APIGroups: []string{"*"}, Resources: []string{"*"}}, {ObjectMeta: metav1.ObjectMeta{Name: "operator", Annotations: map[string]string{constants.DescriptionAnnotationKey: operatorDescription, constants.CreatorAnnotationKey: constants.System}}, Rules: []rbac.PolicyRule{{Verbs: []string{"get", "list", "watch"}, APIGroups: []string{"*"}, Resources: []string{"*"}},
{Verbs: []string{"*"}, APIGroups: []string{"", "apps", "extensions", "batch", "logging.kubesphere.io", "monitoring.kubesphere.io", "iam.kubesphere.io", "resources.kubesphere.io", "autoscaling", "alerting.kubesphere.io"}, Resources: []string{"*"}}}}, {Verbs: []string{"*"}, APIGroups: []string{"", "apps", "extensions", "batch", "logging.kubesphere.io", "monitoring.kubesphere.io", "iam.kubesphere.io", "resources.kubesphere.io", "autoscaling", "alerting.kubesphere.io"}, Resources: []string{"*"}}}},
{ObjectMeta: metav1.ObjectMeta{Name: "viewer", Annotations: map[string]string{constants.DescriptionAnnotationKey: viewerDescription}}, Rules: []rbac.PolicyRule{{Verbs: []string{"get", "list", "watch"}, APIGroups: []string{"*"}, Resources: []string{"*"}}}}, {ObjectMeta: metav1.ObjectMeta{Name: "viewer", Annotations: map[string]string{constants.DescriptionAnnotationKey: viewerDescription, constants.CreatorAnnotationKey: constants.System}}, Rules: []rbac.PolicyRule{{Verbs: []string{"get", "list", "watch"}, APIGroups: []string{"*"}, Resources: []string{"*"}}}},
} }
) )
......
...@@ -62,6 +62,10 @@ func (*persistentVolumeClaimSearcher) match(match map[string]string, item *v1.Pe ...@@ -62,6 +62,10 @@ func (*persistentVolumeClaimSearcher) match(match map[string]string, item *v1.Pe
if !sliceutil.HasString(statuses, pvcStatus(item)) { if !sliceutil.HasString(statuses, pvcStatus(item)) {
return false return false
} }
case storageClassName:
if item.Spec.StorageClassName == nil || *item.Spec.StorageClassName != v {
return false
}
case Keyword: case Keyword:
if !strings.Contains(item.Name, v) && !searchFuzzy(item.Labels, "", v) && !searchFuzzy(item.Annotations, "", v) { if !strings.Contains(item.Name, v) && !searchFuzzy(item.Labels, "", v) && !searchFuzzy(item.Annotations, "", v) {
return false return false
......
...@@ -70,6 +70,7 @@ const ( ...@@ -70,6 +70,7 @@ const (
Keyword = "keyword" Keyword = "keyword"
Status = "status" Status = "status"
includeCronJob = "includeCronJob" includeCronJob = "includeCronJob"
storageClassName = "storageClassName"
cronJobKind = "CronJob" cronJobKind = "CronJob"
s2iRunKind = "S2iRun" s2iRunKind = "S2iRun"
includeS2iRun = "includeS2iRun" includeS2iRun = "includeS2iRun"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册