https://github.com/pingcap/advanced-statefulset
https://github.com/pingcap/advanced-statefulset
Last synced: 23 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/pingcap/advanced-statefulset
- Owner: pingcap
- License: apache-2.0
- Created: 2019-09-29T06:01:20.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-12-01T07:11:47.000Z (3 months ago)
- Last Synced: 2025-12-03T18:33:05.231Z (3 months ago)
- Language: Go
- Size: 20.3 MB
- Stars: 60
- Watchers: 14
- Forks: 22
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Advanced StatefulSet
This is an Advanced StatefulSet CRD implementation based on official
StatefulSet in Kubernetes 1.17.0.
This is an experimental project.
## Features
In addition to official StatefulSet, it adds one feature:
- Scale in at an arbitrary position: https://github.com/kubernetes/kubernetes/issues/83224
## Development
### Verify
```
make verify
```
### Unit Tests
```
make test
```
### Integration Tests
```
make test-integration
```
### E2E
```
make e2e
```
## Test it out
### start a cluster
[kind](https://kind.sigs.k8s.io/) `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
```
### run advanced statefulset controller locally
Open a new terminal and run controller:
```
hack/local-up.sh
```
### deploy a statefulset
```
kubectl apply -f examples/statefulset.yaml
```
### scale out
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
```
### scale in
```
RESOURCE_VERSION=$(kubectl get statefulsets.pingcap.com web -ojsonpath='{.metadata.resourceVersion}')
kubectl scale --resource-version=$RESOURCE_VERSION --replicas=3 statefulsets.pingcap.com web
```
### scale in at arbitrary position
We should set `delete-slots` annotations and decrement `spec.replicas` at the
same time.
```
kubectl apply -f examples/scale-in-statefulset.yaml
```