Skip to content

Commit

Permalink
feat: Add nodepool label to karpenter_interruption_actions_performed (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ant-smith authored May 14, 2024
1 parent 2ace691 commit 120419b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
7 changes: 6 additions & 1 deletion pkg/controllers/interruption/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,12 @@ func (c *Controller) handleNodeClaim(ctx context.Context, msg messages.Message,

// Record metric and event for this action
c.notifyForMessage(msg, nodeClaim, node)
actionsPerformed.WithLabelValues(string(action)).Inc()
actionsPerformed.With(
prometheus.Labels{
actionTypeLabel: string(action),
metrics.NodePoolLabel: nodeClaim.Labels[v1beta1.NodePoolLabelKey],
},
).Inc()

// Mark the offering as unavailable in the ICE cache since we got a spot interruption warning
if msg.Kind() == messages.SpotInterruptionKind {
Expand Down
5 changes: 4 additions & 1 deletion pkg/controllers/interruption/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ var (
Name: "actions_performed",
Help: "Number of notification actions performed. Labeled by action",
},
[]string{actionTypeLabel},
[]string{
actionTypeLabel,
metrics.NodePoolLabel,
},
)
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/subnet/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
type Provider interface {
LivenessProbe(*http.Request) error
List(context.Context, *v1beta1.EC2NodeClass) ([]*ec2.Subnet, error)
AssociatePublicIPAddressValue( *v1beta1.EC2NodeClass) (*bool)
AssociatePublicIPAddressValue(*v1beta1.EC2NodeClass) *bool
ZonalSubnetsForLaunch(context.Context, *v1beta1.EC2NodeClass, []*cloudprovider.InstanceType, string) (map[string]*Subnet, error)
UpdateInflightIPs(*ec2.CreateFleetInput, *ec2.CreateFleetOutput, []*cloudprovider.InstanceType, []*Subnet, string)
}
Expand Down

0 comments on commit 120419b

Please sign in to comment.