Add labeling nodes
This commit is contained in:
parent
99db440287
commit
e89f4ac7ee
2 changed files with 33 additions and 0 deletions
28
ccp/label-nodes.sh
Executable file
28
ccp/label-nodes.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# FIXME: hardcoded roles
|
||||
declare -A nodes
|
||||
nodes=( \
|
||||
["node2"]="openstack-controller=true"
|
||||
["node3"]="openstack-controller=true"
|
||||
["node4"]="openstack-controller=true"
|
||||
["node5"]="openstack-compute=true"
|
||||
["node6"]="openstack-compute=true"
|
||||
["node7"]="openstack-compute=true"
|
||||
)
|
||||
|
||||
label_nodes() {
|
||||
all_label='openstack-compute-controller=true'
|
||||
for i in "${!nodes[@]}"
|
||||
do
|
||||
node=$i
|
||||
label=${nodes[$i]}
|
||||
kubectl get nodes $node --show-labels | grep -q "$label" || kubectl label nodes $node $label
|
||||
kubectl get nodes $node --show-labels | grep -q "$all_label" || kubectl label nodes $node $all_label
|
||||
done
|
||||
}
|
||||
|
||||
label_nodes
|
||||
|
|
@ -8,6 +8,11 @@
|
|||
dest: /root/ccp/
|
||||
|
||||
tasks:
|
||||
- name: Label nodes
|
||||
shell: ./label-nodes.sh
|
||||
args:
|
||||
chdir: /root/ccp
|
||||
run_once: true
|
||||
|
||||
- name: Get namespaces
|
||||
shell: kubectl get namespace
|
||||
|
|
Loading…
Reference in a new issue