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

OSD-22892 (Part 1): Machine ID Lookup Table #240

Merged
merged 4 commits into from
Jul 2, 2024

Conversation

abyrne55
Copy link
Contributor

@abyrne55 abyrne55 commented Jun 26, 2024

What does this PR do? / Related Issues / Jira

This PR is composed of commits cherry-picked from my larger OSD-22892 branch for the sake of readability.

These commits cover the definition of the Probe interface's GetMachineImageID() method, as well as a reference implementation for the CurlJSONProbe. This method takes 3 string arguments (platformType, cpuArch, and region) and returns a "machine image ID," which is a cloud-platform-agnostic term for AMI ID. The platformType and cpuArch arguments should be one of the helpers.Platform* and helpers.Arch* enumerated string types, respectively, while region is more free-form. An example invocation might look like:

imageID, err = myCurlJSONProbe.GetMachineImageID(helpers.PlatformAWS, helpers.ArchX86, "us-east-1")

On the backend, CurlJSONProbe's implementation of GetMachineImageID() is essentially a lookup table, i.e., a multi-level dictionary (in "machine-images.go") containing all the machine image IDs, plus a helper function with some lookup validation logic (e.g., to account for the fact that GCP machine image IDs are not region-specific like AMIs). The x86 AMI IDs included in this PR are the first "RHEL repackaged" images published to the verifier's golden AMI account: these are not expected to change often (maybe 1-3x per year). Ditto for the GCP machine image IDs, which just point to the publicly-available GCP RHEL images. ARM image IDs have placeholder values for now.

This PR intentionally does not cover integration of this new code into the verifier's critical path. That integration will be covered in a separate cherry-picked PR. As such, there isn't much to execute for this PR beyond the included unit tests. When reviewing this PR, please focus on code style/structure.

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

abyrne55 added 4 commits June 26, 2024 11:25
Probe.GetMachineImageID() provides a standardized interface for supplying AMI/GCP machine image/etc. information
to consumers of Probes. A lookup-table-based reference implementation is provided for CurlJSONProbe
@codecov-commenter
Copy link

codecov-commenter commented Jun 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 27.42%. Comparing base (820bf4e) to head (10d1890).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #240      +/-   ##
==========================================
+ Coverage   26.32%   27.42%   +1.09%     
==========================================
  Files          11       11              
  Lines        1056     1072      +16     
==========================================
+ Hits          278      294      +16     
  Misses        764      764              
  Partials       14       14              
Files Coverage Δ
pkg/helpers/helpers.go 87.05% <ø> (ø)
pkg/probes/curl_json/curl_json.go 59.52% <100.00%> (+24.90%) ⬆️

@abyrne55 abyrne55 mentioned this pull request Jun 26, 2024
4 tasks
@AlexVulaj
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 26, 2024
@luis-falcon
Copy link
Contributor

/lgtm

Copy link
Contributor

@rafael-azevedo rafael-azevedo left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link
Contributor

openshift-ci bot commented Jul 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rafael-azevedo

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 Jul 2, 2024
Copy link
Contributor

openshift-ci bot commented Jul 2, 2024

@abyrne55: 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-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit efd4245 into openshift:main Jul 2, 2024
6 checks passed
@abyrne55 abyrne55 deleted the OSD-22892-machineid branch July 2, 2024 17:09
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.

5 participants