<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Bug in Dynatrace 0.15.0 - Erreur : Pod XX invalid: spec.initContainers[1].name: Duplicate value: &amp;quot;install-oneagent&amp;quot; in Developer Q&amp;A Forum</title>
    <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Bug-in-Dynatrace-0-15-0-Erreur-Pod-XX-invalid-spec/m-p/240762#M836</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;We encountered a pod injection problem when using Dynatrace in applicationMonitoring.&lt;/P&gt;&lt;P&gt;What we did:&lt;BR /&gt;Dynakube: Disable monitoring of all applications&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;  feature.dynatrace.com/automatic-injection : false&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On a specific pod: We enable injection&lt;BR /&gt;annotations :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;oneagent.dynatrace.com/inject : 'true'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We've gone from version 0.12.1 to version 0.15.0 and now pods can't be scheduled due to incorrect deployment generated by mutatingwebhook.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what's wrong ? :&lt;/P&gt;&lt;P&gt;All dynatrace pods are deployed, and the webhook is trying to update the configuration of my app to inject Dynatrace but it fails because of this error :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;invalid: spec.initContainers[1].name:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Duplicate value: "install-oneagent"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that the Webhook is trying to inject 2 initContainers with the same name on my fresh app deployment that does not contains any initContainer.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've analyzed the subject in greater depth.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem lies in the mutatingwebhook delivered by Dynatrace.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There's a webhook idempotency problem. This is due to the option used&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;reinvocationPolicy: "IfNeeded"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The webhook is obviously called twice, which causes the "install-oneagent" init container to be doubled.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The webhook has to check if the initContainer has been already added.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This bug has clearly been introduced in releasenote version 0.15&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Kubernetes doc related to this : &lt;A href="https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#reinvocation-policy" target="_blank" rel="noopener"&gt;https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#reinvocation-policy&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Slack editor has encountered the same problem has yours ! :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A href="https://slack.engineering/simple-kubernetes-webhook/" target="_blank" rel="noopener"&gt;https://slack.engineering/simple-kubernetes-webhook/&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"we added reinvocationPolicy: IfNeeded to the MutatingWebhookConfiguration, resulting in the webhook often getting called twice. This is one of the reasons why mutations should be idempotent!"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We are exactly is the case described in the documentation due to idempotency problem :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"In the third case above, reinvoking the webhook will result in duplicated containers in the pod spec, which makes the request invalid and rejected by the API server."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So the problem is not on the Mutating object but within the dynatrace-webhook pod.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If i try to set&amp;nbsp;reinvocationPolicy: "Never", the problem disappeared and pods can be scheduled.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope you fix this issue fast and take necessary actions in order it does not reproduce again, because yes it is a critical issue that can lead to a huge downtime.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Mar 2024 21:44:20 GMT</pubDate>
    <dc:creator>Whisper40</dc:creator>
    <dc:date>2024-03-21T21:44:20Z</dc:date>
    <item>
      <title>Bug in Dynatrace 0.15.0 - Erreur : Pod XX invalid: spec.initContainers[1].name: Duplicate value: "install-oneagent"</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Bug-in-Dynatrace-0-15-0-Erreur-Pod-XX-invalid-spec/m-p/240762#M836</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;We encountered a pod injection problem when using Dynatrace in applicationMonitoring.&lt;/P&gt;&lt;P&gt;What we did:&lt;BR /&gt;Dynakube: Disable monitoring of all applications&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;  feature.dynatrace.com/automatic-injection : false&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On a specific pod: We enable injection&lt;BR /&gt;annotations :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;oneagent.dynatrace.com/inject : 'true'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We've gone from version 0.12.1 to version 0.15.0 and now pods can't be scheduled due to incorrect deployment generated by mutatingwebhook.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what's wrong ? :&lt;/P&gt;&lt;P&gt;All dynatrace pods are deployed, and the webhook is trying to update the configuration of my app to inject Dynatrace but it fails because of this error :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;invalid: spec.initContainers[1].name:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Duplicate value: "install-oneagent"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that the Webhook is trying to inject 2 initContainers with the same name on my fresh app deployment that does not contains any initContainer.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've analyzed the subject in greater depth.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem lies in the mutatingwebhook delivered by Dynatrace.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There's a webhook idempotency problem. This is due to the option used&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;reinvocationPolicy: "IfNeeded"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The webhook is obviously called twice, which causes the "install-oneagent" init container to be doubled.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The webhook has to check if the initContainer has been already added.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This bug has clearly been introduced in releasenote version 0.15&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Kubernetes doc related to this : &lt;A href="https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#reinvocation-policy" target="_blank" rel="noopener"&gt;https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#reinvocation-policy&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Slack editor has encountered the same problem has yours ! :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A href="https://slack.engineering/simple-kubernetes-webhook/" target="_blank" rel="noopener"&gt;https://slack.engineering/simple-kubernetes-webhook/&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"we added reinvocationPolicy: IfNeeded to the MutatingWebhookConfiguration, resulting in the webhook often getting called twice. This is one of the reasons why mutations should be idempotent!"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We are exactly is the case described in the documentation due to idempotency problem :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"In the third case above, reinvoking the webhook will result in duplicated containers in the pod spec, which makes the request invalid and rejected by the API server."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So the problem is not on the Mutating object but within the dynatrace-webhook pod.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If i try to set&amp;nbsp;reinvocationPolicy: "Never", the problem disappeared and pods can be scheduled.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope you fix this issue fast and take necessary actions in order it does not reproduce again, because yes it is a critical issue that can lead to a huge downtime.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 21:44:20 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Bug-in-Dynatrace-0-15-0-Erreur-Pod-XX-invalid-spec/m-p/240762#M836</guid>
      <dc:creator>Whisper40</dc:creator>
      <dc:date>2024-03-21T21:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Dynatrace 0.15.0 - Erreur : Pod XX invalid: spec.initContainers[1].name: Duplicate value: "install-oneagent"</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Bug-in-Dynatrace-0-15-0-Erreur-Pod-XX-invalid-spec/m-p/240782#M837</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/73703"&gt;@Whisper40&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please create a support ticket via&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://one.dynatrace.com/hc/en-us/requests" target="_blank" rel="noopener noreferrer"&gt;https://one.dynatrace.com/hc/en-us/requests&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;with the same description. Tech support will help you with this issue.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best,&lt;BR /&gt;Sini&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 08:54:41 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Bug-in-Dynatrace-0-15-0-Erreur-Pod-XX-invalid-spec/m-p/240782#M837</guid>
      <dc:creator>sinisa_zubic</dc:creator>
      <dc:date>2024-03-22T08:54:41Z</dc:date>
    </item>
  </channel>
</rss>

