kubernetes-sigs / cluster-api-provider-ibmcloud

Cluster API Provider for IBM Cloud
https://cluster-api-ibmcloud.sigs.k8s.io
Apache License 2.0
62 stars 84 forks source link

Return true when PowerVS network is already created during ReconcileNetwork #1931

Closed Amulyam24 closed 3 months ago

Amulyam24 commented 3 months ago

What this PR does / why we need it: When an existing DHCP server is passed such as

apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  labels:
    ccm: external
    cluster.x-k8s.io/cluster-name: capi-test-amulya
  name: capi-test-amulya
  namespace: default
spec:
  clusterNetwork:
    pods:
      cidrBlocks:
      - 192.168.0.0/16
    serviceDomain: cluster.local
    services:
      cidrBlocks:
      - 10.128.0.0/12
  controlPlaneRef:
    apiVersion: controlplane.cluster.x-k8s.io/v1beta1
    kind: KubeadmControlPlane
    name: capi-test-amulya-control-plane
  infrastructureRef:
    apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
    kind: IBMPowerVSCluster
    name: capi-test-amulya
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: IBMPowerVSCluster
metadata:
  annotations:
    powervs.cluster.x-k8s.io/create-infra: "true"
  labels:
    cluster.x-k8s.io/cluster-name: capi-test-amulya
  name: capi-test-amulya
  namespace: default
spec:
  loadBalancers:
  - name: capi-test-amulya-loadbalancer
  resourceGroup:
    name: ibm-hypershift-dev
  serviceInstance:
    name: capi-test-amulya-serviceInstance
  dhcpServer:
    name: capi-test-amulya
  transitGateway:
    name: capi-test-amulya-transitgateway
  vpc:
    name: capi-test-amulya-vpc
    region: eu-es
  vpcSubnets:
  - name: capi-test-amulya-vpcsubnet
  zone: mad02

The cluster provisioning is stuck due to Network or LoadBalancer still not ready, requeuing. This is not right as the network already exists and is ready.

I0829 14:01:21.118147      14 powervs_cluster.go:841] "Found PowerVS network in IBM Cloud" controller="ibmpowervscluster" controllerGroup="infrastructure.cluster.x-k8s.io" controllerKind="IBMPowerVSCluster" IBMPowerVSCluster="default/capi-test-amulya" namespace="default" name="capi-test-amulya" reconcileID="52b281cf-ded9-4412-b388-bcef47329a9a" cluster="default/capi-test-amulya" id="1810b127-9741-4bfa-9323-61c0031d3272"
I0829 14:01:21.118398      14 powervs_cluster.go:395] "Setting status" controller="ibmpowervscluster" controllerGroup="infrastructure.cluster.x-k8s.io" controllerKind="IBMPowerVSCluster" IBMPowerVSCluster="default/capi-test-amulya" namespace="default" name="capi-test-amulya" reconcileID="52b281cf-ded9-4412-b388-bcef47329a9a" cluster="default/capi-test-amulya" resourceType="network" resource={"id":"1810b127-9741-4bfa-9323-61c0031d3272","controllerCreated":false}
I0829 14:01:21.118474      14 ibmpowervscluster_controller.go:171] "PowerVS network creation is pending" logger="powervs" controller="ibmpowervscluster" controllerGroup="infrastructure.cluster.x-k8s.io" controllerKind="IBMPowerVSCluster" 

I0829 14:01:32.081898      14 ibmpowervscluster_controller.go:329] "Network or LoadBalancer still not ready, requeuing" controller="ibmpowervscluster" controllerGroup="infrastructure.cluster.x-k8s.io" controllerKind="IBMPowerVSCluster" IBMPowerVSCluster="default/capi-test-amulya" namespace="default" name="capi-test-amulya" reconcileID="52b281cf-ded9-4412-b388-bcef47329a9a" cluster="default/capi-test-amulya"
Status:
  Conditions:
    Last Transition Time:  2024-08-29T13:55:39Z
    Status:                True
    Type:                  LoadBalancerReady
    Last Transition Time:  2024-08-29T13:55:36Z
    Status:                True
    Type:                  ServiceInstanceReady
    Last Transition Time:  2024-08-29T13:55:49Z
    Status:                True
    Type:                  TransitGatewayReady
    Last Transition Time:  2024-08-29T13:55:37Z
    Status:                True
    Type:                  VPCReady
    Last Transition Time:  2024-08-29T13:55:37Z
    Status:                True
    Type:                  VPCSecurityGroupReady
    Last Transition Time:  2024-08-29T13:55:37Z
    Status:                True
    Type:                  VPCSubnetReady
  Load Balancers:
    Capi - Test - Amulya - Loadbalancer:
      Controller Created:  false
      Hostname:            ad89df14-eu-es.lb.appdomain.cloud
      Id:                  r050-ad89df14-0a82-4b93-b1f7-da8417ff4454
      State:               active
  Network:
    Controller Created:  false
    Id:                  1810b127-9741-4bfa-9323-61c0031d3272
  Ready:                 false
  Resource Group ID:
    Controller Created:  false
    Id:                  08fe0ad0ec9b45aab2cb6d7a4d6817ba
  Service Instance:
    Controller Created:  false
    Id:                  8219f2df-781d-4d64-afbe-68fe652e57d0
  Transit Gateway:
    Controller Created:  false
    Id:                  0b664452-6225-4c89-ac4a-4f20183b89b5
  Vpc:
    Controller Created:  false
    Id:                  r050-03e14d58-2ab4-4b6c-bc2d-7252837d1f0d
  Vpc Subnet:
    Capi - Test - Amulya - Vpcsubnet:
      Controller Created:  false
      Id:                  02w7-0f1a18da-51bb-4ad3-92e1-67459cc3a31c

Hence, return true when PowerVS network is already created and is active.

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 #

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:

Return true when PowerVS network is already created during ReconcileNetwork
netlify[bot] commented 3 months ago

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

Name Link
Latest commit 7d2b7a1a6e33150c559b81229e654fd7c8eb36b6
Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-ibmcloud/deploys/66d08471afeded00086a91a2
Deploy Preview https://deploy-preview-1931--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.

k8s-ci-robot commented 3 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Amulyam24, 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: - ~~[OWNERS](https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/blob/main/OWNERS)~~ [mkumatag] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment