Skip to content

Conversation

@iamkirkbater
Copy link
Contributor

This command exports Carbon Reporting data for a given Red Hat Owned AWS Account. We have customers who wish to obtain this data from their OSD clusters, however this is not published at an account level when an account is a child account, so we cannot expose this as self-service for these customers.

This command allows an SRE to export carbon reporting data for a given account across a given usage period to a CSV file via stdout.

Example Usage:

osdctl cost carbon-report --account [aws account id] --usage-period 2025 > /tmp/emissions.csv

This will go into the carbon emissions S3 bucket, loop through all 2025 usage period reports, and gather only the rows for a given account id, and then publish them to stdout which we can then pipe to a file.

@openshift-ci openshift-ci bot requested review from joshbranham and typeid January 7, 2026 19:01
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 7, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 7, 2026

@iamkirkbater: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@iamkirkbater
Copy link
Contributor Author

/label tide/merge-method-squash

@openshift-ci openshift-ci bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jan 7, 2026
}

// validateAccount validates that the account is a number with at least 12 digits
func (o *carbonReportOptions) validateAccount() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

I could go either way with this check, but seems not necessary.

Copy link
Contributor Author

@iamkirkbater iamkirkbater Jan 12, 2026

Choose a reason for hiding this comment

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

My main concern when adding this check is ensuring that we're passing a valid AWS Account ID - specifically if there are leading 0s in the case of copy/paste errors from excel/sheets or if someone running this tries to pass a cluster ID then it would fail.

Claude did it's thing and added all of the extra validation, but since it's AWS Account IDs I figured it would be fine.

Comment on lines +29 to +30
"payer_account_id": true,
"usage_account_id": true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Without knowing the data, is it better to have an includedColumns map?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could go either way. There's a CSV in https://issues.redhat.com/browse/OHSS-34489 that is the output of this command if you want to take a look at what else is there. In this case I think I'd rather be permissive than be overly exclusive, but I could be convinced otherwise.

@joshbranham
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 12, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 12, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: iamkirkbater, joshbranham

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [iamkirkbater,joshbranham]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 94099fc into openshift:master Jan 12, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants