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: create lattice resources when no endpoints in K8s services (#386) #406

Merged
merged 1 commit into from
Sep 20, 2023

Conversation

scottlaiaws
Copy link
Contributor

What type of PR is this?

bug

Which issue does this PR fix:

#386

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

This PR allows the controller to continue to create Lattice service, and listeners, and rules when there are no targets to register

If an issue # is not available please add repro steps and logs from aws-gateway-controller showing the issue:

Testing done on this change:

Added unit tests, and e2e tests.

make e2e-test output:

Ran 32 of 32 Specs in 2332.975 seconds
SUCCESS! -- 32 Passed | 0 Failed | 0 Pending | 0 Skipped
--- PASS: TestIntegration (2334.12s)
PASS
ok      github.com/aws/aws-application-networking-k8s/test/suites/integration   2334.147s

Automation added to e2e:

Added test case httproute_creation_test.go

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.

Copy link
Contributor

@solmonk solmonk left a comment

Choose a reason for hiding this comment

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

approving with minor comment

@@ -96,6 +97,11 @@ func (s *defaultTargetsManager) Create(ctx context.Context, targets *latticemode
targetList = append(targetList, &t)
}

if len(targetList) == 0 {
glog.Warningln("There are no available targets to regiser. Skipping targets registration")
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO I don't think we need this log line

It("Create lattice resources successfully when no Targets available", func() {
httpRoute = testFramework.NewHttpRoute(testGateway, service, "Service")

// Override port
Copy link
Contributor

@zijun726911 zijun726911 Sep 20, 2023

Choose a reason for hiding this comment

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

Do you need to add more comments here to say that you override the httproute port to cause no port match so that it will cause no Targets in the TG? Or use a more explicit way to construct a no targetPort k8sService?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can add more comments. I doubt creating "no targetPort" K8s service will be used in other place so it will be over-kill to create a method to do that.

@coveralls
Copy link

coveralls commented Sep 20, 2023

Pull Request Test Coverage Report for Build 6253438117

  • 4 of 4 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 39.284%

Totals Coverage Status
Change from base Build 6253200146: 0.02%
Covered Lines: 4062
Relevant Lines: 10340

💛 - Coveralls

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.

4 participants