Skip to content

Conversation

mbaijal
Copy link
Contributor

@mbaijal mbaijal commented Sep 10, 2021

Issue #, if available:
This is currently required as a temporary fix to be able to use AdoptedResource feature for ScalableTarget in the ApplicationAutoscaling Service but is a useful hook to have.

Description of changes:
Adds a hook into SetIdentifier for custom code before ReadOne is called from AdoptedResource.

Sample Usage:
as seen in this PR

set_identifiers_pre_read_one:
       code: r.customSetIdentifierCode(identifier)

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 NOT APPROVED

This pull-request has been approved by: mbaijal
To complete the pull request process, please assign redbackthomson after the PR has been reviewed.
You can assign the PR to them by writing /assign @redbackthomson in a comment when ready.

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

@ack-bot
Copy link
Collaborator

ack-bot commented Sep 10, 2021

Hi @mbaijal. Thanks for your PR.

I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@ack-bot ack-bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 10, 2021
@vijtrip2
Copy link
Contributor

/ok-to-test

@ack-bot ack-bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 13, 2021
// resource identifier
func (r *resource) SetIdentifiers(identifier *ackv1alpha1.AWSIdentifiers) error {
{{- GoCodeSetResourceIdentifiers .CRD "identifier" "r.ko" 1}}
{{- if $hookCode := Hook .CRD "set_identifiers_pre_read_one" }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The position of hook is not pre read one. There is no read one call here.

I agree this can be a useful hook. maybe rename it to just "set_identifiers"

Just a thought, Should there be either hook code OR auto-generated code inside method body?
This is such a simple method, no need to have both.

@RedbackThomson
Copy link
Contributor

I believe this is not necessary anymore. The recent replacement with #190 has fixed your use case for applicationautoscaling, and I imagine should fix most other issues. Happy to re-open this PR if hooks are needed in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Indicates a non-member PR verified by an org member that is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants