Skip to content

Commit

Permalink
Refactored expiration controller into node controller
Browse files Browse the repository at this point in the history
  • Loading branch information
ellistarn committed Aug 3, 2021
1 parent feaa736 commit 641dad0
Show file tree
Hide file tree
Showing 22 changed files with 542 additions and 819 deletions.
4 changes: 0 additions & 4 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ import (
"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/expiration"
"github.com/awslabs/karpenter/pkg/controllers/node"
"github.com/awslabs/karpenter/pkg/controllers/reallocation"
"github.com/awslabs/karpenter/pkg/controllers/termination"
"github.com/go-logr/zapr"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -82,9 +80,7 @@ func main() {
HealthProbeBindAddress: fmt.Sprintf(":%d", options.HealthProbePort),
})
if err := manager.RegisterControllers(ctx,
expiration.NewController(manager.GetClient()),
allocation.NewController(manager.GetClient(), clientSet.CoreV1(), cloudProvider),
reallocation.NewController(manager.GetClient(), cloudProvider),
termination.NewController(ctx, manager.GetClient(), clientSet.CoreV1(), cloudProvider),
node.NewController(manager.GetClient()),
).Start(ctx); err != nil {
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ require (
github.com/avast/retry-go v2.7.0+incompatible
github.com/aws/aws-sdk-go v1.38.69
github.com/deckarep/golang-set v1.7.1
github.com/evanphx/json-patch/v5 v5.5.0 // indirect
github.com/go-logr/zapr v0.4.0
github.com/imdario/mergo v0.3.12
github.com/mitchellh/hashstructure/v2 v2.0.2
github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.13.0
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/r3labs/diff v1.1.0
go.uber.org/multierr v1.7.0
go.uber.org/zap v1.18.1 // indirect
golang.org/x/time v0.0.0-20210611083556-38a9dc6acbc6
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,8 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1
github.com/prometheus/statsd_exporter v0.20.0 h1:M0hQphnq2WyWKS5CefQL8PqWwBOBPhiAkyLo5l4ZYvE=
github.com/prometheus/statsd_exporter v0.20.0/go.mod h1:YL3FWCG8JBBtaUSxAg4Gz2ZYu22bS84XM89ZQXXTWmQ=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/r3labs/diff v1.1.0 h1:V53xhrbTHrWFWq3gI4b94AjgEJOerO1+1l0xyHOBi8M=
github.com/r3labs/diff v1.1.0/go.mod h1:7WjXasNzi0vJetRcB/RqNl5dlIsmXcTTLmF5IoH6Xig=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
Expand Down
3 changes: 1 addition & 2 deletions pkg/apis/provisioning/v1alpha3/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ var (
NotReadyTaintKey = SchemeGroupVersion.Group + "/not-ready"

// Reserved labels
ProvisionerNameLabelKey = SchemeGroupVersion.Group + "/provisioner-name"
ProvisionerUnderutilizedLabelKey = SchemeGroupVersion.Group + "/underutilized"
ProvisionerNameLabelKey = SchemeGroupVersion.Group + "/provisioner-name"

// Reserved annotations
KarpenterDoNotEvictPodAnnotation = SchemeGroupVersion.Group + "/do-not-evict"
Expand Down
1 change: 0 additions & 1 deletion pkg/apis/provisioning/v1alpha3/provisioner_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ var (
ArchitectureLabelKey,
OperatingSystemLabelKey,
ProvisionerNameLabelKey,
ProvisionerUnderutilizedLabelKey,
ProvisionerTTLAfterEmptyKey,
ZoneLabelKey,
InstanceTypeLabelKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ var _ = Describe("Validation", func() {
ArchitectureLabelKey,
OperatingSystemLabelKey,
ProvisionerNameLabelKey,
ProvisionerUnderutilizedLabelKey,
ZoneLabelKey,
InstanceTypeLabelKey,
} {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cloudprovider/aws/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (p *InstanceProvider) Create(ctx context.Context,
retry.Delay(1*time.Second),
retry.Attempts(3),
); err != nil {
return nil, err
return nil, fmt.Errorf("getting instance, %w", err)
}
logging.FromContext(ctx).Infof("Launched instance: %s, type: %s, zone: %s, hostname: %s",
aws.StringValue(instance.InstanceId),
Expand Down
119 changes: 0 additions & 119 deletions pkg/controllers/expiration/controller.go

This file was deleted.

115 changes: 0 additions & 115 deletions pkg/controllers/expiration/suite_test.go

This file was deleted.

Loading

0 comments on commit 641dad0

Please sign in to comment.