Skip to content

Commit

Permalink
Merge pull request #19953 from liggitt/etcd-dial-timeout
Browse files Browse the repository at this point in the history
Set etcd DialTimeout, fix etcd start order in all-in-one
  • Loading branch information
openshift-merge-robot authored Jun 10, 2018
2 parents 166c5f7 + 0a6ead4 commit 116b179
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
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.

0 comments on commit 116b179

Please sign in to comment.