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(display): Output the size and type of disk #44

Merged
merged 4 commits into from
Feb 22, 2023

Conversation

Pokom
Copy link
Contributor

@Pokom Pokom commented Feb 21, 2023

Currently working through a problem where I need to understand the size and type of disks to help prioritize which ones to clean up. The command will now output the type and size(in GB).

Currently working through a problem where I need to understand the size
and type of disks to help prioritize which ones to clean up. The command
will now output the type and size(in GB).
@CLAassistant
Copy link

CLAassistant commented Feb 21, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@inkel inkel left a comment

Choose a reason for hiding this comment

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

I like the direction this is going!

One thing I'd add are standard disk types (SSD and HD for now, I suppose), and then have each provider map their internal representation to one of the standard ones in DiskType. Thoughts?

@Pokom
Copy link
Contributor Author

Pokom commented Feb 22, 2023

One thing I'd add are standard disk types (SSD and HD for now, I suppose), and then have each provider map their internal representation to one of the standard ones in DiskType. Thoughts?

I like the idea of having standard disks then mapping the CSP disks back. Only nit is that I need to dig deeper at the differences between AWS/AKS. GCP is pretty easy in the sense that it's either SSH/HD, but I think AWS has many more types

@inkel
Copy link
Collaborator

inkel commented Feb 22, 2023

Yup. A quick search shows that there are 7 EBS volume types, and the DescribeVolumes docs shows the values returned.

In the case of Azure they don't seem to have any particular identifier for their managed disks, only the full text description.

@Pokom
Copy link
Contributor Author

Pokom commented Feb 22, 2023

Azure:

const (
	// PremiumLRS Premium SSD locally redundant storage. Best for production and performance sensitive
	// workloads.
	PremiumLRS DiskStorageAccountTypes = "Premium_LRS"
	// StandardLRS Standard HDD locally redundant storage. Best for backup, non-critical, and infrequent
	// access.
	StandardLRS DiskStorageAccountTypes = "Standard_LRS"
	// StandardSSDLRS Standard SSD locally redundant storage. Best for web servers, lightly used enterprise
	// applications and dev/test.
	StandardSSDLRS DiskStorageAccountTypes = "StandardSSD_LRS"
	// UltraSSDLRS Ultra SSD locally redundant storage. Best for IO-intensive workloads such as SAP HANA, top
	// tier databases (for example, SQL, Oracle), and other transaction-heavy workloads.
	UltraSSDLRS DiskStorageAccountTypes = "UltraSSD_LRS"
)

AWS:

// Enum values for VolumeType
const (
	VolumeTypeStandard VolumeType = "standard"
	VolumeTypeIo1      VolumeType = "io1"
	VolumeTypeIo2      VolumeType = "io2"
	VolumeTypeGp2      VolumeType = "gp2"
	VolumeTypeSc1      VolumeType = "sc1"
	VolumeTypeSt1      VolumeType = "st1"
	VolumeTypeGp3      VolumeType = "gp3"
)

GCP:

Returns a hyperlink to the hard drive type 🤡

@Pokom
Copy link
Contributor Author

Pokom commented Feb 22, 2023

Can't find anything in AWS, but here's the output for Azure now:

unused -azure.sub $(az account subscription list | jq -r '. | map(.subscriptionId) | join(" ")')
PROVIDER  DISK                                                                      AGE     UNUSED  TYPE    SIZE_GB
Azure     pvc-...                                  155d    n/a     hdd     2
Azure     pvc-...                                 257d    n/a     hdd     100
Azure     pvc-...                                  155d    n/a     hdd     2
Azure     pvc-...                                  75d     n/a     hdd     100
...

@Pokom Pokom requested a review from inkel February 22, 2023 15:49
Copy link
Collaborator

@inkel inkel left a comment

Choose a reason for hiding this comment

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

Looking nicer on each commit! Thanks for working on this.

aws/disk.go Outdated Show resolved Hide resolved
azure/disk.go Outdated Show resolved Hide resolved
cmd/unused/internal/ui/table.go Outdated Show resolved Hide resolved
disk.go Show resolved Hide resolved
}

type DiskType string
Copy link
Collaborator

Choose a reason for hiding this comment

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

I love this 😸 good idea!

@Pokom Pokom requested a review from inkel February 22, 2023 18:24
Copy link
Collaborator

@inkel inkel left a comment

Choose a reason for hiding this comment

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

Let me know if you need help adding these columns to the interactive UI.

@Pokom
Copy link
Contributor Author

Pokom commented Feb 22, 2023

Oh forgot all about the Interactive UI! Let me play around with a bit and I'll let you know

@Pokom Pokom requested a review from inkel February 22, 2023 19:07
@Pokom Pokom marked this pull request as ready for review February 22, 2023 19:14
Copy link
Collaborator

@inkel inkel left a comment

Choose a reason for hiding this comment

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

@Pokom Pokom merged commit 7b3d4c9 into main Feb 22, 2023
@Pokom Pokom deleted the feat/output-size-and-type branch February 22, 2023 20:16
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.

Output additional information about the disks
3 participants