-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
upup/pkg/fi/ upup/pkg/kutil : simplify code and remove code #8118
upup/pkg/fi/ upup/pkg/kutil : simplify code and remove code #8118
Conversation
|
||
attempt := 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused that this function of for{} ,
this seems run one,so i think it is ok to remove this code .
@@ -147,10 +147,10 @@ func (_ *StorageBucketIam) RenderGCE(t *gce.GCEAPITarget, a, e, changes *Storage | |||
return nil | |||
} | |||
|
|||
type terraformStorageBucketIam struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 158 refers to this struct , but commented. So I comment this struct not remove it.
/test pull-kops-e2e-kubernetes-aws |
@@ -69,7 +69,6 @@ func NewLBListenerTaskFromCloud(cloud openstack.OpenstackCloud, lifecycle *fi.Li | |||
} | |||
listenerTask.Pool = poolTask | |||
// TODO: Support Multiple? | |||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't removing this change the listenerTask.Pool
from being the first item in lb.Pools
to the last item?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, forget it.
NewLBListenerTaskFromCloud has not comment , so i has some questions about this function.
This seems that we need not to use for{} . any advice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hakman any advice?Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would try this:
--- upup/pkg/fi/cloudup/openstacktasks/lblistener.go.old
+++ upup/pkg/fi/cloudup/openstacktasks/lblistener.go
@@ -66,10 +66,11 @@
poolTask, err := NewLBPoolTaskFromCloud(cloud, lifecycle, &pool, find.Pool)
if err != nil {
return nil, fmt.Errorf("NewLBListenerTaskFromCloud: Failed to create new LBListener task for pool %s: %v", pool.Name, err)
- }
- listenerTask.Pool = poolTask
- // TODO: Support Multiple?
- break
+ } else {
+ listenerTask.Pool = poolTask
+ // TODO: Support Multiple?
+ break
+ }
}
if find != nil {
// Update all search terms
@@ -49,7 +49,7 @@ func (s *SecurityGroupRule) CompareWithID() *string { | |||
} | |||
|
|||
func equalsIgnoreCase(a, b string) bool { | |||
if strings.ToLower(a) == strings.ToLower(b) { | |||
if strings.EqualFold(a, b) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to me that equalsIgnoreCase
just reimplements strings.EqualFold
and is used only once.
Maybe would be best to just remove it and replace where it's used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I can do it
… simplify code and remove code
This looks great, the for loops that make AWS calls wouldnt have been necessary even if they were retrying properly because the AWS client has its own retry + backoff built in, so this definitely simplifies those functions. Thanks! /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rifelpet, tanjunchen 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 |
ref:#7800