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

support ephemeral storage request/limits #175

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elyesbenamor
Copy link

@elyesbenamor elyesbenamor commented Jan 7, 2025

Closes #116

Add Ephemeral Storage Support

Description

This MR adds optional support for displaying ephemeral storage requests and limits in the kube-capacity CLI tool. This enhancement helps users monitor and analyze ephemeral storage allocation across their Kubernetes clusters, similar to how CPU and memory resources are currently tracked.

Features Added

  • New -e or --ephemeral-storage flag to display ephemeral storage metrics
  • Support for ephemeral storage in all output formats (table, JSON, YAML)
  • Integration with existing -a (available) flag to show available ephemeral storage
  • Container-level ephemeral storage metrics when using -c flag
  • Pod-level ephemeral storage aggregation when using -p flag

Implementation Details

  1. Added ShowEphemeralStorage boolean to the Options struct

  2. Enhanced resource tracking structures:

    • Added ephemeral storage fields to nodeMetric, podMetric, and containerMetric
    • Updated tableLine struct for table output
    • Modified JSON/YAML output structures to include ephemeral storage
  3. Updated formatters to handle ephemeral storage values:

    • Values are displayed in MiB format (consistent with memory)
    • Percentage calculations for requests and limits
    • Available storage calculations when using -a flag

Testing

  • Tested with various pod configurations using ephemeral storage requests and limits
  • Verified output formats (table, JSON, YAML) correctly display ephemeral storage metrics
  • Confirmed compatibility with existing flags (-p, -c, -a)
  • Validated percentage calculations and available storage display

Example Usage

# Show ephemeral storage in table format
kube-capacity -e

# Show ephemeral storage with pod details
kube-capacity -e -p

# Show available ephemeral storage
kube-capacity -e -a

# JSON output with container details
kube-capacity -e -c -o json

@elyesbenamor
Copy link
Author

@robscott Here is a detailed MR that can be reviewed please

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.

Support ephemeral-storage request/limits
1 participant