controller-tools icon indicating copy to clipboard operation
controller-tools copied to clipboard

Update to custom field in custom resource condition is silently dropped

Open kangy-google opened this issue 1 year ago • 5 comments

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?

kangy-google avatar May 23 '24 22:05 kangy-google

Is that in status?

sbueringer avatar May 24 '24 05:05 sbueringer

Is that in status?

Yes, this is in status.

kangy-google avatar May 24 '24 06:05 kangy-google

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

sbueringer avatar May 24 '24 13:05 sbueringer

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.

kangy-google avatar May 24 '24 14:05 kangy-google

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

sbueringer avatar May 24 '24 15:05 sbueringer

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Aug 22 '24 15:08 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Sep 21 '24 16:09 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-triage-robot avatar Oct 21 '24 17:10 k8s-triage-robot

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Oct 21 '24 17:10 k8s-ci-robot