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

Fix application profile and NN patching #335

Merged
merged 1 commit into from
Aug 6, 2024
Merged

Fix application profile and NN patching #335

merged 1 commit into from
Aug 6, 2024

Conversation

amirmalka
Copy link
Contributor

@amirmalka amirmalka commented Aug 6, 2024

Overview

Bug fix:

  • Application profiles and network neighborhoods were not marked as too big when passing the resource size threshold, due to a bug in the logic. The existing patch logic would exit from the function whenever the status annotation exists (regardless of its value).
  • monitorContainer function now returns the error - so that a log message with the reason will be printed to the log.

Logs after the fix:

{"level":"debug","ts":"2024-08-06T12:21:03Z","msg":"ApplicationProfileManager - saved application profile","capabilities":3,"execs":10,"opens":138,"slug":"pod-ping-app","container index":0,"container ID":"ee8d0d98e0700c349ab01565bcb2fff3ddca66bb3a8eb0aa7d6c240c33cebf00","k8s workload":"default/ping-app/ping-app"}
{"level":"debug","ts":"2024-08-06T12:21:03Z","msg":"ApplicationProfileManager - object is too large"}
{"level":"info","ts":"2024-08-06T12:21:03Z","msg":"ApplicationProfileManager - stop monitor on container","reason":"object is too large","container index":0,"container ID":"ee8d0d98e0700c349ab01565bcb2fff3ddca66bb3a8eb0aa7d6c240c33cebf00","k8s workload":"default/ping-app/ping-app"}

Application profile (setting the max size to 12):

kubectl get applicationprofiles pod-ping-app -oyaml
apiVersion: spdx.softwarecomposition.kubescape.io/v1beta1
kind: ApplicationProfile
metadata:
  annotations:
    kubescape.io/completion: complete
    kubescape.io/resource-size: "148"
    kubescape.io/status: too-large
    kubescape.io/wlid: wlid://cluster-xxxx/namespace-default/pod-ping-app
  creationTimestamp: "2024-08-06T12:18:55Z"
....

Signed-off-by: Amir Malka <amirm@armosec.io>
Copy link

github-actions bot commented Aug 6, 2024

Summary:

  • License scan: success
  • Credentials scan: failure
  • Vulnerabilities scan: failure
  • Unit test: success
  • Go linting: success

@amirmalka amirmalka added the release Create release label Aug 6, 2024
@amirmalka amirmalka merged commit 3274822 into main Aug 6, 2024
16 checks passed
@matthyx matthyx deleted the fix-patching branch September 17, 2024 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release Create release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants