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

Refactor logging #1755

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/v1beta2/ibmpowervscluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type IBMPowerVSClusterSpec struct {
// resourceGroup name under which the resources will be created.
// when powervs.cluster.x-k8s.io/create-infra=true annotation is set on IBMPowerVSCluster resource,
// 1. it is expected to set the ResourceGroup.Name, not setting will result in webhook error.
// ServiceInstance.ID and ServiceInstance.Regex is not yet supported and system will ignore the value.
// ResourceGroup.ID and ResourceGroup.Regex is not yet supported and system will ignore the value.
// +optional
ResourceGroup *IBMPowerVSResourceReference `json:"resourceGroup,omitempty"`

Expand Down
328 changes: 173 additions & 155 deletions cloud/scope/powervs_cluster.go

Large diffs are not rendered by default.

104 changes: 49 additions & 55 deletions cloud/scope/powervs_machine.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ spec:
resourceGroup name under which the resources will be created.
when powervs.cluster.x-k8s.io/create-infra=true annotation is set on IBMPowerVSCluster resource,
1. it is expected to set the ResourceGroup.Name, not setting will result in webhook error.
ServiceInstance.ID and ServiceInstance.Regex is not yet supported and system will ignore the value.
ResourceGroup.ID and ResourceGroup.Regex is not yet supported and system will ignore the value.
properties:
id:
description: ID of resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ spec:
resourceGroup name under which the resources will be created.
when powervs.cluster.x-k8s.io/create-infra=true annotation is set on IBMPowerVSCluster resource,
1. it is expected to set the ResourceGroup.Name, not setting will result in webhook error.
ServiceInstance.ID and ServiceInstance.Regex is not yet supported and system will ignore the value.
ResourceGroup.ID and ResourceGroup.Regex is not yet supported and system will ignore the value.
properties:
id:
description: ID of resource
Expand Down
11 changes: 6 additions & 5 deletions controllers/ibmpowervscluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ func (r *IBMPowerVSClusterReconciler) reconcile(clusterScope *scope.PowerVSClust

// reconcile VPC Subnet
clusterScope.Info("Reconciling VPC subnets")
if requeue, err := clusterScope.ReconcileVPCSubnet(); err != nil {
clusterScope.Error(err, "failed to reconcile VPC subnet")
if requeue, err := clusterScope.ReconcileVPCSubnets(); err != nil {
clusterScope.Error(err, "failed to reconcile VPC subnets")
conditions.MarkFalse(powerVSCluster, infrav1beta2.VPCSubnetReadyCondition, infrav1beta2.VPCSubnetReconciliationFailedReason, capiv1beta1.ConditionSeverityError, err.Error())
return reconcile.Result{}, err
} else if requeue {
Expand All @@ -192,7 +192,7 @@ func (r *IBMPowerVSClusterReconciler) reconcile(clusterScope *scope.PowerVSClust
// reconcile VPC security group
clusterScope.Info("Reconciling VPC security group")
if err := clusterScope.ReconcileVPCSecurityGroups(); err != nil {
clusterScope.Error(err, "failed to reconcile VPC security group")
clusterScope.Error(err, "failed to reconcile VPC security groups")
conditions.MarkFalse(powerVSCluster, infrav1beta2.VPCSecurityGroupReadyCondition, infrav1beta2.VPCSecurityGroupReconciliationFailedReason, capiv1beta1.ConditionSeverityError, err.Error())
return reconcile.Result{}, err
}
Expand All @@ -212,8 +212,8 @@ func (r *IBMPowerVSClusterReconciler) reconcile(clusterScope *scope.PowerVSClust

// reconcile LoadBalancer
clusterScope.Info("Reconciling VPC load balancers")
if requeue, err := clusterScope.ReconcileLoadBalancer(); err != nil {
clusterScope.Error(err, "failed to reconcile VPC load balancer")
if requeue, err := clusterScope.ReconcileLoadBalancers(); err != nil {
clusterScope.Error(err, "failed to reconcile VPC load balancers")
conditions.MarkFalse(powerVSCluster, infrav1beta2.LoadBalancerReadyCondition, infrav1beta2.LoadBalancerReconciliationFailedReason, capiv1beta1.ConditionSeverityError, err.Error())
return reconcile.Result{}, err
} else if requeue {
Expand Down Expand Up @@ -330,6 +330,7 @@ func (r *IBMPowerVSClusterReconciler) reconcileDelete(ctx context.Context, clust
}

if len(allErrs) > 0 {
clusterScope.Error(kerrors.NewAggregate(allErrs), "failed to delete IBMPowerVSCluster")
return ctrl.Result{}, kerrors.NewAggregate(allErrs)
}

Expand Down
2 changes: 1 addition & 1 deletion controllers/ibmpowervsmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (r *IBMPowerVSMachineReconciler) reconcileNormal(machineScope *scope.PowerV
machineScope.Info("updating loadbalancer for machine", "name", machineScope.IBMPowerVSMachine.Name)
internalIP := machineScope.GetMachineInternalIP()
if internalIP == "" {
machineScope.Info("Not able to update the LoadBalancer, Machine internal IP not yet set", "machine name", machineScope.IBMPowerVSMachine.Name)
machineScope.Info("Unable to update the LoadBalancer, Machine internal IP not yet set", "machine name", machineScope.IBMPowerVSMachine.Name)
return ctrl.Result{}, nil
}
poolMember, err := machineScope.CreateVPCLoadBalancerPoolMember()
Expand Down