crossplane-contrib / provider-upjet-aws

Official AWS Provider for Crossplane by Upbound.
https://marketplace.upbound.io/providers/upbound/provider-aws
Apache License 2.0
137 stars 112 forks source link

[Bug]: Nodegroup with LaunchTemplate always adds to Update History #1375

Closed georgblumenschein closed 22 hours ago

georgblumenschein commented 1 week ago

Is there an existing issue for this?

Affected Resource(s)

eks.aws.upbound.io/v1beta1 - NodeGroup ec2.aws.upbound.io/v1beta1 - Launchtemplae

Resource MRs required to reproduce the bug

apiVersion: eks.aws.upbound.io/v1beta1
kind: NodeGroup
metadata:
  name: test-ng
spec:
  forProvider:
    clusterNameSelector:
      matchControllerRef: true
    versionSelector:
      matchControllerRef: true
    nodeRoleArnSelector:
      matchControllerRef: true
      matchLabels:
        role: nodegroup
    launchTemplate:
      - name: test-ng-lt
        version: "$Default"
    amiType: "AL2_x86_64"
    capacityType: SPOT
    instanceTypes:
      - m7a.large
    forceUpdateVersion: false
    releaseVersion: "1.29.0-20240227"
    scalingConfig:
      - maxSize: 2
        minSize: 0
        desiredSize: 0
---
apiVersion: ec2.aws.upbound.io/v1beta1
kind: LaunchTemplate
metadata:
  name: test-ng-lt
spec:
  forProvider:
    blockDeviceMappings:
      - ebs:
        - volumeType: gp3
          volumeSize: 50
        deviceName: /dev/xvda
    monitoring:
      - enabled: true
    name: test-ng-lt
    updateDefaultVersion: true
    instanceRequirements:
      - allowedInstanceTypes:
          - m7a.large
        memoryMib:
          - min: 2048
        vcpuCount:
          - min: 2

Steps to Reproduce

  1. Deploy the resources
  2. Wait for the NodeGroup with the LaunchTemplate to show up in the AWS console
  3. Check the update history of the NodeGroup

What happened?

Both with the $Default and the $Latest flag for the LaunchTemplate version the update history gets spammed to the point where "429: Too many Requests" on loading is returned.

I would expect that since the Default/Latest version of the LaunchTemplate is "1", it should count as synced.

Workaround: Have the version as String, so e.g. "1" as version for the LaunchTemplate

Relevant Error Output Snippet

No response

Crossplane Version

1.16.0

Provider Version

1.5.0

Kubernetes Version

1.29

Kubernetes Distribution

EKS

Additional Info

No response

haarchri commented 6 days ago

yes we have the same issue with

    launchTemplate:
      - name: my-awesome-launchtemplate
        version: $Latest
turkenf commented 5 days ago

Hello folks,

Thank you for bringing up this issue. It can be reproducible with the latest provider version:

DEBUG   provider-aws    Diff detected   {"uid": "604ae2df-0141-4a96-890f-54dff549d3a4", "name": "sample-eks-ng-ft", "gvk": "eks.aws.upbound.io/v1beta1, Kind=NodeGroup", "instanceDiff": "*terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff{\"launch_template.0.version\":*terraform.ResourceAttrDiff{Old:\"1\", New:\"$Latest\", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}}, Destroy:false, DestroyDeposed:false, DestroyTainted:false, RawConfig:cty.NilVal, RawState:cty.NilVal, RawPlan:cty.NilVal, Meta:map[string]interface {}(nil)}"}

Screenshot 2024-06-26 at 21 34 30

turkenf commented 4 days ago

Hi folks, after doing some investigation on this issue:

Here, our best solution would be to prevent giving $Latest and $Default values ​​to the launchTemplate.version field.