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

perf: factor out replacement/termination waits from deprovisioning #542

Merged
merged 58 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
b617ca4
chore: remove machine taint code
njtran Nov 6, 2023
998fb57
comments
njtran Nov 6, 2023
7981df6
remove taint before adding
njtran Nov 6, 2023
3ef2a25
initial
njtran Sep 11, 2023
3b479cf
fixed tests
njtran Oct 10, 2023
0eb41c0
change to one taint
njtran Oct 10, 2023
c317799
fix panics
njtran Oct 10, 2023
05e3c53
add back in machine logic
njtran Oct 11, 2023
7420407
tidy up
njtran Oct 11, 2023
829b4a8
faultyrebase
njtran Oct 11, 2023
6e0a7a5
perf: factor out replacement/termination waits from deprovisioning
njtran Sep 27, 2023
f0bb3c8
second commit
njtran Sep 28, 2023
c43a9d2
some tests
njtran Sep 28, 2023
1b69367
more tests
njtran Sep 29, 2023
21a22c2
lastTsts
njtran Sep 29, 2023
31cb9bd
cleanup blocks
njtran Sep 29, 2023
ec2a934
fix hash bug
njtran Sep 29, 2023
1b66854
tests
njtran Oct 2, 2023
d40d552
removehash
njtran Oct 2, 2023
4169118
fixcomments
njtran Oct 3, 2023
4f9e22a
restructure
njtran Oct 3, 2023
0d53517
remove old code
njtran Oct 3, 2023
1db16c3
add rebase tests
njtran Oct 3, 2023
61f5bb1
last one
njtran Oct 3, 2023
9fc640e
update comments and tests
njtran Oct 6, 2023
9722ebd
rebasing problems
njtran Oct 6, 2023
fa5960d
stash
njtran Oct 11, 2023
c90efce
checkpoint
njtran Oct 11, 2023
4d43d25
rebase
njtran Oct 11, 2023
cfbc846
add queue len gate
njtran Oct 13, 2023
38471ce
fixing
njtran Nov 7, 2023
7af4888
restore stash?
njtran Nov 7, 2023
5689f05
rebasing
njtran Nov 7, 2023
d83e2cc
tests
njtran Nov 8, 2023
b27746b
fix rebase errors
njtran Nov 8, 2023
ef5e083
change instance types to beta
njtran Nov 8, 2023
73ca5ad
tests
njtran Nov 8, 2023
02b6cfa
should be fixed
njtran Nov 9, 2023
bee372a
remove race
njtran Nov 9, 2023
4209394
remove alpha and adjust PR
njtran Nov 9, 2023
032d590
revert queue
njtran Nov 9, 2023
3b432d1
comments
njtran Nov 9, 2023
d0906b6
donotconsolidate note
njtran Nov 9, 2023
93b84cf
stuff
njtran Nov 9, 2023
2edb0d3
comments
njtran Nov 10, 2023
45741a7
fix testing
njtran Nov 10, 2023
8707994
disruption test
njtran Nov 10, 2023
04dbf05
test
njtran Nov 10, 2023
ee54a2f
add back in test
njtran Nov 10, 2023
91b25cb
comments
njtran Nov 10, 2023
0848c05
comment removal
njtran Nov 10, 2023
e304553
state + consolidation
njtran Nov 10, 2023
ef767de
consolidation
njtran Nov 11, 2023
b7e7077
more comments
njtran Nov 11, 2023
a4d1d68
rebase leftovers
njtran Nov 11, 2023
d8b744a
testing comments
njtran Nov 13, 2023
6ba6219
test updates
njtran Nov 14, 2023
e4d29fd
final FINAL comment
njtran Nov 14, 2023
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
6 changes: 4 additions & 2 deletions pkg/controllers/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/aws/karpenter-core/pkg/cloudprovider"
"github.com/aws/karpenter-core/pkg/controllers/disruption"
"github.com/aws/karpenter-core/pkg/controllers/disruption/orchestration"
"github.com/aws/karpenter-core/pkg/controllers/leasegarbagecollection"
metricsnode "github.com/aws/karpenter-core/pkg/controllers/metrics/node"
metricsnodepool "github.com/aws/karpenter-core/pkg/controllers/metrics/nodepool"
Expand Down Expand Up @@ -52,10 +53,11 @@ func NewControllers(

p := provisioning.NewProvisioner(kubeClient, kubernetesInterface.CoreV1(), recorder, cloudProvider, cluster)
evictionQueue := terminator.NewQueue(kubernetesInterface.CoreV1(), recorder)
disruptionQueue := orchestration.NewQueue(kubeClient, recorder, cluster, clock, p)
ellistarn marked this conversation as resolved.
Show resolved Hide resolved

return []controller.Controller{
p, evictionQueue,
disruption.NewController(clock, kubeClient, p, cloudProvider, recorder, cluster),
p, evictionQueue, disruptionQueue,
disruption.NewController(clock, kubeClient, p, cloudProvider, recorder, cluster, disruptionQueue),
provisioning.NewController(kubeClient, p, recorder),
nodepoolhash.NewNodePoolController(kubeClient),
informer.NewDaemonSetController(kubeClient, cluster),
Expand Down
7 changes: 6 additions & 1 deletion pkg/controllers/disruption/consolidation.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/aws/karpenter-core/pkg/apis/v1beta1"
"github.com/aws/karpenter-core/pkg/cloudprovider"
disruptionevents "github.com/aws/karpenter-core/pkg/controllers/disruption/events"
"github.com/aws/karpenter-core/pkg/controllers/disruption/orchestration"
"github.com/aws/karpenter-core/pkg/controllers/provisioning"
"github.com/aws/karpenter-core/pkg/controllers/state"
"github.com/aws/karpenter-core/pkg/events"
Expand All @@ -42,6 +43,8 @@ const consolidationTTL = 15 * time.Second
// consolidation is the base consolidation controller that provides common functionality used across the different
njtran marked this conversation as resolved.
Show resolved Hide resolved
// consolidation methods.
type consolidation struct {
// Consolidation needs to be aware of the queue for validation
queue *orchestration.Queue
clock clock.Clock
cluster *state.Cluster
kubeClient client.Client
Expand All @@ -52,8 +55,9 @@ type consolidation struct {
}

func makeConsolidation(clock clock.Clock, cluster *state.Cluster, kubeClient client.Client, provisioner *provisioning.Provisioner,
cloudProvider cloudprovider.CloudProvider, recorder events.Recorder) consolidation {
cloudProvider cloudprovider.CloudProvider, recorder events.Recorder, queue *orchestration.Queue) consolidation {
return consolidation{
queue: queue,
clock: clock,
cluster: cluster,
kubeClient: kubeClient,
Expand Down Expand Up @@ -89,6 +93,7 @@ func (c *consolidation) markConsolidated() {

// ShouldDisrupt is a predicate used to filter candidates
func (c *consolidation) ShouldDisrupt(_ context.Context, cn *Candidate) bool {
// TODO: Remove the check for do-not-consolidate at v1
ellistarn marked this conversation as resolved.
Show resolved Hide resolved
if cn.Annotations()[v1alpha5.DoNotConsolidateNodeAnnotationKey] == "true" {
c.recorder.Publish(disruptionevents.Unconsolidatable(cn.Node, cn.NodeClaim, fmt.Sprintf("%s annotation exists", v1alpha5.DoNotConsolidateNodeAnnotationKey))...)
return false
Expand Down
Loading