feat(apply): flatten native manifest envelope - #772
Conversation
Replace native manifest fields from `kind` + `metadata.name`/`labels` to top-level `type`, `name`, and `labels`, and switch apply/resource code paths to use `Manifest` values directly for name/labels. Co-authored-by: Christer Edvartsen <christer.edvartsen@nav.no>
📝 Changelog previewBelow is a preview of the Changelog that will be added to the next release. Only commit messages that follow the Conventional Commits specification will be included in the Changelog. v5.48.0 - 2026-09-10Full Changelog: v5.47.0...v5.48.0 🚀 Features
|
There was a problem hiding this comment.
🟡 Changes recommended
Several updated code comments and test fixtures are now inconsistent with the flattened manifest format, which can mislead readers and weaken the test coverage of real-world inputs.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the nais-native “stripped manifest” envelope to be flat (type, name, labels) instead of nested (kind + metadata.name/metadata.labels), and aligns apply/resource handlers to use Manifest for name/labels consistently.
Changes:
- Flattened native manifest parsing from
kind+metadata.*to top-leveltype,name, andlabels. - Updated apply flow and resource implementations to use
m.Type/m.Name/m.Labelsinstead of passing name/labels throughresource.Metadata. - Updated unit tests to construct manifests using
Typeand the new YAML shape.
File summaries
| File | Description |
|---|---|
| internal/apply/resource/valkey.go | Switches Valkey apply path to use Manifest name/labels. |
| internal/apply/resource/resource.go | Removes name/labels from apply metadata and resolves stripped manifests by m.Type. |
| internal/apply/resource/resource_test.go | Updates manifest resolution tests to use Type. |
| internal/apply/resource/parse.go | Implements flattened envelope parsing (type/name/labels) and updates ignored-field detection accordingly. |
| internal/apply/resource/parse_test.go | Updates YAML fixtures and assertions for the new envelope fields. |
| internal/apply/resource/opensearch.go | Switches OpenSearch apply path to use Manifest name. |
| internal/apply/resource/config.go | Switches Config apply path to use Manifest name. |
| internal/apply/apply.go | Updates apply output/errors and CRD conversion to use m.Type and stops passing name/labels via resource.Metadata. |
| internal/apply/apply_test.go | Updates apply tests’ YAML fixtures to use type/name. |
Review details
Suppressed comments (1)
internal/apply/resource/parse.go:78
ParseManifest’s doc comment still describes validatingkindandmetadata.name, but the envelope is nowtype+name; the comment should be updated to match the new format.
// ParseManifest parses a nais-native manifest into a Manifest, validating the
// envelope (kind, metadata.name, supported version). Fields outside the format
// are not rejected here but returned in Manifest.IgnoredFields for the caller to
// error or warn on.
- Files reviewed: 9/9 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Replace native manifest fields from
kind+metadata.name/labelsto top-leveltype,name, andlabels, and switch apply/resource code paths to useManifestvalues directly for name/labels.