Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Refactored & Implemented new features for ServiceDNS #353

Merged
merged 6 commits into from
Nov 2, 2018

Conversation

shashidharatd
Copy link
Contributor

Ref: #348

/cc @danehans @pmorie @kubernetes-sigs/federation-v2-maintainers

@k8s-ci-robot k8s-ci-robot requested a review from a team October 23, 2018 14:36
@k8s-ci-robot
Copy link
Contributor

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

In response to this:

Ref: #348

/cc @danehans @pmorie @kubernetes-sigs/federation-v2-maintainers

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 23, 2018
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 23, 2018
@cblecker
Copy link

/cc @danehans
now that he's a k-sigs member

Copy link
Contributor

@font font left a 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.

Copy link
Contributor

@danehans danehans left a 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 {
Copy link
Contributor

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?

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 am fine. @pmorie wdyt?

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 29, 2018
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 29, 2018
endpoint := &feddnsv1a1.Endpoint{
DNSName: dnsObject.Spec.DNSPrefix + "." + dnsObject.Status.Domain,
RecordTTL: ttl,
RecordType: RecordTypeA,
Copy link
Contributor

@font font Oct 31, 2018

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.

Copy link
Contributor Author

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.

test/e2e/servicedns.go Show resolved Hide resolved
test/common/dns.go Outdated Show resolved Hide resolved
test/integration/servicedns_test.go Outdated Show resolved Hide resolved
test/integration/servicedns_test.go Show resolved Hide resolved
Copy link
Contributor

@font font left a 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?

Copy link
Contributor Author

@shashidharatd shashidharatd left a 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,
Copy link
Contributor Author

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.

test/common/dns.go Outdated Show resolved Hide resolved
test/e2e/servicedns.go Outdated Show resolved Hide resolved
test/e2e/servicedns.go Show resolved Hide resolved
test/integration/servicedns_test.go Outdated Show resolved Hide resolved
test/integration/servicedns_test.go Show resolved Hide resolved
Copy link
Contributor

@font font left a 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.

test/e2e/servicedns.go Show resolved Hide resolved
@@ -101,6 +101,15 @@ func getServiceDNSEndpoints(obj interface{}) ([]*feddnsv1a1.Endpoint, error) {
}
endpoints = append(endpoints, endpoint)
}
if dnsObject.Spec.DNSPrefix != "" && len(globalTargets) > 0 {
Copy link
Contributor

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.

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 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
Copy link
Contributor

Choose a reason for hiding this comment

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

s/FederationDomain/Domain/

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

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

s/FederationDomain/Domain/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

@shashidharatd shashidharatd left a 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 !

test/e2e/servicedns.go Show resolved Hide resolved
@@ -101,6 +101,15 @@ func getServiceDNSEndpoints(obj interface{}) ([]*feddnsv1a1.Endpoint, error) {
}
endpoints = append(endpoints, endpoint)
}
if dnsObject.Spec.DNSPrefix != "" && len(globalTargets) > 0 {
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 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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

Copy link
Contributor

@font font left a comment

Choose a reason for hiding this comment

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

Thanks @shashidharatd!
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 2, 2018
@k8s-ci-robot k8s-ci-robot merged commit 355fb6d into kubernetes-retired:master Nov 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants