← Back to Pull requests

[CASCL-1786] Treat any ResourceNotFoundException as "no Pod Identity addon" #3560

Merged
AlexanderYastrebov merged 2 files (170 lines) on Oct 07, 2026 13:44 UTC
View on GitHub
AlexanderYastrebov AlexanderYastrebov commented on Oct 06, 2026 14:55 UTC
Author

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: 170 lines (+161 / -9) across 2 files Reviewer: L3n41c Review duration: 1369m
    All Vouch review confidence checks passed
    Residual risk 0.10 = Change Risk (0.35) × (1 − Review Confidence (0.72)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.35 · 170 lines diff across 2 files
    0.35
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.55 · 2 substantive comment(s)
    0.55
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    72%
    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.308
    Real PR Conversation Timeline
    5 items
    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Oct 06, 2026 14:57 UTC
    Bot

    <!-- codex-pull-request-review-summary -->

    Codex Review Summary

    This comment shows the latest Codex review activity on this pull request.

    | Review | Status | Commit | Review trigger |
    | --- | --- | --- | --- |
    | 📝 Code Review | ✅ Completed <relative-time datetime="2026-10-06T14:59:46.526657Z">2026-10-06T14:59:46.526657Z</relative-time> | 2f345e6 | PR opened |

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review" or "@codex security review".
  • Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

    </details>

    datadog-datadog-prod-us1-2[bot] datadog-datadog-prod-us1-2[bot] commented on Oct 06, 2026 15:08 UTC
    Bot

    <a target='_blank' href='https://app.datadoghq.com/ci/code-coverage/github.com%2Fdatadog%2Fdatadog-operator/pull-requests/3560'><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/code-coverage-ok.svg"/><img src="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/code-coverage-ok-light.svg" alt="Code Coverage" align="center" /></picture></a>

    🎯 Code Coverage (<a target='_blank' href='https://app.datadoghq.com/ci/code-coverage/github.com%2Fdatadog%2Fdatadog-operator/pull-requests/3560'>details</a>)<br>• <strong><span title="Percentage of modified executable lines covered by tests in this PR">Patch Coverage</span></strong>: 100.00%<br>• <strong><span title="Percentage of all executable lines covered by tests in the entire codebase">Overall Coverage</span></strong>: 52.92% <span title="Change in overall coverage compared to the base branch">(+0.05%)</span><br>

    <sub>
    This comment will be updated automatically if new data arrives. <br />
    🔗 Commit SHA: 2f345e6 | <a href="https://docs.datadoghq.com/integrations/guide/source-code-integration/#pr-comments">Docs</a> | Give us <a href="https://dd.enterprise.slack.com/archives/C07E3U2QRMM">feedback</a>!
    </sub>

    L3n41c L3n41c approved these changes on Oct 06, 2026 16:03 UTC
    Approved Reviewer

    Approved these changes.

    hmahmood hmahmood approved these changes on Oct 06, 2026 17:59 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    AlexanderYastrebov AlexanderYastrebov
    Labels
    risk: low confidence: 72% 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: 35.2% (MEDIUM) · Higher = larger blast radius
    35.2%
    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: 72% · Lower = rushed or shallow review
    72%
    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: 9.9% · Safe to merge
    9.9%