From 3b129c2c7919449f4d3a847d6365b7dff4147399 Mon Sep 17 00:00:00 2001 From: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com> Date: Mon, 30 Jun 2025 08:49:04 +0100 Subject: [PATCH] plugin/deploy-image,v1alpha1: drop patchStrategy/protobuf tags from Conditions Simplify the Conditions field in status scaffolding by removing patchStrategy, patchMergeKey, and protobuf tags. Applied to: - deploy-image/alpha-v1 plugin template - Getting Started Memcached example These tags are unnecessary by default and can cause unintended merge behavior. This aligns with best practices for CRD scaffolding. --- .../testdata/project/api/v1alpha1/memcached_types.go | 2 +- hack/docs/internal/getting-started/generate_getting_started.go | 2 +- .../v1alpha1/scaffolds/internal/templates/api/types.go | 2 +- .../api/example.com/v1alpha1/busybox_types.go | 2 +- .../api/example.com/v1alpha1/memcached_types.go | 2 +- testdata/project-v4-with-plugins/api/v1alpha1/busybox_types.go | 2 +- .../project-v4-with-plugins/api/v1alpha1/memcached_types.go | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/book/src/getting-started/testdata/project/api/v1alpha1/memcached_types.go b/docs/book/src/getting-started/testdata/project/api/v1alpha1/memcached_types.go index c327bb4d025..bc9050e8d1b 100644 --- a/docs/book/src/getting-started/testdata/project/api/v1alpha1/memcached_types.go +++ b/docs/book/src/getting-started/testdata/project/api/v1alpha1/memcached_types.go @@ -51,7 +51,7 @@ type MemcachedStatus struct { // Memcached.status.conditions.Message is a human readable message indicating details about the transition. // For further information see: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties - 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/docs/internal/getting-started/generate_getting_started.go b/hack/docs/internal/getting-started/generate_getting_started.go index e260a190773..99cb310643d 100644 --- a/hack/docs/internal/getting-started/generate_getting_started.go +++ b/hack/docs/internal/getting-started/generate_getting_started.go @@ -265,7 +265,7 @@ const newStatusAPI = `// Represents the observations of a Memcached's current st // Memcached.status.conditions.Message is a human readable message indicating details about the transition. // For further information see: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties - Conditions []metav1.Condition ` + "`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`" + Conditions []metav1.Condition ` + "`json:\"conditions,omitempty\"`" const sampleSizeFragment = `# TODO(user): edit the following value to ensure the number # of Pods/Instances your Operand must have on cluster diff --git a/pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/internal/templates/api/types.go b/pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/internal/templates/api/types.go index 09bb14cb048..33d4e981a7f 100644 --- a/pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/internal/templates/api/types.go +++ b/pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/internal/templates/api/types.go @@ -101,7 +101,7 @@ type {{ .Resource.Kind }}Status struct { // {{ .Resource.Kind }}.status.conditions.Message is a human readable message indicating details about the transition. // For further information see: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties - 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/testdata/project-v4-multigroup/api/example.com/v1alpha1/busybox_types.go b/testdata/project-v4-multigroup/api/example.com/v1alpha1/busybox_types.go index 1ebc3c331e2..f980aa5140b 100644 --- a/testdata/project-v4-multigroup/api/example.com/v1alpha1/busybox_types.go +++ b/testdata/project-v4-multigroup/api/example.com/v1alpha1/busybox_types.go @@ -48,7 +48,7 @@ type BusyboxStatus struct { // Busybox.status.conditions.Message is a human readable message indicating details about the transition. // For further information see: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties - 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/testdata/project-v4-multigroup/api/example.com/v1alpha1/memcached_types.go b/testdata/project-v4-multigroup/api/example.com/v1alpha1/memcached_types.go index 7b9167c2dd5..07f0a918255 100644 --- a/testdata/project-v4-multigroup/api/example.com/v1alpha1/memcached_types.go +++ b/testdata/project-v4-multigroup/api/example.com/v1alpha1/memcached_types.go @@ -51,7 +51,7 @@ type MemcachedStatus struct { // Memcached.status.conditions.Message is a human readable message indicating details about the transition. // For further information see: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties - 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/testdata/project-v4-with-plugins/api/v1alpha1/busybox_types.go b/testdata/project-v4-with-plugins/api/v1alpha1/busybox_types.go index 1ebc3c331e2..f980aa5140b 100644 --- a/testdata/project-v4-with-plugins/api/v1alpha1/busybox_types.go +++ b/testdata/project-v4-with-plugins/api/v1alpha1/busybox_types.go @@ -48,7 +48,7 @@ type BusyboxStatus struct { // Busybox.status.conditions.Message is a human readable message indicating details about the transition. // For further information see: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties - 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/testdata/project-v4-with-plugins/api/v1alpha1/memcached_types.go b/testdata/project-v4-with-plugins/api/v1alpha1/memcached_types.go index 7b9167c2dd5..07f0a918255 100644 --- a/testdata/project-v4-with-plugins/api/v1alpha1/memcached_types.go +++ b/testdata/project-v4-with-plugins/api/v1alpha1/memcached_types.go @@ -51,7 +51,7 @@ type MemcachedStatus struct { // Memcached.status.conditions.Message is a human readable message indicating details about the transition. // For further information see: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties - 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