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

feat: add --cost-limit flag #86

Merged
merged 1 commit into from
Feb 21, 2025
Merged

feat: add --cost-limit flag #86

merged 1 commit into from
Feb 21, 2025

Conversation

matheusfm
Copy link
Contributor

Description

This PR adds the --cost-limit option with disabling support.

Linked Issues

Marvin fails when scanning a large ConfigMap.

How has this been tested?

  1. Create a large ConfigMap:
    head -c 1048576 </dev/urandom | base64 | head -c 950000 > configmap-data.txt
    kubectl create configmap large-configmap --from-file=configmap-data.txt
    
  2. Scan the current cluster:
    go run main.go scan
    
    Marvin will exit with a non-zero code and log the following errors:
    E0221 13:18:46.238360 2182897 scan.go:236] "msg"="failed to validate check M-201" "error"="evaluate error: operation cancelled: actual cost limit exceeded" "check"="M-201" "obj"="v1/ConfigMap/default/large-configmap"
    I0221 13:18:46.583668 2182897 scan.go:186] "msg"="scan finished with errors" 
    
  3. Scan the cluster disabling the cost limit:
    go run main.go scan --cost-limit=0
    
    Marvin will finish successfully.

Checklist

  • I have labeled this PR with the relevant Type labels
  • I have documented my code (if applicable)
  • My changes are covered by tests

@matheusfm matheusfm added the enhancement New feature or request label Feb 21, 2025
@matheusfm matheusfm requested a review from knrc February 21, 2025 16:20
@matheusfm matheusfm self-assigned this Feb 21, 2025
@matheusfm matheusfm merged commit 7e5bd08 into main Feb 21, 2025
4 checks passed
@matheusfm matheusfm deleted the cost-limit-flag branch February 21, 2025 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant