-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add k8s metadata in state_cronjob metricset #29572
Changes from all commits
68fdec9
8605023
c3fd58e
d1722e3
0767797
9e7177c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,8 @@ func (r *Resource) GenerateK8s(kind string, obj kubernetes.Resource, options ... | |
"ReplicaSet", | ||
"StatefulSet", | ||
"DaemonSet", | ||
"Job": | ||
"Job", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. with this change we also can close this PR: #28954 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tetianakravchenko my PR is a little bit tricky cause has some tricky parts around k8s api versions. I think we can move on with the community PR and I can rebase mine on top of it. wdyt? |
||
"CronJob": | ||
safemapstr.Put(meta, strings.ToLower(ref.Kind)+".name", ref.Name) | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
This is the `state_cronjob` metricset of the Kubernetes module. | ||
|
||
This metricset does not add metadata by default and hence in order to | ||
add metadata for this one need to configure the metricset with `add_metadata: true` | ||
and uncomment the proper `apiGroup` in the `ClusterRole`. Metadata are only available | ||
for versions of k8s >= v1.21. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ import ( | |
) | ||
|
||
func TestFetchMetricset(t *testing.T) { | ||
config := test.GetKubeStateMetricsConfig(t, "state_cronjob") | ||
config := test.GetKubeStateMetricsConfigWithMetaDisabled(t, "state_cronjob") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why for cronjob only There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cause in version before v1.21 the the current stable api is not available and hence we cannot support metadata in tests for v1.20 |
||
metricSet := mbtest.NewFetcher(t, config) | ||
events, errs := metricSet.FetchEvents() | ||
if len(errs) > 0 { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have a ticket for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#29771