Skip to content

Conversation

@mbaijal
Copy link
Contributor

@mbaijal mbaijal commented Sep 10, 2021

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.

@ack-bot
Copy link
Collaborator

ack-bot commented Sep 10, 2021

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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)
Copy link
Member

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.
Copy link
Member

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?

Copy link
Contributor Author

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):
Copy link
Member

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

Copy link
Contributor Author

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)
Copy link
Member

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

Copy link
Contributor Author

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 ?

Copy link
Member

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?

Copy link
Contributor Author

@mbaijal mbaijal Sep 13, 2021

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

@mbaijal mbaijal force-pushed the fix-adopted-resource-ids-post-release branch from 58f6b96 to c8a129f Compare September 13, 2021 17:09
@mbaijal mbaijal changed the title Enable AdoptedResource and add required custom logic for ScalableTarget [to-be-closed] Enable AdoptedResource and add required custom logic for ScalableTarget Sep 14, 2021
ack-bot pushed a commit that referenced this pull request Sep 14, 2021
…#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.
@mbaijal mbaijal closed this Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants