-
Notifications
You must be signed in to change notification settings - Fork 529
Refactored & Implemented new features for ServiceDNS #353
Conversation
@shashidharatd: GitHub didn't allow me to request PR reviews from the following users: danehans. Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: shashidharatd 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 |
fb4ecd5
to
d18ac13
Compare
/cc @danehans |
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.
@shashidharatd I made some comments in #348 that are related to 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.
Great work. Just one question for you.
// FederationDomain | ||
// +k8s:openapi-gen=true | ||
// +kubebuilder:resource:path=federationdomains | ||
type FederationDomain struct { |
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.
Does it make sense to name this type Domain
since it's part of the multiclusterdns.federation.k8s.io
API group?
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 am fine. @pmorie wdyt?
endpoint := &feddnsv1a1.Endpoint{ | ||
DNSName: dnsObject.Spec.DNSPrefix + "." + dnsObject.Status.Domain, | ||
RecordTTL: ttl, | ||
RecordType: RecordTypeA, |
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.
What if we just create a CNAME record to point to the global DNS name? This would prevent having to manage a duplicate entry where the list of A records match the global DNS entry.
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.
Agree, Updated to create CNAME
record now.
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.
Thanks @shashidharatd for these changes! I made some comments. Also, there are several places we're still referring to FederationDomain
instead of Domain
after the API name was updated. I didn't comment on all of them. Is this intentional?
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.
Thanks @font for the review. I have addressed the comments. PTAL
endpoint := &feddnsv1a1.Endpoint{ | ||
DNSName: dnsObject.Spec.DNSPrefix + "." + dnsObject.Status.Domain, | ||
RecordTTL: ttl, | ||
RecordType: RecordTypeA, |
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.
Agree, Updated to create CNAME
record now.
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.
@shashidharatd Thanks! There are just a few unresolved items and we can merge this.
@@ -101,6 +101,15 @@ func getServiceDNSEndpoints(obj interface{}) ([]*feddnsv1a1.Endpoint, error) { | |||
} | |||
endpoints = append(endpoints, endpoint) | |||
} | |||
if dnsObject.Spec.DNSPrefix != "" && len(globalTargets) > 0 { |
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 think we also need to check if AllowServiceWithoutEndpoints
is set to determine if we need to check whether globalTargets
contains an actual target. If a user sets AllowServiceWithoutEndpoints
, then there should be a DNS entry created even if there are no targets set.
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 agree with you for writing CNAME record even if there are no globalTargets
. But AllowServiceWithoutEndpoints
is for a different purpose (LB backed by endpoints/pods) and IMHO, we should not mix them.
@@ -65,11 +65,18 @@ type Controller struct { | |||
// Informer for the ServiceDNSRecord objects | |||
serviceDNSController cache.Controller | |||
|
|||
// Store for the FederationDomain objects |
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.
s/FederationDomain/Domain/
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.
Done
@@ -65,11 +65,18 @@ type Controller struct { | |||
// Informer for the ServiceDNSRecord objects | |||
serviceDNSController cache.Controller | |||
|
|||
// Store for the FederationDomain objects | |||
federationDomainStore cache.Store | |||
// Informer for the FederationDomain objects |
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.
s/FederationDomain/Domain/
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.
Done
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.
@font, have addressed the comments. ptal. Thanks !
@@ -101,6 +101,15 @@ func getServiceDNSEndpoints(obj interface{}) ([]*feddnsv1a1.Endpoint, error) { | |||
} | |||
endpoints = append(endpoints, endpoint) | |||
} | |||
if dnsObject.Spec.DNSPrefix != "" && len(globalTargets) > 0 { |
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 agree with you for writing CNAME record even if there are no globalTargets
. But AllowServiceWithoutEndpoints
is for a different purpose (LB backed by endpoints/pods) and IMHO, we should not mix them.
@@ -65,11 +65,18 @@ type Controller struct { | |||
// Informer for the ServiceDNSRecord objects | |||
serviceDNSController cache.Controller | |||
|
|||
// Store for the FederationDomain objects |
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.
Done
@@ -65,11 +65,18 @@ type Controller struct { | |||
// Informer for the ServiceDNSRecord objects | |||
serviceDNSController cache.Controller | |||
|
|||
// Store for the FederationDomain objects | |||
federationDomainStore cache.Store | |||
// Informer for the FederationDomain objects |
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.
Done
@@ -123,6 +131,23 @@ func newController(fedClient fedclientset.Interface, kubeClient kubeclientset.In | |||
util.NewTriggerOnAllChanges(s.worker.EnqueueObject), | |||
) | |||
|
|||
// Informer for the FederationDomain resource |
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.
sorry, missed. now i did a grep and replace all of them.
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.
Thanks @shashidharatd!
/lgtm
Ref: #348
/cc @danehans @pmorie @kubernetes-sigs/federation-v2-maintainers