@@ -234,11 +234,29 @@ are the only PVCs modified with an ownerRef. Other PVCs referenced by the Statef
234
234
template are not affected by this behavior.
235
235
236
236
OwnerReferences are used to manage PVC deletion. All such references used for
237
- this feature will set the controller field to the StatefulSet. This will be used
238
- to distinguish references added by the controller from, for example,
239
- user-created owner references. When ownerRefs is removed, it is understood that
240
- only those ownerRefs whose controller field matches the StatefulSet in question
241
- are affected.
237
+ this feature will set the controller field to the StatefulSet or Pod as
238
+ appropriate. This will be used to distinguish references added by the controller
239
+ from, for example, user-created owner references. When ownerRefs is removed, it
240
+ is understood that only those ownerRefs whose controller field matches the
241
+ StatefulSet or Pod in question are affected.
242
+
243
+ The controller flag will be set for these references. If there is already a
244
+ different (non-StatefulSet) controller set for a PVC, an ownerRef will not be
245
+ added. This will mean that the autodelete functionality will not be operative. An
246
+ event will be created to reflect this.
247
+
248
+ To summarize,
249
+
250
+ ** If the StatefulSet is a controller owner** ,
251
+ * the PVC lifecycle will be full managed by the StatefulSet controller
252
+ * old owner references will be updated with ` controller=false ` to ` controller=true `
253
+ (see Upgrade / Downgrade Strategy, below).
254
+ * remove itself as the owner and controller when the retain policy is specified in the StatefulSet.
255
+
256
+ ** If someone else is the controller** ,
257
+ * the PVC lifecycle will not be touched by the StatefulSet controller. The PVC
258
+ will stay when the delete policy is specified in the StatefulSet.
259
+ * old StatefulSet owner references will be removed.
242
260
243
261
### Volume delete policy for the StatefulSet created PVCs
244
262
@@ -394,10 +412,25 @@ This features adds a new field to the StatefulSet. The default value for the new
394
412
maintains the existing behavior of StatefulSets.
395
413
396
414
On a downgrade, the ` PersistentVolumeClaimRetentionPolicy ` field will be hidden on
397
- any StatefulSets. The behavior in this case will be identical to mutating they
415
+ any StatefulSets. The behavior in this case will be identical to mutating the
398
416
policy field to ` Retain ` , as described above, including the edge cases
399
417
introduced if this is done during a scale-down or StatefulSet deletion.
400
418
419
+ The initial beta version did not set the controller flag in the owner
420
+ reference. This was fixed in later versions, so that the controller flag is
421
+ set. The behavior is then as follows.
422
+
423
+ * If the StatefulSet or one of its Pods is a controller, owner references are
424
+ updated as specified by the retention policy.
425
+ * If the StatefulSet or one of its Pods is an owner but not a controller,
426
+ * if there is no other controller, the StatefulSet or Pod owners will be set
427
+ as controller (ie, they are assumed to be from the initial beta version and
428
+ updated).
429
+ * The controller will be updated as specified by the retention policy.
430
+ * If there is another resource that is a controller,
431
+ * any (non-controler) StatefulSet or Pod owner reference is removed.
432
+ * The retention policy is ignored.
433
+
401
434
### Version Skew Strategy
402
435
There are only kube-controller-manager changes involved (in addition to the
403
436
apiserver changes for dealing with the new StatefulSet field). Node components
@@ -590,6 +623,7 @@ stateful set controller lives) should be examined and/or restarted.
590
623
- 1.21, KEP created.
591
624
- 1.23, alpha implementation.
592
625
- 1.27, graduation to beta.
626
+ - 1.31, fix controller references.
593
627
594
628
## Drawbacks
595
629
The StatefulSet field update is required.
0 commit comments