# How can we patch the ECK operator to watch multiple namespaces

**URL:** <https://discuss.elastic.co/t/how-can-we-patch-the-eck-operator-to-watch-multiple-namespaces/198925>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Created:** [September 10, 2019, 3:25pm UTC](https://discuss.elastic.co/t/how-can-we-patch-the-eck-operator-to-watch-multiple-namespaces/198925 "2019-09-10T15:25:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shahtab](https://avatars.discourse-cdn.com/v4/letter/s/e79b87/32.png) [@shahtab](https://discuss.elastic.co/u/shahtab)\
**Post date:** [September 10, 2019, 3:25pm UTC](https://discuss.elastic.co/t/how-can-we-patch-the-eck-operator-to-watch-multiple-namespaces/198925/1 "2019-09-10T15:25:45Z")

</div>

I ahve patched it ONCE to watch one namespace other than default ... But how do you patch for multiple ...

ECK worked for the first one but without patching doesn't for the second one. How do we add to the list of namespaces for ECK to watch... What would be the JSON string for that

patch statefulset/elastic-operator   
-n elastic-system   
--type='json'   
--patch '[{"op":"add","path":"/spec/template/spec/containers/0/env/-","value": {"name": "NAMESPACE", "value": "elastic"}}]'

---

<div class="post-metadata">

**Author:** ![pebrc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pebrc/32/101790_2.png) [@pebrc](https://discuss.elastic.co/u/pebrc)\
**Post date:** [September 11, 2019, 7:31am UTC](https://discuss.elastic.co/t/how-can-we-patch-the-eck-operator-to-watch-multiple-namespaces/198925/2 "2019-09-11T07:31:58Z")

</div>

In the current version ECK supports only one of two modes of operation, you can either watch all namespaces (set `NAMESPACE` to the empty string or omit the environment variable alltogether) or restrict the operator to one specific namespace by setting `NAMESPACE` to that namespace.

---

<div class="post-metadata">

**Author:** ![amanjain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amanjain/32/46385_2.png) [@amanjain](https://discuss.elastic.co/u/amanjain)\
**Post date:** [August 30, 2020, 1:57pm UTC](https://discuss.elastic.co/t/how-can-we-patch-the-eck-operator-to-watch-multiple-namespaces/198925/3 "2020-08-30T13:57:59Z")

</div>

Hi @pebrc,  
I see this answer is from Sept 2019,  
but now I can see `namespaces` which is `Namespaces in which this operator should manage resources. Accepts multiple comma-separated values. Defaults to all namespaces if empty or unspecified.`  
Am i understanding it correctly ?

---

<div class="post-metadata">

**Author:** ![pebrc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pebrc/32/101790_2.png) [@pebrc](https://discuss.elastic.co/u/pebrc)\
**Post date:** [August 31, 2020, 7:21am UTC](https://discuss.elastic.co/t/how-can-we-patch-the-eck-operator-to-watch-multiple-namespaces/198925/4 "2020-08-31T07:21:53Z")

</div>

Yes you are understanding correctly. This restriction has been lifted in version 1.0 of ECK [https://www.elastic.co/guide/en/cloud-on-k8s/master/release-notes-1.0.0.html](https://www.elastic.co/guide/en/cloud-on-k8s/master/release-notes-1.0.0.html)

You can now also specify a list of namespaces to watch as a comma-separated list.

---

<div class="post-metadata">

**Author:** ![amanjain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amanjain/32/46385_2.png) [@amanjain](https://discuss.elastic.co/u/amanjain)\
**Post date:** [August 31, 2020, 9:37am UTC](https://discuss.elastic.co/t/how-can-we-patch-the-eck-operator-to-watch-multiple-namespaces/198925/5 "2020-08-31T09:37:33Z")

</div>

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 4, 2022, 7:24am UTC](https://discuss.elastic.co/t/how-can-we-patch-the-eck-operator-to-watch-multiple-namespaces/198925/6 "2022-11-04T07:24:53Z")

</div>


