[CASCL-1786] Treat any ResourceNotFoundException as "no Pod Identity addon" #3560
<!-- 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
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
</details>
<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>
Approved these changes.
Approved these changes.
L3n41c
AlexanderYastrebov
What does this PR do?
IsThereUnmanagedEKSPodIdentityAgentInstallednow treats anyResourceNotFoundExceptionfromeks:DescribeAddonas "no unmanagedeks-pod-identity-agentaddon", instead of requiring one exact error message.It also takes a small
DescribeAddonAPIinterface (like the neighbouringOIDCProviderAPIandDescribeRouteTablesAPI) 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-nodesfails on any cluster that does not already have the Pod Identity addon. The check only treated the 404 as "no addon" when the message containedNo addon: eks-pod-identity-agent found in cluster, and EKS now answersThe requested resource does not exist.The install then stops with: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
TestAutoscalingInstallModeExistingNodesfails in thee2e_autoscalingjob (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
createCloudFormationStacksdescribes the cluster before it looks for the addon, so it cannot be mistaken for a missing addon here.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-datadogplugin.Describe your test plan
podidentityagent_test.gocover: 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/...andgolangci-lintpass locally.TestAutoscalingInstallModeExistingNodesin thee2e_autoscalingjob covers the end-to-end path.Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel[1]: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits
🤖 Generated with Claude Code