<p>I am trying to use OPA Gatekeeper to modify certain Kubernetes deployments. In this example I want to change the display name of service accounts, regardless of what the user provided. So far I was following the documentation here: <a href="https://open-policy-agent.github.io/gatekeeper/website/docs/mutation/" rel="nofollow noreferrer">https://open-policy-agent.github.io/gatekeeper/website/docs/mutation/</a></p>
<p>I have created the following yaml file:</p>
<pre><code>apiVersion: mutations.gatekeeper.sh/v1alpha1
kind: Assign
metadata:
  name: change-sa-name
spec:
  applyTo:
  - groups: [&quot;&quot;]
    kinds: [&quot;IAMServiceAccount&quot;]
    versions: [&quot;v1beta1&quot;]
  location: &quot;spec.displayName&quot;
  parameters:
    assign:
      value: &quot;New Name&quot;
</code></pre>
<p>and used the following to deploy a service account:</p>
<pre><code>apiVersion: iam.cnrm.cloud.google.com/v1beta1
kind: IAMServiceAccount
metadata:
  labels:
    label-one: &quot;value-one&quot;
  name: iamserviceaccount-sample
spec:
  displayName: Example Service Account
</code></pre>
<p>However, upon deploying it the display name still shows up as Example Service Account and not New Name. What exactly am I doing wrong or what should I be looking at?</p>

Beembo
<p>As per the <a href="https://cloud.google.com/config-connector/docs/reference/resource-docs/iam/iamserviceaccount#schema" rel="nofollow noreferrer">official docs</a> you need to give the display name as you are wishing to give at row displayName. Find below yaml and try it, if you get errors paste it here.</p>
<pre><code>apiVersion: iam.cnrm.cloud.google.com/v1beta1
kind: IAMServiceAccount
metadata:
  labels:
    label-one: &quot;value-one&quot;
  name: iamserviceaccount-sample
spec:
  displayName: &lt;Give the display name that you are looking for&gt;
</code></pre>
