@@ -80,7 +80,6 @@ apply` now would come with a cost.
80
80
We’re proposing a way forward toward toggling the ` --server-side ` flag
81
81
by default.
82
82
83
-
84
83
## Motivation
85
84
86
85
While changing from client-side to server-side is difficult because it
@@ -102,23 +101,29 @@ For maintainers:
102
101
- kubectl has a lot of code to maintain SMP and other client-side apply
103
102
mechanisms. Removing the feature can greatly reduce the complexity of
104
103
kubectl
104
+ - Removes some ugly server-side code meant to deal with transition from
105
+ client-side apply to server-side apply.
105
106
106
107
### Goals
107
108
108
109
The goal is to increase usage of Server-Side Apply so that users can
109
110
benefits from the feature, mostly by turning the feature on by default.
111
+ We also want to reach that goal by making the transition as smooth as
112
+ possible, and limit the risk of converting objects from client-side to
113
+ server-side mode.
110
114
111
115
### Non-Goals
112
116
113
- Good question.
117
+ N/A
114
118
115
119
## Proposal
116
120
117
- The feature consists of adding a new ` auto ` value to the ` --server-side `
118
- flag for ` kubectl apply ` (and corresponding ` kubectl diff ` ) and make
119
- this the default value. All the other values for the flag would continue
120
- to work as expected (for reference, ` false ` continues to client-side
121
- apply, and ` true ` continues to server-side apply).
121
+ The feature, in its alpha phase, consists of adding a new ` auto ` value
122
+ to the ` --server-side ` flag for ` kubectl apply ` (and corresponding
123
+ ` kubectl diff ` ) while keeping ` false ` as the default value. All the
124
+ other values for the flag would continue to work as expected (for
125
+ reference, ` false ` continues to client-side apply, and ` true ` continues
126
+ to server-side apply).
122
127
123
128
The meaning of ` auto ` goes as follows:
124
129
- Resources continue to be fetched (GET) before-hand
@@ -129,36 +134,64 @@ The meaning of `auto` goes as follows:
129
134
- If the resource already exists but doesn't have the ` last-applied `
130
135
annotation, the resource is server-side applied
131
136
137
+ We are also planning on switch the ` --server-side ` flag to ` true ` in
138
+ three releases, by adding a warning message (and a blog-post) in kubectl
139
+ 1.27 to let people know that the change will happen.
140
+
141
+ <<[ UNRESOLVED What default value for --force-conflict] >>
142
+ We're not entirely sure what the value of ` --force-conflict ` should be
143
+ when we switch to ` server-side=true ` .
144
+
145
+ A few thoughts. The question can be summarized with the following
146
+ trade-off: Are conflicts worth breaking people? We would also have to
147
+ change the value of ` --force-conflict ` , which will break some people,
148
+ but arguably a much smaller set of people.
149
+
150
+ We don't know yet, but I'll assume we don't flip the switch in the rest
151
+ of the document since that use-case is more complicated.
152
+ <<[ /UNRESOLVED] >>
153
+
154
+ <<[ UNRESOLVED Removal of CSA] >>
155
+ We considered removing the
156
+ ` --server-side ` flag altogether 2-3 releases after ` true ` becomes the
157
+ default. Curious if other folks think this is an option.
158
+ <<[ /UNRESOLVED] >>
159
+
132
160
### User Stories (Optional)
133
161
134
162
#### Story 1
135
163
136
- User 1 starts using ` kubectl ` for the first time or on a new
137
- project, everything will always be server-side applied, they will get
138
- conflicts and all the good things about server-side apply.
164
+ User 1 uses ` --server-side=auto ` and starts using ` kubectl ` for the
165
+ first time, creates a new project, everything will always be server-side
166
+ applied, they will never have any object to migrate from client-side to
167
+ server-side apply. When the flag eventually fips, they
168
+ already have the hard-coded auto value so they don't really see a
169
+ change, but they can decide to remove the flag if they want.
139
170
140
171
#### Story 2
141
172
142
- User 2 only uses server-side apply all the time, they may have
143
- ` --server-side ` inserted in some scripts or configuration, or they must
144
- remember to always include the flag. Thanks the feature, forgetting the
145
- flag is now doing the right thing by server-side applying all their
146
- resources as expected, causing less confusion and risks of messing up.
173
+ User 2 uses ` --server-side=auto ` and periodically re-creates their
174
+ project, at first, their project might have a mix of server-side applied
175
+ and client-side applied resources, but they will eventually have only
176
+ server-side applied resources, without ever having to migrate any
177
+ resource from one to the other. When the flag eventually fips, they
178
+ already have the hard-coded auto value so they don't really see a
179
+ change, but they can decide to remove the flag if they want.
147
180
148
181
#### Story 3
149
182
150
- User 3 has never used server-side apply and always used the default
151
- value of ` --server-side ` . Applying their existing resources will
152
- continue to work as expected. New resources, on the other hand, will at
153
- first apply the same but may eventually show-up with a conflict. They
154
- may have to update scripts to continue to work with
155
- ` --server-side=false ` if they want to, or they can update their
156
- scripts/workflow to address the conflicts properly .
183
+ Users 3 who use either the default value of ` --server-side ` or an
184
+ existing value will see no immediate change to the behavior. They will
185
+ get the warning if running manually and possibly try it out, or they may
186
+ miss the warning in scripts. In 3 releases, people who have completely
187
+ missed the warning will see their thing break, they can either fix it by
188
+ changing the value of ` --server-side=false ` or the value of
189
+ ` --force-conflict=true ` , a fairly easy change .
157
190
158
191
### Risks and Mitigations
159
192
160
193
This design has no impact on security, but some consequences on UX, since the
161
- default UX of ` kubectl apply ` will change:
194
+ default UX of ` kubectl apply ` will change, 3 releases from now :
162
195
- Currently, it can never fail because of conflict, since they are
163
196
overridden by default. The new default for Server-Side Apply is to
164
197
fail on conflicts, unless the ` --force-conflict ` flag is used. While
@@ -174,7 +207,9 @@ default UX of `kubectl apply` will change:
174
207
object on the server. SSA has more complicated semantics for removing
175
208
fields (e.g. if another user manages fields)
176
209
177
- <!-- Missing mitigation here -->
210
+ This will be mitigated by laying out a plan to address these issues for
211
+ people who meet them, through a blog-post. Actual mitigation is to set
212
+ ` --server-side=false ` or ` --force-conflict=true ` .
178
213
179
214
## Design Details
180
215
@@ -187,21 +222,22 @@ applied by default.
187
222
The ` last-applied ` annotation is used to detect previous client-side
188
223
applied object, hence it is not inserted for server-side objects.
189
224
190
- The interaction with other ` kubectl apply ` flags can be described as
191
- follows:
192
- - ` --force-conflicts ` only applies to existing resources that are
193
- server-side applied
194
- - ` --fieldmanager ` applies to all resources
195
- - The ` --prune ` family of flags, I have no idea
196
- - ` --overwrite ` only applies to client -side applied resources
225
+ ` kubectl apply ` flags that are specific to client-side apply will
226
+ continue to work for client-side applied objects (prune, overwrite),
227
+ while server-side apply flags will apply to existing server-side applied
228
+ resources and new resources. Notably, the ` --force-conflict ` flag is
229
+ somewhat incompatible with ` --server-side=false ` today, it will be
230
+ possible to use the flag with ` auto ` (and we will entirely disallow it
231
+ with ` --server -side=false ` ).
197
232
198
233
Some other commands might be impacted. ` kubectl create ` (and family)
199
234
notably have a ` --save-config ` flag that create the last-applied
200
235
annotation. While I don't know how many people actually use the flag,
201
236
the idea of saving this as a config is confusing, since people don't
202
237
actually have the file and so the situation doesn't really fit well the
203
238
` apply ` workflow. We suggest adding a warning when this flag is used, as
204
- well as updating its documentation to suggest not using it.
239
+ well as updating its documentation to suggest not using it, and possibly
240
+ deprecate it in the future.
205
241
206
242
Because ` kubectl diff ` is supposed to map the behavior of `kubectl
207
243
apply` as closely as possible, the change will also be done for that
@@ -277,23 +313,26 @@ Alpha is the current level of the feature since server-side apply is
277
313
currently enabled by default in Kubernetes, but enabled on-demand by
278
314
kubectl users.
279
315
280
- The feature already has a fair amount of usage though since tools
281
- (sometimes outside of kubectl) have used it both as "clients" and in
282
- controllers.
316
+ The feature already has a fair amount of usage since tools (sometimes
317
+ outside of kubectl) have used it both as "clients" and in controllers.
283
318
284
319
#### Beta
285
320
321
+ <!--
322
+ To be re-evaluated later:
286
323
Server-Side Apply has a very limited set of bugs or feature requests as
287
324
this point and is definitely mature. Enabling client-side will allow
288
325
increased usage and reduce burden cost for kubectl to maintain both
289
- mecahnisms.
326
+ mechanisms. -->
290
327
291
328
#### GA
292
329
330
+ <!--
331
+ To be re-evaluated later:
293
332
Kubectl doesn't have real-time metrics for usage. The decision to move
294
333
to server-side entirely by default (if ever enabled) will be driven by
295
334
bug reports and complaints from customers. Also by the ability to
296
- migrate existing client-side usage to server-side.
335
+ migrate existing client-side usage to server-side. -->
297
336
298
337
#### Deprecation
299
338
@@ -303,8 +342,6 @@ We are not intending to deprecate the flag, but we might remove the
303
342
Same thing applies for ` --save-config ` and other client-side related
304
343
flags in kubectl which we might remove.
305
344
306
- No deprecation is planned at that time though.
307
-
308
345
### Upgrade / Downgrade Strategy
309
346
310
347
While upgrade / downgrade doesn't really apply to a kubectl feature, we
326
363
- [x] Other
327
364
- Describe the mechanism:
328
365
329
- People can actively use the ` --server-side=false ` flag to disable the
330
- feature entirely and go back to the former behavior.
366
+ Feature is enabled on-demand, and can stop using it at any time.
331
367
332
368
- Will enabling / disabling the feature require downtime of the control
333
369
plane?
@@ -341,8 +377,7 @@ Feature is client-side only, no.
341
377
342
378
###### Does enabling the feature change any default behavior?
343
379
344
- Yes. The feature is a change to the default behavior, which can be
345
- reverted by using the former value of the flag.
380
+ No, enabling the ` auto ` feature means actively selecting it.
346
381
347
382
###### Can the feature be disabled once it has been enabled (i.e. can we roll back the enablement)?
348
383
@@ -352,7 +387,7 @@ way to configure it's default value.
352
387
###### What happens if we reenable the feature if it was previously rolled back?
353
388
354
389
Toggling the flag value can have impact, but that's already the case.
355
- Changing the default to an automatic detection will actually help with
390
+ Changing the value to an automatic detection will actually help with
356
391
that.
357
392
358
393
###### Are there any tests for feature enablement/disablement?
@@ -390,12 +425,12 @@ I need to add the tests here.
390
425
391
426
###### Is the rollout accompanied by any deprecations and/or removals of features, APIs, fields of API types, flags, etc.?
392
427
393
- This will change the default behavior of ` kubectl apply ` in possibly
394
- surprising way. ` kubectl apply ` can now fail because of a conflict,
395
- which it wouldn't before on newly created objects. Another surprising
396
- behavior is that since fields can be owned by multiple actors, removing
397
- a field will not necessarily remove the field from the cluster's
398
- resource.
428
+ This will eventually change the default behavior of ` kubectl apply ` in
429
+ possibly surprising way. ` kubectl apply ` can now fail because of a
430
+ conflict, which it wouldn't before on newly created objects. Another
431
+ surprising behavior is that since fields can be owned by multiple
432
+ actors, removing a field will not necessarily remove the field from the
433
+ cluster's resource.
399
434
400
435
### Monitoring Requirements
401
436
@@ -509,9 +544,10 @@ There are basically three different alternatives to the current design:
509
544
server-side applied. The drawback of this approach is that the baby
510
545
step doens't really get us anywhere close to where we want: having
511
546
server-side apply enabled by default.
512
- 3 . Enable ` --server-side=true ` by default, this is what we're aiming for
513
- in GA, but we think we should ease things by first going with
514
- ` --server-side=auto ` to help the transition.
547
+ 3 . Make ` --server-side=auto ` the default, but that doesn't get us closer
548
+ to what we want: have the feature enabled by default, or test the
549
+ migration.
550
+
515
551
516
552
## Infrastructure Needed (Optional)
517
553
0 commit comments