Sign inSign up

cinaq/pv-zone-operator

By cinaq

•Updated about 1 year ago
Archived

A kubernetes Operator that propagates topology data from node to PV

Image
0

492

cinaq/pv-zone-operator repository overview

⁠Kubernetes PV Labeler Operator

Kubernetes operator that automatically labels PersistentVolumes with zone information based on the node where the pod using the PV is running.

⁠Overview

The PV Zone Operator watches for pods in the ready state that use PersistentVolumeClaims. When it finds such pods, it:

  1. Gets the zone label (topology.kubernetes.io/zone) from the node where the pod is running
  2. Finds the PersistentVolume bound to the pod's PVC
  3. Labels the PV with the same zone label

This ensures that PersistentVolumes are correctly labeled with their topology information, which is important for pod scheduling and data locality.

⁠Features

  • Automatically labels PVs with the correct zone information
  • Only processes pods in the ready state
  • Only updates PV labels when necessary
  • Works with any storage type (CSI, cloud provider volumes, etc.)

⁠Installation

⁠Deploy the operator
kubectl apply -f manifests/pv-zone-operator.yaml

This will deploy the operator with the necessary RBAC permissions to watch pods, PVCs, PVs, and nodes, and to update PVs with zone labels.

⁠How it works

The operator runs as a controller that:

  1. Watches for pods that are in the ready state
  2. For each ready pod, checks if it uses any PVCs
  3. For each PVC, finds the bound PV
  4. Gets the zone label from the node where the pod is running
  5. Updates the PV with the zone label if it's not already set correctly

The operator also watches for PVC events to handle cases where a PVC is bound to a PV after the pod is already running.

⁠RBAC Permissions

The operator requires the following permissions:

  • get, list, watch on pods
  • get, list, watch on persistentvolumeclaims
  • get, list, watch on nodes
  • get, list, watch, update, patch on persistentvolumes

Tag summary

Content type

Image

Digest

sha256:d0a550956…

Size

26.2 MB

Last updated

about 1 year ago

docker pull cinaq/pv-zone-operator