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

Implemented support for selecting multiple provisioners #803

Merged
merged 1 commit into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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())
JacobGabrielson marked this conversation as resolved.
Show resolved Hide resolved
}
}
// 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