-
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
document ResourceUsage and Metrics CR #975
document ResourceUsage and Metrics CR #975
Conversation
✅ Deploy Preview for k8s-kwok ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hi @caozhuozi. 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. |
2a2571c
to
1a19492
Compare
1a19492
to
ef99428
Compare
/ok-to-test |
8289da7
to
2d87b17
Compare
2d87b17
to
0f55e6e
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.
Pick some more nits
lgtm for the text and you can mark those comments |
@wzshiming Any new comments? |
The `metrics` field are used to customize the return body of the installed metrics endpoint. | ||
`metrics` is a list of specific configuration items, with each corresponding to a Prometheus style metric: | ||
* `name` defines the metric name. | ||
* `labels` defines the metric labels, with each item corresponding to a specific metric label. | ||
- `name` is a const string that provides the label name. | ||
- `value` is represented as a CEL expression that dynamically determines the label value. | ||
For example: you can use `node.metadata.name` to reference the node name as the label value. | ||
* `help` defines the help string of a metric. | ||
* `kind` defines the type of the metric: `counter`, `guage` or `histogram`. | ||
* `dimension` defines where the data comes from. It could be `node`, `pod`, or `container`. | ||
* `value` is a CEL expression that defines the metric value if `kind` is `counter` or `guage`. | ||
Please refer to [built-in CEL extension functions] for an exhausted list that you can use to simulate the metric value. | ||
* `buckets` is exclusively for customizing the data of the metric of kind `histogram`. | ||
- `le`, which defines the histogram bucket’s upper threshold, has the same meaning as the one of Prometheus histogram bucket. | ||
That is, each bucket contains values less than or equal to `le`. | ||
- `value` is a CEL expression that provides the value of the bucket. | ||
- `hidden` indicates whether to show the bucket in the metric. | ||
But the value of the bucket will be calculated and cumulated into the next bucket. |
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.
This section feels redundant, as there is already automatically generated documentation from API, we should update the API comments.
## built-in CEL extension functions | ||
|
||
As `kwok` doesn't actually run containers, to simulate the resource usage data, `kwok` provides the following CEL | ||
extension functions you can use in a CEL expression to help calculate the simulation data flexibly and dynamically: | ||
* `Now()`: returns the current timestamp. | ||
* `Rand()`: returns a random `float64` value. | ||
* `SinceSecond()` returns the seconds elapsed since a resource (pod or node) was created. | ||
For example: `pod.SinceSecond()`, `node.SinceSecond()`. | ||
* `UnixSecond()` returns the Unix time of a given time of type `time.Time`. | ||
For example: , `UnixSecond(Now())`, `UnixSecond(node.metadata.creationTimestamp)`. | ||
* `Quantity()` returns a float64 value of a given Quantity value. For example: `Quantity("100m")`, `Quantity("10Mi")`. |
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.
Perhaps we should devote a new page to generic template functions, it also includes #836
To associate a ResourceUsage with a certain pod to be simulated, users must ensure `metadata.name` and `metadata.namespace` are inconsistent with the name and namespace of the target pod. | ||
|
||
The resource usages of a pod are specified via `usages` field. | ||
The `usages` field are organized by groups, with each corresponding to a collection of containers that shares a same resource usage simulation setting. | ||
Each group consists of a list of container names (`containers`) and the shared resource usage setting (`usage`). | ||
|
||
{{< hint "info" >}} | ||
If `containers` is not given in a group, the `usage` in that group will be applied to all containers of the target pod. | ||
{{< /hint >}} |
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.
Make this part of the description consistent with Exec, Logs, Attach, PortForward.
Hi, @wzshiming. I'm sorry for the late update.
For the comment "Make the writing consistent across pages“, I'm going to file a separate PR to do this because I think it would be more clear. You can give comments and leave this PR unmerged until the PR for writing consistency is ready and get reviewed. |
131b8da
to
73424d7
Compare
73424d7
to
2d469d9
Compare
Thank you for your great patience in reviewing and helping with modifications. @wzshiming @windsonsea |
|
I ignored the CI result as it seems like it has been always failing before. sry about this... |
I've checked the failed CI stage this time. The logs of the failed one: "test-kwokctl" seems not related to the documentation. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: caozhuozi, 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 |
What type of PR is this?
/kind documentation
What this PR does / why we need it:
The PR tries to document ResourceUsage and Metrics CR.
Which issue(s) this PR fixes:
Fixes #942
Special notes for your reviewer:
Please feel free to leave comments.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: