Repository navigation
Description
Current Behavior
When a source (Helm chart, GitHub repo or URL) contains two CRDs with the same spec.names.kind in different API groups, model generation writes only one of them. The other is dropped with no error and no log line.
This already affects published models on meshery/meshery master:
- linkerd (
models/linkerd/edge-26.11.1): the chart has 14 CRDs, the model has 13 components.HTTPRoute.jsonis the Gateway API HTTPRoute (gateway.networking.k8s.io/v1). Linkerd's ownpolicy.linkerd.ioHTTPRoute (served, not deprecated) is missing. Same in edge-26.6.2, edge-26.9.1 and edge-26.10.2. - crossplane (
models/crossplane/v2.4.3): 21 CRDs, 20 components.Usage.jsonisapiextensions.crossplane.io/v1alpha1, which upstream marksdeprecated: true("migrate to protection.crossplane.io"). Its replacement, the namespacedprotection.crossplane.io/v1beta1Usage, is missing, while its siblingClusterUsageis present. Same in v2.3.2 and v2.4.0.
Which CRD survives depends only on file order.
Expected Behavior
Every CRD in the source becomes a component. Kubernetes allows the same Kind in different groups, and the rest of the pipeline already supports it:
- component IDs are random UUIDs (
GenerateIDin schemascomponent_helper.go:28), so nothing in the DB requires Kind to be unique within a model; - the registry's unique-component count keys on Kind + apiVersion + model + model version (
models/meshmodel/registry/v1beta1/component_filter.go:60); - directory registration (
models/registration/dir.go:74, used by server seeding and import) reads every.jsonfile regardless of its name.
So both components should be written and registered.
Root cause
ComponentDefinition.WriteComponentDefinition(meshery/schemasmodels/v1beta3/component/component_helper.go:84-98, same on schemas master today) names the file<Kind>.json. If that file already exists it returnsalreadyExists = trueand writes nothing.- meshkit treats that as "already generated on an earlier run" and only decrements the written count:
registry/model.go:640-646(GenerateComponentsFromPkg)registry/model.go:998-1001(InvokeGenerationFromSheetWithOptions, which is what the nightlymodel-generator.ymljob runs throughmesheryctl registry generate)registry/model.go:1138-1148
- The generators keep both CRDs:
utils/component/generator.go:126setscomponent.version = <group>/<version>, so the two components differ only in apiVersion. The loss happens at write time.
Screenshots/Logs
Output of the test below (trimmed):
generated: HTTPRoute gateway.networking.k8s.io/v1
generated: HTTPRoute policy.linkerd.io/v1alpha1
total=14 written=13 err=<nil>
on disk: HTTPRoute.json gateway.networking.k8s.io/v1
Running the same pipeline on the source URIs of the published models (git://github.com/linkerd/linkerd2/main/charts/linkerd-crds/ and git://github.com/crossplane/crossplane/master/cluster/crds) writes 13 and 20 components, the same counts as the published models, and keeps the same files.
Environment
- Host OS: Mac
- Platform: N/A (model generation, no running server)
- meshkit: master @ 2157006 (
registry/model.gois identical to v1.0.24, the release meshery master uses) - meshery/schemas: v1.3.115 (meshkit master) and v1.3.37 (meshery master);
WriteComponentDefinitionis the same in both and on schemas master - meshery/meshery: master, commit meshery/meshery@8ad258e7 (meshkit v1.0.24, schemas v1.3.37)
To Reproduce
- Download the linkerd-crds chart for edge-26.11.1: https://helm.linkerd.io/edge/linkerd-crds-2026.11.1.tgz
- Run it through
GitHubPackageManager.GetPackage()->pkg.GenerateComponents("")->registry.GenerateComponentsFromPkg(...)with the test below. - 14 components are generated but only 13 files are written. There is no file for the
policy.linkerd.ioHTTPRoute.
Test used
package github_test
import (
"encoding/json"
"net/http"
"net/http/httptest"
"net/url"
"os"
"path/filepath"
"testing"
"github.com/meshery/meshkit/generators/github"
"github.com/meshery/meshkit/registry"
_model "github.com/meshery/schemas/models/v1beta1/model"
"github.com/meshery/schemas/models/v1beta3/component"
)
func TestSameKindDifferentGroup(t *testing.T) {
dir := os.Getenv("REPRO_DIR") // contains linkerd-crds-2026.11.1.tgz
if dir == "" {
t.Skip("REPRO_DIR not set")
}
srv := httptest.NewServer(http.FileServer(http.Dir(dir)))
defer srv.Close()
u, _ := url.Parse(srv.URL + "/linkerd-crds-2026.11.1.tgz")
pkg, err := github.GitHubPackageManager{PackageName: "repro", SourceURL: u.String()}.GetPackage()
if err != nil {
t.Fatal(err)
}
comps, _ := pkg.GenerateComponents("")
for _, c := range comps {
t.Logf("generated: %-12s %s", c.Component.Kind, c.Component.Version)
}
out := t.TempDir()
total, written, err := registry.GenerateComponentsFromPkg(pkg, out, "v1.0.0", _model.ModelDefinition{Name: "repro"}, "")
t.Logf("total=%d written=%d err=%v", total, written, err)
files, _ := filepath.Glob(filepath.Join(out, "*.json"))
for _, f := range files {
var c component.ComponentDefinition
b, _ := os.ReadFile(f)
_ = json.Unmarshal(b, &c)
t.Logf("on disk: %-16s %s", filepath.Base(f), c.Component.Version)
}
}Run: REPRO_DIR=<dir> go test -count=1 -run TestSameKindDifferentGroup -v ./generators/github/
Proposed fix
Fix it in the writer in meshery/schemas, so every caller gets it: the three generation paths in meshkit registry/model.go, and ExportModel in meshery (server/handlers/component_handler.go:1465), which would drop one of the two in the same way when exporting a model that has both.
- The first component keeps
<Kind>.json, so existing models and file paths do not change. - A component of the same Kind from another API group is written to
<Kind>.<group>.json(corefor the core group), for exampleHTTPRoute.policy.linkerd.io.json. - A component from the same group, in any version, still returns "already exists", so re-running generation into an existing directory works as it does today.
- The signature and return values stay the same, so no caller has to change.
I tried this with a replace to the patched schemas, running the same pipeline: linkerd writes 14 of 14 components (HTTPRoute.json and HTTPRoute.policy.linkerd.io.json) and crossplane 21 of 21 (Usage.json and Usage.protection.crossplane.io.json). Same-group duplicates are still skipped: the linkerd git:// source returns 70 entries and 14 files are written.
Why not the other options:
- Naming every file
<Kind>.<group>.jsonwould rename every component file in every published model. - Keeping one component per Kind would still lose a real CRD.
After the schemas release:
- meshkit: a regression test with two same-Kind CRDs, once the schemas bump is merged.
- meshery/meshery: bump schemas, so the nightly model generator adds the missing linkerd and crossplane components.
Two things to keep in mind:
- Open PR [UI] Deduplicate Design Configurator components by kind meshery#22523 (the fix for [UI] Design Configurator never removes duplicate components (dedup keys on the object, not the kind) meshery#22522) makes the Design Configurator list one entry per Kind per model version. Once both HTTPRoute components exist, that would hide one of them, so it may need to key on Kind + group instead.
- The generated
policy.linkerd.ioHTTPRoute usesv1alpha1, the first version listed in the CRD, rather than the storage versionv1beta3. That is a separate issue; I can file it after this one.
I have the schemas change ready and will open the PR there, linked to this issue.
Contributor Guides and Handbook
- 🛠 Meshery Build & Release Strategy
- 📚 Instructions for contributing to documentation
- 🎨 Wireframes and designs for Meshery UI in Figma (open invite)
- 🙋🏾🙋🏼 Questions: Discussion Forum and Community Slack
Activity
fix(component): handle shared group labels, removed files and concurr…
fix(component): return directory errors instead of reporting the comp…
Prakhar1Ojha commentedon Nov 24, 2026
Hi maintainers @leecalcote,
I would love to work on this issue!
I have investigated the problem in model generation where CRDs sharing
spec.names.kindacross different API groups overwrite each other because components are mapped and keyed by bare Kind rather than group-qualified identifiers.My proposed plan:
(Group, Kind)rather than bare Kind alone.utils/component/generator_test.gowith sample manifests containing identical Kinds in different API groups (matching the Linkerd/Crossplane scenario) to verify neither CRD is dropped.Could you please assign this issue to me? Thank you!