From 0b37f7585fd44e159744f115fc7c62a82a480849 Mon Sep 17 00:00:00 2001 From: Predrag Knezevic Date: Wed, 17 Sep 2025 15:23:13 +0200 Subject: [PATCH] Remove no-op patch strategy tags and markers * `+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. --- api/v1/clustercatalog_types.go | 2 +- api/v1/clusterextension_types.go | 4 +--- api/v1/clusterextensionrevision_types.go | 6 +----- .../crd-generator/testdata/api/v1/clusterextension_types.go | 4 +--- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/api/v1/clustercatalog_types.go b/api/v1/clustercatalog_types.go index ee1391b79..c18fa3c7e 100644 --- a/api/v1/clustercatalog_types.go +++ b/api/v1/clustercatalog_types.go @@ -182,7 +182,7 @@ type ClusterCatalogStatus struct { // +listType=map // +listMapKey=type // +optional - Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + Conditions []metav1.Condition `json:"conditions,omitempty"` // resolvedSource contains information about the resolved source based on the source type. // +optional ResolvedSource *ResolvedCatalogSource `json:"resolvedSource,omitempty"` diff --git a/api/v1/clusterextension_types.go b/api/v1/clusterextension_types.go index a2dd890c3..e331ec63e 100644 --- a/api/v1/clusterextension_types.go +++ b/api/v1/clusterextension_types.go @@ -485,12 +485,10 @@ type ClusterExtensionStatus struct { // PackageDeprecated is set if the requested package is marked deprecated in the catalog. // Deprecated is a rollup condition that is present when any of the deprecated conditions are present. // - // +patchMergeKey=type - // +patchStrategy=merge // +listType=map // +listMapKey=type // +optional - Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + Conditions []metav1.Condition `json:"conditions,omitempty"` // install is a representation of the current installation status for this ClusterExtension. // diff --git a/api/v1/clusterextensionrevision_types.go b/api/v1/clusterextensionrevision_types.go index 55fb4e726..f06b1e262 100644 --- a/api/v1/clusterextensionrevision_types.go +++ b/api/v1/clusterextensionrevision_types.go @@ -59,8 +59,6 @@ type ClusterExtensionRevisionSpec struct { // // +kubebuilder:validation:Required // +kubebuilder:validation:XValidation:rule="self == oldSelf || oldSelf.size() == 0", message="phases is immutable" - // +patchMergeKey=name - // +patchStrategy=merge // +listType=map // +listMapKey=name Phases []ClusterExtensionRevisionPhase `json:"phases"` @@ -135,12 +133,10 @@ type ClusterExtensionRevisionPrevious struct { // ClusterExtensionRevisionStatus defines the observed state of a ClusterExtensionRevision. type ClusterExtensionRevisionStatus struct { - // +patchMergeKey=type - // +patchStrategy=merge // +listType=map // +listMapKey=type // +optional - Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + Conditions []metav1.Condition `json:"conditions,omitempty"` } // +kubebuilder:object:root=true diff --git a/hack/tools/crd-generator/testdata/api/v1/clusterextension_types.go b/hack/tools/crd-generator/testdata/api/v1/clusterextension_types.go index c5c04d5b9..8e134a342 100644 --- a/hack/tools/crd-generator/testdata/api/v1/clusterextension_types.go +++ b/hack/tools/crd-generator/testdata/api/v1/clusterextension_types.go @@ -457,12 +457,10 @@ type ClusterExtensionStatus struct { // PackageDeprecated is set if the requested package is marked deprecated in the catalog. // Deprecated is a rollup condition that is present when any of the deprecated conditions are present. // - // +patchMergeKey=type - // +patchStrategy=merge // +listType=map // +listMapKey=type // +optional - Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + Conditions []metav1.Condition `json:"conditions,omitempty"` // install is a representation of the current installation status for this ClusterExtension. //