Skip to content

Commit

Permalink
Add events based metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
engedaam committed Nov 15, 2024
1 parent 42b6da5 commit 2a95367
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 2a95367

Please sign in to comment.