Skip to content

Commit

Permalink
ownerRef controller update
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcary committed Jan 16, 2024
1 parent 27ef0d9 commit 1c85062
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
37 changes: 31 additions & 6 deletions keps/sig-apps/1847-autoremove-statefulset-pvcs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,29 @@ are the only PVCs modified with an ownerRef. Other PVCs referenced by the Statef
template are not affected by this behavior.

OwnerReferences are used to manage PVC deletion. All such references used for
this feature will set the controller field to the StatefulSet. This will be used
to distinguish references added by the controller from, for example,
user-created owner references. When ownerRefs is removed, it is understood that
only those ownerRefs whose controller field matches the StatefulSet in question
are affected.
this feature will set the controller field to the StatefulSet or Pod as
appropriate. This will be used to distinguish references added by the controller
from, for example, user-created owner references. When ownerRefs is removed, it
is understood that only those ownerRefs whose controller field matches the
StatefulSet or Pod in question are affected.

The controller flag will be set for these references. If there is already a
different (non-StatefulSet) controller set for a PVC, an ownerRef will not be
added. This will mean that the autodelete functionality will not be operative. A
status message will be put on the StatefulSet object to reflect this.

To summarize,

**If the StatefulSet is a controller owner**,
* the PVC lifecycle will be full managed by the StatefulSet controller
* old owner references will be updated with `controller=false` to `controller=true`
(see Upgrade / Downgrade Strategy, below).
* remove itself as the owner and controller when the retain policy is specified in the StatefulSet.

**If someone else is the controller**,
* the PVC lifecycle will not be touched by the StatefulSet controller. The PVC
will stay when the delete policy is specified in the StatefulSet.
* old StatefulSet owner references will be removed.

### Volume delete policy for the StatefulSet created PVCs

Expand Down Expand Up @@ -394,10 +412,17 @@ This features adds a new field to the StatefulSet. The default value for the new
maintains the existing behavior of StatefulSets.

On a downgrade, the `PersistentVolumeClaimRetentionPolicy` field will be hidden on
any StatefulSets. The behavior in this case will be identical to mutating they
any StatefulSets. The behavior in this case will be identical to mutating the
policy field to `Retain`, as described above, including the edge cases
introduced if this is done during a scale-down or StatefulSet deletion.

The initial beta version did not set the controller flag in the owner
reference. If a PVC has an owner reference to the expected StatefulSet or Pod
object, and the controller flag is not set, it will be set, if there are no
other controllers on the object. If there is another controller, the existing
non-controller StatefulSet or Pod reference will be removed. That is, we will
assume any such references are due to the older version of the controller.

### Version Skew Strategy
There are only kube-controller-manager changes involved (in addition to the
apiserver changes for dealing with the new StatefulSet field). Node components
Expand Down
2 changes: 1 addition & 1 deletion keps/sig-apps/1847-autoremove-statefulset-pvcs/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ latest-milestone: "v1.27"
milestone:
alpha: "v1.23"
beta: "v1.27"
stable: "v1.28"
stable: "v1.31"

feature-gates:
- name: StatefulSetAutoDeletePVC
Expand Down

0 comments on commit 1c85062

Please sign in to comment.