-
Notifications
You must be signed in to change notification settings - Fork 20
[to-be-closed] Enable AdoptedResource and add required custom logic for ScalableTarget #42
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
[to-be-closed] Enable AdoptedResource and add required custom logic for ScalableTarget #42
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mbaijal 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 |
0848c57 to
58f6b96
Compare
| target_reference = k8s.create_reference( | ||
| CRD_GROUP, CRD_VERSION, TARGET_RESOURCE_PLURAL, target_name, "default" | ||
| ) | ||
| target_resource = k8s.wait_resource_consumed_by_controller(target_reference) |
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.
adopted resource reconciler now patches spec and status so if the status has ACK.Adopted true, we can just do k8s.get_resource
| @@ -0,0 +1,71 @@ | |||
| # Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. | |||
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.
can rename file to utils.py?
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.
I think this name is more appropriate since this bootstraps AA resources using boto3 for the tests ?
| def application_autoscaling_client(): | ||
| return boto3.client("application-autoscaling") | ||
|
|
||
| def sagemaker_endpoint_register_scalable_target(resource_id): |
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.
arent these methods specific to the test? why in utills
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.
We can call it something other than utils but this file does for applicationAutoscaling what sagemaker_utils does for sagemaker. These are pre-setup steps for the test and not really related to what we want to test and thus IMO cleaner in a separate module.
| ) | ||
|
|
||
| yield resource_id | ||
| sagemaker_endpoint_deregister_scalable_target(resource_id) |
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.
delete only if exists? because its already being deleted at end of test
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.
I will have to run a botot3 describe call to check, seems unnecessary ?
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.
won't it throw an error if the resource doesn't exist?
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.
It hasn't so far and the resource should never exist at this point - let me check
58f6b96 to
c8a129f
Compare
…#47) First two commits are the same as #42 but created a separate PR because I wanted preserve the changes of that PR. TODO: - I still need to address [one review comment from #42 ](#42 (comment)) - Runtime update to 0.14.0 Description of changes: - Enable AdoptedResource for both resources - Add required custom logic for ScalableTarget - Add integration test for the same Testing - Manually verified that scalableTarget can be adopted - Local Kind tests pass By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Description of changes:
Testing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.