This is an Advanced StatefulSet CRD implementation based on official StatefulSet in Kubernetes 1.17.0.
This is an experimental project.
In addition to official StatefulSet, it adds one feature:
- Scale in at an arbitrary position: kubernetes/kubernetes#83224
make verify
make test
make test-integration
make e2e
kind v0.7.0+
is recommended.
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-$(uname)-amd64
chmod +x ./kind
./kind create cluster
Open a new terminal and run controller:
hack/local-up.sh
kubectl apply -f examples/statefulset.yaml
Note that --resource-version
is required for CRD objects.
RESOURCE_VERSION=$(kubectl get statefulsets.pingcap.com web -ojsonpath='{.metadata.resourceVersion}')
kubectl scale --resource-version=$RESOURCE_VERSION --replicas=4 statefulsets.pingcap.com web
RESOURCE_VERSION=$(kubectl get statefulsets.pingcap.com web -ojsonpath='{.metadata.resourceVersion}')
kubectl scale --resource-version=$RESOURCE_VERSION --replicas=3 statefulsets.pingcap.com web
We should set delete-slots
annotations and decrement spec.replicas
at the
same time.
kubectl apply -f examples/scale-in-statefulset.yaml