Repository: kubernetes/kubernetes (language: go)

Issue:
The current and desired number of replicas in the sample controller is incorrect.
### What happened?

The current and desired number of replicas in the sample controller is incorrect.

`Say, we have the replicas of the crd start with 1 and change to 2.`

we got this:
`"Update deployment resource" objectRef="default/example-foo" currentReplicas=2 desiredReplicas=1`

![image](https://github.com/user-attachments/assets/536045c1-74e5-4321-83f9-6074fa878751)


### What did you expect to happen?

When updating the replicas of the crd and the log level set to 4, the log should show `current 1, desired 2`.



### How can we reproduce it (as minimally and precisely as possible)?

- Run sample controller and set log level to 4
- Apply crd.yaml and `example-foo.yaml` file in artifacts folder
- Change the replicas of `example-foo.yaml` from 1 to 2 and apply the changes


### Anything else we need to know?

_No response_

### Kubernetes version
<details>
```console
$ kubectl version
v1.28.1
```

</details>


### Cloud provider

<details>
Local cluster
</details>


### OS version

<details>

```console
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
```

</details>


### Install tools

<details>

</details>


### Container runtime (CRI) and version (if applicable)

<details>

</details>


### Related plugins (CNI, CSI, ...) and versions (if applicable)

<details>

</details>



Discussion / hints:

Fix patch:
diff --git a/staging/src/k8s.io/sample-controller/controller.go b/staging/src/k8s.io/sample-controller/controller.go
index bf7c445933ceb..dd6ac9a203303 100644
--- a/staging/src/k8s.io/sample-controller/controller.go
+++ b/staging/src/k8s.io/sample-controller/controller.go
@@ -289,7 +289,7 @@ func (c *Controller) syncHandler(ctx context.Context, objectRef cache.ObjectName
 	// number does not equal the current desired replicas on the Deployment, we
 	// should update the Deployment resource.
 	if foo.Spec.Replicas != nil && *foo.Spec.Replicas != *deployment.Spec.Replicas {
-		logger.V(4).Info("Update deployment resource", "currentReplicas", *foo.Spec.Replicas, "desiredReplicas", *deployment.Spec.Replicas)
+		logger.V(4).Info("Update deployment resource", "currentReplicas", *deployment.Spec.Replicas, "desiredReplicas", *foo.Spec.Replicas)
 		deployment, err = c.kubeclientset.AppsV1().Deployments(foo.Namespace).Update(ctx, newDeployment(foo), metav1.UpdateOptions{FieldManager: FieldManager})
 	}
 


Test patch: