Skip to content

Fix server-side apply for search resources#75

Merged
scotwells merged 5 commits intomainfrom
fix/openapi-ssa-compatibility
Mar 18, 2026
Merged

Fix server-side apply for search resources#75
scotwells merged 5 commits intomainfrom
fix/openapi-ssa-compatibility

Conversation

@scotwells
Copy link
Copy Markdown
Contributor

@scotwells scotwells commented Mar 18, 2026

What's going on?

Server-side apply is broken for ResourceIndexPolicy resources. When something tries to kubectl apply --server-side, it blows up with:

no corresponding type for search.miloapis.com/v1alpha1, Kind=ResourceIndexPolicy

This is the same bug the activity service ran into — the OpenAPI schema is missing type metadata that SSA relies on to track who owns which fields. The root cause is that GetDefinitionName transforms names in the wrong order, so the DefinitionNamer never finds the GVK extensions.

Fixes #74

What's changing?

  • Fixed the OpenAPI config to transform Go module paths to REST-friendly format before looking them up in the DefinitionNamer (matching what activity did)
  • Re-compute the definitions with corrected $ref callbacks for both v2 and v3
  • Added unit tests proving the old approach drops GVK extensions and the new approach preserves them
  • Added an end-to-end chainsaw test that creates and updates a ResourceIndexPolicy via kubectl apply --server-side

🤖 Generated with Claude Code

Add unit tests verifying GVK extensions are present for SSA, and an e2e
chainsaw test that exercises server-side apply on ResourceIndexPolicy.
The e2e test will fail against the current server because the OpenAPI
$ref resolution doesn't produce correct REST-friendly definition names.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
scotwells and others added 4 commits March 17, 2026 21:47
Move catch/finally to step level and merge verify-policy-updated into the
update step to match chainsaw v1alpha1 schema.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Transform Go module paths to REST-friendly format before looking them up
in DefinitionNamer, so GVK extensions are returned. Re-compute definitions
with corrected $ref callbacks for both OpenAPI v2 and v3.

This matches the approach used by the activity service in PR #90.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Avoid conflict with other tests that use the same targetResource by
using a dedicated API group for the SSA test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The API server omits zero-value booleans (searchable: false), causing the
assertion to fail. Use searchable: true for the third field instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@scotwells scotwells merged commit 0bb17e8 into main Mar 18, 2026
7 checks passed
@scotwells scotwells deleted the fix/openapi-ssa-compatibility branch March 18, 2026 03:45
@github-project-automation github-project-automation bot moved this from Backlog to Done in Searching Resources in Milo Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ResourceIndexPolicy CRD not found in Milo staging

2 participants