openstack-helm-infra/tools/deployment/tenant-ceph/010-relabel-nodes.sh
Steve Wilkerson 4593854c6c Add tenant ceph deployment as nonvoting check
This adds a nonvoting check that will deploy two ceph clusters
and then deploy two radosgw instances, each one backed by a unique
ceph cluster. This allows us validate whether we can reliably
deploy multiple ceph clusters, as in the case of tenant-ceph outlined
in openstack-helm specs

Change-Id: I76a416eddcdb3ea2416d475ea8c8756925cd9580
Co-Authored-By: Meghan Heisler <mh783g@att.com>
2018-12-07 23:02:52 +00:00

26 lines
961 B
Bash
Executable File

#!/bin/bash
#NOTE(srwilkers): To simplify the process, we simply remove the ceph related
# labels from half the deployed nodes. This allows us to relabel them with the
# tenant ceph labels instead
# Find the number of nodes and determine half of them
export NUM_NODES=$(kubectl get nodes -o name | wc -w)
export NUM_RELABEL=$(expr $NUM_NODES / 2)
# Store all node information in JSON
kubectl get nodes -o json >> /tmp/nodes.json
# Use jq to find the names of the nodes to relabel by slicing the output at the
# number identified above
export RELABEL_NODES=$(cat /tmp/nodes.json | jq -r '.items[0:(env.NUM_RELABEL|tonumber)] | .[].metadata.name')
# Relabel the nodes appropriately
for node in $RELABEL_NODES; do
for ceph_label in ceph-mon ceph-osd ceph-mds ceph-rgw ceph-mgr; do
kubectl label node $node $ceph_label-;
kubectl label node $node $ceph_label-tenant=enabled;
done;
kubectl label node $node tenant-ceph-control-plane=enabled;
done;