How lerentis/bitwarden-crd-operator works
Project type and purpose
• This is a Kubernetes Operator (open-source tool) written in Python.
• It leverages Kopf (Kubernetes Operator Pythonic Framework) to watch custom resources (CRDs) and automatically generate native Kubernetes Secret objects from Bitwarden entries.
• It ships as a Helm chart for easy deployment in any Kubernetes cluster.
File structure
• Top-level files: Dockerfile, Makefile, requirements.txt, skaffold.yaml, Helm chart under charts/bitwarden-crd-operator, plus CI/CD configs (.drone.yml, GitHub workflows).
• src/: contains the core operator logic
• bitwardenCrdOperator.py – main controller registration and event handlers
• dockerlogin.py – logic for RegistryCredential CRD → .dockerconfigjson secrets
• kv.py – general key/value helper
• lookups/bitwarden_lookup.py – implements bitwarden_lookup for Jinja2 templates
• template.py – implements BitwardenTemplate functionality
• utils/utils.py – shared utility functions
• charts/bitwarden-crd-operator/: Helm chart, CRD definitions, Kubernetes resources (Deployment, RBAC, HPA, ServiceAccount, etc.)
• Example YAMLs demonstrating how to instantiate CRDs
README for additional insights
• Describes three CRD kinds: BitwardenSecret, RegistryCredential, BitwardenTemplate
• Explains how the operator uses the bitwarden CLI for background sync and login intervals
• Shows desired resulting Kubernetes Secret manifests and how Jinja2 templates are rendered
Essential architectural elements
• Helm’s initial setup steps (CRD and Deployment) separate from runtime
• Configuration parameters (BW_SYNC_INTERVAL, BW_RELOGIN_INTERVAL) as operator env vars