Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to custom field in custom resource condition is silently dropped #981

Open
kangy-google opened this issue May 23, 2024 · 5 comments

Comments

@kangy-google
Copy link

Hello,

I added a custom field to the condition field of my CRD that looks like the following:

type CrCondition struct {
    // Ignore standard fields
    Metadata *ConditionMetadata `json:"metadata,omitempty"`
}

type ConditionMetadata struct {
    Items []ConditionMetadataItem `json:"items,omitempty"`
}

type ConditionMetadataItem struct {
    Key   string `json:"key"`
    Value string `json:"value"`
}

I was hoping to keep track of some metadata along with the condition. However, it seems that when the condition was updated, the metadata field was silently dropped. I can verify with kubectl edit. The command went through without validation error, but the output of the new resource doesn't have the metadata field. Why is this?

@sbueringer
Copy link
Member

Is that in status?

@kangy-google
Copy link
Author

Is that in status?

Yes, this is in status.

@sbueringer
Copy link
Member

You have to use --subresource=status to modify status with kubectl edit

@kangy-google
Copy link
Author

Hey, if I understand it correctly, that is for the case where subresource is enabled. I have not enabled it for my resource.

Also, other custom fields with string type can be updated just fine, so I wonder if it has anything to do with the data type.

@sbueringer
Copy link
Member

sbueringer commented May 24, 2024

I don't see anything obviously wrong. If those fields also exist in the CRD that you have deployed, there should be no reason why the values should be dropped

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

No branches or pull requests

2 participants