Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joatmon08/hello-stateful-operator
https://github.com/joatmon08/hello-stateful-operator
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/joatmon08/hello-stateful-operator
- Owner: joatmon08
- Created: 2018-07-21T20:05:45.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2021-02-20T00:07:11.000Z (almost 4 years ago)
- Last Synced: 2024-10-12T23:52:32.204Z (2 months ago)
- Language: Go
- Size: 27.3 MB
- Stars: 4
- Watchers: 1
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hello-stateful-operator
This is a Kubernetes operator that creates HelloStateful resources
using the Operator framework. HelloStateful writes the date and time
to a `stateful.log` file every 10 seconds. It it useful for practicing
with PersistentVolumes.The operator itself creates:
* A StatefulSet for the application.
* A CronJob for backup of the stateful.log file.
* A Job run if you choose to do a restore because it existed before.The CustomResource should be defined as follows:
```
apiVersion: "hello-stateful.example.com/v1alpha1"
kind: "HelloStateful"
metadata:
name:
spec:
replicas:
restoreFromExisting:
backupSchedule:
```## Pre-Requisites
* Minikube
* Kubernetes 1.10## Run
1. Deploy the CustomResource Definition & RBAC.
```
make setup
```
1. Deploy the Operator.
```
kubectl create -f deploy/operator.yaml
```
1. Deploy the HelloStateful Custom Resource.
```
kubectl create -f deploy/cr.yaml
```## Test
```
make tests
```## To Consider
In order for us to immutably restore a PV & PVC, we need to create & delete them separately
from the StatefulSet.This is a bit annoying to statically define, especially since StatefulSets should probably
have their own PVs and PVCs anyway. But statically defining a PVC means tying replicas to
the same PV, which isn't good.