mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-15 06:58:11 +00:00
update k8sinterface version
This commit is contained in:
@@ -4,7 +4,7 @@ go 1.17
|
||||
|
||||
require (
|
||||
github.com/armosec/armoapi-go v0.0.23
|
||||
github.com/armosec/k8s-interface v0.0.24
|
||||
github.com/armosec/k8s-interface v0.0.27
|
||||
github.com/armosec/opa-utils v0.0.57
|
||||
github.com/armosec/rbac-utils v0.0.1
|
||||
github.com/armosec/utils-go v0.0.3
|
||||
|
||||
@@ -87,8 +87,9 @@ github.com/armosec/armoapi-go v0.0.2/go.mod h1:vIK17yoKbJRQyZXWWLe3AqfqCRITxW8qm
|
||||
github.com/armosec/armoapi-go v0.0.23 h1:jqoLIWM5CR7DCD9fpFgN0ePqtHvOCoZv/XzCwsUluJU=
|
||||
github.com/armosec/armoapi-go v0.0.23/go.mod h1:iaVVGyc23QGGzAdv4n+szGQg3Rbpixn9yQTU3qWRpaw=
|
||||
github.com/armosec/k8s-interface v0.0.8/go.mod h1:xxS+V5QT3gVQTwZyAMMDrYLWGrfKOpiJ7Jfhfa0w9sM=
|
||||
github.com/armosec/k8s-interface v0.0.24 h1:rVFPpx/WqWFbFWDudBjKOhIMIon1Cd/fGFJtE2RBivU=
|
||||
github.com/armosec/k8s-interface v0.0.24/go.mod h1:0ztwEWLez2lpMMKHbs0DoZV64S0YIA4s72vCs9iAAiE=
|
||||
github.com/armosec/k8s-interface v0.0.27 h1:jVchKZT+PCtys0YbwEGoaG7OF0ebTZSEx9igu2oZ3wc=
|
||||
github.com/armosec/k8s-interface v0.0.27/go.mod h1:vHxGWqD/uh6+GQb9Sqv7OGMs+Rvc2dsFVc0XtgRh1ZU=
|
||||
github.com/armosec/opa-utils v0.0.57 h1:7lDEKxblqfsEXLn+6lkj17ctBSnhDuYanfdqG55kW2g=
|
||||
github.com/armosec/opa-utils v0.0.57/go.mod h1:UAT4Xokq91ysLa4Xg0WLqVsjJCnbFgsevkiIJFxTghU=
|
||||
github.com/armosec/rbac-utils v0.0.1 h1:N2MI98F/0zbDjmRZ29CNElU1AXkFLk5csd/qAHOBdXY=
|
||||
|
||||
@@ -54,7 +54,9 @@ func getNamespacesSelector(resource *schema.GroupVersionResource, ns, operator s
|
||||
}
|
||||
namespacesSlice := strings.Split(ns, ",")
|
||||
for _, n := range namespacesSlice {
|
||||
fieldSelectors += fmt.Sprintf("%s%s%s,", fieldSelector, operator, n)
|
||||
if n != "" {
|
||||
fieldSelectors += fmt.Sprintf("%s%s%s,", fieldSelector, operator, n)
|
||||
}
|
||||
}
|
||||
return fieldSelectors
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package resourcehandler
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/armosec/k8s-interface/k8sinterface"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
func TestGetNamespacesSelector(t *testing.T) {
|
||||
k8sinterface.InitializeMapResourcesMock()
|
||||
assert.Equal(t, "metadata.namespace==default,", getNamespacesSelector(&schema.GroupVersionResource{Version: "v1", Resource: "pods"}, "default,", "=="))
|
||||
assert.Equal(t, "", getNamespacesSelector(&schema.GroupVersionResource{Version: "v1", Resource: "nodes"}, "default,", "=="))
|
||||
}
|
||||
Reference in New Issue
Block a user