-
Notifications
You must be signed in to change notification settings - Fork 211
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
[kwok] Provide generic functions that enable it to simulate data for any indicator (Node) #555
[kwok] Provide generic functions that enable it to simulate data for any indicator (Node) #555
Conversation
Hi @nikola-jokic. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
✅ Deploy Preview for k8s-kwok canceled.
|
This is currently just a proposed way of exposing metrics from the controller, to make sure package structure is okay. |
The package structure is good to me, |
/ok-to-test |
7330ed0
to
99456b1
Compare
@@ -277,6 +284,7 @@ func (c *NodeController) watchResources(ctx context.Context, opt metav1.ListOpti | |||
node := event.Object.(*corev1.Node) | |||
if c.need(node) { | |||
c.putNodeInfo(node) | |||
c.applyMetrics(ctx, node) |
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.
Should we delete the registry when the node is deleted, or should we set values to 0?
Update: |
/cc @wzshiming |
pkg/kwok/metrics/histogram.go
Outdated
} | ||
|
||
// Set is used to increment value at le bucket and add val to the sum. | ||
func (h *Histogram) Set(le string, val float64) (err error) { |
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.
I tested it and it didn't behave as I expected, so I refactored it and wzshiming@e4f49e3 it meets expectations 😄.
Apply my patch git apply <(curl https://github.com/wzshiming/kwok/commit/e4f49e3acf3ae0915cb3898e8f9cbf326888aa93.patch)
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.
Amazing, sorry I could not make it work right away, I did not exactly know how it should behave 😄
I tried applying patch but it produced an error
Do you mind pushing on the branch 😄
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.
BTY, I added auto docs for API, so this PR needs to rebase then exec ./hack/update-api-docs.sh
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.
Rebased and executed
I'll apply the patch by hand. git shows error (patch does not apply)
34e0a90
to
e120819
Compare
/retest |
// MetricSpec holds spec for metrics. | ||
type MetricSpec struct { | ||
// Path is a restful service path. | ||
Path string `json:"path"` |
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.
Suggestion, if kwokctl is using this configuration, we should add this Path to the Prometheus collection target, so we can open the web of Prometheus and see the chart of the configured metrics.
WDYT?
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.
That sounds great as long as we keep it static
If you see it become dynamic (having route like /nodes/{nodeName}
) in the future, is it okay to opt-out of the prometheus collection targets?
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.
Don't worry, Prometheus supports rules for dynamically discovered targets.
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#http_sd_config
pkg/kwok/metrics/cel/evaluate.go
Outdated
} | ||
|
||
// EvaluateMetric evaluates a cel program and returns a metric value | ||
func (e *Evaluator) EvaluateMetric(node *corev1.Node) (float64, error) { |
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.
Let's keep it in the same style as EvaluateString
.
hack/tools/tools.go
Outdated
// gen-crd-api-reference-docs | ||
_ "github.com/ahmetb/gen-crd-api-reference-docs" | ||
// code-generator |
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.
Revert this file
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.
Oh sure, sorry about that
5ef07f7
to
077008e
Compare
help: "[ALPHA] Cumulative number of containers started" | ||
kind: counter | ||
value: 'startedContainersTotal( node.metadata.name )' | ||
- name: kubelet_pleg_relist_duration_seconds |
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.
BTY, commits are too much, squash it 😄 |
08ccda5
to
bb96667
Compare
0c3021c
to
ac3cefd
Compare
Co-authored-by: Shiming Zhang <wzshiming@foxmail.com>
ac3cefd
to
a7fa8aa
Compare
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.
/approve
/lgtm
Thank you for your contribution!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nikola-jokic, wzshiming The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thank you for doing many reviews and improvements! |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #199
Does this PR introduce a user-facing change?