Skip to content

fix podstartup#3179

Merged
levan-m merged 2 commits into
levan-m/introspection-ddaifrom
levan-m/introspection-ddai-fix-podstartup
Jun 23, 2026
Merged

fix podstartup#3179
levan-m merged 2 commits into
levan-m/introspection-ddaifrom
levan-m/introspection-ddai-fix-podstartup

Conversation

@levan-m

@levan-m levan-m commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

If Operator can't read the etcd secret agent pod gets stuck in ContainerCreating. To avoid we check if secret exists before mounting. Unmounted secret leads to check failure but everything else work fine.

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

Minimum Agent Versions

Are there minimum versions of the Datadog Agent and/or Cluster Agent required?

  • Agent: vX.Y.Z
  • Cluster Agent: vX.Y.Z

Describe your test plan

To reproduce the failure

k scale deploy etcd-operator -n openshift-etcd-operator --replicas 0
k delete secret etcd-metric-client -n openshift-etcd-operator

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)

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jun 18, 2026

Copy link
Copy Markdown

Pipelines  Code Coverage

Fix all issues with BitsAI

⚠️ Warnings

🚦 2 Pipeline jobs failed

pull request linter | Check Milestone   View in Datadog   GitHub Actions

pull request linter | build   View in Datadog   GitHub Actions

ℹ️ Info

🎯 Code Coverage (details)
Patch Coverage: 90.91%
Overall Coverage: 44.65% (+0.23%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 6dba535 | Docs | Datadog PR Page | Give us feedback!

@levan-m levan-m changed the title introspection ddai fix podstartup fix podstartup Jun 18, 2026

@tbavelier tbavelier left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, is indeed a useful defensive measure. Unit tests are failing also before merging
I don't think we need a new direct api call but could be wrong. Proposing to add the flag as part of existing helpers or something else, what do you think ?

Comment on lines +324 to +336
if f.client == nil {
return false
}

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
key := types.NamespacedName{Namespace: f.owner.GetNamespace(), Name: etcdCertsSecretName}
if err := f.client.Get(ctx, key, &corev1.Secret{}); err != nil {
if !apierrors.IsNotFound(err) {
f.logger.V(1).Info("Unable to verify OpenShift etcd metric client secret; skipping etcd cert mount", "namespace", key.Namespace, "name", key.Name, "error", err)
}
return false
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole loop uses the direct api read the same way copyOpenShiftEtcdSecret does. However, unlike the copy function, this is not needed I feel like because we're checking existence within the "store"/the owner namespace that we are watching. We can possibly check the store or add this flag in the existing helpers that already go through the direct api call: e.g. #3180

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.17647% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.40%. Comparing base (c326289) to head (6dba535).

Files with missing lines Patch % Lines
...dogagent/feature/controlplanemonitoring/feature.go 91.17% 2 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@                      Coverage Diff                       @@
##           levan-m/introspection-ddai    #3179      +/-   ##
==============================================================
+ Coverage                       44.18%   44.40%   +0.22%     
==============================================================
  Files                             378      378              
  Lines                           30903    30912       +9     
==============================================================
+ Hits                            13654    13726      +72     
+ Misses                          16352    16290      -62     
+ Partials                          897      896       -1     
Flag Coverage Δ
unittests 44.40% <91.17%> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...dogagent/feature/controlplanemonitoring/feature.go 52.41% <91.17%> (+28.15%) ⬆️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c326289...6dba535. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@levan-m
levan-m merged commit e36d53e into levan-m/introspection-ddai Jun 23, 2026
33 of 35 checks passed
@levan-m
levan-m deleted the levan-m/introspection-ddai-fix-podstartup branch June 23, 2026 15:42
levan-m added a commit that referenced this pull request Jun 24, 2026
* Extend introspection and support DDAI code path

* handle edge cases when user unsets annotation

* pr review fixes

* skip adding default provider to ddai

* remove logging

* Copy OpenShift etcd metric secret (#3131)

* copy OpenShift etcd metric secret

* Add 5s timeout

* Keep existing secret if source read fails

* fix podstartup (#3179)

* Avoid agent getting stuck in container creating

* Do not use direct apireader client and instead make f.etcdSecretPresent as part of existing calls (#3180)

---------

Co-authored-by: Timothée Bavelier <[email protected]>

---------

Co-authored-by: Timothée Bavelier <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants