Skip to content

fix(dashboard): periodic OCI repo discovery from k8s for late-arriving CRDs#130

Merged
edu-diaz merged 4 commits intomainfrom
fix/legacy-contract-compat
Apr 4, 2026
Merged

fix(dashboard): periodic OCI repo discovery from k8s for late-arriving CRDs#130
edu-diaz merged 4 commits intomainfrom
fix/legacy-contract-compat

Conversation

@edu-diaz
Copy link
Copy Markdown
Contributor

@edu-diaz edu-diaz commented Apr 4, 2026

Summary

When the dashboard starts before all CRDs are deployed (e.g. ArgoCD hasn't synced yet), EnrichFromK8s only discovers repos that exist at startup. CRDs that appear later never get their OCI repos scanned, leaving those services with k8s-only data — no diffs, no full bundle details, no version enrichment.

Root cause: dashboard pod started at 10:04:14Z, but pacto-demo CRDs were created at 10:06:14Z by ArgoCD.

Changes

  • Add repoProvider callback to OCISource, called each background discovery cycle (60s)
  • Add RepoProviderFromSource factory that queries a DataSource for resolvedRef/imageRef fields
  • Dashboard wires this to the k8s source so late-arriving CRDs feed into OCI scanning
  • Move discoverOCIReposFromSource to source_oci.go (was in detect.go)

Test plan

  • TestOCISource_RepoProvider: dynamic repo discovery via provider callback
  • TestRepoProviderFromSource: factory creates working provider from DataSource
  • TestDiscoverOCIReposFromSource_*: skip no-ref, handle list errors, handle GetService errors
  • TestDiscoverOCIReposFromK8s_NilK8s: nil guard
  • Full CI passes (make ci)

edu-diaz added 4 commits April 4, 2026 12:29
Add UnmarshalYAML migration on Contract to transparently handle the
pre-#127 format: singular `configuration` field, dependencies and
policies without required `name`.

OCI bundles published before the breaking change fail to parse with
`field configuration not found`, which prevents caching and breaks
dashboard service details, diffs, and version tracking.

Migration rules:
- `configuration:` (object) → `configurations:` (array, name="default")
- `configuration: {configs: [...]}` → `configurations: [...]` (unwrap)
- Dependencies without name → derived from ref (last path segment)
- Policies without name → name="default"

New-format contracts are unaffected.
…g CRDs

When the dashboard starts before all CRDs are deployed (e.g. ArgoCD
hasn't synced yet), EnrichFromK8s only discovers repos that exist at
startup. CRDs that appear later never get their OCI repos scanned.

Add a repoProvider callback to OCISource that's called during each
background discovery cycle (every 60s). The dashboard wires this to
query k8s for resolvedRefs, so late-arriving CRDs automatically feed
into OCI scanning.

Also clear failedRepos on each cycle so previously failed repos are
retried (e.g. after the v1 format compat fix is deployed).

Root cause: dashboard pod started at 10:04:14Z, but pacto-demo CRDs
were created at 10:06:14Z by ArgoCD — 2 minutes after enrichment ran.
…rce_oci

- Remove v1 contract format migration (migrate.go) — bundles must use
  current format
- Extract RepoProviderFromSource to eliminate duplicated wiring lambdas
- Move discoverOCIReposFromSource to source_oci.go where it belongs
- Add tests for RepoProvider, discoverOCIReposFromSource, nil K8s guard
@edu-diaz edu-diaz changed the title fix(contract): backward-compatible parsing for v1 contract format fix(dashboard): periodic OCI repo discovery from k8s for late-arriving CRDs Apr 4, 2026
@edu-diaz edu-diaz merged commit 7fd664f into main Apr 4, 2026
14 checks passed
@edu-diaz edu-diaz deleted the fix/legacy-contract-compat branch April 4, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant