-
Notifications
You must be signed in to change notification settings - Fork 9
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
Tag and Untag API for cluster. #43
Conversation
a40d55f
to
69d6858
Compare
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 for adding this! I had a few comments on the custom hooks for tags.
ResourceArn: &resourceARN, | ||
}, | ||
) | ||
rm.metrics.RecordAPICall("GET", "ListTags", 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.
This should be a READ_MANY
instead of GET
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.
Thank you for correcting me!
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.
After careful consideration, I still think it should be GET
here. May I know why you think it should be READ_MANY
here instead? @jljaco
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.
@kyriechen96 please disregard this comment -- there may be some inconsistencies across ACK controllers in how this choice is made, and we will circle back to this later if necessary. you're good with GET
!
pkg/resource/cluster/hooks.go
Outdated
) (err error) { | ||
rlog := ackrtlog.FromContext(ctx) | ||
exit := rlog.Trace("rm.syncTags") | ||
defer func() { exit(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.
defer func(err error) { exit(err) }(err)
pkg/resource/cluster/hooks.go
Outdated
} | ||
|
||
for _, tag := range desired { | ||
toAdd = append(toAdd, tag) |
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.
Do you want to check whether tag
is in latest
before putting it in the toAdd
list?
pkg/resource/cluster/hooks.go
Outdated
latest *resource, | ||
) (err error) { | ||
rlog := ackrtlog.FromContext(ctx) | ||
exit := rlog.Trace("rm.syncTags") |
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 should match the function name; so either rename the function syncTags
or change this to rm.updateTags
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're right. Forgot changing it.
pkg/resource/cluster/hooks.go
Outdated
return nil, err | ||
} | ||
tags := make([]*svcapitypes.Tag, 0, len(resp.TagList)) | ||
for _, tag := range resp.TagList { |
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've implemented sdkTagsFromResourceTags
below; consider adding a function resourceTagsFromSDKTags
to do this, which is the inverse transformation.
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
|
||
resourceARN := (*string)(ko.Status.ACKResourceMetadata.ARN) | ||
tags, err := rm.getTags(ctx, *resourceARN) |
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.
Indentation needs fixing here
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.
Not sure why this happened. The indentation looks good in my local file.
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.
Github bug I think
69d6858
to
f419524
Compare
f419524
to
c263865
Compare
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.
Almost there :)
Left few comments below
pkg/resource/cluster/hooks.go
Outdated
"errors" | ||
"fmt" | ||
ackutil "github.com/aws-controllers-k8s/runtime/pkg/util" | ||
|
||
ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" | ||
ackerr "github.com/aws-controllers-k8s/runtime/pkg/errors" | ||
ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log" | ||
"strconv" |
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.
Import order :)
pkg/resource/cluster/hooks.go
Outdated
) | ||
|
||
if len(toDelete) > 0 { | ||
rlog.Debug("removing tags from parameter group", "tags", toDelete) |
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.
s/parameter group/cluster/
pkg/resource/cluster/hooks.go
Outdated
} | ||
|
||
if len(toAdd) > 0 { | ||
rlog.Debug("adding tags to parameter group", "tags", toAdd) |
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.
s/parameter group/cluster/
c263865
to
ebcc270
Compare
@jljaco and I discussed about the READ_MANY vs GET issue. For now we don't have a precise answer and we'll try to discuss tomorrow. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: A-Hilaly, kyriechen96 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 |
Issue #, if available:
ACK MemoryDB controller doesn't provide tags update after creation of cluster.
Description of changes:
Add functions so that customers can update tags of cluster after creation.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.