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

Audit mode with default true #21

Merged
merged 10 commits into from
May 16, 2024
Merged

Audit mode with default true #21

merged 10 commits into from
May 16, 2024

Conversation

avrodrigues5
Copy link
Collaborator

@avrodrigues5 avrodrigues5 commented May 16, 2024

What does this PR change?

  1. Introduces audit mode run for Disk auto scaler
  2. adds caching in front of API call to Kubecost API
  3. Recommended bytes is calculated by convert targetutilization to headroom percentage expected by kubecost API
  4. Interchanges namespace and deployment in custom error.
  5. Kubernetes REST client settings are set to Queries per second of 20 and Burst of 10. This is still low to avoid log message having Kubernetes request.go warning about waiting to get the kubernetes object.

Does this PR rely on any other PRs?

None

How does this PR impact users?

Default will be audit mode, unless it set to false the Disk auto scaling wouldnt perform any scaling up and scaling down operations

Links to Issues or tickets this PR addresses or fixes

closes #4

What risks are associated with merging this PR? What is required to fully test this PR?

The audit mode is a safe option as default so its better for user

How was this PR tested?

When run in audit mode logs will look like below

2024-05-16T22:44:17Z INF Namespace: steven, Deployment: steven-prometheus-server, PVC: steven-prometheus-server, PV: pvc-8fb7e7f6-83ef-444a-b337-0c6698cc9f90, Target Utilization: 70%, current size is: 32Gi, recommended size is: 1Gi, and expected monthly savings is: $3.10
2024-05-16T22:44:17Z INF Namespace: thanos, Deployment: thanos-compactor, PVC: thanos-compactor, PV: pvc-5f174e0f-8245-4023-880e-d44383ba4c2a, Target Utilization: 70%, current size is: 8Gi, recommended size is: 1Gi, and expected monthly savings is: $0.70
2024-05-16T22:44:19Z INF Namespace: disk-scaler-demo, Deployment: ubuntu-deployment-scale-up, PVC: scale-up-pvc, PV: pvc-bd21b08e-7f68-4798-b1db-16577a5d9772, Target Utilization: 70%, current size is: 6Gi, recommended size is: 6Gi, and expected monthly savings is: $-0.08
2024-05-16T22:44:19Z INF Namespace: thomasn-guardduty-tmp, Deployment: thomasn-guardduty-tmp-cost-analyzer, PVC: thomasn-guardduty-tmp-cost-analyzer, PV: pvc-589ada18-bd52-41e6-a768-a2da2e12e67d, Target Utilization: 70%, current size is: 32Gi, recommended size is: 2Gi, and expected monthly savings is: $3.00
2024-05-16T22:44:20Z INF Namespace: thomasn-guardduty-tmp, Deployment: thomasn-guardduty-tmp-prometheus-server, PVC: thomasn-guardduty-tmp-prometheus-server, PV: pvc-7f3bde56-5ad0-43bb-b7a7-61e6878200d9, Target Utilization: 70%, current size is: 32Gi, recommended size is: 1Gi, and expected monthly savings is: $3.10
2024-05-16T22:44:21Z INF Namespace: ecr-test, Deployment: ecr-test-cost-analyzer, PVC: ecr-test-cost-analyzer, PV: pvc-cfa8a9c3-88e6-4bbc-8511-9bdeb5e89141, Target Utilization: 70%, current size is: 32Gi, recommended size is: 1Gi, and expected monthly savings is: $3.10
2024-05-16T22:44:21Z INF Namespace: thomasn-nightly-dev, Deployment: thomasn-nightly-dev-cost-analyzer, PVC: thomasn-nightly-dev-cost-analyzer, PV: pvc-691a99a8-ad61-4432-b125-fd136e8de168, Target Utilization: 70%, current size is: 32Gi, recommended size is: 2Gi, and expected monthly savings is: $3.00

Without audit mode tested for scale up and scale down operation

Copy link
Collaborator

@chipzoller chipzoller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please copy that logged output in audit mode as a code block, not screenshot? We should add this to the README.

@avrodrigues5
Copy link
Collaborator Author

Can you please copy that logged output in audit mode as a code block, not screenshot? We should add this to the README.

Done

avrodrigues5 and others added 2 commits May 16, 2024 16:45
Co-authored-by: Chip Zoller <chipzoller@gmail.com>
Co-authored-by: Chip Zoller <chipzoller@gmail.com>
@chipzoller
Copy link
Collaborator

@avrodrigues5 please review latest README changes.

@avrodrigues5 avrodrigues5 merged commit d683173 into main May 16, 2024
1 check passed
@avrodrigues5 avrodrigues5 deleted the avr/audit-mode branch May 16, 2024 23:55
@dwbrown2
Copy link

Really cool! Just a future idea, could be nice to show % savings and maybe even a total expected savings amount.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Audit mode
3 participants