kubernetes-sigs/controller-tools

Update to custom field in custom resource condition is silently dropped

kangy-google opened this issue · 9 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?

Is that in status?

Is that in status?

Yes, this is in status.

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

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.

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

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

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

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: 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.