Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oc get nodes with selector should be separated by commas #146

Open
e-minguez opened this issue Apr 21, 2020 · 0 comments
Open

oc get nodes with selector should be separated by commas #146

e-minguez opened this issue Apr 21, 2020 · 0 comments

Comments

@e-minguez
Copy link
Member

nodes=$(${OC_TOOL} get nodes --selector='node-role.kubernetes.io/worker' \
--selector='!node-role.kubernetes.io/master' -o name | sed -n 1,2p)

-l, --selector='': Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)

Otherwise, it uses just the latest selector:

[kni@kni1-bootstrap cnv]$ oc get nodes
NAME                                         STATUS   ROLES               AGE   VERSION
kni1-master-0.cloud.lab.eng.bos.redhat.com   Ready    worker,worker-cnf   26h   v1.17.1
kni1-master-1.cloud.lab.eng.bos.redhat.com   Ready    worker,worker-cnf   26h   v1.17.1
kni1-vmaster-0                               Ready    master              27h   v1.17.1
kni1-vmaster-1                               Ready    master              27h   v1.17.1
kni1-vmaster-2                               Ready    master              27h   v1.17.1
kni1-worker-0.cloud.lab.eng.bos.redhat.com   Ready    worker              27h   v1.17.1
$ oc get nodes --selector='node-role.kubernetes.io/worker' --selector='!node-role.kubernetes.io/worker-cnf'
NAME                                         STATUS   ROLES    AGE   VERSION
kni1-vmaster-0                               Ready    master   27h   v1.17.1
kni1-vmaster-1                               Ready    master   27h   v1.17.1
kni1-vmaster-2                               Ready    master   27h   v1.17.1
kni1-worker-0.cloud.lab.eng.bos.redhat.com   Ready    worker   27h   v1.17.1

vs

$ oc get nodes --selector='node-role.kubernetes.io/worker,!node-role.kubernetes.io/worker-cnf'
NAME                                         STATUS   ROLES    AGE   VERSION
kni1-worker-0.cloud.lab.eng.bos.redhat.com   Ready    worker   27h   v1.17.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant