-
Notifications
You must be signed in to change notification settings - Fork 55
Fix AdoptedResources functionality for CapacityReservations #268
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
fizashaikh
wants to merge
12
commits into
aws-controllers-k8s:main
Choose a base branch
from
fizashaikh:fix_capacity_reservation_adoption
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.
+69
−8
Open
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
606f97f
fix_capacity_reservation_adoption: Fix AdoptedResources functionality…
8498190
fix_capacity_reservation_adoption: Fix AdoptedResources functionality…
2ac3488
fix_capacity_reservation_adoption: Fix AdoptedResources functionality…
0e47229
fix_capacity_reservation_adoption: Fix updating reservations if addit…
5738a2b
Merge branch 'main' into fix_capacity_reservation_adoption
4f56940
fix_capacity_reservation_adoption: Update code-generator and rebuild …
7958897
fix_capacity_reservation_adoption: Feedback changes
43b4d17
fix_capacity_reservation_adoption: Feedback changes
60b8673
fix_capacity_reservation_adoption: Feedback changes
b270245
fix_capacity_reservation_adoption: Build latest controller
6e3b4b7
Merge branch 'main' into fix_capacity_reservation_adoption
adaec78
fix_capacity_reservation_adoption: Resolve conflicts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
ack_generate_info: | ||
build_date: "2025-05-13T17:53:20Z" | ||
build_hash: 55bf57b2806c33a7fcd074be403f26ce3f8e58db | ||
go_version: go1.24.2 | ||
version: v0.46.2 | ||
build_date: "2025-05-26T04:21:07Z" | ||
build_hash: b57010693b861c793703028023ae75209a6af343 | ||
go_version: go1.24.0 | ||
version: v0.43.2-26-gb570106-dirty | ||
api_directory_checksum: 3df6921566512e42abdabd564c80aea5311d410a | ||
api_version: v1alpha1 | ||
aws_sdk_go_version: v1.32.6 | ||
generator_config_info: | ||
file_checksum: 631d4b99d0839af4f2c0561d15f7da3c911786d7 | ||
file_checksum: 172877410214b442af4d618739f2222b3dfebb3b | ||
original_file_name: generator.yaml | ||
last_modification: | ||
reason: API generation |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
templates/hooks/capacity_reservation/post_set_resource_identifiers.go.tpl
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,24 @@ | ||
|
||
if instanceCount, ok := identifier.AdditionalKeys["instanceCount"]; ok { | ||
parsedInstanceCount, err := strconv.ParseInt(instanceCount, 10, 64) | ||
if err != nil { | ||
return fmt.Errorf("failed to parse instanceCount: %v", err) | ||
} | ||
r.ko.Spec.InstanceCount = &parsedInstanceCount | ||
} | ||
fizashaikh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if instancePlatform, ok := identifier.AdditionalKeys["instancePlatform"]; ok { | ||
r.ko.Spec.InstancePlatform = &instancePlatform | ||
} | ||
|
||
if instanceType, ok := identifier.AdditionalKeys["instanceType"]; ok { | ||
r.ko.Spec.InstanceType = &instanceType | ||
} | ||
|
||
if availabilityZone, ok := identifier.AdditionalKeys["availabilityZone"]; ok { | ||
r.ko.Spec.AvailabilityZone = &availabilityZone | ||
} | ||
|
||
if availabilityZoneID, ok := identifier.AdditionalKeys["availabilityZoneID"]; ok { | ||
r.ko.Spec.AvailabilityZoneID = &availabilityZoneID | ||
} | ||
fizashaikh marked this conversation as resolved.
Show resolved
Hide resolved
|
7 changes: 7 additions & 0 deletions
7
templates/hooks/capacity_reservation/sdk_read_many_post_set_output.go.tpl
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,7 @@ | ||
|
||
// set the instance count in spec from the total instance count in status, | ||
// without this there's no diff detected for this field in the desired object and latest state in aws | ||
// causing update calls to have no effect at all | ||
if ko.Status.TotalInstanceCount != nil { | ||
ko.Spec.InstanceCount = ko.Status.TotalInstanceCount | ||
} | ||
Comment on lines
+5
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
9 changes: 9 additions & 0 deletions
9
templates/hooks/capacity_reservation/sdk_update_post_build_request.go.tpl
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,9 @@ | ||
|
||
// If additionalInfo field is being updated, other fields cannot be modified simultaneously, | ||
// hence we reset them or else we run into InvalidParameterCombination error | ||
if input.AdditionalInfo != nil { | ||
input.InstanceCount = nil | ||
input.EndDate = nil | ||
input.EndDateType = "" | ||
input.InstanceMatchCriteria = "" | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.