Skip to content

Conversation

dharaneeshvrd
Copy link
Contributor

Need to depend on load balancer's state to set the cluster's ready status instead of using requeue logic which is designed to block the reconciliation.

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #2026

Special notes for your reviewer:

/area provider/ibmcloud

  1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:


@k8s-ci-robot k8s-ci-robot added area/provider/ibmcloud Issues or PRs related to ibmcloud provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 28, 2024
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 28, 2024
Copy link

netlify bot commented Oct 28, 2024

Deploy Preview for kubernetes-sigs-cluster-api-ibmcloud ready!

Name Link
🔨 Latest commit 87fe803
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-ibmcloud/deploys/671f888fc972bc0008077418
😎 Deploy Preview https://deploy-preview-2029--kubernetes-sigs-cluster-api-ibmcloud.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@dharaneeshvrd
Copy link
Contributor Author

/cc @Karthik-K-N

if requeue := s.checkLoadBalancerStatus(*loadBalancer); requeue {
return requeue, nil
if isReady := s.checkLoadBalancerStatus(*loadBalancer); !isReady {
s.V(3).Info("LoadBalancer is still not Active", "name", *loadBalancer.Name, "state", *loadBalancer.ProvisioningStatus)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*loadbalancer.Name can be nil when user sets only id. so better avoid it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's coming from cloud API resp right, would be able to create a LB without name?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah, sorry, I overlooked loadbalancer from

for index, loadBalancer := range loadBalancers {

}

// check VPC load balancer exist in cloud
loadBalancerStatus, err := s.checkLoadBalancer(loadBalancer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkLoadBalancer checks load balancer by the user provided name, which we already do in prev block here by recently added code via this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s.GetLoadBalancerID(loadBalancer.Name) just checks only from status not from cloud!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sry, did not look properly, reverted the changes.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 28, 2024
Copy link
Contributor

@Karthik-K-N Karthik-K-N left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/assign @Amulyam24 @mkumatag

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 28, 2024
Copy link
Contributor

@Amulyam24 Amulyam24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Thank you for the quick fix @dharaneeshvrd!

@Karthik-K-N
Copy link
Contributor

/hold

@KeerthanaAP is doing some testing, will update here once done.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 28, 2024
@KeerthanaAP
Copy link
Contributor

@dharaneeshvrd I have tried deploying the cluster with your changes and tried to verify the loadbalancer status.
I could see one loadbalancer is in active state and other is in create_pending state but still the ready is set to true

 status:
    conditions:
    - lastTransitionTime: "2024-10-28T10:09:43Z"
      status: "True"
      type: COSInstanceCreated
    - lastTransitionTime: "2024-10-28T10:06:06Z"
      status: "True"
      type: LoadBalancerReady
    - lastTransitionTime: "2024-10-28T10:14:23Z"
      status: "True"
      type: NetworkReady
    - lastTransitionTime: "2024-10-28T10:05:58Z"
      status: "True"
      type: ServiceInstanceReady
    - lastTransitionTime: "2024-10-28T10:09:34Z"
      status: "True"
      type: TransitGatewayReady
    - lastTransitionTime: "2024-10-28T10:05:08Z"
      status: "True"
      type: VPCReady
    - lastTransitionTime: "2024-10-28T10:05:30Z"
      status: "True"
      type: VPCSecurityGroupReady
    - lastTransitionTime: "2024-10-28T10:05:30Z"
      status: "True"
      type: VPCSubnetReady
    cosInstance:
      controllerCreated: true
      id: 2535acaf-64b4-43af-b62f-0d04ef5d802a
    dhcpServer:
      controllerCreated: true
      id: 7d5d4674-568f-4095-bb2f-d88a1ed86caa
    loadBalancers:
      keer-test-r2tmb-loadbalancer:
        controllerCreated: true
        hostname: eecc5943-eu-gb.lb.appdomain.cloud
        id: r018-eecc5943-6cba-4801-9f8d-d1f364c0d662
        state: active
      keer-test-r2tmb-loadbalancer-int:
        controllerCreated: true
        hostname: fed61d1c-eu-gb.lb.appdomain.cloud
        id: r018-fed61d1c-4b28-4a31-b5be-707e1c5099eb
        state: create_pending
    network:
      controllerCreated: true
      id: a3780531-b7ff-4a2e-b795-4fde4aad5297
    ready: true

@Karthik-K-N
Copy link
Contributor

Thanks @KeerthanaAP for testing it quickly.
@dharaneeshvrd i think we discussed about this but forgot , we need to make sure all the LBs are active before infra is set to true.

Need to depend on load balancer's state to set the cluster's ready status instead of using requeue logic which is designed to block the reconciliation.
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 28, 2024
@dharaneeshvrd
Copy link
Contributor Author

@KeerthanaAP Can you please double check this? It is working for me when I tested in local and in the log you have provided for this deployment does not have my changes.
@Karthik-K-N I have considered and did the changes earlier and it was working properly, but it was creating the LBs serially, now I have added a flag to create them without blocking further LBs reconcile. PTAL now.

@Karthik-K-N
Copy link
Contributor

Karthik-K-N commented Oct 28, 2024

@KeerthanaAP Can you please double check this? It is working for me when I tested in local and in the log you have provided for this deployment does not have my changes.

Checking with @ hamzy about this in slack

@Karthik-K-N I have considered and did the changes earlier and it was working properly, but it was creating the LBs serially, now I have added a flag to create them without blocking further LBs reconcile. PTAL now.

Got it earlier will work but there was no gurantee that in case of multiple LBs all will be in Active as we used to return once we found one LB in active. But I think with this change we should be good

Copy link
Contributor

@Karthik-K-N Karthik-K-N left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its been verified and works as expected.
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 29, 2024
@mkumatag mkumatag added this to the v0.9.0 milestone Oct 29, 2024
Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 29, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dharaneeshvrd, mkumatag

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 29, 2024
@k8s-ci-robot k8s-ci-robot merged commit 9b07704 into kubernetes-sigs:main Oct 29, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/provider/ibmcloud Issues or PRs related to ibmcloud provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cluster incorrectly shown as ready when both LoadBalancers are not ready
6 participants