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
84a071a8
Commit
84a071a8
authored
Feb 29, 2024
by
Brad Davidson
Committed by
Brad Davidson
Mar 04, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add env var to allow spegel mirroring of `latest` tag
Signed-off-by:
Brad Davidson
<
brad.davidson@rancher.com
>
parent
26feb25c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
spegel.go
pkg/spegel/spegel.go
+13
-2
No files found.
pkg/spegel/spegel.go
View file @
84a071a8
...
...
@@ -54,6 +54,9 @@ var (
P2pAddressAnnotation
=
"p2p."
+
version
.
Program
+
".cattle.io/node-address"
P2pEnabledLabel
=
"p2p."
+
version
.
Program
+
".cattle.io/enabled"
P2pPortEnv
=
version
.
ProgramUpper
+
"_P2P_PORT"
P2pEnableLatestEnv
=
version
.
ProgramUpper
+
"_P2P_ENABLE_LATEST"
resolveLatestTag
=
false
)
type
authFunc
func
()
authenticator
.
Request
...
...
@@ -93,7 +96,6 @@ type Config struct {
// These values are not currently configurable
const
(
resolveLatestTag
=
false
resolveRetries
=
0
resolveTimeout
=
time
.
Second
*
5
registryNamespace
=
"k8s.io"
...
...
@@ -171,11 +173,20 @@ func (c *Config) Start(ctx context.Context, nodeConfig *config.Node) error {
return
errors
.
Wrap
(
err
,
"failed to create peerstore"
)
}
// get latest tag configuration override
if
env
:=
os
.
Getenv
(
P2pEnableLatestEnv
);
env
!=
""
{
if
b
,
err
:=
strconv
.
ParseBool
(
env
);
err
!=
nil
{
logrus
.
Warnf
(
"Invalid %s value; using default %v"
,
P2pEnableLatestEnv
,
resolveLatestTag
)
}
else
{
resolveLatestTag
=
b
}
}
// get port and start p2p router
routerPort
:=
defaultRouterPort
if
env
:=
os
.
Getenv
(
P2pPortEnv
);
env
!=
""
{
if
i
,
err
:=
strconv
.
Atoi
(
env
);
i
==
0
||
err
!=
nil
{
logrus
.
Warnf
(
"Invalid
P2P node port; using default"
)
logrus
.
Warnf
(
"Invalid
%s value; using default %v"
,
P2pPortEnv
,
defaultRouterPort
)
}
else
{
routerPort
=
env
}
...
...
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