stakater / Reloader

A Kubernetes controller to watch changes in ConfigMap and Secrets and do rolling upgrades on Pods with their associated Deployment, StatefulSet, DaemonSet and DeploymentConfig – [✩Star] if you're using it!

Home Page:https://docs.stakater.com/reloader/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to set the correct namespaceSelector at values.yaml

yangtian9999 opened this issue · 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.

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.

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).

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.

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

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

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

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.