Skip to content

metadata field not created after creation of resource #2726

Closed Answered by camilamacedo86
akgowda asked this question in Support
Discussion options

You must be logged in to vote

Hi @akgowda,

I think you've correctly diagnosed the issue. In Kubernetes, the Custom Resource Definitions (CRDs) have a feature called "field pruning". This feature ensures that unknown fields in the custom resource (CR) don't get saved to etcd. Given this, if you define fields in the CR that aren't present in the CRD, they will be pruned and won't be saved.

For your DhruvaDeployment, the metadata under the template spec is not being preserved, hence the missing labels and annotations.

To retain these fields, you can use the x-kubernetes-preserve-unknown-fields: true annotation for the specific field in the CRD. In this case, you'd want to apply it to the metadata field of the template to…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@akgowda
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by camilamacedo86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
2 participants