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

Set etcd DialTimeout, fix etcd start order in all-in-one #19953

Merged
merged 2 commits into from
Jun 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions pkg/cmd/server/start/start_master.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,17 @@ func (m *Master) Start() error {
}

if m.api {
// start etcd if configured to run in process
if m.config.EtcdConfig != nil {
etcdserver.RunEtcd(m.config.EtcdConfig)
}

// ensure connectivity to etcd before calling BuildMasterConfig,
// which constructs storage whose etcd clients require connectivity to etcd at construction time
if err := testEtcdConnectivity(m.config.EtcdClientInfo); err != nil {
return err
}

// informers are shared amongst all the various api components we build
// TODO the needs of the apiserver and the controllers are drifting. We should consider two different skins here
clientConfig, err := configapi.GetClientConfig(m.config.MasterClients.OpenShiftLoopbackKubeConfig, m.config.MasterClients.OpenShiftLoopbackClientConnectionOverrides)
Expand Down Expand Up @@ -461,20 +472,9 @@ func (m *Master) Start() error {

// StartAPI starts the components of the master that are considered part of the API - the Kubernetes
// API and core controllers, the Origin API, the group, policy, project, and authorization caches,
// etcd, the asset server (for the UI), the OAuth server endpoints, and the DNS server.
// the asset server (for the UI), the OAuth server endpoints, and the DNS server.
// TODO: allow to be more granularly targeted
func StartAPI(oc *origin.MasterConfig) error {
// start etcd
if oc.Options.EtcdConfig != nil {
etcdserver.RunEtcd(oc.Options.EtcdConfig)
}

// verify we can connect to etcd with the provided config
// TODO remove when this becomes a health check in 3.8
if err := testEtcdConnectivity(oc.Options.EtcdClientInfo); err != nil {
return err
}

// start DNS before the informers are started because it adds a ClusterIP index.
if oc.Options.DNSConfig != nil {
oc.RunDNSServer()
Expand All @@ -493,6 +493,7 @@ func testEtcdConnectivity(etcdClientInfo configapi.EtcdConnectionInfo) error {
if err != nil {
return err
}
defer etcdClient3.Close()
if err := etcd.TestEtcdClientV3(etcdClient3); err != nil {
return err
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.