Skip to content

Commit 56d10e2

Browse files
committed
✨ Add automated schema generation and validation for deploymentConfig
Summary: Implements Phase 1 of the DeploymentConfig feature to achieve feature parity with OLMv0's SubscriptionConfig for registry+v1 bundles. RFC: https://docs.google.com/document/d/18O4qBvu5I4WIJgo5KU1opyUKcrfgk64xsI3tyXxmVEU/edit?tab=t.0#heading=h.x3tfh25grvnv Details: This PR adds infrastructure for JSON schema-based validation of the `deploymentConfig` field in ClusterExtension: - **Schema Generation Tool**: Created reflection-based generator (`hack/tools/schema-generator/`) that automatically introspects `v1alpha1.SubscriptionConfig` from `github.com/operator-framework/api` to produce a JSON Schema Draft 7 document - Handles nested k8s corev1 types recursively - Supports inline/embedded struct fields - Extracts field documentation from Go source via AST parsing - Excludes `selector` field (unused in OLMv0) - **Validation Infrastructure**: Added `internal/operator-controller/rukpak/bundle/schema/` package with: - Embedded JSON schema validator using `santhosh-tekuri/jsonschema/v6` - `ValidateDeploymentConfig()` function integrated into bundle config validation - Comprehensive test coverage - **Regeneration Workflow**: Added `make update-deploymentconfig-schema` target to regenerate schema when upstream SubscriptionConfig changes. When the upstream `v1alpha1.SubscriptionConfig` adds new fields (e.g., new k8s corev1 types), running the regeneration target will automatically include them in the schema without manual updates. Addresses OPRUN-4112 (Phase 1) Future PRs will implement: - Phase 2: Renderer integration to apply deploymentConfig to Deployments - Phase 3: Provider integration to extract deploymentConfig from bundles - Phase 4: Documentation
1 parent 8167ff8 commit 56d10e2

File tree

10 files changed

+2924
-1
lines changed

10 files changed

+2924
-1
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ fmt: $(YAMLFMT) #EXHELP Formats code
222222
update-tls-profiles: $(GOJQ) #EXHELP Update TLS profiles from the Mozilla wiki
223223
env JQ=$(GOJQ) hack/tools/update-tls-profiles.sh
224224

225+
.PHONY: update-deploymentconfig-schema
226+
update-deploymentconfig-schema: #EXHELP Update DeploymentConfig JSON schema by introspecting v1alpha1.SubscriptionConfig
227+
hack/tools/update-deploymentconfig-schema.sh
228+
225229
.PHONY: verify-crd-compatibility
226230
CRD_DIFF_ORIGINAL_REF := git://main?path=
227231
CRD_DIFF_UPDATED_REF := file://

0 commit comments

Comments
 (0)