Skip to content

Commit 12923b9

Browse files
authored
✨ Add automated schema generation and validation for registry+v1 bundle configuration (#2454)
Summary: Implements Phase 1 of the variable configuration 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 registry+v1 bundle configuration in ClusterExtension, including both `watchNamespace` and `deploymentConfig` fields: - **Schema Generation Tool**: Parses SubscriptionConfig using AST to extract field names/types - Fetches Kubernetes OpenAPI v3 specs from GitHub releases - Maps fields to official Kubernetes schemas - Generates schema with `watchNamespace` (for operator scope) and `deploymentConfig` (for deployment customization) - Excludes `selector` field (unused in OLMv0) - **Runtime Schema Customization**: The base schema is loaded and modified at runtime based on operator install modes: `watchNamespace` validation rules are customized per operator's supported install modes - **Validation Infrastructure**: Validation integrated into bundle config unmarshaling via `config.UnmarshalConfig()` - **Regeneration Workflow**: Added `make update-registryv1-bundle-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 bundle configuration from bundles - Phase 4: Documentation
1 parent 7a60e71 commit 12923b9

10 files changed

Lines changed: 3922 additions & 25 deletions

File tree

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyI
202202
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) object:headerFile="hack/boilerplate.go.txt" paths="./..."
203203

204204
.PHONY: verify
205-
verify: k8s-pin kind-verify-versions fmt generate manifests update-tls-profiles crd-ref-docs verify-bingo #HELP Verify all generated code is up-to-date. Runs k8s-pin instead of just tidy.
205+
verify: k8s-pin kind-verify-versions fmt generate manifests update-tls-profiles crd-ref-docs update-registryv1-bundle-schema verify-bingo #HELP Verify all generated code is up-to-date. Runs k8s-pin instead of just tidy.
206206
git diff --exit-code
207207

208208
.PHONY: verify-bingo
@@ -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-registryv1-bundle-schema
226+
update-registryv1-bundle-schema: #EXHELP Update registry+v1 bundle configuration JSON schema
227+
hack/tools/update-registryv1-bundle-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)