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
2285aa69
Commit
2285aa69
authored
Mar 23, 2022
by
Roberto Bonafiglia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed etcd URL in case of IPv6 address
Signed-off-by:
Roberto Bonafiglia
<
roberto.bonafiglia@suse.com
>
parent
df94b372
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
etcd.go
pkg/etcd/etcd.go
+12
-1
No files found.
pkg/etcd/etcd.go
View file @
2285aa69
...
@@ -45,6 +45,7 @@ import (
...
@@ -45,6 +45,7 @@ import (
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
utilnet
"k8s.io/apimachinery/pkg/util/net"
utilnet
"k8s.io/apimachinery/pkg/util/net"
"k8s.io/client-go/util/retry"
"k8s.io/client-go/util/retry"
utilsnet
"k8s.io/utils/net"
)
)
const
(
const
(
...
@@ -727,11 +728,17 @@ func (e *ETCD) migrateFromSQLite(ctx context.Context) error {
...
@@ -727,11 +728,17 @@ func (e *ETCD) migrateFromSQLite(ctx context.Context) error {
// peerURL returns the peer access address for the local node
// peerURL returns the peer access address for the local node
func
(
e
*
ETCD
)
peerURL
()
string
{
func
(
e
*
ETCD
)
peerURL
()
string
{
if
utilsnet
.
IsIPv6String
(
e
.
address
)
{
return
fmt
.
Sprintf
(
"https://[%s]:2380"
,
e
.
address
)
}
return
fmt
.
Sprintf
(
"https://%s:2380"
,
e
.
address
)
return
fmt
.
Sprintf
(
"https://%s:2380"
,
e
.
address
)
}
}
// clientURL returns the client access address for the local node
// clientURL returns the client access address for the local node
func
(
e
*
ETCD
)
clientURL
()
string
{
func
(
e
*
ETCD
)
clientURL
()
string
{
if
utilsnet
.
IsIPv6String
(
e
.
address
)
{
return
fmt
.
Sprintf
(
"https://[%s]:2379"
,
e
.
address
)
}
return
fmt
.
Sprintf
(
"https://%s:2379"
,
e
.
address
)
return
fmt
.
Sprintf
(
"https://%s:2379"
,
e
.
address
)
}
}
...
@@ -739,7 +746,11 @@ func (e *ETCD) clientURL() string {
...
@@ -739,7 +746,11 @@ func (e *ETCD) clientURL() string {
func
(
e
*
ETCD
)
metricsURL
(
expose
bool
)
string
{
func
(
e
*
ETCD
)
metricsURL
(
expose
bool
)
string
{
address
:=
"http://127.0.0.1:2381"
address
:=
"http://127.0.0.1:2381"
if
expose
{
if
expose
{
address
=
fmt
.
Sprintf
(
"http://%s:2381,%s"
,
e
.
address
,
address
)
if
utilsnet
.
IsIPv6String
(
e
.
address
)
{
address
=
fmt
.
Sprintf
(
"https://[%s]:2381,%s"
,
e
.
address
,
address
)
}
else
{
address
=
fmt
.
Sprintf
(
"https://%s:2381,%s"
,
e
.
address
,
address
)
}
}
}
return
address
return
address
}
}
...
...
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