-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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 example for conditions to use SSA go tags #7477
Conversation
cc @liggitt |
@@ -428,6 +428,15 @@ It should be included as a top level element in status, similar to | |||
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need the listType / listMapKey comments in built-in types as well, or is the patchStrategy/patchMergeKey inherited by SSA?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"If listType is missing, the API server interprets a patchMergeStrategy=merge marker as a listType=map and the corresponding patchMergeKey marker as a listMapKey." (xref)
That said, it looks like Conditions for built-in types are often defined as:
// +listType=map
// +listMapKey=type
I can update this doc for that as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, if we include that and patchStrategy/patchMergeKey, that works for built-in and kubebuilder types, so we can drop the kubebuilder language
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@apelisse is there any reason to recommend +patchStrategy
and +patchMergeKey
on new built-in types? I see a mix of "only patchStrategy/patchMergeKey", "both patchStrategy/patchMergeKey and SSA listType/listMapKey" and "only SSA listType/listMapKey" in the built-in types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplified to just use SSA in the built-in example form
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well… don't we want CSA to still work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found another patch strategy ref in the doc. I've updated that too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well… don't we want CSA to still work?
I'm not sure. We have a couple cases like: https://github.com/kubernetes/kubernetes/blob/f8b5f1a77bbab217159b1d024000770f8c95ed97/staging/src/k8s.io/api/flowcontrol/v1beta2/types.go#L360
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we audit all of this? I'm seeing a wide range of annotation patterns. There are some surprising things in here like JobCondition where SSA uses atomic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, a sweep is probably good
5104ee3
to
efb5435
Compare
@@ -425,7 +425,10 @@ Conditions are most useful when they follow some consistent conventions: | |||
Conditions should follow the standard schema included in [k8s.io/apimachinery/pkg/apis/meta/v1/types.go](https://github.com/kubernetes/apimachinery/blob/release-1.23/pkg/apis/meta/v1/types.go#L1432-L1492). | |||
It should be included as a top level element in status, similar to | |||
```go | |||
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` | |||
// +listType=map | |||
// +listMapKey=type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would include these as well to keep client-side apply working as we want
// +patchStrategy=merge
// +patchMergeKey=type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I'll do a sweep separately.
efb5435
to
ea6cd12
Compare
/lgtm |
/assign @johnbelamaric |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: johnbelamaric, jpbetz, liggitt The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Which issue(s) this PR fixes:
Fixes kubernetes/autoscaler#5848 (comment)