Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target resource doesn't register with an ALB target type #1458

Closed
erickfaustino opened this issue Aug 30, 2022 · 2 comments · Fixed by #1464
Closed

Target resource doesn't register with an ALB target type #1458

erickfaustino opened this issue Aug 30, 2022 · 2 comments · Fixed by #1464
Labels
bug Something isn't working

Comments

@erickfaustino
Copy link

What happened?

Hi, first of all, thank you for the great work!

I'm trying use crossplane to create a TargetGroup that has a Target to an Application Load Balancer. I'm using the Target resource that was introduced in the very last release of the provider.

The problem is: The target doesn't register if the Target type is an ALB

How can we reproduce it?

  • Create a Network LoadBalancer
  • Create a TargetGroup
  • Create a Listener to the NLB using forwarding the traffic to the previous TargetGroup
  • Create a target resource to register an Application Load Balancer as it's target
  • I've created these resources:
---
apiVersion: elbv2.aws.crossplane.io/v1alpha1
kind: LoadBalancer
metadata:
  name: mytest-lb
spec:
  deletionPolicy: Delete
  forProvider:
    ipAddressType: ipv4
    loadBalancerType: network
    region: sa-east-1
    name: mytest-lb
    scheme: internet-facing
    subnetMappings:
      - subnetID: subnet-xxxxxxxxx
      - subnetID: subnet-xxxxxxxxx
      - subnetID: subnet-xxxxxxxxx
  providerConfigRef:
    name: aws-provider
---
apiVersion: elbv2.aws.crossplane.io/v1alpha1
kind: TargetGroup
metadata:
  name: test-targetgroup
spec:
  forProvider:
    name: test-targetgroup
    port: 80
    protocol: HTTP  #I've tried with TCP too 
    region: sa-east-1
    targetType: alb
    vpcID: "vpc-xxxxxxx"
  providerConfigRef:
    name: aws-provider
---
apiVersion: elbv2.aws.crossplane.io/v1alpha1
kind: Listener
metadata:
  name: test-listener
spec:
  forProvider:
    region: sa-east-1
    defaultActions:
      - actionType: forward
        forwardConfig:
          targetGroups:
            - targetGroupArnRef:
                name: test-targetgroup
    loadBalancerArnRef:
      name: mytest-lb
    port: 80
    protocol: TCP
  providerConfigRef:
    name: aws-provider
---
apiVersion: elbv2.aws.crossplane.io/v1alpha1
kind: Target
metadata:
  annotations:
    crossplane.io/external-name: arn:aws:elasticloadbalancing:sa-east-1:xxxxxxxxxxx:loadbalancer/app/xxxx-xxxx-xxxxxx
  name: test-target
spec:
  forProvider:
    region: sa-east-1
    targetGroupArnRef:
      name: test-targetgroup
  providerConfigRef:
    name: aws-provider

Whenever I exec kubectl get target test-target -o yaml I get this status:

status:
  atProvider:
    targetHealth:
      description: Target is not registered to the target group
      reason: Target.NotRegistered
      state: unused
  conditions:
  - lastTransitionTime: "2022-08-30T01:21:48Z"
    reason: ReconcileSuccess
    status: "True"
    type: Synced
  - lastTransitionTime: "2022-08-30T01:21:48Z"
    reason: Unavailable
    status: "False"
    type: Ready

The status of the target is:

reason: Target.NotRegistered
state: unused

At the AWS the target doesn't show up inside of the Target Group

What environment did it happen in?

Crossplane version: 1.9.1

  • Cloud provider: AWS
  • Kubernetes version: 1.22
  • Kubernetes distribution: EKS
  • OS: Amazon Linux 2
  • Kernel: 5.4.209-116.363.amzn2.x86_64
@erickfaustino erickfaustino added the bug Something isn't working label Aug 30, 2022
@MisterMX
Copy link
Collaborator

MisterMX commented Sep 1, 2022

I guess the issue is that the controller never retries if the registration failed once. I think we have to check if reason == types.TargetHealthReasonEnumNotRegistered and retry.

MisterMX added a commit to MisterMX/provider-aws that referenced this issue Sep 1, 2022
Fixes crossplane-contrib#1458

Signed-off-by: Maximilian Blatt <[email protected]>
(external expert on behalf of DB Netz AG)
@erickfaustino
Copy link
Author

Thank you for your reply and commit, @MisterMX

MisterMX added a commit to MisterMX/provider-aws that referenced this issue Oct 17, 2022
Fixes crossplane-contrib#1458

Signed-off-by: Maximilian Blatt <[email protected]>
(external expert on behalf of DB Netz AG)
MisterMX added a commit to MisterMX/provider-aws that referenced this issue Oct 17, 2022
Fixes crossplane-contrib#1458

Signed-off-by: Maximilian Blatt <[email protected]>
(external expert on behalf of DB Netz AG)
MisterMX added a commit to MisterMX/provider-aws that referenced this issue Oct 17, 2022
Fixes crossplane-contrib#1458

Signed-off-by: Maximilian Blatt <[email protected]>
(external expert on behalf of DB Netz AG)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants