Skip to content
open-component-modelPublic

About

Core API of ODG (github.com/open-component-model/open-delivery-gear)

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

11 stars

Watchers

2 watching

Forks

Latest commit

 

History

3,798 Commits

Folders and files

Open Delivery Gear - Core

This repository is the home of the core API and feature extensions for the Open Delivery Gear.

REUSE status tests release

Index

Technology

The core API implements a Python HTTP web server, intended for deployment into a Kubernetes cluster. It features compliance-related automation for software built with the Open Component Model.

Getting Started

There are multiple ways to run ODG-Core locally.

Standalone

The ODG-Core Python HTTP web server can be started locally as a standalone application. It is loosely coupled to the database and Kubernetes-specific components, therefore this option is considered best if you intend to run web server-only features (e.g. adding new endpoints).

Dependencies and Setup

First, you need to prepare your local environment. Install uv (e.g. brew install uv), then run:

make setup

This creates a project-local .venv with all dependencies pinned from uv.lock. Afterwards you can either prefix commands with uv run (e.g. uv run pytest) or activate the venv manually.

Common Makefile targets:

Target Description
make setup Create/update .venv from lock file
make run-db Start a local PostgreSQL instance
make run Start the development server
make test Run the test suite
make lint Run ruff and bandit
make format Check code formatting
make build-core Build the odg-core-libs wheel
make build-clients Build bdba-client and odg-client wheels
make build-docker-local Build the OCI image for your local architecture
make build-docker Build the OCI image for all supported architectures
make clean Remove build artifacts

Running the Web Server

The Makefile features a convenient command to run the ODG-Core web server in a lightweight fashion. This naturally has limitations, as most features will be turned off. If you want to run specific features, please review the Makefile and build your custom run command.

make run

Local development logs are human-readable by default (--no-json-logs is passed in Makefile::run). To get structured JSON logs (same as delivery-service in production clusters):

make run JSON_LOGS=1

The flag is a per-invocation override, so you can flip it per run without changing any file.

Log level defaults to INFO and can be set via the ODG_LOG_LEVEL env var (any ODG process), or the --log-level CLI flag for the delivery-service (wins over the env var):

ODG_LOG_LEVEL=DEBUG make run

Extensions always log JSON. To read them locally, pipe through jq (non-JSON lines pass through unchanged):

uv run python -m malware 2>&1 | jq -Rr 'fromjson? // .'

Kubernetes in Docker

To run the ODG-Core web server alongside dependencies and feature extensions, you need to deploy it to a Kubernetes environment. You can use Kubernetes-in-Docker (KinD) to deploy such a setup locally.

Please refer to this guide to deploy ODG to KinD.

Dev Container

You can also develop ODG in a Dev Container. Install the Dev Containers extension and choose Reopen in Container in VS Code.

The Dev Container provides:

  • Run & debug:
    • To run the core service, run Debug: core service
    • To run an extension, run Debug: extension and select the extension
  • Pytest integration
  • PostgreSQL browser (password: MyPassword, see .devcontainer/compose.yml)
  • Auto-format & lint on save

To work with a KinD cluster:

  1. Create the KinD cluster on the host: kind create cluster --config .devcontainer/kind-config.yml, which includes host.docker.internal as SAN
  2. Flatten your kubeconfig into ~/.kube/config: kubectl config view --flatten > ~/.kube/config
  3. Open the Dev Container (Reopen in Container in VS Code)
  4. Open a terminal session. The kubeconfig is refreshed on every shell startup, with 127.0.0.1 replaced by host.docker.internal
  5. Copy the extensions config: cp extensions_cfg.yaml extensions_cfg.local.yaml
  6. Adjust the local configuration and secrets to your needs

To clean up the KinD cluster: kind delete clusters odg-devcontainer-cluster

Network Policies

The delivery-service and extensions Helm charts ship a namespace-wide default-deny policy (Ingress + Egress) plus tiered per-workload allow policies. Egress is restricted to cluster DNS, the Kubernetes API, the delivery-service, the delivery database, the OpenTelemetry collector, and HTTPS (443); ingress to the delivery-service is restricted to same-namespace pods and the configured gateway namespaces.

Tuning knobs (defaults work on upstream Kubernetes, Gardener shoots, and OpenShift):

Knob Purpose
dnsNamespaceLabels / dnsPorts / dnsNodeLocalIps Where and how Cluster-DNS is reachable (CoreDNS 8053, OpenShift 5353, NodeLocal DNSCache 169.254.20.10)
postgresCidrs Egress to databases outside the cluster
dbClientLabelKey / dbClientLabelValue Pod label required to connect to a tightened DB policy (allowExternal: false)
otlpCollectorLabels Selector for the in-namespace OTLP collector
gatewayNamespaceNames Extra namespaces allowed to ingress the delivery-service (empty list honoured; unset defaults to envoy-gateway-system)
extraEgress Raw egress rules appended verbatim (proxies, non-443 registries, cross-namespace collectors)

Pod-to-pod traffic on ports other than the listed ones is denied by default.

Documentation

The documentation is hosted here.

Quicklinks

Open-API Specification

Additionally, each ODG-Core instance hosts an Open-API specification. It is available at: https://<odg-core>/api/v1/doc/

You can also checkout the documentation hosted by the public demo instance, but please be aware that the running version might differ from your installation.

-> Public ODG Demo Open-API

Packages

ODG-Core publishes multiple software artefacts. This list provides an overview.

Name Type Description Location
odg-core-libs Python Package Core APIs and functionalities. Contains the ODG web server. PyPi
odg-client Python Package Python HTTP client library to interact with the ODG-Core API PyPi
bdba-client Python Package Python HTTP client library to interact with BlackDuck Binary Analysis PyPi
odg-core OCI Image Filesystem to run ODG-Core and ODG extensions in cloud environments GHCR
odg-core OCM Component Software component referencing all delivery artefacts and metadata OCM Repo

Bundesministerium für Wirtschaft und Energie (BMWE)-EU funding logo

About

Core API of ODG (github.com/open-component-model/open-delivery-gear)

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

11 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages