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

[Feature] Add script to clean up golden AMIs in AWS regions where we're at our quota for public images #230

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

AlexVulaj
Copy link
Contributor

What does this PR do? / Related Issues / Jira

Adds a Go script to clean up our Golden AMIs in regions where we've hit our quota.

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have tested the functionality against gcp / aws, it doesn't cause any regression
  • I have added execution results to the PR's readme

How to test this PR locally / Special Instructions

First, make sure you have AWS credentials for the target account. Then cd into cleangoldenami, run go build, then run the executable (preferably with --dry-run and --verbose)

Logs

Region af-south-1 is under quota. (Images: 13, Quota: 20)
Region ap-east-1 is under quota. (Images: 14, Quota: 20)
Region ap-northeast-1 is under quota. (Images: 14, Quota: 20)
Region ap-northeast-2 is under quota. (Images: 13, Quota: 20)
Region ap-northeast-3 is under quota. (Images: 14, Quota: 20)
Region ap-south-1 is under quota. (Images: 14, Quota: 20)
Region ap-south-2 is under quota. (Images: 8, Quota: 20)
Region ap-southeast-1 is under quota. (Images: 15, Quota: 20)
Region ap-southeast-2 is under quota. (Images: 13, Quota: 20)
Region ap-southeast-3 is under quota. (Images: 13, Quota: 20)
Region ap-southeast-4 is under quota. (Images: 8, Quota: 20)
Region ca-central-1 is under quota. (Images: 13, Quota: 20)
Region eu-central-1 is at quota (10) - would delete ami-08eca5bab97189074
Region eu-central-2 is under quota. (Images: 8, Quota: 20)
Region eu-north-1 is under quota. (Images: 9, Quota: 20)
Region eu-south-1 is under quota. (Images: 12, Quota: 20)
Region eu-south-2 is under quota. (Images: 7, Quota: 20)
Region eu-west-1 is under quota. (Images: 13, Quota: 20)
Region eu-west-2 is under quota. (Images: 14, Quota: 20)
Region eu-west-3 is under quota. (Images: 14, Quota: 20)
Region me-central-1 is under quota. (Images: 6, Quota: 20)
Region me-south-1 is under quota. (Images: 12, Quota: 20)
Region sa-east-1 is under quota. (Images: 13, Quota: 20)
Region us-east-1 is under quota. (Images: 11, Quota: 20)
Region us-east-2 is under quota. (Images: 15, Quota: 20)
Region us-west-1 is under quota. (Images: 12, Quota: 20)
Region us-west-2 is under quota. (Images: 14, Quota: 20)
Done!

@AlexVulaj
Copy link
Contributor Author

/hold

I'd like to add unit tests and a README still, but the functional code is ready for review.

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 25, 2024
@openshift-ci openshift-ci bot requested review from abyrne55 and reedcort April 25, 2024 16:11
@AlexVulaj
Copy link
Contributor Author

/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 26, 2024
@AlexVulaj AlexVulaj force-pushed the clean-golden-ami branch 2 times, most recently from 5bdb88b to b9cc838 Compare April 29, 2024 18:55
cleangoldenami/regions.go Outdated Show resolved Hide resolved
cleangoldenami/README.md Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Apr 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 15.24%. Comparing base (6907dda) to head (06888b0).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #230   +/-   ##
=======================================
  Coverage   15.24%   15.24%           
=======================================
  Files          17       17           
  Lines        1358     1358           
=======================================
  Hits          207      207           
  Misses       1137     1137           
  Partials       14       14           

Copy link
Contributor

openshift-ci bot commented Apr 29, 2024

@AlexVulaj: all tests passed!

Full PR test history. Your PR dashboard.

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/test-infra repository. I understand the commands that are listed here.

@abyrne55
Copy link
Contributor

Tested locally with --dry-run and saw expected results. Also ran go test and visually reviewed code. Nice work @AlexVulaj

/approve

Copy link
Contributor

openshift-ci bot commented Apr 29, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abyrne55

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

The pull request process is described here

Needs approval from an approver in each of these files:

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 29, 2024
@luis-falcon
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 29, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 39956d9 into openshift:main Apr 29, 2024
6 checks passed
@AlexVulaj AlexVulaj deleted the clean-golden-ami branch April 29, 2024 19:37
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants