Skip to content

Commit

Permalink
feat: Add node events based metrics (#7382)
Browse files Browse the repository at this point in the history
  • Loading branch information
engedaam authored Nov 15, 2024
1 parent adb9f72 commit 6a940ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions charts/karpenter/templates/clusterrole-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
3 changes: 3 additions & 0 deletions pkg/controllers/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6a940ff

Please sign in to comment.