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
d358a891
Commit
d358a891
authored
Aug 21, 2024
by
Derek Nola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix secrets-encrypt metrics
Signed-off-by:
Derek Nola
<
derek.nola@suse.com
>
parent
178aadbe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
config.go
pkg/secretsencrypt/config.go
+13
-6
No files found.
pkg/secretsencrypt/config.go
View file @
d358a891
...
@@ -253,10 +253,11 @@ func GetEncryptionConfigMetrics(runtime *config.ControlRuntime, initialMetrics b
...
@@ -253,10 +253,11 @@ func GetEncryptionConfigMetrics(runtime *config.ControlRuntime, initialMetrics b
return
true
,
err
return
true
,
err
}
}
tsMetric
:=
mf
[
"apiserver_encryption_config_controller_automatic_reload_last_timestamp_seconds"
]
tsMetric
:=
mf
[
"apiserver_encryption_config_controller_automatic_reload_last_timestamp_seconds"
]
successMetric
:=
mf
[
"apiserver_encryption_config_controller_automatic_reload_success_total"
]
// Potentially multiple metrics with different success/failure labels
totalMetrics
:=
mf
[
"apiserver_encryption_config_controller_automatic_reloads_total"
]
// First time, no metrics exist, so return zeros
// First time, no metrics exist, so return zeros
if
tsMetric
==
nil
&&
successMetric
==
nil
&&
initialMetrics
{
if
tsMetric
==
nil
&&
totalMetrics
==
nil
&&
initialMetrics
{
return
true
,
nil
return
true
,
nil
}
}
...
@@ -265,8 +266,8 @@ func GetEncryptionConfigMetrics(runtime *config.ControlRuntime, initialMetrics b
...
@@ -265,8 +266,8 @@ func GetEncryptionConfigMetrics(runtime *config.ControlRuntime, initialMetrics b
return
false
,
nil
return
false
,
nil
}
}
if
successMetric
==
nil
{
if
totalMetrics
==
nil
{
lastFailure
=
"encryption config
success
metric not found"
lastFailure
=
"encryption config
total
metric not found"
return
false
,
nil
return
false
,
nil
}
}
...
@@ -275,8 +276,14 @@ func GetEncryptionConfigMetrics(runtime *config.ControlRuntime, initialMetrics b
...
@@ -275,8 +276,14 @@ func GetEncryptionConfigMetrics(runtime *config.ControlRuntime, initialMetrics b
return
true
,
fmt
.
Errorf
(
"encryption reload time is incorrectly ahead of current time"
)
return
true
,
fmt
.
Errorf
(
"encryption reload time is incorrectly ahead of current time"
)
}
}
reloadSuccessCounter
=
int64
(
successMetric
.
GetMetric
()[
0
]
.
GetCounter
()
.
GetValue
())
for
_
,
totalMetric
:=
range
totalMetrics
.
GetMetric
()
{
logrus
.
Debugf
(
"totalMetric: %+v"
,
totalMetric
)
for
_
,
label
:=
range
totalMetric
.
GetLabel
()
{
if
label
.
GetName
()
==
"status"
&&
label
.
GetValue
()
==
"success"
{
reloadSuccessCounter
=
int64
(
totalMetric
.
GetCounter
()
.
GetValue
())
}
}
}
return
true
,
nil
return
true
,
nil
})
})
...
...
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