This repository aims to go through the tutorial from Kopf Documents to create an EphemeralVolumeClaim Operator.
The EphemeralVolumeClaim Operator manages the following things:
- Create a PersistentVolumeClaim once an EphemeralVolumeClaim was created (
@kopf.on.create
) - Update the size of the PersistentVolumeClaim once the size of the EphemeralVolumeClaim was updated (
@kopf.on.update
) - Create/update the labels of a PersistentVolumeClaim once the labels of an EphemeralVolumeClaim was created/updated (
@kopf.on.field
) - Delete a PersistentVolumeClaim once an EphemeralVolumeClaim was deleted (
kopf.adopt()
)
To achieve above, one CustomResourceDefinition to registry the EphemeralVolumeClaim object, a Python file to define the operator behavior as well as the appropriate RBACs setup for the operator are included in this repository.
.
├── Dockerfile
├── Pipfile
├── Pipfile.lock
├── README.md
├── evc.yaml
├── manifests
│ ├── crd.yaml
│ ├── deployment.yaml
│ ├── kustomization.yaml
│ └── rbac.yaml
└── src
├── ephemeral.py
├── requirements.txt
└── template
└── pvc.yaml
4 directories, 12 files
Dockerfile
: the dockerfile for building the operator imageevc.yaml
: the example yaml to create an EphemeralVolumeClaimmanifests/
: the yamls for deploying the operatorsrc/
: the main component of the operator, written in Python with Kopf framework
cd kopf-tutorial
kustomize build manifests | kubectl apply -f -
cd kopf-tutorial
kubectl apply -f evc.yaml