diff --git a/charts/karpenter/templates/clusterrole-core.yaml b/charts/karpenter/templates/clusterrole-core.yaml index eccc9fb7acc6..edb7ca93d54e 100644 --- a/charts/karpenter/templates/clusterrole-core.yaml +++ b/charts/karpenter/templates/clusterrole-core.yaml @@ -44,6 +44,9 @@ rules: - apiGroups: ["policy"] resources: ["poddisruptionbudgets"] verbs: ["get", "list", "watch"] + - apiGroups: [] + resources: ["events"] + verbs: ["get", list, "watch"] # Write - apiGroups: ["karpenter.sh"] resources: ["nodeclaims", "nodeclaims/status"] diff --git a/pkg/controllers/controllers.go b/pkg/controllers/controllers.go index 50fabf52d5ea..c5e58541f900 100644 --- a/pkg/controllers/controllers.go +++ b/pkg/controllers/controllers.go @@ -18,6 +18,7 @@ import ( "context" "github.com/awslabs/operatorpkg/controller" + opevents "github.com/awslabs/operatorpkg/events" "github.com/awslabs/operatorpkg/status" "github.com/patrickmn/go-cache" "sigs.k8s.io/controller-runtime/pkg/manager" @@ -37,6 +38,7 @@ import ( servicesqs "github.com/aws/aws-sdk-go-v2/service/sqs" "github.com/samber/lo" + corev1 "k8s.io/api/core/v1" "k8s.io/utils/clock" "sigs.k8s.io/controller-runtime/pkg/client" @@ -86,6 +88,7 @@ func NewControllers( controllersinstancetypecapacity.NewController(kubeClient, instanceTypeProvider), ssminvalidation.NewController(ssmCache, amiProvider), status.NewController[*v1.EC2NodeClass](kubeClient, mgr.GetEventRecorderFor("karpenter"), status.EmitDeprecatedMetrics), + opevents.NewController[*corev1.Node](kubeClient, clk), } if options.FromContext(ctx).InterruptionQueue != "" { sqsapi := servicesqs.NewFromConfig(cfg)