The use of AddNamespaceConstraint was removed in e35b8304 of
rancher/rancher, so there is no possibility of there being a namespace
constraint in the request context. Remove the unused function and the
unused codepath from the rbac store.
The header defined in RFC 9110[1] is "Accept", not "Accepts". This
change corrects the route filter. Since this API is not documented and
the header was plainly incorrect, no attempt is made at backwards
compatibility.
[1] https://www.rfc-editor.org/rfc/rfc9110.html#name-accept
By default, a watch times out after 30 minutes. For debugging purposes,
it's convenient if this can be decreased. Add an environment variable
CATTLE_WATCH_TIMEOUT_SECONDS to enable setting the timeout in seconds.
Add debug logs and send websocket messages when the watch is closed
unexpectedly.
In addition to being helpful for debugging, the dashboard specifically
looks for a `resource.error` event containing the string "too old" in
order to trigger the watch to be resynced with a refreshed revision
number. Without this error returned, the dashboard will only see
`resource.stop` events and never change its behavior, continuing to try
to restart the watch with an incorrect resource version.
This change enables steve to work with three new query parameters:
"include": only include the named fields from the kubernetes object.
Subfields are denoted with ".". Subfields within arrays are ignored.
Multiple fields can be included by repeating the parameter. Example:
GET /v1/configmaps?include=kind&include=apiVersion =>
{
"type": "collection",
"links": {
"self": "http://server/v1/configmaps"
},
"createTypes": {
"configmap": "http://server/v1/configmaps"
},
"actions": {},
"resourceType": "configmap",
"revision": "327238",
"data": [
{
"id": "c-m-w466b2vg/kube-root-ca.crt",
"type": "configmap",
"links": {
"remove": "http://server/v1/configmaps/c-m-w466b2vg/kube-root-ca.crt",
"self": "http://server/v1/configmaps/c-m-w466b2vg/kube-root-ca.crt",
"update": "http://server/v1/configmaps/c-m-w466b2vg/kube-root-ca.crt",
"view": "http://server/api/v1/namespaces/c-m-w466b2vg/configmaps/kube-root-ca.crt"
},
"apiVersion": "v1",
"kind": "ConfigMap"
},
}
...
}
"exclude": exclude the named fields from the kubernetes object.
Subfields are denoted with ".". Subfields within arrays are ignored.
Multiple fields can be excluded by repeating the parameter. Example:
GET /v1/configmaps?exclude=data&exclude=metadata.managedFields =>
{
"type": "collection",
"links": {
"self": "http://server/v1/configmaps"
},
"createTypes": {
"configmap": "http://server/v1/configmaps"
},
"actions": {},
"resourceType": "configmap",
"revision": "328086",
"data": [
{
"id": "c-m-w466b2vg/kube-root-ca.crt",
"type": "configmap",
"links": {
"remove": "http://server/v1/configmaps/c-m-w466b2vg/kube-root-ca.crt",
"self": "http://server/v1/configmaps/c-m-w466b2vg/kube-root-ca.crt",
"update": "http://server/v1/configmaps/c-m-w466b2vg/kube-root-ca.crt",
"view": "http://server/api/v1/namespaces/c-m-w466b2vg/configmaps/kube-root-ca.crt"
},
"apiVersion": "v1",
"kind": "ConfigMap",
"metadata": {
"creationTimestamp": "2022-04-11T22:05:27Z",
"fields": [
"kube-root-ca.crt",
1,
"25h"
],
"name": "kube-root-ca.crt",
"namespace": "c-m-w466b2vg",
"relationships": null,
"resourceVersion": "36948",
"state": {
"error": false,
"message": "Resource is always ready",
"name": "active",
"transitioning": false
},
"uid": "1c497934-52cb-42ab-a613-dedfd5fb207b"
}
},
...
}
"excludeValues": replace the values of an object with empty strings, leaving
the keys in place. Useful for showing a summary of an object with large
values, such as the data in a ConfigMap. Only works on fields that are
object. Multiple fields can have values excluded by repeating the
parameter. Example:
GET /v1/configmaps?excludeValues=data =>
{
"type": "collection",
...
"data": [
{
...
"data": {
"ca.crt": ""
},
...
},
...
]
}