Skip to content

Commit

Permalink
Implemented support for multiple provisioners
Browse files Browse the repository at this point in the history
  • Loading branch information
ellistarn committed Nov 18, 2021
1 parent e7736b6 commit a68b662
Show file tree
Hide file tree
Showing 19 changed files with 819 additions and 1,019 deletions.
11 changes: 8 additions & 3 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
"github.com/awslabs/karpenter/pkg/cloudprovider"
"github.com/awslabs/karpenter/pkg/cloudprovider/registry"
"github.com/awslabs/karpenter/pkg/controllers"
"github.com/awslabs/karpenter/pkg/controllers/allocation"
"github.com/awslabs/karpenter/pkg/controllers/metrics"
"github.com/awslabs/karpenter/pkg/controllers/node"
"github.com/awslabs/karpenter/pkg/controllers/provisioning"
"github.com/awslabs/karpenter/pkg/controllers/termination"
"github.com/awslabs/karpenter/pkg/utils/options"
"github.com/awslabs/karpenter/pkg/utils/restconfig"
Expand Down Expand Up @@ -81,9 +81,14 @@ func main() {
HealthProbeBindAddress: fmt.Sprintf(":%d", opts.HealthProbePort),
})

terminator := termination.NewController(ctx, manager.GetClient(), clientSet.CoreV1(), cloudProvider)
provisioner := provisioning.NewController(ctx, manager.GetClient(), clientSet.CoreV1(), cloudProvider)
scheduler := provisioning.NewScheduler(manager.GetClient(), provisioner)

if err := manager.RegisterControllers(ctx,
allocation.NewController(manager.GetClient(), clientSet.CoreV1(), cloudProvider),
termination.NewController(ctx, manager.GetClient(), clientSet.CoreV1(), cloudProvider),
provisioner,
scheduler,
terminator,
node.NewController(manager.GetClient()),
metrics.NewController(manager.GetClient(), cloudProvider),
).Start(ctx); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/provisioning/v1alpha5/constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ func (c *Constraints) Supports(pod *v1.Pod) error {
podRequirements := PodRequirements(pod)
for _, key := range podRequirements.Keys() {
if c.Requirements.Requirement(key).Len() == 0 {
return fmt.Errorf("%s is too constrained", key)
return fmt.Errorf("invalid constraint %q, %v not in %v", key, podRequirements.Requirement(key).UnsortedList(), c.Requirements.Requirement(key).UnsortedList())
}
}
// The combined requirements are not compatible
combined := c.Requirements.With(podRequirements)
for _, key := range podRequirements.Keys() {
if combined.Requirement(key).Len() == 0 {
return fmt.Errorf("%s is too constrained", key)
return fmt.Errorf("invalid constraint %q, %v not in %v", key, podRequirements.Requirement(key).UnsortedList(), c.Requirements.Requirement(key).UnsortedList())
}
}
return nil
Expand Down
229 changes: 86 additions & 143 deletions pkg/cloudprovider/aws/suite_test.go

Large diffs are not rendered by default.

173 changes: 0 additions & 173 deletions pkg/controllers/allocation/batch.go

This file was deleted.

Loading

0 comments on commit a68b662

Please sign in to comment.