-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
cluster-autoscaler: standardize context usage #7664
base: master
Are you sure you want to change the base?
Conversation
eb36b73
to
1233b65
Compare
/assign @MaciekPytel @towca While reviewing some other PRs this stuff was driving me nuts. I think this PR, while pretty huge, improves the way we use context(s) significantly and isn't too horrible to review. |
/test ls |
@jackfrancis: The specified target(s) for
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/test pull-cluster-autoscaler-e2e-azure-master |
1233b65
to
45876c7
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: jackfrancis The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test pull-cluster-autoscaler-e2e-azure-master |
45876c7
to
a802d00
Compare
/retest |
a802d00
to
e7dea53
Compare
Signed-off-by: Jack Francis <[email protected]>
e7dea53
to
de117ea
Compare
/retest |
/cc |
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.
thanks for the cleanup @jackfrancis , it looks good to me but i did not go searching for missed references. i do have a couple questions about adding some comments.
@@ -219,7 +219,7 @@ func (a *Actuator) taintNodesSync(NodeGroupViews []*budgets.NodeGroupView) (time | |||
err error | |||
}, len(nodesToTaint)) | |||
taintedNodes := make(chan *apiv1.Node, len(nodesToTaint)) | |||
workqueue.ParallelizeUntil(default_context.Background(), maxConcurrentNodesTainting, len(nodesToTaint), func(piece int) { | |||
workqueue.ParallelizeUntil(context.Background(), maxConcurrentNodesTainting, len(nodesToTaint), func(piece int) { |
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 wonder if we should add a comment here to explain why the default context is being used instead of autoscalingcontext?
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.
autoscalingContext
doesn't fulfill the context.Context
interface (maybe it's unfortunate that we named it AutoscalingContext
, but that ship has sailed. Ref:
@@ -270,10 +270,10 @@ func run(healthCheck *metrics.HealthCheck, debuggingSnapshotter debuggingsnapsho | |||
autoscalingOpts := flags.AutoscalingOptions() | |||
|
|||
metrics.RegisterAll(autoscalingOpts.EmitPerNodeGroupMetrics) | |||
context, cancel := ctx.WithCancel(ctx.Background()) | |||
ctx, cancel := context.WithCancel(context.Background()) |
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.
should we comment about why we are using the default context here?
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.
ditto my earlier response
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
This PR standardizes CA-specific context usage of the
"k8s.io/autoscaler/cluster-autoscaler/context"
library.Specifically:
ca_context
to disambiguate from the standard golang "context" package.ca_context "k8s.io/autoscaler/cluster-autoscaler/context"
AutoscalingContext
in functions, etc, asautoscalingContext
(again, to disambiguate from the standard context foo)ctx
as the variable reference to acontext.Context
typeWhich issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: