-
Notifications
You must be signed in to change notification settings - Fork 71
Fix target group leaking and e2etest #510
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
Conversation
| if aws.StringValue(hz.Name) != name { | ||
| return nil, nil | ||
| } |
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.
why name should not be equal? list zones should apply dns name filter
out, err := client.ListHostedZonesByName(&route53.ListHostedZonesByNameInput{DNSName: &name})
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.
"Fix bug where e2e test will pick up existing other hosted zone and delete it"
There was intention to use existing hosted zone if test was terminated and zone leaked. Test re-run should pick-up previous zone and cleanup after. Otherwise need to manually delete them from route53.
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.
ListHostedZonesByName always returns all hosted zones in the account. DNSName field only guarantees the first element that is getting picked up, and you still get other hosted zones in the following elements.
| switch status { | ||
| case vpclattice.TargetGroupStatusCreateInProgress, vpclattice.TargetGroupStatusDeleteInProgress: | ||
| return nil, errors.New(LATTICE_RETRY) | ||
| case vpclattice.TargetGroupStatusDeleteFailed, vpclattice.TargetGroupStatusActive: |
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 we need to return err for TargetGroupStatusDeleteFailed tg?
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 so, they do exist.
test/pkg/test/framework.go
Outdated
| ResourceArn: service.Arn, | ||
| }) | ||
| managed, err := env.Cloud.IsArnManaged(ctx, *service.Arn) | ||
| if err == nil { // for err != nil, it is possible that this service own by other account, and it is shared to current account by RAM |
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: change variable name to managedByCurrentCluster?
Seems this comment description is not really precise:
// for err != nil, it is possible that this service own by other account, and it is shared to current account by RAM
should be // for err != nil, it is possible that this lattice service is own by other cluster
not just limit to the RAM share
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.
its failing to fetch tags so most of the time it will be other account, not other cluster within the same account. I can update the comment though.
test/pkg/test/framework.go
Outdated
| } | ||
| } | ||
|
|
||
| retrievedTargetGroups, _ := env.LatticeClient.ListTargetGroupsAsList(ctx, &vpclattice.ListTargetGroupsInput{}) |
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 we need to pass vpcIdentifier in vpclattice.ListTargetGroupsInput{} ?
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 makes sense
test/pkg/test/framework.go
Outdated
| continue | ||
| } | ||
| managed, err := env.Cloud.IsArnManaged(ctx, *tg.Arn) | ||
| if err == nil { // for err != nil, it is possible that this service own by other account, and it is shared to current account by RAM |
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.
Need to change this comment, it is checking target group existing
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.
missed that, will change
| IpAddressType: latticeTg.Config.IpAddressType, | ||
| Type: latticeTg.Type, | ||
| VpcIdentifier: latticeTg.Config.VpcIdentifier, | ||
| }, nil) // we already know that tags match |
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.
Just wondering should we add a Protocol(or other tg fields) tags for TargetGroup?
So that to make sure one FindResourcesByTags() api call could definitely exactly match one TG?
(not in this PR)
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 if it is necessary. Actually.. I wanted to remove as many tags as possible. I "had to" add protocolVersion in the tag because it is not available in TGSummary, so it needed extra Get() call to be figured out. Ideally VPC Lattice should just return protocolVersion in the summary instead.
zijun726911
left a comment
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.
LGTM, are we safe to add the --procs param in the Makefile?
|
I have thought about that but I think it is at experimental stage yet. Will add that once I have more confidence |
What type of PR is this?
bug
Which issue does this PR fix:
What does this PR do / Why do we need it:
If an issue # is not available please add repro steps and logs from aws-gateway-controller showing the issue:
Testing done on this change:
make e2e-testAutomation added to e2e:
Will this PR introduce any new dependencies?:
Will this break upgrades or downgrades. Has updating a running cluster been tested?:
Does this PR introduce any user-facing change?:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.