Skip to content
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

Parse TargetGroup names from ARNs #10276

Merged
merged 5 commits into from Nov 21, 2020
Merged

Conversation

hakman
Copy link
Member

@hakman hakman commented Nov 20, 2020

Fixes: #10268
Summary of fixes:

  1. duplicate tasks names because the names for external TGs are the same for each IG
  2. model names differ from actual names so always show changes
  3. ordering is required to not show false changes

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 20, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hakman

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

@k8s-ci-robot k8s-ci-robot added area/provider/aws Issues or PRs related to aws provider approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 20, 2020
@hakman hakman added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 20, 2020
@k8s-ci-robot k8s-ci-robot added area/api size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 20, 2020
@hakman hakman removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 20, 2020
@hakman
Copy link
Member Author

hakman commented Nov 20, 2020

This and other may need back-porting to 1.18 also now.
/cc @rifelpet @rdrgmnzs

Copy link
Member

@rifelpet rifelpet left a comment

Choose a reason for hiding this comment

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

is there anything in the integration tests that we could add that would expose this bug and confirm this fix?

tg := &awstasks.TargetGroup{
Name: fi.String(fmt.Sprintf("external-tg-%d", i)),
Name: fi.String(resource[1]),
Copy link
Member

Choose a reason for hiding this comment

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

This assumes that the ARN field after targetgroup/ is always equal to the target group's name and that AWS never modifies that in anyway. is that a safe assumption?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think for now should be ok. AWS will break pretty much anything it wants :).

Copy link
Member Author

Choose a reason for hiding this comment

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

For now, in case of TGs, the resource ID is always tg-name/big-number. This PR validates this format so people will know in advance if something is changed in the future.

Technically, tasks are compared by name and ARN. The name is also used for ordering. We could potentially add some logic that detects the external TGs and generates the name is a way that doesn't assume tg-name/big-number, but would complicate things and add assume some fixed names as belonging to kOps. Seems safer to just assume AWS will not change the ARN format for TGs. For sure AWS will not change the ARNs of existing TGs.

upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go Outdated Show resolved Hide resolved
@rifelpet rifelpet changed the title Parse TargetGrup names from ARNs Parse TargetGroup names from ARNs Nov 20, 2020
@rifelpet
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 21, 2020
@k8s-ci-robot k8s-ci-robot merged commit 4446507 into kubernetes:master Nov 21, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.20 milestone Nov 21, 2020
k8s-ci-robot added a commit that referenced this pull request Nov 21, 2020
…-upstream-release-1.19

Automated cherry pick of #10276: Parse TargetGrup names from ARNs
@hakman hakman deleted the fix-asg branch November 22, 2020 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/api area/provider/aws Issues or PRs related to aws provider blocks-next cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't generate terraform when using externalLoadBalancers in two IGs
3 participants