glance-operator is a Kubernetes operator that manages OpenStack Glance (the image service: discovery, registration, and retrieval of VM images) on OpenShift/Kubernetes. It is part of the openstack-k8s-operators project.
Key Glance domain concepts: backends (Ceph RBD, Cinder, Swift, NFS, S3), API types (internal, external, single, edge), image cache, image import (web-download, glance-direct, copy-image), quotas.
Go module: github.com/openstack-k8s-operators/glance-operator
API group: glance.openstack.org
API version: v1beta1
| Layer | Technology |
|---|---|
| Language | Go (modules, multi-module workspace via go.work) |
| Scaffolding | Kubebuilder v4 + Operator SDK |
| CRD generation | controller-gen (DeepCopy, CRDs, RBAC, webhooks) |
| Config management | Kustomize |
| Packaging | OLM bundle |
| Testing | Ginkgo/Gomega + envtest (functional), KUTTL (integration) |
| Linting | golangci-lint (.golangci.yaml) |
| CI | Zuul (zuul.d/), Prow (.ci-operator.yaml), GitHub Actions |
| Kind | Purpose |
|---|---|
Glance |
Top-level CR. Owns the database, keystone service, and spawns one or more GlanceAPI sub-CRs based on the requested layout (single, split, edge). |
GlanceAPI |
Manages a single Glance API deployment (StatefulSet, Service, endpoints). Created and owned by the Glance controller -- not intended to be created directly by users. |
Both CRDs have defaulting and validating admission webhooks.
| Directory | Contents |
|---|---|
api/v1beta1/ |
CRD types (glance_types.go, glanceapi_types.go, common_types.go), conditions, webhook markers |
cmd/ |
main.go entry point |
internal/controller/ |
Reconcilers: glance_controller.go, glanceapi_controller.go, shared helpers |
internal/glance/ |
Glance-level resource builders (db-sync Job, CronJob, PVC, volumes) |
internal/glanceapi/ |
GlanceAPI-level resource builders (StatefulSet, cache job) |
internal/webhook/v1beta1/ |
Webhook implementation |
templates/ |
Config files and scripts mounted into pods via OPERATOR_TEMPLATES env var |
config/crd,rbac,manager,webhook/ |
Generated Kubernetes manifests (CRDs, RBAC, deployment, webhooks) |
config/samples/ |
Example CRs (Kustomize overlays). layout/{single,split,edge,multiple} for API topologies. backends/{ceph,cinder,nfs,s3,swift,...} for storage. Feature dirs: image_cache/, quotas/, notifications/, copy_image/, import_plugins/, policy/, others. |
test/functional/ |
envtest-based Ginkgo/Gomega tests |
test/kuttl/ |
KUTTL integration tests |
hack/ |
Helper scripts (CRD schema checker, local webhook runner) |
docs/ |
Design decisions, troubleshooting, probes documentation |
After modifying Go code, always run: make generate manifests fmt vet.
- Follow standard openstack-k8s-operators conventions and lib-common patterns.
- Use
lib-commonmodules for conditions, endpoints, TLS, storage, and other cross-cutting concerns rather than re-implementing them. - CRD types go in
api/v1beta1/. Controller logic goes ininternal/controller/. Resource-building helpers go ininternal/glance/orinternal/glanceapi/. - Config templates are plain files in
templates/-- they are mounted at runtime via theOPERATOR_TEMPLATESenvironment variable. - Webhook logic is split between the kubebuilder markers in
api/v1beta1/and the implementation ininternal/webhook/v1beta1/.
- Functional tests use the envtest framework with Ginkgo/Gomega and live in
test/functional/. - KUTTL integration tests live in
test/kuttl/. - Run all functional tests:
make test. - When adding a new field or feature, add corresponding test cases in
test/functional/and updatetest/functional/glance_test_data.gowith fixture data. - When modifying samples,
test/functional/sample_test.govalidates that all sample CRs can be parsed.
- lib-common: shared modules for conditions, endpoints, database, TLS, secrets, etc.
- infra-operator: RabbitMQ and topology APIs.
- mariadb-operator: database provisioning.
- keystone-operator: identity service registration.
- gophercloud: Go OpenStack SDK used for Keystone endpoint operations.