Skip to content

Conversation

@solmonk
Copy link
Contributor

@solmonk solmonk commented Jul 11, 2023

What type of PR is this?

feature

Which issue does this PR fix:

#88

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

Resolves #88 by using DNSEndpoint CRD supported by ExternalDNS

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 and manual traffic tests

HTTPRoute resource with hostname will create the resource resembles the following. Note the ownerReferences field.

apiVersion: externaldns.k8s.io/v1alpha1
kind: DNSEndpoint
metadata:
  creationTimestamp: "2023-07-10T23:35:29Z"
  generation: 1
  name: byoc-parking-dns
  namespace: default
  ownerReferences:
  - apiVersion: gateway.networking.k8s.io/v1beta1
    blockOwnerDeletion: true
    controller: true
    kind: HTTPRoute
    name: byoc-parking
    uid: 4f494890-8314-4a37-b787-99fe80cedd0a
  resourceVersion: "17044921"
  uid: ea7f0852-9060-4927-9d89-b5f4477acdfe
spec:
  endpoints:
  - dnsName: parking.my-test.com
    recordTTL: 300
    recordType: CNAME
    targets:
    - byoc-parking-default-03f7a7580d37de850.7d67968.vpc-lattice-svcs.us-west-2.on.aws

Automation 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.

@coveralls
Copy link

coveralls commented Jul 11, 2023

Pull Request Test Coverage Report for Build 5523240624

  • 10 of 14 (71.43%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-2.8%) to 29.886%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/deploy/stack_deployer.go 1 2 50.0%
pkg/deploy/lattice/service_synthesizer.go 9 12 75.0%
Totals Coverage Status
Change from base Build 5511205616: -2.8%
Covered Lines: 2933
Relevant Lines: 9814

💛 - Coveralls

@liwenwu-amazon
Copy link
Contributor

are you planning to add e2e test for this as part of this PR? Thanks

@liwenwu-amazon
Copy link
Contributor

QQ, for customer who do NOT run external DNS, will they able to use lattice controller at all?

Copy link
Contributor

@liwenwu-amazon liwenwu-amazon left a comment

Choose a reason for hiding this comment

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

I think we should not require customer to "MUST" run external DNS. The lattice controller should still run if they choose to manually add DNS record today or use another way to update their DNS.

@solmonk
Copy link
Contributor Author

solmonk commented Jul 11, 2023

Running ExternalDNS is not required at all (and should not be). I have a couple of setups in this PR for it:

  • Watch for DNSEndpoint will be disabled when CRD is not detected - see controller setup
  • DNSEndpoint creation does not happen when CRD is not detected. This is done by detecting NoMatchError on listing DNSEndpoint resource.
  • The documentation mentions that customers can setup DNS manually when not using ExternalDNS
  • I have done the testing with deleting DNSEndpoint CRD

@liwenwu-amazon
Copy link
Contributor

Please add some test for these business logic. thanks

@solmonk
Copy link
Contributor Author

solmonk commented Jul 11, 2023

Will try to update a few more unit test cases. I am hoping to add e2e test case in other PR. There is a separate ongoing work on E2E testing for custom domain names so I am worried about the conflict. I can add more check when it is delivered.

@liwenwu-amazon
Copy link
Contributor

Will try to update a few more unit test cases. I am hoping to add e2e test case in other PR. There is a separate ongoing work on E2E testing for custom domain names so I am worried about the conflict. I can add more check when it is delivered.

QQ, have you run e2e

  • have external DNS running, but no DNS CRD?
  • do not have external DNS and also no CRD?
    thanks

@solmonk
Copy link
Contributor Author

solmonk commented Jul 11, 2023

Whether externalDNS is running or not does not matter to our controller. We could perhaps just check with CRD / no CRD scenario.

@zijun726911
Copy link
Contributor

When people use ExternalDNS, do they usually create kind:DNSEndpoint by themselves, or it has some use cases that some controllers could create kind:DNSEndpoint on behalf of users?

@solmonk
Copy link
Contributor Author

solmonk commented Jul 12, 2023

@zijun726911 Both are feasible scenarios, for automatic management I think this project is a good example.

glog.V(2).Infof("Failed creating service DNS: %v", err)
return err
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to dos.latticeDataStore.AddLatticeService() at last, after s.dnsEndpointManager.Create() finished? i.e., if s.dnsEndpointManager.Create() failed we should not do s.latticeDataStore.AddLatticeService()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dnsEndpoint is not a requirement for a service to function so I think we can still unblock other logic that uses it. I think latticeDataStore should represent what controller actually has in Lattice.

@zijun726911
Copy link
Contributor

zijun726911 commented Jul 12, 2023

Can you show more manual e2etest result in the PR description? for example, if you installed the CoreDNS addon in your cluster and create a httproute with hostnames it indeed can create a route53 CNAME record

QQ: I am not quite familiar with external-dns, if our k8s controller create a kind:DNSEndpoint, does external-dns be able to create corresponding privated hosted zone and associate with current cluster VPC and create corresponding CNAME record? ok, I saw ## Notes mention that, user need to manually create hosted zone

Copy link
Contributor

@liwenwu-amazon liwenwu-amazon left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you

@solmonk solmonk merged commit 0ab4680 into aws:main Jul 13, 2023
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.

Automate associating custom domain name with service

4 participants