Skip to content

feat(apply): flatten native manifest envelope - #772

Merged
thokra-nav merged 3 commits into
mainfrom
flatten-nais-yaml
Sep 10, 2026
Merged

thokra-nav merged 3 commits into
mainfrom
flatten-nais-yaml

Conversation

@thokra-nav

Copy link
Copy Markdown
Contributor

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.

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>
@thokra-nav
thokra-nav requested a lite review from Copilot September 10, 2026 10:38
@github-actions

Copy link
Copy Markdown
Contributor

📝 Changelog preview

Below 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-10

Full Changelog: v5.47.0...v5.48.0

🚀 Features

  • (apply) Flatten native manifest envelope (a78301d)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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-level type, name, and labels.
  • Updated apply flow and resource implementations to use m.Type/m.Name/m.Labels instead of passing name/labels through resource.Metadata.
  • Updated unit tests to construct manifests using Type and 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 validating kind and metadata.name, but the envelope is now type + 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.

Comment thread internal/apply/resource/parse_test.go
Comment thread internal/apply/resource/parse_test.go
Comment thread internal/apply/resource/parse.go Outdated
Comment thread internal/apply/resource/resource.go Outdated
@thokra-nav
thokra-nav enabled auto-merge (squash) September 10, 2026 10:50
@thokra-nav
thokra-nav merged commit e21603d into main Sep 10, 2026
22 checks passed
@thokra-nav
thokra-nav deleted the flatten-nais-yaml branch September 10, 2026 10:55
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.

2 participants