Skip to content

Commit

Permalink
Merge branch 'main' into limit-by-nodepool
Browse files Browse the repository at this point in the history
  • Loading branch information
engedaam authored Nov 22, 2024
2 parents 54b7093 + 9d472b7 commit a0b1355
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/kind-e2e.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: kind-e2e
on:
push:
branches: [main]
workflow_dispatch:
jobs:
kind-e2e:
Expand Down
1 change: 0 additions & 1 deletion pkg/controllers/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ func NewControllers(
status.NewController[*v1.NodeClaim](kubeClient, mgr.GetEventRecorderFor("karpenter"), status.EmitDeprecatedMetrics),
status.NewController[*v1.NodePool](kubeClient, mgr.GetEventRecorderFor("karpenter"), status.EmitDeprecatedMetrics),
status.NewGenericObjectController[*corev1.Node](kubeClient, mgr.GetEventRecorderFor("karpenter")),
health.NewController(kubeClient, cloudProvider, clock),
}

// The cloud provider must define status conditions for the node repair controller to use to detect unhealthy nodes
Expand Down
10 changes: 5 additions & 5 deletions pkg/controllers/metrics/pod/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ var (
[]string{podName, podNamespace},
)
// Stage: alpha
PodProvisioningSchedulingUndecidedTimeSeconds = opmetrics.NewPrometheusGauge(
PodSchedulingUndecidedTimeSeconds = opmetrics.NewPrometheusGauge(
crmetrics.Registry,
prometheus.GaugeOpts{
Namespace: metrics.Namespace,
Subsystem: metrics.PodSubsystem,
Name: "provisioning_scheduling_undecided_time_seconds",
Name: "scheduling_undecided_time_seconds",
Help: "The time from when Karpenter has seen a pod without making a scheduling decision for the pod. Note: this calculated from a point in memory, not by the pod creation timestamp.",
},
[]string{podName, podNamespace},
Expand Down Expand Up @@ -229,7 +229,7 @@ func (c *Controller) Reconcile(ctx context.Context, req reconcile.Request) (reco
podName: req.Name,
podNamespace: req.Namespace,
})
PodProvisioningSchedulingUndecidedTimeSeconds.Delete(map[string]string{
PodSchedulingUndecidedTimeSeconds.Delete(map[string]string{
podName: req.Name,
podNamespace: req.Namespace,
})
Expand Down Expand Up @@ -261,15 +261,15 @@ func (c *Controller) recordPodSchedulingUndecidedMetric(pod *corev1.Pod) {
nn := client.ObjectKeyFromObject(pod)
// If we've made a decision on this pod, delete the metric idempotently and return
if decisionTime := c.cluster.PodSchedulingDecisionTime(nn); !decisionTime.IsZero() {
PodProvisioningSchedulingUndecidedTimeSeconds.Delete(map[string]string{
PodSchedulingUndecidedTimeSeconds.Delete(map[string]string{
podName: pod.Name,
podNamespace: pod.Namespace,
})
return
}
// If we haven't made a decision, get the time that we ACK'd the pod and emit the metric based on that
if podAckTime := c.cluster.PodAckTime(nn); !podAckTime.IsZero() {
PodProvisioningSchedulingUndecidedTimeSeconds.Set(time.Since(podAckTime).Seconds(), map[string]string{
PodSchedulingUndecidedTimeSeconds.Set(time.Since(podAckTime).Seconds(), map[string]string{
podName: pod.Name,
podNamespace: pod.Namespace,
})
Expand Down
12 changes: 6 additions & 6 deletions pkg/controllers/metrics/pod/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ var _ = Describe("Pod Metrics", func() {

ExpectReconcileSucceeded(ctx, podController, client.ObjectKeyFromObject(p))
fakeClock.Step(1 * time.Hour)
_, found := FindMetricWithLabelValues("karpenter_pods_provisioning_scheduling_undecided_time_seconds", map[string]string{
_, found := FindMetricWithLabelValues("karpenter_pods_scheduling_undecided_time_seconds", map[string]string{
"name": p.GetName(),
"namespace": p.GetNamespace(),
})
Expand All @@ -262,7 +262,7 @@ var _ = Describe("Pod Metrics", func() {
ExpectReconcileSucceeded(ctx, podController, client.ObjectKeyFromObject(p))
fakeClock.Step(1 * time.Hour)

_, found = FindMetricWithLabelValues("karpenter_pods_provisioning_scheduling_undecided_time_seconds", map[string]string{
_, found = FindMetricWithLabelValues("karpenter_pods_scheduling_undecided_time_seconds", map[string]string{
"name": p.GetName(),
"namespace": p.GetNamespace(),
})
Expand All @@ -271,7 +271,7 @@ var _ = Describe("Pod Metrics", func() {
cluster.MarkPodSchedulingDecisions(map[*corev1.Pod]error{}, p)
ExpectReconcileSucceeded(ctx, podController, client.ObjectKeyFromObject(p))

_, found = FindMetricWithLabelValues("karpenter_pods_provisioning_scheduling_undecided_time_seconds", map[string]string{
_, found = FindMetricWithLabelValues("karpenter_pods_scheduling_undecided_time_seconds", map[string]string{
"name": p.GetName(),
"namespace": p.GetNamespace(),
})
Expand All @@ -284,7 +284,7 @@ var _ = Describe("Pod Metrics", func() {

ExpectReconcileSucceeded(ctx, podController, client.ObjectKeyFromObject(p))
fakeClock.Step(1 * time.Hour)
_, found := FindMetricWithLabelValues("karpenter_pods_provisioning_scheduling_undecided_time_seconds", map[string]string{
_, found := FindMetricWithLabelValues("karpenter_pods_scheduling_undecided_time_seconds", map[string]string{
"name": p.GetName(),
"namespace": p.GetNamespace(),
})
Expand All @@ -295,7 +295,7 @@ var _ = Describe("Pod Metrics", func() {
ExpectReconcileSucceeded(ctx, podController, client.ObjectKeyFromObject(p))
fakeClock.Step(1 * time.Hour)

_, found = FindMetricWithLabelValues("karpenter_pods_provisioning_scheduling_undecided_time_seconds", map[string]string{
_, found = FindMetricWithLabelValues("karpenter_pods_scheduling_undecided_time_seconds", map[string]string{
"name": p.GetName(),
"namespace": p.GetNamespace(),
})
Expand All @@ -304,7 +304,7 @@ var _ = Describe("Pod Metrics", func() {
ExpectDeleted(ctx, env.Client, p)
ExpectReconcileSucceeded(ctx, podController, client.ObjectKeyFromObject(p))

_, found = FindMetricWithLabelValues("karpenter_pods_provisioning_scheduling_undecided_time_seconds", map[string]string{
_, found = FindMetricWithLabelValues("karpenter_pods_scheduling_undecided_time_seconds", map[string]string{
"name": p.GetName(),
"namespace": p.GetNamespace(),
})
Expand Down

0 comments on commit a0b1355

Please sign in to comment.