Skip to content

✨ chore(crd): Add a named EmbeddedObjectMeta type when generateEmbeddedObjectMeta is enabled#1397

Open
camilamacedo86 wants to merge 1 commit into
kubernetes-sigs:mainfrom
camilamacedo86:object-data
Open

✨ chore(crd): Add a named EmbeddedObjectMeta type when generateEmbeddedObjectMeta is enabled#1397
camilamacedo86 wants to merge 1 commit into
kubernetes-sigs:mainfrom
camilamacedo86:object-data

Conversation

@camilamacedo86
Copy link
Copy Markdown
Member

@camilamacedo86 camilamacedo86 commented Apr 27, 2026

Problem

CRD schemas did not clearly show which fields were embedded ObjectMeta.

You had to guess by matching field names (name, namespace, labels, etc).

Solution

When generateEmbeddedObjectMeta=true:

  • Embedded ObjectMeta is generated as a named type
  • New type: EmbeddedObjectMeta
  • Can be identified directly (no guessing)

Example

Before (anonymous)

type MyResource struct {
    Template corev1.PodTemplateSpec `json:"template"`
}

After (named type)

type MyResource struct {
    Template corev1.PodTemplateSpec `json:"template"`
}

Generated schema:

  • Registers EmbeddedObjectMeta type
  • Example:
TypeIdent{Name: "EmbeddedObjectMeta", Package: metav1}

Closes: #805

@k8s-ci-robot k8s-ci-robot requested a review from JoelSpeed April 27, 2026 09:39
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: camilamacedo86
Once this PR has been reviewed and has the lgtm label, please assign alvaroaleman for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested a review from vincepri April 27, 2026 09:39
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Promote minimized CRD ObjectMeta type to be it's own named type

2 participants