<p>I have <code>Validating Webhook</code> that triggers when some <code>CRDs resources</code> get <code>[CREATE, UPDATE]</code> operations.
I wanted to add for that, a specific configmap that will trigger that validating webhook.</p>
<p>Under the same namespace, I have multiple CRDs and configmaps, but I wanted to trigger the webhook also for one of the configmaps.</p>
<p><a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#validatingwebhook-v1beta1-admissionregistration-k8s-io" rel="nofollow noreferrer">This</a> is the <code>ValidatingWebhook v1beta1 admissionregistration.k8s.io</code> properties.</p>
<p>I guess the <code>namespaceSelector</code> is not the perfect match for my needs since it triggers for any configmap under that namespace. Tried to understand also if the <code>objectSelector</code> is good solution, but couldnt fully understand.</p>
<p>This is the relevent part of my webhook configurations:</p>
<pre><code>webhooks:
- name: myWebhook.webhook
  clientConfig:
  ***
  failurePolicy:
  ***
  rules:
   - operations: ['CREATE', 'UPDATE']
     apiGroups: ***
     apiVersion: ***
     resources: [CRD_resource_1, CRD_resource_2]

  
</code></pre>
<p>So I guess that my question is- how can I pick one of the multiple configmaps to triger my validation webhook?</p>
<p>Many thanks.</p>

user1673206
<p>You definitely should use <code>objectSelector</code> in order to act only on specific configMaps.
You can make sure you put some specific label on those configMaps and configure your webhook:</p>
<pre><code>  objectSelector:
    matchLabels:
      myCoolConfigMaps: true 
</code></pre>
