Skip to content

Automate default resource type registration from resource-types-contrib#11911

Merged
kachawla merged 7 commits into
mainfrom
kachawla/automate-resource-types
May 15, 2026
Merged

Automate default resource type registration from resource-types-contrib#11911
kachawla merged 7 commits into
mainfrom
kachawla/automate-resource-types

Conversation

@kachawla
Copy link
Copy Markdown
Member

Overview

Implement automated sync of default resource type manifests from resource-types-contrib into the radius repo, as described in the design: https://github.com/radius-project/radius/pull/11610/changes.

This eliminates manual cross-repo file editing and schema drift by making resource-types-contrib the single source of truth for resource type manifests that ship as defaults in Radius.

How it works

There are two pieces: a manual Makefile target that copies manifests, and a CI check that verifies the copies are up to date.

1. Manual sync (developer runs locally)

When a developer wants to update the default resource types - either to pick up schema changes from resource-types-contrib or to add/remove a default type - they run:

make update-resource-types   # bumps go.mod to latest resource-types-contrib, then copies manifests

make sync-resource-types (copy only, no version bump) is useful when:

  • A new entry was added to defaults.yaml without changing the resource-types-contrib version
  • A previously-copied manifest was accidentally hand-edited and needs to be restored
  • CI reports drift and the developer needs to regenerate the copies
make sync-resource-types     # copies manifests from the version already pinned in go.mod

This reads deploy/manifest/defaults.yaml to determine which resource types to copy, resolves each entry to a file in the resource-types-contrib Go module cache, and copies it into deploy/manifest/built-in-providers/{dev,self-hosted}/. It also removes any stale previously-copied files that are no longer in defaults.yaml. The developer then commits the resulting changes.

There is no automated workflow that does the copying - it is always a deliberate local action followed by a PR.

2. CI drift detection (runs automatically on PRs)

The verify-resource-types.yaml workflow runs on every PR that touches go.mod, go.sum, defaults.yaml, the copied manifests, or the sync logic. It:

  1. Re-runs make sync-resource-types in CI (copy only, no version bump).
  2. Checks git diff on the built-in-providers/ directories.
    • No diff → the committed copies match the pinned version → check passes.
    • Diff found → the committed copies have drifted → check fails with a message telling the developer to run make sync-resource-types and commit.

This catches cases where someone bumps go.mod but forgets to re-sync, manually edits a copied file, or adds an entry to defaults.yaml without re-running the copy.

Key design points

  • Version pinning via go.mod: resource-types-contrib is added as a Go module dependency. A blank import in pkg/resourcetypescontrib/import.go keeps go mod tidy from removing it. The version pinned in go.mod is the single source of truth for which version of manifests are used.
  • No runtime changes: The existing RegisterDirectory startup path is reused as-is. Copied manifests have no location field, so UCP routes via DefaultDownstreamEndpoint (dynamic-rp).
  • Per-type file layout: Previously, built-in-providers/ contained one YAML file per namespace (e.g., radius_compute.yaml with containers, routes, and persistentVolumes all in one file). Now each resource type has its own file (e.g., containers.yaml, routes.yaml). This matches the per-type file layout in resource-types-contrib, makes it straightforward to map defaults.yaml entries to files, and keeps diffs scoped to the individual type that changed.

Changes

New files

  • deploy/manifest/defaults.yaml - Lists which resource types from resource-types-contrib ship as defaults.
  • build/resource-types.mk - Makefile targets:
    • make update-resource-types - Bumps go.mod to the latest resource-types-contrib version and syncs manifest files.
    • make sync-resource-types - Copies manifest files from the version pinned in go.mod (no version bump). Used by CI for drift detection.
  • .github/workflows/verify-resource-types.yaml - CI drift detection: runs make sync-resource-types and fails if committed copies diverge from the pinned version.
  • pkg/resourcetypescontrib/import.go - Blank import to retain the resource-types-contrib dependency in go.mod.
  • Per-type manifest files in both dev/ and self-hosted/: containers.yaml, persistentVolumes.yaml, routes.yaml, mySqlDatabases.yaml, secrets.yaml

Removed files

  • radius_compute.yaml (dev + self-hosted) - Replaced by per-type files: containers.yaml, persistentVolumes.yaml, routes.yaml
  • radius_data.yaml (dev + self-hosted) - Replaced by per-type file: mySqlDatabases.yaml
  • radius_security.yaml (dev + self-hosted) - Replaced by per-type file: secrets.yaml

Modified files

  • Makefile - Includes build/resource-types.mk
  • go.mod - Adds resource-types-contrib dependency (pinned to v0.0.0-20260515162318-067b29d71eb8)

Dependencies

Test plan

  • make sync-resource-types copies exactly the files listed in defaults.yaml
  • Running twice produces no diff (idempotent)
  • Adding a missing path to defaults.yaml causes the script to fail clearly
  • Existing Test_ResourceProvider_RegisterManifests continues to pass
  • CI drift detection catches manual edits or missed syncs

Copilot AI review requested due to automatic review settings May 15, 2026 17:20
@kachawla kachawla requested review from a team as code owners May 15, 2026 17:20
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails
actions/actions/checkout de0fac2e4500dabe0009e67214ff5f5447ce83dd 🟢 5.7
Details
CheckScoreReason
Maintained⚠️ 01 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Binary-Artifacts🟢 10no binaries found in the repo
Code-Review🟢 10all changesets reviewed
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies⚠️ 3dependency not pinned by hash detected -- score normalized to 3
Packaging⚠️ -1packaging workflow not detected
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
Branch-Protection🟢 5branch protection is not maximal on development and all release branches
SAST🟢 8SAST tool detected but not run on all commits
actions/actions/setup-go 4a3601121dd01d1626a1e23e37211e3254c1c06c 🟢 5.6
Details
CheckScoreReason
Code-Review🟢 10all changesets reviewed
Maintained🟢 56 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 5
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Binary-Artifacts🟢 10no binaries found in the repo
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Packaging⚠️ -1packaging workflow not detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
SAST🟢 10SAST tool is run on all commits
gomod/github.com/radius-project/resource-types-contrib 0.0.0-20260515162318-067b29d71eb8 UnknownUnknown

Scanned Files

  • .github/workflows/verify-resource-types.yaml
  • go.mod

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes resource-types-contrib the source of truth for the default resource type manifests shipped with Radius by introducing a local sync target and a PR-time drift check, plus updating the built-in provider manifests to be per-resource-type and omit location so routing uses UCP’s DefaultDownstreamEndpoint.

Changes:

  • Add make update-resource-types / make sync-resource-types to copy default manifests listed in deploy/manifest/defaults.yaml from the pinned resource-types-contrib module version.
  • Add a GitHub Actions workflow that re-runs make sync-resource-types and fails if the committed copies drift.
  • Refactor built-in provider manifests to per-type files (and add an integration test covering manifest registration without location).

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.github/workflows/verify-resource-types.yaml Adds PR-time drift detection by re-syncing and diffing built-in provider manifests.
build/resource-types.mk Implements local sync/version-bump targets to copy manifests from the Go module cache.
deploy/manifest/defaults.yaml Declares which <namespace>/<typeName> resource types ship as defaults and are synced.
deploy/manifest/built-in-providers/dev/containers.yaml Updates dev built-in manifests to per-type layout and removes explicit location.
deploy/manifest/built-in-providers/dev/mySqlDatabases.yaml Removes explicit location and aligns formatting with upstream per-type manifest.
deploy/manifest/built-in-providers/dev/persistentVolumes.yaml Adds per-type persistentVolumes manifest synced from upstream.
deploy/manifest/built-in-providers/dev/routes.yaml Adds per-type routes manifest synced from upstream.
deploy/manifest/built-in-providers/dev/secrets.yaml Removes explicit location and updates schema/docs per upstream manifest.
deploy/manifest/built-in-providers/self-hosted/containers.yaml Updates self-hosted built-in manifests to per-type layout and removes explicit location.
deploy/manifest/built-in-providers/self-hosted/mySqlDatabases.yaml Removes explicit location and aligns formatting with upstream per-type manifest.
deploy/manifest/built-in-providers/self-hosted/persistentVolumes.yaml Adds per-type persistentVolumes manifest synced from upstream.
deploy/manifest/built-in-providers/self-hosted/routes.yaml Adds per-type routes manifest synced from upstream.
deploy/manifest/built-in-providers/self-hosted/secrets.yaml Removes explicit location and updates schema/docs per upstream manifest.
deploy/manifest/built-in-providers/dev/radius_compute.yaml (removed) Removes old namespace-bundled manifest (superseded by per-type YAMLs).
deploy/manifest/built-in-providers/self-hosted/radius_compute.yaml (removed) Removes old namespace-bundled manifest (superseded by per-type YAMLs).
deploy/manifest/built-in-providers/dev/radius_data.yaml (removed) Removes old namespace-bundled manifest (superseded by per-type YAMLs).
deploy/manifest/built-in-providers/self-hosted/radius_data.yaml (removed) Removes old namespace-bundled manifest (superseded by per-type YAMLs).
deploy/manifest/built-in-providers/dev/radius_security.yaml (removed) Removes old namespace-bundled manifest (superseded by per-type YAMLs).
deploy/manifest/built-in-providers/self-hosted/radius_security.yaml (removed) Removes old namespace-bundled manifest (superseded by per-type YAMLs).
pkg/resourcetypescontrib/import.go Adds a blank import to keep resource-types-contrib pinned in go.mod.
go.mod Pins github.com/radius-project/resource-types-contrib dependency version.
go.sum Adds checksums for the new module dependency.
Makefile Includes build/resource-types.mk to expose the new targets.
pkg/ucp/integrationtests/resourceproviders/resourceproviders_test.go Adds a test ensuring manifests without location are registered at startup.
pkg/ucp/integrationtests/resourceproviders/testdata/manifests-no-location/containers.yaml Adds a minimal no-location manifest fixture for the new integration test.
Comments suppressed due to low confidence (2)

deploy/manifest/built-in-providers/dev/containers.yaml:53

  • Typo in the manifest description: "emphemeral" should be "ephemeral". Since this file is now synced from resource-types-contrib, fix it upstream and re-run make sync-resource-types to update the copy.
    deploy/manifest/built-in-providers/self-hosted/containers.yaml:53
  • Typo in the manifest description: "emphemeral" should be "ephemeral". Since this file is now synced from resource-types-contrib, fix it upstream and re-run make sync-resource-types to update the copy.

Comment thread .github/workflows/verify-resource-types.yaml
Comment thread .github/workflows/verify-resource-types.yaml Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

Unit Tests

    2 files  ±0    423 suites  +1   7m 24s ⏱️ +15s
5 128 tests +1  5 126 ✅ +1  2 💤 ±0  0 ❌ ±0 
6 157 runs  +1  6 155 ✅ +1  2 💤 ±0  0 ❌ ±0 

Results for commit 2f3c43a. ± Comparison against base commit b4f6667.

♻️ This comment has been updated with latest results.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.71%. Comparing base (b4f6667) to head (2f3c43a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11911      +/-   ##
==========================================
+ Coverage   51.70%   51.71%   +0.01%     
==========================================
  Files         726      726              
  Lines       45608    45608              
==========================================
+ Hits        23581    23587       +6     
+ Misses      19798    19795       -3     
+ Partials     2229     2226       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread deploy/manifest/defaults.yaml
Comment thread pkg/resourcetypescontrib/import.go
Comment thread build/resource-types.mk
nithyatsu
nithyatsu previously approved these changes May 15, 2026
kachawla added 4 commits May 15, 2026 11:51
Replace manually-maintained per-namespace manifest files with per-type
manifest files copied from resource-types-contrib. This eliminates
schema drift by making resource-types-contrib the single source of
truth for resource type schemas that ship as defaults in Radius.

File layout change: Previously, built-in-providers/ contained one YAML
file per namespace (e.g. radius_compute.yaml with containers, routes,
and persistentVolumes all in one file). Now each resource type has its
own file (containers.yaml, routes.yaml, persistentVolumes.yaml, etc.),
matching the per-type file layout in resource-types-contrib. This makes
it straightforward to map defaults.yaml entries to files and keeps diffs
scoped to the type that changed.

Changes:
- Add deploy/manifest/defaults.yaml listing default resource types
- Add build/resource-types.mk with update-resource-types and
  sync-resource-types Makefile targets
- Add pkg/resourcetypescontrib/import.go with a blank import to keep
  resource-types-contrib in go.mod across go mod tidy
- Add go.mod dependency on resource-types-contrib pinned to
  v0.0.0-20260515162318-067b29d71eb8
- Copy per-type manifest files from resource-types-contrib into both
  dev/ and self-hosted/ directories
- Remove old per-namespace files (radius_compute.yaml,
  radius_data.yaml, radius_security.yaml) from both directories
- Add .github/workflows/verify-resource-types.yaml for CI drift
  detection
- Add integration test for no-location manifest registration

The copied manifests have no 'location' field, so UCP routes requests
via DefaultDownstreamEndpoint (dynamic-rp), matching existing behavior.

Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
Shell comments (#) inside multi-line backslash-continued recipe blocks
break the continuation chain, causing 'Syntax error: end of file
unexpected' in CI. Move all inline comments to standalone @# lines
before the shell block they describe.

Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
Verify the global location resource is created with no address property,
confirming UCP will use DefaultDownstreamEndpoint for routing.

Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
@kachawla kachawla force-pushed the kachawla/automate-resource-types branch from 5a5922a to e2af82c Compare May 15, 2026 18:52
Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
nithyatsu added a commit that referenced this pull request May 15, 2026
# Description

Adding mysql type to default recipepack as a quick follow up to
#11911

---------

Signed-off-by: Nithya Subramanian <nithyasu@microsoft.com>
@radius-functional-tests
Copy link
Copy Markdown

radius-functional-tests Bot commented May 15, 2026

Radius functional test overview

🔍 Go to test action run

Click here to see the test run details
Name Value
Repository radius-project/radius
Commit ref 2f3c43a
Unique ID func334174a165
Image tag pr-func334174a165
  • gotestsum 1.13.0
  • KinD: v0.29.0
  • Dapr: 1.14.4
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func334174a165
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func334174a165
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func334174a165
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func334174a165
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func334174a165
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting ucp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
✅ corerp-cloud functional tests succeeded
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@kachawla kachawla merged commit 73acc9a into main May 15, 2026
61 checks passed
@kachawla kachawla deleted the kachawla/automate-resource-types branch May 15, 2026 21:37
kachawla added a commit that referenced this pull request May 15, 2026
…11914)

## Overview

Update the existing `generate` subcommand of `manifest-to-bicep` to
accept multiple manifest files. When given multiple YAML manifests with
the same namespace, their `Types` maps are merged into a single output
(`types.json`, `index.json`, `index.md`).

This supports per-type manifest files (e.g. `containers.yaml`,
`routes.yaml`) as introduced by the [automated resource type
registration
design](#11911), where each
file defines a single resource type within a namespace.

Backward compatible: single-file usage works exactly as before.

## Changes

- `bicep-tools/cmd/manifest-to-bicep/main.go`: Updated `generate` to
accept `<manifest1> [manifest2...] <output>` (last arg is always output
dir). Added `mergeManifestFiles()` that validates same namespace and
rejects duplicate types.
- `bicep-tools/cmd/manifest-to-bicep/main_test.go`: Added tests for
single-file, multi-file merge, namespace mismatch, nonexistent file,
empty manifest list, and duplicate type detection.
- `bicep-tools/cmd/manifest-to-bicep/testdata/`: Added test manifest
files for `Radius.Compute` (containers, routes) and `Radius.Security`
(secrets).

## Usage

Single file (backward compatible):
```bash
go run ./bicep-tools/cmd/manifest-to-bicep generate containers.yaml /tmp/out
```

Multiple files (merge into one output):
```bash
go run ./bicep-tools/cmd/manifest-to-bicep generate containers.yaml routes.yaml persistentVolumes.yaml /tmp/out
```

## Test plan

- `go test ./bicep-tools/cmd/manifest-to-bicep/` - 6 tests covering
single-file generation, multi-file merge, namespace mismatch rejection,
nonexistent file handling, empty input, and duplicate type detection.

## Part of

Unified Bicep extension publishing (PR 1/4). See [design
doc](#11892).

## Dependencies

- [Automated default resource type
registration](#11911)
(provides `defaults.yaml` and per-type manifest files that this command
consumes)

---------

Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants