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
f270db4b
Commit
f270db4b
authored
Nov 17, 2023
by
Brad Davidson
Committed by
Brad Davidson
Nov 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorder snapshot configmap reconcile to reduce log spew during initial startup
Signed-off-by:
Brad Davidson
<
brad.davidson@rancher.com
>
parent
8cf46ed4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
snapshot_controller.go
pkg/etcd/snapshot_controller.go
+15
-15
No files found.
pkg/etcd/snapshot_controller.go
View file @
f270db4b
...
@@ -160,21 +160,6 @@ func (e *etcdSnapshotHandler) onRemove(key string, esf *apisv1.ETCDSnapshotFile)
...
@@ -160,21 +160,6 @@ func (e *etcdSnapshotHandler) onRemove(key string, esf *apisv1.ETCDSnapshotFile)
}
}
func
(
e
*
etcdSnapshotHandler
)
reconcile
()
error
{
func
(
e
*
etcdSnapshotHandler
)
reconcile
()
error
{
logrus
.
Infof
(
"Reconciling snapshot ConfigMap data"
)
snapshotConfigMap
,
err
:=
e
.
configmaps
.
Get
(
metav1
.
NamespaceSystem
,
snapshotConfigMapName
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
if
!
apierrors
.
IsNotFound
(
err
)
{
return
errors
.
Wrap
(
err
,
"failed to get snapshot ConfigMap"
)
}
snapshotConfigMap
=
&
v1
.
ConfigMap
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
snapshotConfigMapName
,
Namespace
:
metav1
.
NamespaceSystem
,
},
}
}
// Get a list of all etcd nodes currently in the cluster.
// Get a list of all etcd nodes currently in the cluster.
// We will use this list to prune local entries for any node that does not exist.
// We will use this list to prune local entries for any node that does not exist.
nodes
:=
e
.
etcd
.
config
.
Runtime
.
Core
.
Core
()
.
V1
()
.
Node
()
nodes
:=
e
.
etcd
.
config
.
Runtime
.
Core
.
Core
()
.
V1
()
.
Node
()
...
@@ -202,6 +187,8 @@ func (e *etcdSnapshotHandler) reconcile() error {
...
@@ -202,6 +187,8 @@ func (e *etcdSnapshotHandler) reconcile() error {
return
errNotReconciled
return
errNotReconciled
}
}
logrus
.
Infof
(
"Reconciling snapshot ConfigMap data"
)
// Get a list of existing snapshots
// Get a list of existing snapshots
snapshotList
,
err
:=
e
.
snapshots
.
List
(
metav1
.
ListOptions
{})
snapshotList
,
err
:=
e
.
snapshots
.
List
(
metav1
.
ListOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -219,6 +206,19 @@ func (e *etcdSnapshotHandler) reconcile() error {
...
@@ -219,6 +206,19 @@ func (e *etcdSnapshotHandler) reconcile() error {
snapshots
[
sfKey
]
=
esf
snapshots
[
sfKey
]
=
esf
}
}
snapshotConfigMap
,
err
:=
e
.
configmaps
.
Get
(
metav1
.
NamespaceSystem
,
snapshotConfigMapName
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
if
!
apierrors
.
IsNotFound
(
err
)
{
return
errors
.
Wrap
(
err
,
"failed to get snapshot ConfigMap"
)
}
snapshotConfigMap
=
&
v1
.
ConfigMap
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
snapshotConfigMapName
,
Namespace
:
metav1
.
NamespaceSystem
,
},
}
}
// Make a copy of the configmap for change detection
// Make a copy of the configmap for change detection
existing
:=
snapshotConfigMap
.
DeepCopyObject
()
existing
:=
snapshotConfigMap
.
DeepCopyObject
()
...
...
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