crossplane-contrib / provider-jet-aws

AWS Provider for Crossplane that is built with Terrajet.
https://crossplane.io
Apache License 2.0
37 stars 30 forks source link

Can't create nodegroup #187

Closed andrzej-natzka closed 2 years ago

andrzej-natzka commented 2 years ago

What happened?

After applying Composition to create EKS cluster NodeGroup is not created.

Error Message:

Warning CannotObserveExternalResource 52s (x816 over 3h48m) managed/eks.aws.jet.crossplane.io/v1alpha2, kind=nodegroup cannot run refresh: refresh failed: unexpected format for ID (xpjeteks), expected cluster-name:node-group-name: : File name: main.tf.json

How can we reproduce it?

Part of composition:

  - name: eksnode
    base:
      apiVersion: eks.aws.jet.crossplane.io/v1alpha2
      kind: NodeGroup
      spec:
        forProvider:
          clusterNameSelector:
            matchControllerRef: true
          nodeRoleArnSelector:
            matchControllerRef: true
          subnetIdSelector:
            matchControllerRef: true
            matchLabels:
              access: public
          scalingConfig:
          - maxSize: 5
        providerConfigRef:
          name: aws-jet-provider
    patches:
    - type: PatchSet
      patchSetName: region
    - fromFieldPath: spec.id
      toFieldPath: metadata.name
    - fromFieldPath: spec.id
      toFieldPath: spec.forProvider.nodeRoleArnSelector.matchLabels.role
      transforms:
        - type: string
          string:
            fmt: "%s-nodegroup"      
    - fromFieldPath: spec.parameters.nodeSize
      toFieldPath: spec.forProvider.instanceTypes[0]
      transforms:
        - type: map
          map:
            small: t3.small
            medium: t3.medium
            large: t3.large
    - fromFieldPath: spec.parameters.nodeCount
      toFieldPath: spec.forProvider.scalingConfig[0].minSize
    - fromFieldPath: spec.parameters.nodeCount
      toFieldPath: spec.forProvider.scalingConfig[0].desiredSize
    - type: ToCompositeFieldPath
      fromFieldPath: status.atProvider.status
      toFieldPath: status.nodePoolStatus
    readinessChecks:
    - type: MatchString
      fieldPath: status.atProvider.status
      matchString: ACTIVE

Status after applying:

NAME                                           READY   SYNCED   EXTERNAL-NAME   AGE
nodegroup.eks.aws.jet.crossplane.io/xpjeteks           False    xpjeteks        3h45m

Spec:
  Deletion Policy:  Delete
  For Provider:
    Cluster Name:  xpjeteks
    Cluster Name Ref:
      Name:  xpjeteks
    Cluster Name Selector:
      Match Controller Ref:  true
    Instance Types:
      t3.small
    Node Role Arn:  arn:aws:iam::xxx:role/xpjeteks-nodegroup
    Node Role Arn Ref:
      Name:  xpjeteks-nodegroup
    Node Role Arn Selector:
      Match Controller Ref:  true
      Match Labels:
        Role:  xpjeteks-nodegroup
    Region:    eu-north-1
    Scaling Config:
      Desired Size:  1
      Max Size:      5
      Min Size:      1
    Subnet Id Refs:
      Name:  xpjeteks-pub-a
      Name:  xpjeteks-pub-b
      Name:  xpjeteks-pub-c
    Subnet Id Selector:
      Match Controller Ref:  true
      Match Labels:
        Access:  public
    Subnet Ids:
      subnet-xxx
      subnet-yyy
      subnet-zzz
  Provider Config Ref:
    Name:  aws-jet-provider
Status:
  At Provider:
  Conditions:
    Last Transition Time:  2022-04-27T09:20:43Z
    Message:               observe failed: cannot run refresh: refresh failed: unexpected format for ID (xpjeteks), expected cluster-name:node-group-name: : File name: main.tf.json
    Reason:                ReconcileError
    Status:                False
    Type:                  Synced
Events:
  Type     Reason                         Age                    From                                                        Message
  ----     ------                         ----                   ----                                                        -------
  Warning  CannotObserveExternalResource  52s (x816 over 3h48m)  managed/eks.aws.jet.crossplane.io/v1alpha2, kind=nodegroup  cannot run refresh: refresh failed: unexpected format for ID (xpjeteks), expected cluster-name:node-group-name: : File name: main.tf.json

What environment did it happen in?

Crossplane version: 1.7.0 jet-aws 0.4.0-preview