-
Notifications
You must be signed in to change notification settings - Fork 168
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
Add image/blob tagging functionality to ore #3915
base: main
Are you sure you want to change the base?
Conversation
We need the ability to tag images to facilitate garbage collection of RHCOS AMIs that are not used in boot images. The pre-existing tagging functionality on the initial upload cannot be leveraged because we don't know whether a RHCOS build will be used as a boot image at build time.
Add ability to tag images to facilate resource management.
Add ability to label images to facilate resource management.
Add ability to tag images to facilate resource management.
7d5408f
to
e4a1004
Compare
This seems sane to me though do note that there is renewed interest in solving the bootimage bump problem along with a rough timeline. So we should be able at some point to delete even those bootimages that were promoted. |
They still want us to tag images for cost reporting. We can figure out the cluster boot image updates when it happens. |
|
||
err := API.CreateTags([]string{amiID}, tagMap) | ||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "couldn't create image tags: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\n
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And similarly for the other files.
tagMap := make(map[string]string) | ||
for _, tag := range tags { | ||
splitTag := strings.SplitN(tag, "=", 2) | ||
if len(splitTag) != 2 { | ||
fmt.Fprintf(os.Stderr, "invalid tag format; should be key=value, not %v\n", tag) | ||
os.Exit(1) | ||
} | ||
key, value := splitTag[0], splitTag[1] | ||
tagMap[key] = value | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: feels like we should just lower this into API.CreateTags()
so that it's deduped with ore aws upload --tags
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly for the others.
Aliyun.AddCommand(cmdTagImage) | ||
cmdTagImage.Flags().StringVar(&id, "id", "", "Aliyun Image ID") | ||
cmdTagImage.Flags().StringVar(®ion, "region", "", "Region") | ||
cmdTagImage.Flags().StringSliceVar(&tags, "tags", []string{}, "list of key=value tags to attach to the Aliyun image") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to add --tags
to ore aliyun create-image
too for consistency.
Similarly for GCP and Azure.
For cost reporting purposes, I would expect us actually to want to set the tags on upload instead of as a postprocess step.
} | ||
|
||
if len(kr.Keys) == 0 { | ||
fmt.Fprintf(os.Stderr, "No storage service keys found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\n
Doesn't need Fprintf
.
This is prep work for the garbage collection on RHCOS. In OpenShift, RHCOS nodes are provisioned with the original boot image and regardless of newer boot images. The original boot images need to be kept indefinitely and policies can be set up to garbage collect images based on tags.