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
f2f57b4a
Commit
f2f57b4a
authored
Nov 20, 2024
by
Brad Davidson
Committed by
Brad Davidson
Dec 06, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused code from etcdproxy
None of these fields or functions are used in k3s or rke2 Signed-off-by:
Brad Davidson
<
brad.davidson@rancher.com
>
parent
183f0c8d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
50 deletions
+8
-50
etcdproxy.go
pkg/etcd/etcdproxy.go
+8
-50
No files found.
pkg/etcd/etcdproxy.go
View file @
f2f57b4a
...
...
@@ -6,21 +6,16 @@ import (
"fmt"
"net"
"net/http"
"net/url"
"strconv"
"time"
"github.com/k3s-io/k3s/pkg/agent/loadbalancer"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/util/wait"
)
type
Proxy
interface
{
Update
(
addresses
[]
string
)
ETCDURL
()
string
ETCDAddresses
()
[]
string
ETCDServerURL
()
string
}
var
httpClient
=
&
http
.
Client
{
...
...
@@ -34,44 +29,22 @@ var httpClient = &http.Client{
// NewETCDProxy initializes a new proxy structure that contain a load balancer
// which listens on port 2379 and proxy between etcd cluster members
func
NewETCDProxy
(
ctx
context
.
Context
,
supervisorPort
int
,
dataDir
,
etcdURL
string
,
isIPv6
bool
)
(
Proxy
,
error
)
{
u
,
err
:=
url
.
Parse
(
etcdURL
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"failed to parse etcd client URL"
)
}
e
:=
&
etcdproxy
{
dataDir
:
dataDir
,
initialETCDURL
:
etcdURL
,
etcdURL
:
etcdURL
,
supervisorPort
:
supervisorPort
,
disconnect
:
map
[
string
]
context
.
CancelFunc
{},
}
lb
,
err
:=
loadbalancer
.
New
(
ctx
,
dataDir
,
loadbalancer
.
ETCDServerServiceName
,
etcdURL
,
2379
,
isIPv6
)
if
err
!=
nil
{
return
nil
,
err
}
e
.
etcdLB
=
lb
e
.
etcdLBURL
=
lb
.
LoadBalancerServerURL
()
e
.
fallbackETCDAddress
=
u
.
Host
e
.
etcdPort
=
u
.
Port
()
return
e
,
nil
return
&
etcdproxy
{
supervisorPort
:
supervisorPort
,
etcdLB
:
lb
,
disconnect
:
map
[
string
]
context
.
CancelFunc
{},
},
nil
}
type
etcdproxy
struct
{
dataDir
string
etcdLBURL
string
supervisorPort
int
initialETCDURL
string
etcdURL
string
etcdPort
string
fallbackETCDAddress
string
etcdAddresses
[]
string
etcdLB
*
loadbalancer
.
LoadBalancer
disconnect
map
[
string
]
context
.
CancelFunc
supervisorPort
int
etcdLB
*
loadbalancer
.
LoadBalancer
disconnect
map
[
string
]
context
.
CancelFunc
}
func
(
e
*
etcdproxy
)
Update
(
addresses
[]
string
)
{
...
...
@@ -95,21 +68,6 @@ func (e *etcdproxy) Update(addresses []string) {
}
}
func
(
e
*
etcdproxy
)
ETCDURL
()
string
{
return
e
.
etcdURL
}
func
(
e
*
etcdproxy
)
ETCDAddresses
()
[]
string
{
if
len
(
e
.
etcdAddresses
)
>
0
{
return
e
.
etcdAddresses
}
return
[]
string
{
e
.
fallbackETCDAddress
}
}
func
(
e
*
etcdproxy
)
ETCDServerURL
()
string
{
return
e
.
etcdURL
}
// start a polling routine that makes periodic requests to the etcd node's supervisor port.
// If the request fails, the node is marked unhealthy.
func
(
e
etcdproxy
)
createHealthCheck
(
ctx
context
.
Context
,
address
string
)
func
()
bool
{
...
...
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