Skip to content

Commit 1f17841

Browse files
authored
Merge pull request #7477 from jpbetz/kubebuilder-tags
Update example for conditions to use SSA go tags
2 parents 868de7d + ea6cd12 commit 1f17841

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

contributors/devel/sig-architecture/api-conventions.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,11 @@ Conditions are most useful when they follow some consistent conventions:
425425
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).
426426
It should be included as a top level element in status, similar to
427427
```go
428+
// +listType=map
429+
// +listMapKey=type
430+
// +patchStrategy=merge
431+
// +patchMergeKey=type
432+
// +optional
428433
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
429434
```
430435

@@ -979,7 +984,7 @@ All forms of defaulting should only make the following types of modifications:
979984
- Setting previously unset fields
980985
- Adding keys to maps
981986
- Adding values to arrays which have mergeable semantics
982-
(`patchStrategy:"merge"` attribute in the type definition)
987+
(`+listType=map` tag or `patchStrategy:"merge"` attribute in the type definition)
983988

984989
In particular we never want to change or override a value that was provided by
985990
the user. If they requested something invalid, they should get an error.

0 commit comments

Comments
 (0)