-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Reduce API calls in upgrade cluster #4366
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ type Cluster interface { | |
|
|
||
| func New(cfg *api.ClusterConfig, ctl *eks.ClusterProvider) (Cluster, error) { | ||
| clusterExists := true | ||
| err := ctl.RefreshClusterStatus(cfg) | ||
| err := ctl.RefreshClusterStatusIfStale(cfg) | ||
| if err != nil { | ||
| if awsError, ok := errors.Unwrap(errors.Unwrap(err)).(awserr.Error); ok && | ||
| awsError.Code() == awseks.ErrCodeResourceNotFoundException { | ||
|
|
@@ -31,14 +31,14 @@ func New(cfg *api.ClusterConfig, ctl *eks.ClusterProvider) (Cluster, error) { | |
| } | ||
|
|
||
| stackManager := ctl.NewStackManager(cfg) | ||
| hasClusterStack, err := stackManager.HasClusterStack() | ||
| clusterStack, err := stackManager.GetClusterStackIfExists() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No. It only returns an error if one of the API call fails. Thats why its the I don't love the code but I wanted a way to re-use the stack so that we make less API calls
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nikimanoledaki does that make sense?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. makes sense, I don't love it either but can't think of anything else! |
||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| if hasClusterStack { | ||
| if clusterStack != nil { | ||
| logger.Debug("cluster %q was created by eksctl", cfg.Metadata.Name) | ||
| return NewOwnedCluster(cfg, ctl, stackManager), nil | ||
| return NewOwnedCluster(cfg, ctl, clusterStack, stackManager), nil | ||
| } | ||
|
|
||
| if !clusterExists { | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
wb
RefreshStaleClusterStatus?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.
mhmm that implies it will always refresh, rather than only sometimes (it used to be
maybe)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.
ok yeah that's true,
ifXis a step up frommaybe!