-
Notifications
You must be signed in to change notification settings - Fork 362
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
feat(sesv2): Implement Simple Email Service v2 resources #791
feat(sesv2): Implement Simple Email Service v2 resources #791
Conversation
I have just submitted a PR, not sure what causing the CI/check-diff step failing, can advise on this? Is it because i modified some of the zz_.go file, which kind is allowed to be changed and not allowed to (e.g. zz_conversion.go or zz_generated_.go)? Thanks, |
@kelvinwijaya yeah, I think it's either
try |
Thanks @chlunde I have rebased my code and removed handwritten code from the auto-generated one. But i noticed errors during the go building process: Problem is if I don't modify this file to make it work as below, it wont compile:
After modification (no compile error):
But after making this modification and commit the code. I ran Slack Thread: https://crossplane.slack.com/archives/C01718T2476/p1628649932065800 |
@kelvinwijaya I wonder why the content of the for loop is empty. From your message in Slack, it seems it has some fields that should be used in the for loop. I think we need to open an issue there and to get the PR going, you can add this specific resource to the ignore list. Once the issue is addressed there, we can get back to adding it. |
4466f17
to
2a745e2
Compare
Thanks @muvaf for your input, i will open a new case in Thanks @chlunde also for pointing out the issue in code-generator, I will follow-up by opening an issue ticket with them I have make sure |
I have open a case to |
93f5033
to
a8f0049
Compare
Hi @chlunde I have added Update operations for TrackingOptions. Feel free to review my PR whenever you ready or available |
@chlunde Would you mind taking another look and confirming your comments are resolved? |
e121002
to
0ecc1c3
Compare
Please ignore my comment earlier. I notice the code-generator is now referencing to newer version (v0.14.1) with commit: 285d87b66b62fbfb859986ddf74c9f9b6ae743fb Let me update the changes accordingly and update your guys with the new commit, I believe this should fix the Thanks |
c96f1bd
to
26f296d
Compare
Hi @chlunde I have done with my changes using the latest code-generator Many thanks! |
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 @kelvinwijaya !
DkimSigningAttributes *DkimSigningAttributes `json:"dkimSigningAttributes,omitempty"` | ||
// The email address or domain that you want to verify. | ||
// +kubebuilder:validation:Required | ||
EmailIdentity *string `json:"emailIdentity"` |
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 should be taken from the external name annotation.
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 changing to external name annotation in consideration with email identity contain characters (e.g. my@acme.com) that is not valid k8s metadata name
} | ||
|
||
// UpdateTagsForResource with resourceName | ||
func UpdateTagsForResource(client sesv2iface.SESV2API, spec []*svcapitypes.Tag, resourceArn *string) error { |
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.
Seems like this is never used.
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, keeping the code once able to figure out: // TODO(kelvinwijaya): Updating Tags will be useful if we can determine the resourceArn from the Status return by Observation state object
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.
Whats blocking this TODO from being implemented?
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.
As for ConfigurationSet resource, the creation of Tags is passed via CreateConfigurationSet API only: https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_CreateConfigurationSet.html
As for today, the tagging API only support update via arn format resource name which i cannot retrieve from the GET api: https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_TagResource.html
I am keeping the code for future usage, but i can remove if this cause confusion as not being used for now.
|
||
tags := spec | ||
for _, t := range GetExternalTags(mg) { | ||
if _, exists := tagMap[awsclient.StringValue(t.Key)]; !exists { |
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 override its value if it exists.
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 am not sure on this one. If the user specifies a different value in the spec the controller should keep it. We some issues with this in the past.
I would keep it the way it is and only set tag values if the key isn't present already.
} | ||
|
||
// AddExternalTags to spec if they don't exist | ||
func AddExternalTags(mg resource.Managed, spec []*svcapitypes.Tag) []*svcapitypes.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.
Would it be possible to have an implementation similar to this one that covers all cases including composition and ordering? https://github.com/crossplane/provider-aws/blob/8be1568/pkg/controller/ecr/repository/controller.go#L246
@kelvinwijaya any chance to check the Open Points that we can finalize this PR ? |
Hi @haarchri Let me have a look at the open points and try to resolve the review comments |
@kelvinwijaya can you fix the issues and rebase to the latest master? Then we can work on getting this merged. |
@MisterMX , absolutely.. let me plan on review issues and merge the changes |
26f296d
to
8e9104b
Compare
28aabd9
to
b9cd5da
Compare
|
||
tags := spec | ||
for _, t := range GetExternalTags(mg) { | ||
if _, exists := tagMap[awsclient.StringValue(t.Key)]; !exists { |
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 am not sure on this one. If the user specifies a different value in the spec the controller should keep it. We some issues with this in the past.
I would keep it the way it is and only set tag values if the key isn't present already.
} | ||
|
||
// UpdateTagsForResource with resourceName | ||
func UpdateTagsForResource(client sesv2iface.SESV2API, spec []*svcapitypes.Tag, resourceArn *string) error { |
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.
Whats blocking this TODO from being implemented?
91e2adb
to
7e8c19e
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.
Looks almost good to me. Only some minor issues remaining. @guilhermef after solving these can you squash your changes into a single commit?
CustomRedirectDomain: cr.Spec.ForProvider.TrackingOptions.CustomRedirectDomain, | ||
} | ||
if _, err := e.client.PutConfigurationSetTrackingOptionsWithContext(ctx, trackingOptionInput); err != nil { | ||
return managed.ExternalUpdate{}, errors.Wrap(err, "update failed") |
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.
There should be a different error message for each Wrap
to help identify where the error came from. "update failed"
is too generic 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.
resolved
SendingEnabled: cr.Spec.ForProvider.SendingOptions.SendingEnabled, | ||
} | ||
if _, err := e.client.PutConfigurationSetSendingOptionsWithContext(ctx, sendingOptionInput); err != nil { | ||
return managed.ExternalUpdate{}, errors.Wrap(err, "update failed") |
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.
There should be a different error message for each Wrap
to help identify where the error came from. "update failed"
is too generic 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.
resolved
EmailIdentity: cr.Spec.ForProvider.EmailIdentity, | ||
} | ||
if _, err := e.client.PutEmailIdentityConfigurationSetAttributesWithContext(ctx, configurationSetAttributesInput); err != nil { | ||
return managed.ExternalUpdate{}, errors.Wrap(err, "update failed") |
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.
There should be a different error message for each Wrap
to help identify where the error came from. "update failed"
is too generic 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.
resolved
} | ||
|
||
if _, err := e.client.PutEmailIdentityMailFromAttributesWithContext(ctx, mailFromAttributesInput); err != nil { | ||
return managed.ExternalUpdate{}, errors.Wrap(err, "update failed") |
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.
There should be a different error message for each Wrap
to help identify where the error came from. "update failed"
is too generic 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.
resolved
SigningAttributesOrigin: awsclient.String(dkimSigningAttributeExternal), | ||
} | ||
if _, err := e.client.PutEmailIdentityDkimSigningAttributesWithContext(ctx, dkimSigningAttributesInput); err != nil { | ||
return managed.ExternalUpdate{}, errors.Wrap(err, "update failed") |
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.
There should be a different error message for each Wrap
to help identify where the error came from. "update failed"
is too generic 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.
resolved
}, | ||
} | ||
if _, err := e.client.PutEmailIdentityDkimSigningAttributesWithContext(ctx, dkimSigningAttributesInput); err != nil { | ||
return managed.ExternalUpdate{}, errors.Wrap(err, "update failed") |
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.
There should be a different error message for each Wrap
to help identify where the error came from. "update failed"
is too generic 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.
resolved
Signed-off-by: kelvinwijaya <kelvin_wijaya@tech.gov.sg>
7e8c19e
to
9c7a7ed
Compare
@MisterMX , thanks for your kind review and i have squashed the commit messages |
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.
@kelvinwijaya thank you very much for your contribution! LGTM.
Description of your changes
Fixes #414
I have:
make reviewable test
to ensure this PR is ready for review.How has this code been tested
True
and Condition asAvailable
when the resources are provisioned successfullyFalse
and Condition asUnavailable
ORCreating
if wrong parameters being supplied in the custom resource manifestsTest plan based on examples template:
emailidentity
CRD operations for email address (verified with email acknowledgement status)emailidentity
CRD operations for domain (verified with DKIM and MailFrom status)emailidentity
Update operations forConfigurationSetAttributes
emailidentity
Update operations forMailFromAttributes
configurationset
CRD operations which is referenced in the emailidentityconfigurationset
Update operations forDeliveryOptions
configurationset
Update operations forReputationOptions
configurationset
Update operations forSuppressionOptions
configurationset
Update operations forSendingOptions
configurationset
Update operations forTrackingOptions
emailtemplate
CRUD operations withHTML,Subject,Text