Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
97eb28a0
Commit
97eb28a0
authored
Sep 23, 2020
by
Brad Davidson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary listener arg from managed DB setup
Signed-off-by:
Brad Davidson
<
brad.davidson@rancher.com
>
parent
a3bbd58f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
https.go
pkg/cluster/https.go
+2
-1
managed.go
pkg/cluster/managed.go
+4
-3
drivers.go
pkg/cluster/managed/drivers.go
+1
-2
etcd.go
pkg/etcd/etcd.go
+6
-7
No files found.
pkg/cluster/https.go
View file @
97eb28a0
...
...
@@ -55,7 +55,8 @@ func (c *Cluster) initClusterAndHTTPS(ctx context.Context) error {
return
err
}
l
,
handler
,
err
=
c
.
initClusterDB
(
ctx
,
l
,
handler
)
// Config the cluster database and allow it to add additional request handlers
handler
,
err
=
c
.
initClusterDB
(
ctx
,
handler
)
if
err
!=
nil
{
return
err
}
...
...
pkg/cluster/managed.go
View file @
97eb28a0
...
...
@@ -52,9 +52,10 @@ func (c *Cluster) start(ctx context.Context) error {
return
c
.
managedDB
.
Start
(
ctx
,
c
.
clientAccessInfo
)
}
func
(
c
*
Cluster
)
initClusterDB
(
ctx
context
.
Context
,
l
net
.
Listener
,
handler
http
.
Handler
)
(
net
.
Listener
,
http
.
Handler
,
error
)
{
// initClusterDB registers routes for database info with the http request handler
func
(
c
*
Cluster
)
initClusterDB
(
ctx
context
.
Context
,
handler
http
.
Handler
)
(
http
.
Handler
,
error
)
{
if
c
.
managedDB
==
nil
{
return
l
,
handler
,
nil
return
handler
,
nil
}
if
!
strings
.
HasPrefix
(
c
.
config
.
Datastore
.
Endpoint
,
c
.
managedDB
.
EndpointName
()
+
"://"
)
{
...
...
@@ -63,7 +64,7 @@ func (c *Cluster) initClusterDB(ctx context.Context, l net.Listener, handler htt
}
}
return
c
.
managedDB
.
Register
(
ctx
,
c
.
config
,
l
,
handler
)
return
c
.
managedDB
.
Register
(
ctx
,
c
.
config
,
handler
)
}
func
(
c
*
Cluster
)
assignManagedDriver
(
ctx
context
.
Context
)
error
{
...
...
pkg/cluster/managed/drivers.go
View file @
97eb28a0
...
...
@@ -2,7 +2,6 @@ package managed
import
(
"context"
"net"
"net/http"
"github.com/rancher/k3s/pkg/clientaccess"
...
...
@@ -16,7 +15,7 @@ var (
type
Driver
interface
{
IsInitialized
(
ctx
context
.
Context
,
config
*
config
.
Control
)
(
bool
,
error
)
Register
(
ctx
context
.
Context
,
config
*
config
.
Control
,
l
net
.
Listener
,
handler
http
.
Handler
)
(
net
.
Listener
,
http
.
Handler
,
error
)
Register
(
ctx
context
.
Context
,
config
*
config
.
Control
,
handler
http
.
Handler
)
(
http
.
Handler
,
error
)
Reset
(
ctx
context
.
Context
,
clientAccessInfo
*
clientaccess
.
Info
)
error
Start
(
ctx
context
.
Context
,
clientAccessInfo
*
clientaccess
.
Info
)
error
Test
(
ctx
context
.
Context
,
clientAccessInfo
*
clientaccess
.
Info
)
error
...
...
pkg/etcd/etcd.go
View file @
97eb28a0
...
...
@@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/url"
"os"
...
...
@@ -276,20 +275,20 @@ func (e *ETCD) join(ctx context.Context, clientAccessInfo *clientaccess.Info) er
})
}
// Register configures a new etcd client and adds db info routes for the http
listen
er.
func
(
e
*
ETCD
)
Register
(
ctx
context
.
Context
,
config
*
config
.
Control
,
l
net
.
Listener
,
handler
http
.
Handler
)
(
net
.
Listener
,
http
.
Handler
,
error
)
{
// Register configures a new etcd client and adds db info routes for the http
request handl
er.
func
(
e
*
ETCD
)
Register
(
ctx
context
.
Context
,
config
*
config
.
Control
,
handler
http
.
Handler
)
(
http
.
Handler
,
error
)
{
e
.
config
=
config
e
.
runtime
=
config
.
Runtime
client
,
err
:=
getClient
(
ctx
,
e
.
runtime
,
endpoint
)
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
err
}
e
.
client
=
client
address
,
err
:=
getAdvertiseAddress
(
config
.
AdvertiseIP
)
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
err
}
e
.
address
=
address
...
...
@@ -299,10 +298,10 @@ func (e *ETCD) Register(ctx context.Context, config *config.Control, l net.Liste
e
.
config
.
Datastore
.
Config
.
KeyFile
=
e
.
runtime
.
ClientETCDKey
if
err
:=
e
.
setName
(
false
);
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
err
}
return
l
,
e
.
handler
(
handler
),
err
return
e
.
handler
(
handler
),
err
}
// setName sets a unique name for this cluster member. The first time this is called,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment