Skip to content

Commit 9af2eff

Browse files
authored
Remove no-op patch strategy tags and markers (#2225)
* `+patchStrategy` and `+patchMergeKey` markers are not supported by controller-gen, see https://github.com/kubernetes-sigs/controller-tools/tree/main/pkg/crd/markers * `patchStrategy` and `patchMergeKey` golang tags are of no use for CRDs. They have their use in k8s core types in order to produce proper strategic merge patches, see https://github.com/kubernetes/community/blob/master/contributors/devel/sig-api-machinery/strategic-merge-patch.md but are superseded by `+listType` and `+listMapKey` in CRD world. It removal, as expected, did not provide any effect on the generated resources.
1 parent 27b05e7 commit 9af2eff

File tree

4 files changed

+4
-12
lines changed

4 files changed

+4
-12
lines changed

api/v1/clustercatalog_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ type ClusterCatalogStatus struct {
182182
// +listType=map
183183
// +listMapKey=type
184184
// +optional
185-
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
185+
Conditions []metav1.Condition `json:"conditions,omitempty"`
186186
// resolvedSource contains information about the resolved source based on the source type.
187187
// +optional
188188
ResolvedSource *ResolvedCatalogSource `json:"resolvedSource,omitempty"`

api/v1/clusterextension_types.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,12 +485,10 @@ type ClusterExtensionStatus struct {
485485
// PackageDeprecated is set if the requested package is marked deprecated in the catalog.
486486
// Deprecated is a rollup condition that is present when any of the deprecated conditions are present.
487487
//
488-
// +patchMergeKey=type
489-
// +patchStrategy=merge
490488
// +listType=map
491489
// +listMapKey=type
492490
// +optional
493-
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
491+
Conditions []metav1.Condition `json:"conditions,omitempty"`
494492

495493
// install is a representation of the current installation status for this ClusterExtension.
496494
//

api/v1/clusterextensionrevision_types.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ type ClusterExtensionRevisionSpec struct {
5959
//
6060
// +kubebuilder:validation:Required
6161
// +kubebuilder:validation:XValidation:rule="self == oldSelf || oldSelf.size() == 0", message="phases is immutable"
62-
// +patchMergeKey=name
63-
// +patchStrategy=merge
6462
// +listType=map
6563
// +listMapKey=name
6664
Phases []ClusterExtensionRevisionPhase `json:"phases"`
@@ -135,12 +133,10 @@ type ClusterExtensionRevisionPrevious struct {
135133

136134
// ClusterExtensionRevisionStatus defines the observed state of a ClusterExtensionRevision.
137135
type ClusterExtensionRevisionStatus struct {
138-
// +patchMergeKey=type
139-
// +patchStrategy=merge
140136
// +listType=map
141137
// +listMapKey=type
142138
// +optional
143-
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
139+
Conditions []metav1.Condition `json:"conditions,omitempty"`
144140
}
145141

146142
// +kubebuilder:object:root=true

hack/tools/crd-generator/testdata/api/v1/clusterextension_types.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,12 +457,10 @@ type ClusterExtensionStatus struct {
457457
// PackageDeprecated is set if the requested package is marked deprecated in the catalog.
458458
// Deprecated is a rollup condition that is present when any of the deprecated conditions are present.
459459
//
460-
// +patchMergeKey=type
461-
// +patchStrategy=merge
462460
// +listType=map
463461
// +listMapKey=type
464462
// +optional
465-
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
463+
Conditions []metav1.Condition `json:"conditions,omitempty"`
466464

467465
// install is a representation of the current installation status for this ClusterExtension.
468466
//

0 commit comments

Comments
 (0)