Skip to content

Commit

Permalink
fix: register additional nodeclass and status controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
tallaxes committed Oct 12, 2024
1 parent 2f15c9f commit 8ce0482
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ func main() {
WithWebhooks(ctx, corewebhooks.NewWebhooks()...).
WithControllers(ctx, controllers.NewControllers(
ctx,
op.Manager,
op.GetClient(),
op.EventRecorder,
aksCloudProvider,
op.InstanceProvider,
)...).
Expand Down
2 changes: 2 additions & 0 deletions cmd/controller/main_ccp.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ func main() {
// WithWebhooks(ctx, corewebhooks.NewWebhooks()...).
WithControllers(ctx, controllers.NewControllers(
ctx,
op.Manager,
op.GetClient(),
op.EventRecorder,
aksCloudProvider,
op.InstanceProvider,
)...).
Expand Down
16 changes: 14 additions & 2 deletions pkg/controllers/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,34 @@ import (
"context"

"github.com/awslabs/operatorpkg/controller"
"github.com/awslabs/operatorpkg/status"

"sigs.k8s.io/karpenter/pkg/cloudprovider"
"sigs.k8s.io/karpenter/pkg/events"

"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/manager"

"github.com/Azure/karpenter-provider-azure/pkg/apis/v1alpha2"
nodeclaimgarbagecollection "github.com/Azure/karpenter-provider-azure/pkg/controllers/nodeclaim/garbagecollection"
nodeclasshash "github.com/Azure/karpenter-provider-azure/pkg/controllers/nodeclass/hash"
nodeclassstatus "github.com/Azure/karpenter-provider-azure/pkg/controllers/nodeclass/status"
nodeclasstermination "github.com/Azure/karpenter-provider-azure/pkg/controllers/nodeclass/termination"

"github.com/Azure/karpenter-provider-azure/pkg/controllers/nodeclaim/inplaceupdate"
"github.com/Azure/karpenter-provider-azure/pkg/providers/instance"
)

func NewControllers(ctx context.Context, kubeClient client.Client, cloudProvider cloudprovider.CloudProvider, instanceProvider instance.Provider) []controller.Controller {
func NewControllers(ctx context.Context, mgr manager.Manager, kubeClient client.Client, recorder events.Recorder,
cloudProvider cloudprovider.CloudProvider, instanceProvider instance.Provider) []controller.Controller {
controllers := []controller.Controller{
nodeclasshash.NewController(kubeClient),
nodeclassstatus.NewController(kubeClient),
nodeclasstermination.NewController(kubeClient, recorder),
nodeclaimgarbagecollection.NewController(kubeClient, cloudProvider),
// TODO: nodeclaim tagging
inplaceupdate.NewController(kubeClient, instanceProvider),
nodeclassstatus.NewController(kubeClient),
status.NewController[*v1alpha2.AKSNodeClass](kubeClient, mgr.GetEventRecorderFor("karpenter")),
}
return controllers
}

0 comments on commit 8ce0482

Please sign in to comment.