fix podstartup#3179
Conversation
|
| 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 | ||
| } |
There was a problem hiding this comment.
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
…nt as part of existing calls (#3180)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
* 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]>
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?
Describe your test plan
To reproduce the failure
Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel