-
Notifications
You must be signed in to change notification settings - Fork 34
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
Feature - Add/Modify/Delete tags for model resource #261
base: main
Are you sure you want to change the base?
Feature - Add/Modify/Delete tags for model resource #261
Conversation
/retest |
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.
@rkurduka we have plans to start generating Tag handlers for all the ACK controllers. But nothing stops us from implement some manually if there is urgent need for them :)
I left few comments in-line
AddTags: | ||
operation_type: Update | ||
resource_name: Model |
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.
This generates code that treats AddTags
as the Update API Call to update the model.
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.
@a-hilaly - Thanks for review.
Sagemaker model API do not have any modify /update method , as fields are immutable except tags . Also Sagemaker API resource only have "ADDTAG" and "DELETE TAG" . So to handle update on this resource will have to use one of these two. So chose "ADD TAGS" and handling "DELETE tags" using template hooks.
Let me know if you think any other approach we can consider
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.
Agree with Amine, need to discuss this further as we need to throw appropriate error if any other fields except Tags are modified as Model does not have udpate API, maybe implement it completely via hooks
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.
@surajkota - Added check in update_pre hooks to validate field to update, if it is other than tag , reconciler will update "message" status. Please review
Please let me know if you feel anything else is require
helm/Chart.yaml
Outdated
@@ -1,8 +1,8 @@ | |||
apiVersion: v1 | |||
name: sagemaker-chart | |||
description: A Helm chart for the ACK service controller for Amazon SageMaker (SageMaker) | |||
version: 1.2.7 | |||
appVersion: 1.2.7 | |||
version: 0.0.0-non-release-version |
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.
Please pull the controller tags
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.
Done
@@ -3,7 +3,8 @@ apiVersion: apiextensions.k8s.io/v1 | |||
kind: CustomResourceDefinition | |||
metadata: | |||
annotations: | |||
controller-gen.kubebuilder.io/version: v0.14.0 | |||
controller-gen.kubebuilder.io/version: v0.9.2 |
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.
You need to install controller-gen v0.14.0
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.
Done
// this to handle delete/remove tags | ||
_ , err = rm.deleteTags(ctx,desired,latest) | ||
if err != nil { | ||
return nil, err | ||
} |
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 don't need to delete the tags before performing a tag update.
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.
@a-hilaly - as I mentioned above , SDK update method is handling ADDTAGS only and hooks are deleting tags , there is no modify API available for sagemaker model resource . So in SDKUPDATE , first "DeletTags" method look for any deletion request , if not then proceed and look for add tags request .
Let me know if anything else is require.
) | ||
|
||
// deleteTags is used to keep tags in sync by calling Create and Delete API's | ||
func (rm *resourceManager) deleteTags( |
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.
This function should stay, syncTags
and also handle tag creation
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.
@a-hilaly - same comments as above , let me know if any other approach we should consider here
/hold |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: rkurduka The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
See #261 (comment)
} | ||
|
||
// computeTagsDelta returns tags to be added and removed from the resource | ||
func computeTagsDelta( |
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.
Sagemaker tag API pattern(addTag/deleteTag) resembles memorydb pattern (TagResource/UntagResource).
We have a reference implementation in memorydb which uses ackcompare.GetTagsDifference
helper method which can reduce maintenance of SM controller code. https://github.com/aws-controllers-k8s/memorydb-controller/blob/main/pkg/resource/acl/hooks.go#L92
Can you please look into adopting similar pattern?
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.
Thanks @surajkota for sharing this , and looking into it . But it seems memoryDB - ACL resource do have "UpdateACL" API method . So we can plug tags manipulation in it , using hooks. But in sagemaker -model case , there is NO update method available , so "SDKUPDATE block doesn't get generated by code-generator . So had to generate that using "ADDTags" in "Operation" Block , and later handling tags CRUD operations in it . Let me know if you have any suggestion in this case. Thanks again
@rkurduka: The following tests failed, say
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/test-infra repository. I understand the commands that are listed here. |
Issue 1732, if available:
Description of changes:
Currently tags modification is not supported for model resource . Hence added require changes to support tags modification.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.