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

Fix service delete event #255

Merged
merged 5 commits into from
May 23, 2023
Merged

Fix service delete event #255

merged 5 commits into from
May 23, 2023

Conversation

zmingxi
Copy link
Contributor

@zmingxi zmingxi commented May 19, 2023

What type of PR is this?
bug

Which issue does this PR fix:
#237

What does this PR do / Why do we need it:
Fix

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 e2etest
Manually run #257

Automation added to e2e:

Will this PR introduce any new dependencies?:
No

Will this break upgrades or downgrades. Has updating a running cluster been tested?:
No
Does this PR introduce any user-facing change?:
No


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@coveralls
Copy link

coveralls commented May 19, 2023

Pull Request Test Coverage Report for Build 5028410283

  • 15 of 19 (78.95%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 31.927%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/gateway/model_build_targets.go 15 19 78.95%
Totals Coverage Status
Change from base Build 4962673720: 0.02%
Covered Lines: 3193
Relevant Lines: 10001

💛 - Coveralls

@zmingxi zmingxi requested a review from liwenwu-amazon May 19, 2023 19:53
@@ -76,7 +76,7 @@ func (h *enqueueRequestsForEndpointsEvent) enqueueImpactedService(queue workqueu
}

if err := h.client.Get(context.TODO(), namespaceName, svc); err != nil {
glog.V(2).Infof("enqueueImpactedService, service not found %v\n", err)
glog.V(2).Infof("Event: enqueueImpactedService, service not found %v\n", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

let's use V(6)

@@ -29,6 +29,7 @@ func NewEqueueRequestServiceEvent(client client.Client) handler.EventHandler {

func (h *enqueueRequetsForServiceEvent) Create(e event.CreateEvent, queue workqueue.RateLimitingInterface) {
service := e.Object.(*corev1.Service)
h.enqueueImpactedService(queue, service)
Copy link
Contributor

Choose a reason for hiding this comment

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

being consistent , can we add glog.V(6) here

@@ -37,13 +38,34 @@ func (h *enqueueRequetsForServiceEvent) Update(e event.UpdateEvent, queue workqu

func (h *enqueueRequetsForServiceEvent) Delete(e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
service := e.Object.(*corev1.Service)
h.enqueueImpactedService(queue, service)
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

tgNameD := latticestore.TargetGroupName(svc.Name, svc.Namespace)
TGDeleted := ds.GetTargetGroupsByTG(tgNameD)
for _, tg := range TGDeleted {
glog.V(6).Infof("endpoints change trigger target IP list registration %v and tg %v\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update this debugging log line

@@ -72,6 +81,38 @@ func Test_Targets(t *testing.T) {
},
},
},
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a unit test to test service delete ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unit test is covered at line 85-115

Copy link
Contributor

Choose a reason for hiding this comment

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

also, can u add a new test for just service add without HTTProute stuff...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created issue for adding e2etest: #257

@@ -72,6 +81,38 @@ func Test_Targets(t *testing.T) {
},
},
},
{
name: "Add all endpoints to build spec",
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update this unit test to match what this unit test for?

@liwenwu-amazon
Copy link
Contributor

LGTM. Please also add more detail on how you fixed the issue. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants