# Executing a kubectl patch command from or based on a ConfigOption

**URL:** <https://community.replicated.com/t/executing-a-kubectl-patch-command-from-or-based-on-a-configoption/1419>\
**Category:** How do I?\
**Tags:** kots, config, registry\
**Created:** [June 26, 2024, 2:54pm UTC](https://community.replicated.com/t/executing-a-kubectl-patch-command-from-or-based-on-a-configoption/1419 "2024-06-26T14:54:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Vizena](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/david_vizena/32/765_2.png) [@David\_Vizena](https://community.replicated.com/u/David_Vizena)\
**Post date:** [June 26, 2024, 2:54pm UTC](https://community.replicated.com/t/executing-a-kubectl-patch-command-from-or-based-on-a-configoption/1419/1 "2024-06-26T14:54:38Z")

</div>

I would like to have an option in the KOTS Admin Console, that when selected it runs the a kubectl patch command to patch a value of the kotsadm-confg ConfigMap in the namespace where kots is installed.

Specifically we would like to provide an option to disable garbage collection in the embedded registry from the config panel of kots.

[Here](https://docs.replicated.com/enterprise/image-registry-kurl#disable-image-garbage-collection) are the documents we are trying to execute.

Do you have a recommendation on how to achieve this? Any help provided is greatly appreciated.

---

<div class="post-metadata">

**Author:** ![jdewinne](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/jdewinne/32/152_2.png) [@jdewinne](https://community.replicated.com/u/jdewinne)\
**Post date:** [June 26, 2024, 4:55pm UTC](https://community.replicated.com/t/executing-a-kubectl-patch-command-from-or-based-on-a-configoption/1419/2 "2024-06-26T16:55:17Z")

</div>

Hi @David_Vizena

Would a Kubernetes Job work? It would of course require the necessary permission that allows executing a patch.

---

<div class="post-metadata">

**Author:** ![David\_Vizena](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/david_vizena/32/765_2.png) [@David\_Vizena](https://community.replicated.com/u/David_Vizena)\
**Post date:** [June 26, 2024, 7:37pm UTC](https://community.replicated.com/t/executing-a-kubectl-patch-command-from-or-based-on-a-configoption/1419/3 "2024-06-26T19:37:56Z")

</div>

This is likely what we will end up having to go with after talking to my colleagues. I was just wondering if there was some functionality that someone else knew up prior to going that route.
