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

Allow configurable etcd options #42246

Merged

Conversation

jamiehannaford
Copy link
Contributor

What this PR does / why we need it:

Allows users to set the --listen-client-urls and --advertise-client-urls flags on etcd binaries for clusters set up with kubeadm.

Which issue this PR fixes:

As far as I can tell right now, other nodes in a cluster set up with kubeadm cannot communicate with the etcd static pod running on the master. This is needed in order to set up calico/canal SDN which needs access to a publicly addressable IPv4 before the overlay network and inter-cluster subnet is created.

Addresses kubernetes/enhancements#138 and kubernetes/enhancements#11.

Release note:

Users can now specify listen and advertise URLs for etcd in a kubeadm cluster 

@k8s-ci-robot
Copy link
Contributor

Hi @jamiehannaford. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with @k8s-bot ok to test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

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. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 28, 2017
@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Feb 28, 2017
@jamiehannaford
Copy link
Contributor Author

The overall solution to this problem I think is to create a NodePort etcd service (either manually or automatically with kubeadm) and have the binary bind to 0.0.0.0.

@k8s-reviewable
Copy link

This change is Reviewable

@pires
Copy link
Contributor

pires commented Mar 2, 2017

@kubernetes/sig-cluster-lifecycle-pr-reviews @luxas @lukemarsden

@jamiehannaford
Copy link
Contributor Author

@pires @kubernetes/sig-cluster-lifecycle-pr-reviews @luxas @lukemarsden I know kubeadm is in code freeze due to moving over codebases - should I wait until that's happened or is there anything I can incorporate now?

@luxas
Copy link
Member

luxas commented Mar 14, 2017

@jamiehannaford Kubernetes as a project is in code freeze right now and no non-bugfix PRs can be merged at this point in the cycle. Hence the pending state...

kubeadm will eventually move to its own repo, but that will take some time yet before our machinery is able to do that.

@jamiehannaford
Copy link
Contributor Author

@luxas I know but some of my other PRs have been reviewed but not merged. Maybe it will save time when the code freeze is lifted. I'd just like a general idea of whether this feature is approved/needed and if any of the implementation logic is off :)

Copy link
Contributor

@pires pires left a comment

Choose a reason for hiding this comment

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

Overall this LGTM. I just don't like the flags.

cmd.PersistentFlags().StringVar(
&cfg.Etcd.AdvertiseURL, "etcd-advertise-url", cfg.Etcd.AdvertiseURL,
"Specify a advertise-client-urls value to the etcd container",
)

Copy link
Contributor

Choose a reason for hiding this comment

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

Use configuration, not flags.

@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 31, 2017
@jamiehannaford
Copy link
Contributor Author

@pires Does this look okay now? I removed the flags

if cfg.Etcd.AdvertiseURL != "" {
advertiseURL += fmt.Sprintf(",%s", cfg.Etcd.AdvertiseURL)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

listenURL and advertiseURL should point to a same constant value.

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 wasn't 100% sure what you meant, but I added a new default variable which both URLs point to. That DRYed it up a bit. Is that what you meant?

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 4, 2017
Copy link
Contributor

@pires pires left a comment

Choose a reason for hiding this comment

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

/lgtm

@pires
Copy link
Contributor

pires commented Apr 4, 2017

Ah, yes, the API changes break stuff. Please, check the test failure details and fix it.

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 4, 2017
Copy link
Member

@luxas luxas left a comment

Choose a reason for hiding this comment

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

There's nothing wrong with this PR per se, but I really think that if we do this, it should be generic from the get go.

Please align the logic here with what we have for all the other control plane components

CAFile string
CertFile string
KeyFile string
ListenURL string
Copy link
Member

Choose a reason for hiding this comment

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

I think we really should go with a generic Args here instead of two hard-coded string fields.
Imagine I want to set the token authz mechanism. Eventually we would duplicate all etcd options, instead we should go with a more dynamic route with map[string]string as the other control plane components

func getEtcdCommand(cfg *kubeadmapi.MasterConfiguration) []string {
defaultURL := "http://127.0.0.1:2379"

listenURL := defaultURL
Copy link
Member

Choose a reason for hiding this comment

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

Please use the same logic as the other control plane components here with default and overridable arguments.

@luxas luxas self-assigned this Apr 5, 2017
@jamiehannaford
Copy link
Contributor Author

@k8s-bot bazel test this

@k8s-ci-robot
Copy link
Contributor

@jamiehannaford: you can't request testing unless you are a kubernetes member.

In response to this comment:

@k8s-bot bazel test this

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. I understand the commands that are listed here.

@jamiehannaford
Copy link
Contributor Author

@luxas Thanks for the feedback, I've made things a bit more generic so folks can easily extend. Would you mind kicking off the tests again?

@pires
Copy link
Contributor

pires commented Apr 5, 2017

@k8s-bot bazel test this

@jamiehannaford
Copy link
Contributor Author

@luxas Agree about the dataDir stuff. I've added a new config key and removed the hard-coded references. Can you comment with ok to test so I can re-run tests to get them green?

@dims
Copy link
Member

dims commented Apr 6, 2017

@k8s-bot ok to test

@jamiehannaford jamiehannaford force-pushed the add-etcd-flags-kubeadm branch 3 times, most recently from 8140f56 to 91e41e6 Compare April 6, 2017 12:03
@jamiehannaford
Copy link
Contributor Author

@k8s-bot non-cri e2e test this

1 similar comment
@luxas
Copy link
Member

luxas commented Apr 6, 2017

@k8s-bot non-cri e2e test this

@jamiehannaford
Copy link
Contributor Author

Looks like this is all green now

@pires
Copy link
Contributor

pires commented Apr 7, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 7, 2017
Copy link
Member

@luxas luxas left a comment

Choose a reason for hiding this comment

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

LGTM, only one nit.
Thanks for doing this!

@@ -31,7 +33,7 @@ func SetEnvParams() *EnvParams {

envParams := map[string]string{
"kubernetes_dir": "/etc/kubernetes",
"host_etcd_path": "/var/lib/etcd",
"host_etcd_path": v1alpha1.DefaultEtcdDataDir,
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for being unclear earlier, I don't think this is used anymore (if it is, switch to the new method)
It could/should be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem, I appreciate the feedback 👍 does this commit address what you mean? 4b065f8

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 7, 2017
@jamiehannaford
Copy link
Contributor Author

@k8s-bot non-cri e2e test this

@pires
Copy link
Contributor

pires commented Apr 8, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 8, 2017
@luxas
Copy link
Member

luxas commented Apr 8, 2017

@jamiehannaford LGTM, but please squash (unless you really think the commit sequence makes a lot of sense)

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 10, 2017
@jamiehannaford
Copy link
Contributor Author

@luxas Sure - I squashed those commits into 1

@jamiehannaford
Copy link
Contributor Author

Any update on this?

Copy link
Member

@luxas luxas left a comment

Choose a reason for hiding this comment

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

Hi, thanks for bearing with us. I've been away last week, digging myself up now from all the emails.

Thanks for the ping!

LGTM

@luxas
Copy link
Member

luxas commented Apr 18, 2017

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 18, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jamiehannaford, luxas, pires

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 18, 2017
@jamiehannaford
Copy link
Contributor Author

@k8s-bot gce etcd3 e2e test this

@k8s-github-robot
Copy link

Automatic merge from submit-queue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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 "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants