mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-15 06:58:11 +00:00
@@ -5,7 +5,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/armosec/k8s-interface/k8sinterface"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
@@ -55,22 +54,8 @@ func getNamespacesSelector(resource *schema.GroupVersionResource, ns, operator s
|
||||
}
|
||||
namespacesSlice := strings.Split(ns, ",")
|
||||
for _, n := range namespacesSlice {
|
||||
fieldSelectors += fmt.Sprintf("%s!=%s,", fieldSelector, n)
|
||||
fieldSelectors += fmt.Sprintf("%s%s%s,", fieldSelector, operator, n)
|
||||
}
|
||||
return fieldSelectors
|
||||
|
||||
}
|
||||
func setFieldSelector(listOptions *metav1.ListOptions, resource *schema.GroupVersionResource, excludedNamespaces string) {
|
||||
fieldSelector := "metadata."
|
||||
if resource.Resource == "namespaces" {
|
||||
fieldSelector += "name"
|
||||
} else if k8sinterface.IsNamespaceScope(resource.Group, resource.Resource) {
|
||||
fieldSelector += "namespace"
|
||||
} else {
|
||||
return
|
||||
}
|
||||
excludedNamespacesSlice := strings.Split(excludedNamespaces, ",")
|
||||
for _, excludedNamespace := range excludedNamespacesSlice {
|
||||
listOptions.FieldSelector += fmt.Sprintf("%s!=%s,", fieldSelector, excludedNamespace)
|
||||
}
|
||||
}
|
||||
|
||||
+10
-5
@@ -33,10 +33,15 @@ if __name__ == "__main__":
|
||||
run(kubescape_exec=smoke_utils.get_exec_from_args(sys.argv))
|
||||
|
||||
'''
|
||||
Tests to add:
|
||||
1. Scan E2E
|
||||
2. Download and add --use-from
|
||||
Supported tests:
|
||||
1. Commands
|
||||
2. Version number
|
||||
3. E2E yaml scanning
|
||||
|
||||
3. Test formats + output
|
||||
4. Test -t
|
||||
TODO:
|
||||
1. Test formats + output
|
||||
2. Test --fail-threshold
|
||||
3. Test known supported FW
|
||||
4. Test FW list
|
||||
5. Test Controls list
|
||||
'''
|
||||
Reference in New Issue
Block a user