This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
pulp-service is a Django REST Framework plugin for Pulpcore that extends the Pulp content management platform with Red Hat cloud-specific features: multi-tenant authentication (X-RH-IDENTITY), custom S3/OCI storage backends, domain-based org isolation, content guards, vulnerability reporting, and OpenTelemetry observability.
The plugin is registered via the pulpcore.plugin entry point in pulp_service/setup.py.
pulp_service/— The Python package (all source code lives here)pulp_service/app/— Core Django app: models, viewsets, serializers, middleware, auth, storage, taskspulp_service/tests/functional/— Functional tests (pytest + pytest-django)setup.py,requirements.txt— Package definition and dependencies
images/— Container build assets (startup scripts for pulp-api, pulp-content, pulp-worker; WSGI middleware)deploy/— OpenShift ClowdApp deployment manifestsdocs/ARCHITECTURE.md— Comprehensive architecture reference (read this for deep context)CHANGES/— Towncrier changelog fragments
# Install in development mode
cd pulp_service && pip install -e .
# Format code (line length 100)
black --line-length 100 pulp_service/
# Run all functional tests
pytest pulp_service/pulp_service/tests/functional/
# Run a single test file
pytest pulp_service/pulp_service/tests/functional/test_authentication.py
# Run a single test
pytest pulp_service/pulp_service/tests/functional/test_authentication.py::TestClass::test_methodTest dependencies: pytest, pytest-django (see unittest_requirements.txt / functest_requirements.txt).
Three-service model:
- pulp-api — Gunicorn WSGI serving Django REST API (port 24817 local, 8000 prod)
- pulp-content — Gunicorn + aiohttp async content delivery (port 24816 local, 8000 prod)
- pulp-worker — Celery workers for background tasks (Redis broker)
Request flow:
WSGI middleware (images/assets/log_middleware.py) → Django middleware stack (app/middleware.py) → DRF ViewSets (app/viewsets.py)
Key patterns:
- Authentication:
X-RH-IDENTITYheader (base64-encoded JSON) → custom auth classes inapp/authentication.py - Multi-tenancy:
DomainOrgmodel maps org_id → Pulp domain; domain-based routing for content APIs - Context variables:
ContextVarinstances inapp/middleware.pycarry request-scoped data (org_id, user_id, request_path) across layers - Storage backends:
AIPCCStorageBackend(S3) andOCIStorageBackend(OCI/ORAS) inapp/storage.py - Tasks: Background work in
app/tasks/(package scanning, domain metrics, RDS testing)
Upstream plugins this extends: pulpcore, pulp-python, pulp-container, pulp-rpm, pulp-gem, pulp-npm, pulp-maven, pulp-hugging-face.
Uses towncrier. For any non-trivial change, create a file in CHANGES/ named {issue_number}.{category} where category is one of: feature, bugfix, doc, removal, deprecation, misc.
- Black formatter, line length 100, targeting py36/py37
- Excludes: migrations, docs, build directories