Seed code for FOCOM REST NBI (Provisioning)#1091
Conversation
|
|
|
Hi @saulgillEST. Thanks for your PR. I'm waiting for a nephio-project member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
This work refers to user story #1066 |
|
See also API Proposal nephio-project/api#71 |
|
/approve |
|
/retest |
|
@saulgillEST: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
- Add REST NBI API (Gin) for OCloud, TemplateInfo, and FPR resources - Implement draft/validate/approve/reject lifecycle for all resource types - Add Porch storage backend mapping to PackageRevision lifecycle states - Add in-memory storage backend for testing - Add FPR templateParameters validation against TemplateInfo JSON Schema - Add TemplateInfo schema metavalidation (verify schema is valid JSON Schema) - Add structured schema error reporting with field path and constraint info - Add optional early validation mode via FOCOM_EARLY_SCHEMA_VALIDATION env var - Add FOCOM_NAMESPACE env var for configurable default namespace - Add ConfigSync and Flux GitOps deployment support - Add OpenAPI 3.0 specification for the NBI API - Add property-based tests (gopter) for schema validation correctness - Add unit tests for models, validation, services, storage, and controller - Add integration test framework with smoke, integration, and stability tiers - Add Postman collection for manual API testing - Add documentation for architecture, deployment, Porch setup, and troubleshooting - Comply with linting, gosec, docker and other nephio make commands - Support docker.io by default but also support private github registries for testing - Support kpt deploy undeploy through makefile Signed-off-by: saul.gill <saul.gill@est.tech>
|
/ok-to-test |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liamfallon The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Add REST NBI with Porch storage, schema validation, and GitOps deployment
Description
This PR introduces the FOCOM North Bound Interface (NBI) REST API layer, Porch-based GitOps storage, FPR template parameter schema validation, and supporting infrastructure for the focom-operator.
What changed
REST NBI API (
internal/nbi/)A complete REST API layer built with Gin, implementing the draft → validate → approve → publish lifecycle for three resource types: OCloud, TemplateInfo, and FocomProvisioningRequest. The API follows the OpenAPI spec at
api/openapi/focom-nbi-api.yaml.handlers/— HTTP handlers for all three resource types with full CRUD, draft management, revision history, and lifecycle operations (validate, approve, reject)services/— Business logic layer with dependency validation, state machine enforcement, and schema validation orchestrationmodels/— Internal data models with JSON serialization, ID generation, and structured error typesvalidation/— Validation framework with JSON Schema validation (gojsonschema), business rule validation, dependency validation, and schema metavalidationstorage/— Storage abstraction with two implementations:inmemory.go— In-memory storage for testingporch.go— Production storage using Nephio Porch PackageRevisions via Kubernetes REST API, with full draft/revision lifecycle mapped to Porch's Draft/Proposed/Published statesintegration/— Operator integration layer for mapping NBI resources to Kubernetes CRsconfig/— Runtime configuration with environment variable supportFPR Template Parameter Schema Validation
Validates FPR
templateParametersagainst thetemplateParameterSchemadefined in the referenced TemplateInfo:FOCOM_EARLY_SCHEMA_VALIDATION=truetemplateParameterSchemais a valid JSON Schema before approvalgopter) verify schema validation conformance, error structure completeness, metavalidation correctness, and error serialization round-tripPorch Storage Implementation
Full implementation of the storage layer using Nephio Porch as a GitOps backend:
GitOps Deployment (ConfigSync & Flux)
config/configsync/for automatic Git → Kubernetes syncconfig/flux/as an alternative GitOps engine with webhook support for instant syncdeploy,deploy-with-flux,deploy-with-flux-webhook,undeploy,undeploy-fluxTesting
api/postman/) for manual API testingunit-tests,ci-tests,test-smoke,test-integration,test-stabilityDocumentation
docs/ARCHITECTURE.md)docs/DEPLOYMENT.md)docs/PORCH_SETUP.md)docs/TROUBLESHOOTING.md)docs/flux/)docs/kpt/)api/openapi/focom-nbi-api.yaml)Environment Variables
FOCOM_NAMESPACEfocom-systemFOCOM_EARLY_SCHEMA_VALIDATIONfalseNBI_STORAGE_BACKENDinmemoryorporch)porchPORCH_NAMESPACEdefaultPORCH_REPOSITORYfocom-resourcesTesting