Skip to content

Commit 25777c1

Browse files
authored
Merge pull request #4920 from mattcary/upgrade
KEP-1847: Clarify upgrade & downgrade test
2 parents ca601e6 + 4c3b0f5 commit 25777c1

File tree

1 file changed

+40
-2
lines changed
  • keps/sig-apps/1847-autoremove-statefulset-pvcs

1 file changed

+40
-2
lines changed

keps/sig-apps/1847-autoremove-statefulset-pvcs/README.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,15 +387,53 @@ Added `Feature:StatefulSetAutoDeletePVC` tests to `k8s.io/kubernetes/test/e2e/ap
387387

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

390-
Should be added as an e2e tests, but we have not figured out if there is a
391-
mechanism to run upgrade/downgrade tests.
390+
The following scenarios were manuall tested.
392391

393392
1. Create statefulset in previous version and upgrade to the version
394393
supporting this feature. The PVCs should remain intact.
395394
2. Downgrade to earlier version and check the PVCs with Retain
396395
remain intact and the others with set policies before upgrade
397396
gets deleted based on if the references were already set.
398397

398+
Since `rancher.io/local-path` now provides a default storage class, StatefulSets
399+
can be tested with kind with the following procedure.
400+
401+
* Create a [kind](https://kind.sigs.k8s.io/) cluster with the following `config.yaml`.
402+
```
403+
apiVersion: kind.x-k8s.io/v1alpha4
404+
kind: Cluster
405+
featureGates:
406+
StatefulSetAutoDeletePVC: false
407+
nodes:
408+
- role: control-plane
409+
image: kindest/node:v1.31.0
410+
```
411+
This is done with `kind create cluster --config config.yaml`
412+
* The configuration adds the feature gate to all control plane services. In a
413+
kind cluster, these are stored in the `/etc/kubernetes/manifests` directory of
414+
the kind docker container serving as the control plane node. The manifests are
415+
reconciled to the control plane, so the cluster can be upgraded or downgraded
416+
from the StatefulSet retention policy feature with bash script like the
417+
following.
418+
```
419+
for c in kube-apiserver kube-controller-manager kube-scheduler; do
420+
docker exec kind-control-plane \
421+
sed -i -r "s|(StatefulSetAutoDeletePVC)=false|\1=true|" \
422+
/etc/kubernetes/manifests/$c.yaml
423+
echo $c updated
424+
done
425+
```
426+
To downgrade, swap false for true in the above. Note that the kind control
427+
plane will be unreachable for a minute or so while the reconciliation occurs.
428+
429+
For the upgrade scenario, a StatefulSet was created in a cluster with the
430+
feature gate disabled. The feature gate was enabled, the StatefulSet was scaled
431+
down or deleted, and it was confirmed that no PVCs were deleted.
432+
433+
In the downgrade scenario, four StatefulSets were created with all possibilities
434+
of WhenScaled and WhenDeleted policies. After downgraded, it was confirmed that
435+
(1) no PVCs are deleted when the StatefulSet is scaled down, and (2) PVCs are
436+
deleted when the WhenDeleted policy is Delete, and the StatefulSet is deleted.
399437

400438
### Graduation Criteria
401439

0 commit comments

Comments
 (0)