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.
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
Issue# 306: Added tagging controller #308
Issue# 306: Added tagging controller #308
Changes from 35 commits
aeaaf45
6c7fbb1
4e40c99
793403b
92d5743
1e8be5a
014b607
dc0227c
5821607
615f200
ac31741
f2d58ab
cc464d6
a3f19e5
1f12385
a580ac2
966e97f
e458d6f
5546277
374a18e
332ac7e
b5375b7
dd2bd14
0330b61
0c9bd00
633768d
2511565
dda006d
22067dc
40f3796
6247587
4466163
fa80a6a
2f2f639
df3d102
19a931d
a27a550
a17f858
4fdd368
2e4b7a8
5fb201b
781d0e2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Give format of tags in the help string.
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
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.
Is this done? Not seeing it in the current diff. EDIT I see you added it to the error message, I think its more user friendly to (also) have it in the initial help message, or else the user has to guess and get it wrong in order to get the format.
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.
oh, sorry, I added it to the error string and forgot to add it 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.
nit: if you're not storing each value that doesn't match the supported resources, then just return the error from inside the if.
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.
nit: Also, for a very slight readability improvement you could use a map or set for supportedResources so that the check is a lookup instead of an inner loop.
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.
got it, will update.
Regarding a map, I was using it in one of the previous commit but was told this is easier to read. (2f2f639)
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.
Ok, I guess your reviewers have a difference of opinion then :) I'm thinking the checks if it is in the map don't have to loop over it, but its not important. Up to you.
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 set would have perfectly solved this but with map, we had to earlier loop through it to print out a valid list of inputs which wasn't very readable in my opinion (and just printing the map as is would not have been pretty). Not something I am super concerned about too. :)
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 don't think this is going to work. Right now you never remove tags unless the node is deleted, right? How does a user change an existing tag that they previously set?
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 is to tag any nodes that exist before the controller were brought up, similar to the node controller.
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.
Yeah and I just realized you will basically don't delete tags unless nodes are deleted? Probably partially because we can't recognize tags applied by the controller from user-owned 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.
So I guess we should document (maybe you already did) that the controller only deletes tags on a node when the node object gets deleted. It doesn't really expect the tags to change. And if the tags do change, we just leave the existing tags alone and apply the new ones?
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.
Will add it to the controller md
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.
@nckturner right now the tags are passed as flags to this controller so we don't really expect them to change. But you have a good point - in case we decide to move these to a config map or make them more configurable, we'll probably need to delete the tags as well.
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.
Does this happen on non-retryable errors too? Like if the tag is never going to succeed are we going to keep adding it to the workqueue?
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.
Yes it does. Currently, we do not handle specific errors from EC2 but simply retrying everything with the assumption that no non-retryable errors expected here. Do you have any recommendation for the specific errors that we should look out for that could happen?
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 we need to return nil from
workItem.action
for any non-retryable errors... and I'm not sure what possibilities there are... incorrectly formatted 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.
We should log the error but we don't want to keep spamming the tag API, if possible.
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.
okay, I can try looking into
https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html#CommonErrors
and see what errors are non-retryable in this case.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.
Are retries and throttling type errors handled somewhere? I see that retriable errors are handled here so as long as we are using that function under the covers then we are ok. Not sure if we are.
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 is handled here by simply requeuing the items back to the queue with rate limiting.