-
Notifications
You must be signed in to change notification settings - Fork 1.5k
SPLAT-2172: AWS dedicate host support #10079
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
Open
vr4manta
wants to merge
6
commits into
openshift:main
Choose a base branch
from
vr4manta:SPLAT-2172
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2e1f99e
Add IPI installation on AWS dedicated hosts
vr4manta 1b9823e
Added shared tag for BYO dedicated host
vr4manta c9236a2
Added permission checking for dedicated hosts
vr4manta 3d54fbf
Added logic to handle cleaning up dynamic dedicated hosts
vr4manta c79ea56
Added featuregate check for BYO DH
vr4manta d687fa9
Fix lint issues w/ legacy tests
vr4manta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| package aws | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
|
|
||
| "github.com/aws/aws-sdk-go-v2/aws" | ||
| "github.com/aws/aws-sdk-go-v2/service/ec2" | ||
| "github.com/sirupsen/logrus" | ||
| ) | ||
|
|
||
| // Host holds metadata for a dedicated host. | ||
| type Host struct { | ||
| ID string | ||
| Zone string | ||
| } | ||
|
|
||
| // dedicatedHosts retrieves a list of dedicated hosts and returns them in a map keyed by the host ID. | ||
| func dedicatedHosts(ctx context.Context, client *ec2.Client) (map[string]Host, error) { | ||
| hostsByID := map[string]Host{} | ||
|
|
||
| paginator := ec2.NewDescribeHostsPaginator(client, &ec2.DescribeHostsInput{}) | ||
| for paginator.HasMorePages() { | ||
| page, err := paginator.NextPage(ctx) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("fetching dedicated hosts: %w", err) | ||
| } | ||
|
|
||
| for _, h := range page.Hosts { | ||
| id := aws.ToString(h.HostId) | ||
| if id == "" { | ||
| // Skip entries lacking an ID (should not happen) | ||
| continue | ||
| } | ||
|
|
||
| logrus.Debugf("Found dedicatd host: %s", id) | ||
vr4manta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| hostsByID[id] = Host{ | ||
| ID: id, | ||
| Zone: aws.ToString(h.AvailabilityZone), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return hostsByID, nil | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧩 Analysis chain
🌐 Web query:
In Kubernetes CRDx-kubernetes-validations, doeshas(self.someList)evaluate to true when the list field is present but empty ([]), and isminItems: 1the recommended schema-level way to require at least one list element?💡 Result:
Yes. In CRD CEL,
has(self.someList)is a presence test (for JSON-like objects: “is this field/key defined?”), not a “non-empty” test—so ifsomeListis present in the object as[],has(self.someList)evaluates to true. This aligns with CEL’s intent of unifying presence checks across protobuf and JSON-like types. [1][2]has(self.someList) && self.someList.size() > 0.Yes. To require at least one list element at the schema level,
minItems: 1is the standard / recommended OpenAPI-schema validation for arrays (preferred over CEL when an OpenAPI validation exists). [3][4]Sources: Kubernetes CEL docs [2], cel-go README (has macro semantics) [1], Kubernetes CRD validation best practices (prefer OpenAPI validations) [3], controller-tools / OpenAPI marker for
MinItems=1[4].Enforce non-empty
dedicatedHostarray whenaffinity: DedicatedHost.The
has(self.dedicatedHost)check only validates field presence, so a config withaffinity: DedicatedHostanddedicatedHost: []passes validation despite being unusable. AddminItems: 1to the array definition to reject empty lists at the schema boundary.Suggested fix
dedicatedHost: + minItems: 1 description: |-Apply the same change at lines 1812–1861, 3362–3411, and 5112–5161.
📝 Committable suggestion
🤖 Prompt for AI Agents