← Back to Pull requests

[Backport v1.31] [CASCL-1786] Treat any ResourceNotFoundException as no Pod Identity addon #3564

Closed
unknown closed this pull request without merging on Oct 07, 2026 18:28 UTC
View on GitHub
unknown unknown commented on Oct 07, 2026 13:45 UTC
Author

Backport ddb93850efa6c3d8cf8b8d3d39f32745b09a2ed5 from #3560.

___

What does this PR do?

IsThereUnmanagedEKSPodIdentityAgentInstalled now treats any ResourceNotFoundException from eks:DescribeAddon as "no unmanaged eks-pod-identity-agent addon", instead of requiring one exact error message.

It also takes a small DescribeAddonAPI interface (like the neighbouring OIDCProviderAPI and DescribeRouteTablesAPI) so the behaviour can be unit tested, and reports an empty response as an error instead of wrapping a nil error.

Motivation

kubectl datadog autoscaling cluster install --install-mode=existing-nodes fails on any cluster that does not already have the Pod Identity addon. The check only treated the 404 as "no addon" when the message contained No addon: eks-pod-identity-agent found in cluster, and EKS now answers The requested resource does not exist. The install then stops with:

Error: failed to check if EKS pod identity agent is installed: failed to describe addon eks-pod-identity-agent for cluster <cluster>: operation error EKS: DescribeAddon, https response error StatusCode: 404, ... ResourceNotFoundException: The requested resource does not exist.

and leaves the first CloudFormation stack (dd-karpenter-<cluster>-karpenter) behind. This is not a regression in the plugin: the matching code dates from #2301 and is unchanged since. The template creates the addon itself when it is missing, so "not found" is the normal case.

It is also why TestAutoscalingInstallModeExistingNodes fails in the e2e_autoscaling job (seen on 2026-09-25, 2026-09-28 and 2026-10-06). That job only runs automatically on PRs that touch the autoscaling paths, so nothing exercised the code in between.

Fixes CASCL-1786.

Additional Notes

  • A missing cluster is still reported earlier: createCloudFormationStacks describes the cluster before it looks for the addon, so it cannot be mistaken for a missing addon here.

  • Two other places match on AWS error text (cloudformation.go, for a missing stack and for "No updates are to be performed"). They look at CloudFormation's own well-known messages and are not changed here.
  • Minimum Agent Versions

    Not applicable: this only changes the kubectl-datadog plugin.

    Describe your test plan

  • New unit tests in podidentityagent_test.go cover: addon not installed (the message EKS returns today, the legacy message, and an untyped API error carrying the not-found code), unmanaged addon installed, addon tagged by another tool, addon installed by kubectl-datadog, an unrelated API error, a non-API error, and an empty response. With the old message check put back, the first and third "not installed" cases fail.

  • go test ./cmd/kubectl-datadog/autoscaling/... and golangci-lint pass locally.

  • Not run against a real cluster. TestAutoscalingInstallModeExistingNodes in the e2e_autoscaling job covers the end-to-end path.
  • Checklist

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies

  • PR has a milestone or the qa/skip-qa label

  • All commits are signed (see: [signing commits][1])
  • [1]: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits

    🤖 Generated with Claude Code

    Diff: 427 lines (+320 / -107) across 5 files Reviewer: AlexanderYastrebov Review duration: 283m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 427 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.363
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3564"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.1% (MEDIUM) · Higher = larger blast radius
    45.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.8% · Safe to merge
    17.8%