Repository: crossplane/provider-aws (go)

Issue:
NodeGroup fails to update when unchanged labels exist
<!--
Thank you for helping to improve Crossplane!

Please be sure to search for open issues before raising a new one. We use issues
for bug reports and feature requests. Please find us at https://slack.crossplane.io
for questions, support, and discussion.
-->

### What happened?
<!--
Please let us know what behaviour you expected and how Crossplane diverged from
that behaviour.
-->

I updated the `desiredSize/minSize` `scalingConfig` properties in a `NodeGroup` but the operation failed with the error message

> cannot update EKS node group configuration: InvalidParameterException: Both or either addOrUpdateLabels or removeLabels must not be empty

My `NodeGroup` has the following config

```
apiVersion: eks.aws.crossplane.io/v1alpha1
kind: NodeGroup
metadata:
  name: g4dn-xlarge
spec:
  forProvider:
    region: us-west-2
    amiType: AL2_x86_64_GPU
    instanceTypes:
      - g4dn.xlarge
    clusterNameRef:
      name: cluster
    diskSize: 256
    subnetRefs:
      - name: vpc-subnet-1
      - name: vpc-subnet-2
      - name: vpc-subnet-3
    nodeRoleRef:
      name: node-role
    labels:
      gpu: nvidia
      accelerator: nvidia-t4
    scalingConfig:
      desiredSize: 2
      maxSize: 3
      minSize: 2
```

As a workaround, if I add a new label as part of the update - i.e. `zzzworkaround: "3"` then the operation completes as expected without error.

My guess is the bug is related to this line https://github.com/crossplane/provider-aws/blob/82e7f3f02baf949e2217ef76045786ad8b0700ce/pkg/clients/eks/nodegroup.go#L99. If both `addOrModify` and `remove` are empty then the line should likely be skipped.

If it does end up being the above I'm more than happy to help fix.  Just wanted to open the issue first.

### How can we reproduce it?
<!--
Help us to reproduce your bug as succinctly and precisely as possible. Artifacts
such as example manifests or a script that triggers the issue are highly
appreciated!
-->

Create a `NodeGroup` with labels. Then update the `NodeGroup`'s scalingConfig.

### What environment did it happen in?
Crossplane version:  v1.5
Provider-aws: v0.21.0
Kubernetes: 1.21

<!--
Include at least the version or commit of Crossplane you were running. Consider
also including your:

* Cloud provider or hardware configuration
* Kubernetes version (use `kubectl version`)
* Kubernetes distribution (e.g. Tectonic, GKE, OpenShift)
* OS (e.g. from /etc/os-release)
* Kernel (e.g. `uname -a`)
-->


Pull request description:
fix(lables): eks-nodegroup - both or either addOrUpdateLabels or removeLabels must not be empty
Signed-off-by: haarchri <chhaar30@googlemail.com>

<!--
Thank you for helping to improve Crossplane!

Please read through https://git.io/fj2m9 if this is your first time opening a
Crossplane pull request. Find us in https://slack.crossplane.io/messages/dev if
you need any help contributing.
-->

### Description of your changes
fixed error both or either addOrUpdateLabels or removeLabels must not be empty which leads in Ready false for NodeGroup
also our friends from terraform did it this way https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/eks/node_group.go#L806 and add nil if nothing changed for addOrUpdateLabels / removeLables ;)
<!--
Briefly describe what this pull request does. Be sure to direct your reviewers'
attention to anything that needs special consideration.

We love pull requests that resolve an open Crossplane issue. If yours does, you
can uncomment the below line to indicate which issue your PR fixes, for example
"Fixes #500":

-->
Fixes #975

I have:

- [x] Read and followed Crossplane's [contribution process].
- [x] Run `make reviewable test` to ensure this PR is ready for review.

### How has this code been tested
NodeGroup Scaling Config is updated with this fix in our environment

<!--
Before reviewers can be confident in the correctness of this pull request, it
needs to tested and shown to be correct. Briefly describe the testing that has
already been done or which is planned for this change.
-->

[contribution process]: https://git.io/fj2m9


Patch:
diff --git a/pkg/clients/eks/nodegroup.go b/pkg/clients/eks/nodegroup.go
index 6c76d74b0..9e03e5c59 100644
--- a/pkg/clients/eks/nodegroup.go
+++ b/pkg/clients/eks/nodegroup.go
@@ -96,9 +96,12 @@ func GenerateUpdateNodeGroupConfigInput(name string, p *manualv1alpha1.NodeGroup
 
 	if len(p.Labels) > 0 {
 		addOrModify, remove := awsclient.DiffLabels(p.Labels, ng.Labels)
-		u.Labels = &ekstypes.UpdateLabelsPayload{
-			AddOrUpdateLabels: addOrModify,
-			RemoveLabels:      remove,
+		// error: both or either addOrUpdateLabels or removeLabels must not be empty
+		if len(addOrModify) > 0 || len(remove) > 0 {
+			u.Labels = &ekstypes.UpdateLabelsPayload{
+				AddOrUpdateLabels: addOrModify,
+				RemoveLabels:      remove,
+			}
 		}
 	}
 	if p.ScalingConfig != nil {


Test patch:
diff --git a/pkg/clients/eks/nodegroup_test.go b/pkg/clients/eks/nodegroup_test.go
index e10b766a0..598516b70 100644
--- a/pkg/clients/eks/nodegroup_test.go
+++ b/pkg/clients/eks/nodegroup_test.go
@@ -308,11 +308,8 @@ func TestGenerateUpdateNodeGroupInput(t *testing.T) {
 				},
 			},
 			want: &eks.UpdateNodegroupConfigInput{
-				ClusterName: &clusterName,
-				Labels: &ekstypes.UpdateLabelsPayload{
-					AddOrUpdateLabels: map[string]string{},
-					RemoveLabels:      []string{},
-				},
+				ClusterName:   &clusterName,
+				Labels:        nil,
 				NodegroupName: &ngName,
 				ScalingConfig: &ekstypes.NodegroupScalingConfig{
 					DesiredSize: &currentSize,
@@ -356,11 +353,8 @@ func TestGenerateUpdateNodeGroupInput(t *testing.T) {
 				},
 			},
 			want: &eks.UpdateNodegroupConfigInput{
-				ClusterName: &clusterName,
-				Labels: &ekstypes.UpdateLabelsPayload{
-					AddOrUpdateLabels: map[string]string{},
-					RemoveLabels:      []string{},
-				},
+				ClusterName:   &clusterName,
+				Labels:        nil,
 				NodegroupName: &ngName,
 				ScalingConfig: &ekstypes.NodegroupScalingConfig{
 					DesiredSize: awsclients.Int32(6),