Skip to content

Commit

Permalink
Update statefulset autodelete beta to 1.25
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcary committed Jun 13, 2022
1 parent 5cde0fc commit f1e5170
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 38 deletions.
2 changes: 1 addition & 1 deletion keps/prod-readiness/sig-apps/1847.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
kep-number: 1847
alpha:
beta:
approver: "@wojtek-t"
86 changes: 55 additions & 31 deletions keps/sig-apps/1847-autoremove-statefulset-pvcs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
- [Mutating <code>PersistentVolumeClaimRetentionPolicy</code>](#mutating-)
- [Cluster role change for statefulset controller](#cluster-role-change-for-statefulset-controller)
- [Test Plan](#test-plan)
- [Integration tests](#integration-tests)
- [e2e tests](#e2e-tests)
- [Unit tests](#unit-tests)
- [e2e/integration tests](#e2eintegration-tests)
- [Upgrade/downgrade &amp; feature enabled/disable tests](#upgradedowngrade--feature-enableddisable-tests)
- [Graduation Criteria](#graduation-criteria)
- [Alpha release](#alpha-release)
- [Upgrade / Downgrade Strategy](#upgrade--downgrade-strategy)
Expand All @@ -46,14 +51,14 @@
Items marked with (R) are required *prior to targeting to a milestone / release*.

- [ ] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
- [ ] (R) KEP approvers have approved the KEP status as `implementable`
- [ ] (R) Design details are appropriately documented
- [ ] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input
- [X] (R) KEP approvers have approved the KEP status as `implementable`
- [X] (R) Design details are appropriately documented
- [X] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input
- [ ] (R) Graduation criteria is in place
- [ ] (R) Production readiness review completed
- [ ] (R) Production readiness review approved
- [ ] "Implementation History" section is up-to-date for milestone
- [ ] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io]
- [X] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io]
- [ ] Supporting documentation e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes


Expand Down Expand Up @@ -305,38 +310,57 @@ In order to update the PVC ownerReference, the `buildControllerRoles` will be up

### Test Plan

1. Unit tests

1. e2e/integration tests
- With `Delete` policies for `whenScaled` and `whenDeleted`
1. Create 2 pod statefulset, scale to 1 pod, confirm PVC deleted
1. Create 2 pod statefulset, add data to PVs, scale to 1 pod, scale back to 2, confirm PV empty.
1. Create 2 pod statefulset, delete stateful set, confirm PVCs deleted.
1. Create 2 pod statefulset, add data to PVs, manually delete one pod, confirm pod comes back and PV still has data (PVC not deleted).
1. As above, but manually delete all pods in stateful set.
1. Create 2 pod statefulset, add data to PVs, manually delete one pod, immediately scale down to one pod, confirm PVC is deleted.
1. Create 2 pod statefulset, add data to PVs, manually delete one pod, immediately scale down to one pod, scale back to two pods, confirm PV is empty.
1. Create 2 pod statefulset, add data to PVs, perform rolling confirm PVC don't get deleted and PV contents remain intact and useful in the updated pods.
- With `Delete` policy for `whenDeleted` only
1. Create 2 pod statefulset, scale to 1 pod, confirm PVC still exists,
1. Create 2 pod statefulset, add data to PVs, scale to 1 pod, scale back to 2, confirm PV has data (PVC not deleted).
1. Create 2 pod statefulset, delete stateful set, confirm PVCs deleted
1. Create 2 pod statefulset, add data to PVs, manually delete one pod, confirm pod comes back and PV has data (PVC not deleted).
1. As above, but manually delete all pods in stateful set.
1. Create 2 pod statefulset, add data to PVs, manually delete one pod, immediately scale down to one pod, confirm PVC exists.
1. Create 2 pod statefulset, add data to PVs, manually delete one pod, immediately scale down to one pod, scale back to two pods, confirm PV has data.
- Retain:
1. same tests as above, but PVCs not deleted in any case and confirm data intact on the PV.
- Pod restart tests:
1. Create statefulset, perform rolling update, confirm PVC data still exists.
- `--casecade=false` tests.
1. Upgrade/Downgrade tests
[X] I/we understand the owners of the involved components may require updates to
existing tests to make this code solid enough prior to committing the changes necessary
to implement this enhancement.

#### Unit tests

- `pkg/controller/statefulset`: [test coverage](https://testgrid.k8s.io/sig-testing-canaries#ci-kubernetes-coverage-unit&include-filter-by-regex=statefulset)
- `TestStatefulPodControlUpdatePodClaimForRetentionPolicy`
- `TestStatefulPodControlRetainDeletionPolicyUpdate`
- `TestStatefulPodControlRetentionPolicyUpdate`
- `TestStatefulPodControlRetentionPolicyUpdateMissingClaims`
- `TestOrphanedPodsWithPVCDeletePolicy`
- `TestStaleOwnerRefOnScaleup`
- `stateful_set_control_test`
- Added `runTestOverPVCRetentionPolicies` to augment existing tests with
coverage for retention policies.
- `checkClaimInvarients` extended to test new feature.

##### Integration tests

- `test/integration/statefulset`
- TBD, add same tests as in e2e, below, so they can be tested while the
feature gate is default off.

##### E2E tests

- `test/e2e/apps`: [Triage
dashboard](https://storage.googleapis.com/k8s-triage/index.html?text=Feature%3AStatefulSetAutoDeletePVC)
- Note that as this is behind a feature gate, there are no tests being run.

Tests
- With `WhenDeleted` policy of `Delete`, create 3 replica StatefulSet, confirm PVCs
exist, delete the set, verify PVCs deleted.
- With `WhenScaled` policy of `Delete`, create 3 replica StatefulSet, scale down to one
pod, confirm PVCs deleted.
- With `WhenDeleted` policy of `Delete`, create 3 replica StatefulSet, orphan
a pod, delete StatefulSet, confirm all PVCs deleted (ie, orphaned pod was
adopted correctly).
- As above, with `WhenScaled` policy of `Delete`, confirm adoption behavoir on
scale down.

##### Upgrade/downgrade & feature enabled/disable tests

Should be added as an e2e tests, but we have not figured out if there is a
mechanism to run upgrade/downgrade tests.

1. Create statefulset in previous version and upgrade to the version
supporting this feature. The PVCs should remain intact.
2. Downgrade to earlier version and check the PVCs with Retain
remain intact and the others with set policies before upgrade
gets deleted based on if the references were already set.
1. Feature disablement/enable test for alpha feature flag `statefulset-autodelete-pvcs`.


### Graduation Criteria
Expand Down
11 changes: 5 additions & 6 deletions keps/sig-apps/1847-autoremove-statefulset-pvcs/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ approvers:
- "@msau42"
- "@janetkuo"

stage: alpha
stage: beta

latest-milestone: "v1.23"
latest-milestone: "v1.25"

milestone:
alpha: "v1.23"
beta: "v1.24"
stable: "v1.25"
beta: "v1.25"
stable: "v1.27"

feature-gates:
- name: StatefulSetAutoDeletePVC
Expand All @@ -36,6 +36,5 @@ feature-gates:
- kube-apiserver
disable-supported: true

# The following PRR answers are required at beta release
# metrics:
# Currently no metrics is planned for alpha release.
# No new metrics are planned (the stateful set controller does not export any metrics).

0 comments on commit f1e5170

Please sign in to comment.