Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump k8s-interface pkg #197

Merged
merged 2 commits into from
Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/hashicorp/golang-lru/v2 v2.0.6
github.com/kubescape/backend v0.0.17
github.com/kubescape/go-logger v0.0.21
github.com/kubescape/k8s-interface v0.0.148
github.com/kubescape/k8s-interface v0.0.153
github.com/kubescape/opa-utils v0.0.270
github.com/kubescape/storage v0.0.29
github.com/mitchellh/mapstructure v1.5.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,8 @@ github.com/kubescape/backend v0.0.17 h1:vxUwbvLAvtqcWBpq+8H+PMpT/1zOPPLqL9+sgYan
github.com/kubescape/backend v0.0.17/go.mod h1:ug9NFmmxT4DcQx3sgdLRzlLPWMKGHE/fpbcYUm5G5Qo=
github.com/kubescape/go-logger v0.0.21 h1:4ZRIEw3UGUH6BG/cH3yiqFipzQSfGAoCrxlsZuk37ys=
github.com/kubescape/go-logger v0.0.21/go.mod h1:x3HBpZo3cMT/WIdy18BxvVVd5D0e/PWFVk/HiwBNu3g=
github.com/kubescape/k8s-interface v0.0.148 h1:vtXDUjvCow5wMdDvb5c/Td9SpafeRqsV/LnOd0NVVsE=
github.com/kubescape/k8s-interface v0.0.148/go.mod h1:5sz+5Cjvo98lTbTVDiDA4MmlXxeHSVMW/wR0V3hV4K8=
github.com/kubescape/k8s-interface v0.0.153 h1:EXYmQuLrCf7nJZnhNFRyeIwGbiSrNLIXy9p2EP9ZiXQ=
github.com/kubescape/k8s-interface v0.0.153/go.mod h1:5sz+5Cjvo98lTbTVDiDA4MmlXxeHSVMW/wR0V3hV4K8=
github.com/kubescape/opa-utils v0.0.270 h1:DXTw+p7vJE44s8btYlcxqJdpkFlXuhKeveSJWEFC0jM=
github.com/kubescape/opa-utils v0.0.270/go.mod h1:VmplJnkhei6mDna+6z183k/HX6GOPgsXiwIlDW8mhKw=
github.com/kubescape/rbac-utils v0.0.20 h1:1MMxsCsCZ3ntDi8f9ZYYcY+K7bv50bDW5ZvnGnhMhJw=
Expand Down
24 changes: 12 additions & 12 deletions watcher/watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func TestHandleSBOMFilteredEvents(t *testing.T) {
Type: watch.Added,
Object: &spdxv1beta1.SBOMSPDXv2p3Filtered{
ObjectMeta: v1.ObjectMeta{
Name: "default-pod-reverse-proxy-2f07-68bd",
Name: "pod-reverse-proxy",
Annotations: map[string]string{
instanceidv1.InstanceIDMetadataKey: "apiVersion-v1/namespace-default/kind-Pod/name-reverse-proxy/containerName-nginx",
},
Expand All @@ -376,7 +376,7 @@ func TestHandleSBOMFilteredEvents(t *testing.T) {
},
{
name: "Adding a new Filtered SBOM with known instance ID slug should produce a matching scan command",
knownInstanceIDSlugs: []string{"default-pod-reverse-proxy-2f07-68bd"},
knownInstanceIDSlugs: []string{"pod-reverse-proxy"},
wlidsToContainersToImageIDsMap: WlidsToContainerToImageIDMap{
"wlid://cluster-relevant-clutser/namespace-default/deployment-nginx": {
"nginx": "nginx@sha256:1f4e3b6489888647ce1834b601c6c06b9f8c03dee6e097e13ed3e28c01ea3ac8c",
Expand All @@ -387,7 +387,7 @@ func TestHandleSBOMFilteredEvents(t *testing.T) {
Type: watch.Added,
Object: &spdxv1beta1.SBOMSPDXv2p3Filtered{
ObjectMeta: v1.ObjectMeta{
Name: "default-pod-reverse-proxy-2f07-68bd",
Name: "pod-reverse-proxy",
Annotations: map[string]string{
instanceidv1.InstanceIDMetadataKey: "apiVersion-v1/namespace-default/kind-Pod/name-reverse-proxy/containerName-nginx",
instanceidv1.WlidMetadataKey: "wlid://cluster-relevant-clutser/namespace-default/deployment-nginx",
Expand All @@ -396,7 +396,7 @@ func TestHandleSBOMFilteredEvents(t *testing.T) {
},
},
},
expectedObjectNames: []string{"default-pod-reverse-proxy-2f07-68bd"},
expectedObjectNames: []string{"pod-reverse-proxy"},
expectedCommands: []*apis.Command{
{
CommandName: apis.TypeScanImages,
Expand All @@ -412,7 +412,7 @@ func TestHandleSBOMFilteredEvents(t *testing.T) {
},
{
name: "Adding a new Filtered SBOM with known instance ID slug but missing WLID annotation should produce a matching error",
knownInstanceIDSlugs: []string{"default-pod-reverse-proxy-2f07-68bd"},
knownInstanceIDSlugs: []string{"pod-reverse-proxy"},
wlidsToContainersToImageIDsMap: WlidsToContainerToImageIDMap{
"wlid://cluster-relevant-clutser/namespace-default/deployment-nginx": {
"nginx": "nginx@sha256:1f4e3b6489888647ce1834b601c6c06b9f8c03dee6e097e13ed3e28c01ea3ac8c",
Expand All @@ -423,15 +423,15 @@ func TestHandleSBOMFilteredEvents(t *testing.T) {
Type: watch.Added,
Object: &spdxv1beta1.SBOMSPDXv2p3Filtered{
ObjectMeta: v1.ObjectMeta{
Name: "default-pod-reverse-proxy-2f07-68bd",
Name: "pod-reverse-proxy",
Annotations: map[string]string{
instanceidv1.InstanceIDMetadataKey: "apiVersion-v1/namespace-default/kind-Pod/name-reverse-proxy/containerName-nginx",
},
},
},
},
},
expectedObjectNames: []string{"default-pod-reverse-proxy-2f07-68bd"},
expectedObjectNames: []string{"pod-reverse-proxy"},
expectedCommands: []*apis.Command{},
expectedErrors: []error{ErrMissingWLIDAnnotation},
},
Expand All @@ -448,15 +448,15 @@ func TestHandleSBOMFilteredEvents(t *testing.T) {
Type: watch.Added,
Object: &spdxv1beta1.SBOMSPDXv2p3Filtered{
ObjectMeta: v1.ObjectMeta{
Name: "default-pod-reverse-proxy-1ba5-4aaf",
Name: "pod-reverse-proxy",
Annotations: map[string]string{
instanceidv1.WlidMetadataKey: "wlid://cluster-relevant-clutser/namespace-routing/deployment-nginx",
},
},
},
},
},
expectedObjectNames: []string{"default-pod-reverse-proxy-1ba5-4aaf"},
expectedObjectNames: []string{"pod-reverse-proxy"},
expectedCommands: []*apis.Command{},
expectedErrors: []error{ErrMissingInstanceIDAnnotation},
},
Expand All @@ -468,13 +468,13 @@ func TestHandleSBOMFilteredEvents(t *testing.T) {
Type: watch.Deleted,
Object: &spdxv1beta1.SBOMSPDXv2p3Filtered{
ObjectMeta: v1.ObjectMeta{
Name: "default-pod-reverse-proxy-1ba5-4aaf",
Name: "pod-reverse-proxy",
Annotations: map[string]string{instanceidv1.InstanceIDMetadataKey: "60d3737f69e6bd1e1573ecbdb395937219428d00687b4e5f1553f6f192c63e6c"},
},
},
},
},
expectedObjectNames: []string{"default-pod-reverse-proxy-1ba5-4aaf"},
expectedObjectNames: []string{"pod-reverse-proxy"},
expectedCommands: []*apis.Command{},
expectedErrors: []error{},
},
Expand All @@ -486,7 +486,7 @@ func TestHandleSBOMFilteredEvents(t *testing.T) {
Type: watch.Added,
Object: &spdxv1beta1.VulnerabilityManifest{
ObjectMeta: v1.ObjectMeta{
Name: "default-pod-reverse-proxy-1ba5-4aaf",
Name: "pod-reverse-proxy",
Annotations: map[string]string{instanceidv1.InstanceIDMetadataKey: "60d3737f69e6bd1e1573ecbdb395937219428d00687b4e5f1553f6f192c63e6c"},
},
},
Expand Down
Loading