Skip to content

Commit

Permalink
remove debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Pearl1594 committed Jul 18, 2024
1 parent 5c7e3c6 commit 95f5c08
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test:

docker:
docker build . -t apache/cloudstack-kubernetes-provider:${GIT_COMMIT_SHORT}
docker tag apache/cloudstack-kubernetes-provider:${GIT_COMMIT_SHORT} pearl1594/cloudstack-kubernetes-provider:v7
docker tag apache/cloudstack-kubernetes-provider:${GIT_COMMIT_SHORT} pearl1594/cloudstack-kubernetes-provider:v9
ifneq (${GIT_IS_TAG},NOT_A_TAG)
docker tag apache/cloudstack-kubernetes-provider:${GIT_COMMIT_SHORT} pearl1594/cloudstack-kubernetes-provider:${GIT_TAG}
endif
21 changes: 6 additions & 15 deletions cloudstack_loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ func (cs *CSCloud) EnsureLoadBalancer(ctx context.Context, clusterName string, s
}
}

klog.Infof("Creating ACL for network ID: %v", lb.networkID)
network, count, err := lb.Network.GetNetworkByID(lb.networkID, cloudstack.WithProject(lb.projectID))
if err != nil {
if count == 0 {
Expand Down Expand Up @@ -213,7 +212,7 @@ func (cs *CSCloud) EnsureLoadBalancer(ctx context.Context, clusterName string, s
return nil, err
}

klog.Infof("Deleting Network ACL rules associated with load balancer rule: %v (%v:%v)", lbRule.Name, protocol, port)
klog.V(4).Infof("Deleting Network ACL rules associated with load balancer rule: %v (%v:%v)", lbRule.Name, protocol, port)
if _, err := lb.deleteNetworkACLRule(int(port), protocol, lb.networkID); err != nil {
return nil, err
}
Expand Down Expand Up @@ -312,7 +311,7 @@ func (cs *CSCloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName st
}

for _, lbRule := range lb.rules {
klog.Infof("Deleting firewall rules for load balancer: %v", lbRule.Name)
klog.V(4).Infof("Deleting firewall rules / Network ACLs for load balancer: %v", lbRule.Name)
protocol := ProtocolFromLoadBalancer(lbRule.Protocol)
if protocol == LoadBalancerProtocolInvalid {
klog.Errorf("Error parsing protocol: %v", lbRule.Protocol)
Expand All @@ -321,31 +320,25 @@ func (cs *CSCloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName st
if err != nil {
klog.Errorf("Error parsing port: %v", err)
} else {
klog.Infof("LB IP Addr: %v ", lb.ipAddrID)
networkId, err := cs.getNetworkIDFromIPAddress(lb.ipAddrID)
if err != nil {
return err
}
klog.Infof("Attempting to delete Fw / ACL for port: %v for network ID: %v", port, networkId)
network, count, err := lb.Network.GetNetworkByID(networkId, cloudstack.WithProject(lb.projectID))
if err != nil {
if count == 0 {
klog.Infof("No network found")
klog.Errorf("No network found")
return err
}
klog.Infof("Returning err")
return err
}
klog.Infof("network vpc id: %v", network.Vpcid)
klog.Infof("Network belongs to VPC: %v", network.Vpcid == "")
if network.Vpcid == "" {
klog.Infof("Deleting firewall rule - as network doesn't belong to a VPC")
_, err = lb.deleteFirewallRule(lbRule.Publicipid, int(port), protocol)
if err != nil {
klog.Errorf("Error deleting firewall rule: %v", err)
}
} else {
klog.Infof("Deleting network ACLs for %v - %v", int(port), protocol)
klog.V(4).Infof("Deleting network ACLs for %v - %v", int(port), protocol)
_, err = lb.deleteNetworkACLRule(int(port), protocol, networkId)
if err != nil {
klog.Errorf("Error deleting Network ACL rule: %v", err)
Expand Down Expand Up @@ -424,9 +417,9 @@ func (cs *CSCloud) getNetworkIDFromIPAddress(publicIpId string) (string, error)
return "", err
}
if ip.Networkid != "" {
network, _, netErr := cs.client.Network.GetNetworkByID(ip.Networkid)
network, _, netErr := cs.client.Network.GetNetworkByID(ip.Associatednetworkid)
if netErr != nil {
klog.Errorf("Failed to fetch the network for id: %v", ip.Networkid)
klog.Errorf("Failed to fetch the network for id: %v", ip.Associatednetworkid)
return "", err
}
return network.Id, nil
Expand Down Expand Up @@ -934,8 +927,6 @@ func (lb *loadBalancer) deleteNetworkACLRule(publicPort int, protocol LoadBalanc
return false, fmt.Errorf("error fetching Network ACL rules Network ID %v: %v", networkID, err)
}

klog.Infof("found the following network acl for port %v: %v", publicPort, r.NetworkACLs)

// filter by proto:port
filtered := make([]*cloudstack.NetworkACL, 0, 1)
for _, rule := range r.NetworkACLs {
Expand Down
2 changes: 1 addition & 1 deletion deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ spec:
spec:
containers:
- name: cloud-controller-manager
image: pearl1594/cloudstack-kubernetes-provider:v7
image: pearl1594/cloudstack-kubernetes-provider:v9
imagePullPolicy: IfNotPresent
args:
- --leader-elect=true
Expand Down

0 comments on commit 95f5c08

Please sign in to comment.