Skip to content

Commit 2e79b33

Browse files
committed
Add logs
1 parent 03f4716 commit 2e79b33

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cloud/scope/vpc_cluster.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,13 +923,15 @@ func (s *VPCClusterScope) ReconcileDedicatedHosts() (bool, error) {
923923
return false, nil
924924
}
925925

926+
s.Info("checking dedicated hosts")
926927
requeue := false
927928
for _, dHost := range s.IBMVPCCluster.Spec.DedicatedHosts {
928929
var dHostDetails *vpcv1.DedicatedHost
929930
var err error
930931
switch {
931932
// Attempt lookup of Dedicated Host by ID, if provided. A defined ID expects the Dedicated Host to exist.
932933
case dHost.ID != nil:
934+
s.Info("checking host id", "id", *dHost.ID)
933935
dHostDetails, _, err = s.VPCClient.GetDedicatedHost(&vpcv1.GetDedicatedHostOptions{
934936
ID: dHost.ID,
935937
})
@@ -941,11 +943,13 @@ func (s *VPCClusterScope) ReconcileDedicatedHosts() (bool, error) {
941943
s.V(3).Info("found dedicated host with id: %s", *dHost.ID)
942944
// Attempt lookup of Dedicated Host by Name, if provided. A defined name could be for an existing Dedicated Host, or if not found and a profile provided, create a new Dedicated Host.
943945
case dHost.Name != nil:
946+
s.Info("checking host name", "name", *dHost.Name)
944947
dHostDetails, err = s.VPCClient.GetDedicatedHostByName(*dHost.Name)
945948
switch {
946949
case err != nil:
947950
return false, fmt.Errorf("error looking up dedicated host by name %s: %w", *dHost.Name, err)
948951
case dHostDetails == nil && dHost.Profile != nil:
952+
s.Info("checking host profile", "profile", *dHost.Profile)
949953
// If Dedicated Host not found by name and a profile is defined, try to create a new Dedicated Host.
950954
dHostDetails, _, err = s.createDedicatedHost(dHost)
951955
if err != nil {
@@ -969,6 +973,7 @@ func (s *VPCClusterScope) ReconcileDedicatedHosts() (bool, error) {
969973
default:
970974
return false, fmt.Errorf("error cannot reconcile dedicated host without id and name")
971975
}
976+
s.Info("found dedicated host")
972977
// Determine whether the Dedicated Host is ready and available for provisioning VSI's.
973978
dHostReady := *dHostDetails.State == vpcv1.DedicatedHostStateAvailableConst && *dHostDetails.Provisionable
974979
// Update Dedicated Host Status.
@@ -979,15 +984,18 @@ func (s *VPCClusterScope) ReconcileDedicatedHosts() (bool, error) {
979984
})
980985
// If the Dedicated Host is not ready, flag for requeue.
981986
if !dHostReady {
987+
s.Info("requeue for unready dedicated host")
982988
requeue = true
983989
}
984990
}
985991

992+
s.Info("returning", "requeue", requeue)
986993
return requeue, nil
987994
}
988995

989996
// createDedicatedHost will create a new Dedicated Host as defined by the VPCDedicatedHost.
990997
func (s *VPCClusterScope) createDedicatedHost(dHost infrav1beta2.VPCDedicatedHost) (*vpcv1.DedicatedHost, *core.DetailedResponse, error) {
998+
s.Info("created dedicated host", "name", *dHost.Name)
991999
// Collect Resource Group ID for Dedicated Host creation options.
9921000
resourceGroupID, err := s.GetResourceGroupID()
9931001
if err != nil {

0 commit comments

Comments
 (0)