-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Improve LimitRange documentation #46950
base: main
Are you sure you want to change the base?
Conversation
✅ Pull request preview available for checkingBuilt without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -2,6 +2,7 @@ apiVersion: v1 | |||
kind: LimitRange | |||
metadata: | |||
name: cpu-resource-constraint | |||
namespace: default |
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.
Can use other than default, like dev / prod
@@ -2,6 +2,7 @@ apiVersion: v1 | |||
kind: Pod | |||
metadata: | |||
name: example-no-conflict-with-limitrange-cpu | |||
namespace: default |
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.
Can use other than default, like dev / prod
@@ -2,6 +2,7 @@ apiVersion: v1 | |||
kind: Pod | |||
metadata: | |||
name: example-conflict-with-limitrange-cpu | |||
namespace: default |
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.
Can use other than default, like dev / prod
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.
The problem with using other namespace than default is when user copies the manifest and executes it, they will potentially run into namespace not found error.
Although it might be a simple error which users can fix themselves, this will disrupt the user's workflow as the namespace creation is not mentioned anywhere before.
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.
@utkarsh-singh1 wdyt? Do you still recommend specifying dev/prod namespace?
May be we can add a note to create the namespace before applying the yaml?
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.
IMO
To keep the concept simple, I think it's okay to keep namespace as the default namespace and include a comment in the YAML manifest indicating that the namespace is implied.
Explicitly specifying "namespace" property is not a good practice for manifest authors. It makes the manifest non-portable. Hardcoding the "namespace" to a fixed value, even if for demonstration's purpose, could be confusing. I'd suggest we add a warning to that concept page rather than change the manifest. |
@tengqm, |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thank you @tengqm @T-Lakshmi for the suggestions. Updated the changes. PTAL! |
@@ -55,16 +55,18 @@ The name of a LimitRange object must be a valid | |||
|
|||
A `LimitRange` does **not** check the consistency of the default values it applies. This means that a default value for the _limit_ that is set by `LimitRange` may be less than the _request_ value specified for the container in the spec that a client submits to the API server. If that happens, the final Pod will not be schedulable. | |||
|
|||
|
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 don't think this extra line required.
@@ -55,16 +55,18 @@ The name of a LimitRange object must be a valid | |||
|
|||
A `LimitRange` does **not** check the consistency of the default values it applies. This means that a default value for the _limit_ that is set by `LimitRange` may be less than the _request_ value specified for the container in the spec that a client submits to the API server. If that happens, the final Pod will not be schedulable. |
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.
A `LimitRange` does **not** check the consistency of the default values it applies. This means that a default value for the _limit_ that is set by `LimitRange` may be less than the _request_ value specified for the container in the spec that a client submits to the API server. If that happens, the final Pod will not be schedulable. | |
A `LimitRange` does **not** check the consistency of the default values it applies. This means that | |
a default value for the _limit_ that is set by `LimitRange` may be less than the _request_ value | |
specified for the container in the spec that a client submits to the API server. If that happens, | |
the final Pod will not be schedulable. |
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 change doesn't align with the PR description, @T-Lakshmi.
It's OK to not make suggestions where those suggestions would leave the code changes out of step with the PR description.
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.
Noted @sftim.
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.
@subhals,
This suggestion is entirely optional as it is out of scope as per the PR description.
However, you are free to make changes so that it more closely matches with the PR recent title update.
For example, you define a `LimitRange` with this manifest: | ||
|
||
{{% code_sample file="concepts/policy/limit-range/problematic-limit-range.yaml" %}} | ||
{{< warning >}} | ||
The following examples operate within the default namespace, as the namespace parameter is undefined. This implies that any references or operations within these examples will interact with elements within the default namespace unless otherwise specified.{{< /warning >}} |
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.
The following examples operate within the default namespace, as the namespace parameter is undefined. This implies that any references or operations within these examples will interact with elements within the default namespace unless otherwise specified.{{< /warning >}} | |
The following examples operate within the default namespace of your cluster, as the namespace | |
parameter is undefined and the `LimitRange` scope is limited to the namespace level. | |
This implies that any references or operations within these examples will interact with elements | |
within the default namespace of your cluster. You can override the operating namespace | |
by configuring namespace in the `metadata.namespace` field. | |
{{< /warning >}} |
Do you agree with these?
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.
OK, but we'd ideally we'd write LimitRange without backticks.
If you'd like to, @subhals, you can edit this file so that all the API kinds (eg LimitRange) are written without backticks. It's not mandatory!
/retitle Improve LimitRange documentation |
For example, you define a `LimitRange` with this manifest: | ||
|
||
{{% code_sample file="concepts/policy/limit-range/problematic-limit-range.yaml" %}} | ||
{{< warning >}} |
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.
warning
is much too strong. We use warning for: you must follow this advice; if you didn't, your cluster might be at risk.
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.
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'd use note
@subhals, |
@subhals, would you be willing to revise this PR further? With a few adjustments it would be good to merge. |
Improve limitRange documentation by creating example resources in specific namespaces.
fixes #46899