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

Google Cloud DNS dnsprovider #25389

Closed
wants to merge 7 commits into from
Closed

Google Cloud DNS dnsprovider #25389

wants to merge 7 commits into from

Conversation

ghost
Copy link

@ghost ghost commented May 10, 2016

Add Google Cloud DNS dnsprovider.

@ghost ghost assigned madhusudancs May 10, 2016
@ghost ghost added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. team/control-plane labels May 10, 2016
@ghost ghost added this to the v1.3 milestone May 10, 2016
@ghost
Copy link
Author

ghost commented May 10, 2016

Successfully tested against both real and stubbed cloud backends.
Separate PR for Amazon Route53 coming shortly.

@mfanjie @nikhiljindal FYI

@k8s-github-robot k8s-github-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. release-note-label-needed labels May 10, 2016
@ghost
Copy link
Author

ghost commented May 10, 2016

cc: @justinsb

"github.com/golang/glog"
)

// Factory is a function that returns a cloudprovider.Interface.
Copy link
Author

Choose a reason for hiding this comment

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

My apologies - this file needs updating, and has not been tested yet. I'll fix it now. But you can review the rest of the PR in the mean time,

@ghost
Copy link
Author

ghost commented May 11, 2016

Looks like a vendor-related problem. I'm looking...

pkg/cloudprovider/providers/gce/gce.go:31:2: cannot find package "code.google.com/p/gcfg" in any of:
    /go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/code.google.com/p/gcfg (vendor tree)

@ghost
Copy link
Author

ghost commented May 12, 2016

@k8s-bot test this issue #25516

@ghost
Copy link
Author

ghost commented May 12, 2016

Apparently #25516 did not fix this:

pkg/cloudprovider/providers/gce/gce.go:31:2: cannot find package "code.google.com/p/gcfg" in any of:
    /go/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/code.google.com/p/gcfg (vendor tree)
    /usr/local/go/src/code.google.com/p/gcfg (from $GOROOT)
    /go/src/k8s.io/kubernetes/_output/local/go/src/code.google.com/p/gcfg (from $GOPATH)

@ghost
Copy link
Author

ghost commented May 12, 2016

@k8s-bot Test this please

@ghost
Copy link
Author

ghost commented May 12, 2016

Looks like I need a better header comment. Fixing...

Verifying ./hack/../hack/verify-boilerplate.sh
Boilerplate header is wrong for: /go/src/k8s.io/kubernetes/federation/pkg/dnsprovider/dns.go
...
FAILED   ./hack/../hack/verify-boilerplate.sh   0s

@ghost ghost mentioned this pull request May 12, 2016
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as previous files.

Copy link
Author

Choose a reason for hiding this comment

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

Agreed, done.

@ghost
Copy link
Author

ghost commented May 13, 2016

@k8s-bot Test this please.

@ghost ghost closed this May 13, 2016
@ghost ghost reopened this May 13, 2016

// All registered dns providers.
var providersMutex sync.Mutex
var providers = make(map[string]Factory)
Copy link
Contributor

@madhusudancs madhusudancs May 13, 2016

Choose a reason for hiding this comment

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

These two are always used together and should be structurally reflected that way. Something like:

type providersMap struct {
    providers map[string]Factory
    mutex sync.Mutex
}

And initialize the struct in InitDnsProviders() below.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, that makes sense.

Copy link
Contributor

Choose a reason for hiding this comment

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

InitDnsProvider() seems to be not the right place. It seems to initialize a single provider. providersMap can probably be globally initialized. Or could be done in a package level init() function.

Copy link
Author

Choose a reason for hiding this comment

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

This code is actually a direct mirror of what's in the cloudprovider package. I'd suggest that we fix both of them, as you suggest, but in a separate cleanup PR. At least the two (dnsprovider and cloudprovider) are consistent now :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure.

package internal

import (
"google.golang.org/api/dns/v1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as before.

Copy link
Author

Choose a reason for hiding this comment

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

ok

Copy link
Author

Choose a reason for hiding this comment

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

Done.

@madhusudancs
Copy link
Contributor

@quinton-hoole I did one full pass. Have left some comments.

In terms of what it accomplishes, it looks good. But on the other hand, there are too many levels in the hierarchy. I guess you are doing all that to provide fakes for testing. But that makes it hard to form a very good mental model in the first pass.

@madhusudancs
Copy link
Contributor

madhusudancs commented May 13, 2016

Also, why is all this in federation/pkg/dnsprovider instead of /pkg/dnsprovider? It seems useful for non-federation stuff too. People have asked for the ability to program external DNS in the context of PetSets and other places. And this seems to be generic enough to be useful elsewhere.

@ghost
Copy link
Author

ghost commented May 13, 2016

@madhusudancs Agreed it's a lot of code, but there is no other/better way to do unit testing. At least not that I could think of. I don't like it either, but I couldn't think of a better/more lucid way.

Also, agreed, this could/should be moved to pkg/dnsprovider. Will do.

@ghost
Copy link
Author

ghost commented May 13, 2016

@madhusudancs One more thing about the unit testing. The root of the complication is that Google Cloud DNS golang library does not include any golang interfaces. It implements structs directly, with read/write fields. This is what makes it fundamentally unstubbable without a separate interface level, and another level of implementations of that interface (as well as the stub implementation) - hence three levels.

AWS Route 53 on the other hand, provides the interfaces and implementations thereof, hence requiring only a single layer of stub implementations. Make sense?

@k8s-bot
Copy link

k8s-bot commented May 16, 2016

GCE e2e build/test passed for commit 4988c43.

@ghost
Copy link
Author

ghost commented May 16, 2016

Should compile correctly after #25679 merges. Needs updated googleapi package.

@madhusudancs
Copy link
Contributor

@quinton-hoole Is this ready for next review pass?

@ghost
Copy link
Author

ghost commented May 19, 2016

All that remains is to move it out of the federation package tree, I think.
On May 18, 2016 23:12, "Madhusudan.C.S" notifications@github.com wrote:

@quinton-hoole https://github.com/quinton-hoole Is this ready for next
review pass?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#25389 (comment)

@madhusudancs
Copy link
Contributor

@quinton-hoole Except for a few very minor nits, this code looks good to me for the first cut. I definitely don't want to hold this PR for the dnsprovider package to be moved to pkg/. Please do consider doing that in a follow up PR and also address the tiny nits.

I am applying the LGTM label. If you need to rebase or something and the merge bot removes the label, please feel free to reapply.

@madhusudancs madhusudancs added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 19, 2016
@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 19, 2016
@madhusudancs
Copy link
Contributor

@madhusudancs One more thing about the unit testing. The root of the complication is that Google Cloud DNS golang library does not include any golang interfaces. It implements structs directly, with read/write fields. This is what makes it fundamentally unstubbable without a separate interface level, and another level of implementations of that interface (as well as the stub implementation) - hence three levels.

AWS Route 53 on the other hand, provides the interfaces and implementations thereof, hence requiring only a single layer of stub implementations. Make sense?

Yeah, makes sense.

@ghost ghost added release-note Denotes a PR that will be considered when it comes time to generate release notes. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels May 21, 2016
@ghost
Copy link
Author

ghost commented May 21, 2016

Replaced by identical #26020

@ghost ghost closed this May 21, 2016
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants