Skip to content

Commit 9b3a152

Browse files
committed
KEP 1693: copy edits
1 parent 39c65b4 commit 9b3a152

File tree

1 file changed

+29
-28
lines changed
  • keps/sig-api-machinery/1693-warnings

1 file changed

+29
-28
lines changed

keps/sig-api-machinery/1693-warnings/README.md

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,21 @@ checklist items _must_ be updated for the enhancement to be released.
5555
[kubernetes/website]: https://git.k8s.io/website
5656

5757
## Summary
58-
58+
5959
This enhancement makes it easier for users and cluster administrators
6060
to recognize and remedy use of deprecated APIs.
6161
Users are presented with informative warnings at time of use.
6262
Administrators are given metrics that show deprecated API use,
6363
and audit annotations that can be used to identify particular API clients.
6464

6565
## Motivation
66-
66+
6767
Kubernetes has many deprecations in flight at any given moment, in various stages, with various time horizons.
6868
Keeping track of all of them is difficult, and has historically required careful reading of release notes,
6969
and manually sweeping for use of deprecated features.
7070

7171
### Goals
72-
72+
7373
* When a user makes a request to a deprecated API, present them with a warning
7474
that includes the target removal release and any replacement API
7575
* Allow a cluster administrator to programatically determine if deprecated APIs are being used:
@@ -79,27 +79,27 @@ and manually sweeping for use of deprecated features.
7979
* Allow a cluster administrator to programatically identify particular clients using deprecated APIs
8080

8181
### Non-Goals
82-
82+
8383
While the proposed warning mechanism is generic enough to carry arbitrary warnings,
8484
the following items are out of scope for the first iteration of this feature:
8585

86-
* Allowing extensions mechanisms like admission webhooks to contribute warnings
86+
* Allowing extension mechanisms like admission webhooks to contribute warnings
8787
* Surfacing warnings about other non-fatal problems
8888
(for example, [problematic API requests](http://issue.k8s.io/64841#issuecomment-395141013)
8989
that cannot be rejected for compatibility reasons)
9090

9191
## Proposal
92-
92+
9393
### Server-side changes
94-
94+
9595
When a deprecated API is used:
9696

9797
1. Add a `Warning` header to the response
9898
2. Increment a counter metric with labels for the API group, version, resource, API verb, and target removal major/minor version
9999
3. Record an audit annotation indicating the request used a deprecated API
100100

101101
### Client-side changes
102-
102+
103103
In client-go:
104104

105105
1. Parse `Warning` headers from server responses
@@ -109,38 +109,39 @@ In client-go:
109109
3. log warnings with klog.Warn
110110
3. Add a process-wide warning handler (defaulting to the klog.Warn handler)
111111
4. Add a per-client warning handler (defaulting to the process-wide warning handler)
112-
112+
113113
In kubectl, configure the per-process handler to:
114114

115115
1. dedupe warnings (only print a given warning once per invocation)
116116
2. log to stderr with a `Warning:` prefix
117117
3. color the `Warning:` prefix if stderr is a terminal and `$TERM != "dumb"` and `$NO_COLOR` is unset
118-
118+
119119
In kube-apiserver and kube-controller-manager, configure the process-wide handler to ignore warnings
120120

121121
## Design Details
122-
122+
123123
Server-side:
124124

125125
* Add a handler chain filter that attaches a WarningRecorder implementation to the request context
126-
* Add a WarningRecord implementation that deduplicates the warning message per request and writes a `Warning` header
126+
* Add a WarningRecorder implementation that de-duplicates the warning message per request and writes a `Warning` header
127127
* the header structure is defined in [RFC2616#14.46](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.46)
128128
* warnings would be written with code `299` and warn-agent of `-`
129129
* In the endpoint installer, decorate handlers for deprecated APIs:
130130
* add the warning header
131-
* increment the counter for the deprecated use metric
132-
* add an audit annotation indicating the request was to a deprecated API
133-
131+
* increment the counter metric for the deprecated use
132+
* add an audit annotation indicating the request was made to a deprecated API
133+
134134
Client-side:
135135

136136
* Parse `Warning` headers in server responses
137-
* Ignore malformed warning headers and warnings with codes other than `299`,
138-
ensuring that this enhancement will not cause any previously successful API request to fail
137+
* Ignore malformed warning headers, ensuring that this enhancement
138+
will not cause any previously successful API request to fail
139+
* Ignore warnings with codes other than `299`
139140
* Add the parsed warning headers to the `rest.Result` struct
140141
* Pass parsed warnings through the per-client or per-process warning handler
141142

142143
### Test Plan
143-
144+
144145
- Unit tests
145146
- `Warning` header generation
146147
- `Warning` header parsing (including tolerating/ignoreing malformed headers)
@@ -149,60 +150,60 @@ Client-side:
149150
- warning headers are returned when making requests to deprecated APIs
150151
- deprecated metrics are incremented when making requests to deprecated APIs
151152
- audit annotations are added when making requests to deprecated APIs
152-
153+
153154
### Risks and Mitigations
154155

155156
**Metric cardinality**
156-
157+
157158
In the past, we have had problems with unbounded metric labels increasing cardinality of
158159
metrics and causing significant memory/storage use. Limiting these metrics to bounded values
159160
(API group, version, resource, API verb, target removal release) and omitting unbounded values
160161
(resource instance name, client username, etc), metric cardinality is controlled.
161-
162+
162163
Annotating audit events for the deprecated API requests allows an administrator to locate
163164
the particular client making deprecated requests when metrics indicate an investigation is needed.
164165

165166
**Additional stderr / warning output**
166-
167+
167168
Additional warning messages may be unexpected by kubectl or client-go consumers.
168169
However, kubectl and client-go already output warning messages to stderr or via `klog.Warn`.
169170
client-go consumers can programmatically modify or suppress the warning output at a per-process or per-client level.
170171

171172
### Graduation Criteria
172-
173+
173174
The structure of the `Warning` header is RFC-defined and unversioned.
174175
The RFC defines the behavior of the `299` warning code as follows:
175176

176177
> The warning text can include arbitrary information to be presented to a human user or logged.
177178
> A system receiving this warning MUST NOT take any automated action.
178-
179+
179180
Because the server -> client warning format is fixed, and the warnings do not
180181
drive automated action in clients, graduation criteria is primarily oriented
181182
toward the stability level of the administrator metrics, and the ability to
182183
disable the server sending warnings during the beta period.
183184

184185
#### Beta graduation
185-
186+
186187
* Test plan is implemented
187188
* API server output of `Warning` headers for deprecated API use is feature-gated and enabled by default
188189
* The metric for deprecated API use is registered at [stability level `ALPHA`](https://github.com/kubernetes/enhancements/blob/master/keps/sig-instrumentation/20190404-kubernetes-control-plane-metrics-stability.md#stability-classes)
189190
* client-go logs warnings by default
190191
* kubectl outputs warnings to stderr
191192

192193
#### GA graduation
193-
194+
194195
* At least two releases after Beta
195196
* Gathered feedback on metric structure and use from multi-cluster admins
196197
* API server output of `Warning` headers for deprecated API use is unconditionally enabled
197198
* Server metric for deprecated API use is registered at [stability level `STABLE`](https://github.com/kubernetes/enhancements/blob/master/keps/sig-instrumentation/20190404-kubernetes-control-plane-metrics-stability.md#stability-classes)
198199

199200
### Upgrade / Downgrade Strategy
200-
201+
201202
client-go consumers wanting to suppress default warning messages would need to override the per-process warning handler.
202203
Note that client-go already [logs warning messages](https://grep.app/search?q=klog.Warn&filter[repo][0]=kubernetes/client-go).
203204

204205
### Version Skew Strategy
205-
206+
206207
Old clients making requests to a new API server ignore `Warning` headers.
207208

208209
New clients making requests to old API servers handle requests without `Warning` headers normally.

0 commit comments

Comments
 (0)