Reloader icon indicating copy to clipboard operation
Reloader copied to clipboard

How to set the correct namespaceSelector at values.yaml

Open yangtian9999 opened this issue 2 years ago • 6 comments

Dear team,

May I know how to set the correct namespaceSelector at values.yaml?

I tried

reloader:
  namespaceSelector: "aaa.bbb.ccc.ddd/eee=foo,aaa.bbb.ccc.ddd/eee=bar"

reloader:
  namespaceSelector: "aaa.bbb.ccc.ddd/eee:foo,aaa.bbb.ccc.ddd/eee:bar"

Both settings can not work, and can not allow the namespace's workloads to be restarted.

Please kindly help to check what value should I use, thanks very much for your help.

yangtian9999 avatar Oct 18 '23 01:10 yangtian9999

Hi,

May I know "aaa.bbb.ccc.ddd/eee=foo,aaa.bbb.ccc.ddd/eee=bar" can not be existed at the same time? I mean ""aaa.bbb.ccc.ddd/eee" can not use 2 values for namespaceSelector at the same time?

Thanks.

yangtian9999 avatar Oct 19 '23 03:10 yangtian9999

namespaceSelector: list of comma separated label selectors, if multiple are provided they are combined with the AND operator

hi, you can use 2 or more values, but then they apply on those namespaces which has all of the mentioned selectors.

However, this format can be used to give different values of same label key another-label in (value1,value2,value3)

Reloader can be configured to only watch namespaces labeled with one or more labels using the --namespace-selector parameter. Supported operators are !, in, notin, ==, =, !=, if no operator is found the 'exists' operator is inferred (i.e. key only).

MuneebAijaz avatar Oct 19 '23 17:10 MuneebAijaz

Thanks very much, I followed your reply, and it worked.

There is another case, the test result is not expected, please kindly help to check if my setting is wrong.

Deployment: foo, namespace: foo, label: aaa.bbb.ccc.ddd/eee=foo, Deployment: bar, namespace: bar, label: aaa.bbb.ccc.ddd/eee=bar,

If I set for reloader as:

--namespace-selector=aaa.bbb.ccc.ddd/eee in (foo),kubernetes.io/metadata.name in (bar)

Deployment bar can not be reloaded.

yangtian9999 avatar Oct 25 '23 11:10 yangtian9999

A continuation of @yangtian9999 question,

The understanding is that if we were to have a namespace "foo" and a namespace "bar"

Under the manifest file of namespace of "foo

labels:
    kubernetes.io/metadata.name: foo
    reloader: enabled

Under the manifest file of namespace of "bar

labels:
    kubernetes.io/metadata.name: bar
    reloader: enabled

and under my values.yaml i have mentioned

reloader:
  namespaceSelector: reloader=enabled

It should be able to watch all namespaces with the label reloader-enabled

and let's assume i have 2 secrets , secretA in foo and secretB in bar namespace respectively and i need to reload a deployment when values in A or B changes

Then i will annotate my deployment with , The deployment exists in Foo namespace secret.reloader.stakater.com/reload: secretA,secretB

My deployment should reload ? But this doesn't seem to happen in my case ,please point me in the right direction

Hareshraman avatar Nov 03 '23 10:11 Hareshraman

If i have a a secret " A" in foo namespace and a deployment in bar namespace , i have annotated the deployment with secret.reloader.stakater.com/reload: A , will reloader be able to update/roll this particular deployment , please note they are two different namespaces

and both these namespaces have a label reloader:enable

labels:
    reloader: enable

Hareshraman avatar Nov 03 '23 13:11 Hareshraman

Hello, sorry for the delayed response. i will check it at my end and respond soon if not fixed already.

MuneebAijaz avatar Nov 07 '23 13:11 MuneebAijaz

Close this?

I think the OP has been addressed: Multiple label selections separated by comma are AND'd

But the 'in' operator can be used to select multiple namespaces.

joebowbeer avatar Mar 07 '24 05:03 joebowbeer