forked from ceph/ceph-container
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.k8s.sh
executable file
·36 lines (27 loc) · 954 Bytes
/
config.k8s.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
set -e
function get_admin_key {
# No-op for static
log "k8s: does not generate admin key. Use secrets instead."
}
function get_mon_config {
# Get FSID from ceph.conf
FSID=$(ceph-conf --lookup fsid -c /etc/ceph/ceph.conf)
timeout=10
MONMAP_ADD=""
while [[ -z "${MONMAP_ADD// }" && "${timeout}" -gt 0 ]]; do
# Get the ceph mon pods (name and IP) from the Kubernetes API. Formatted as a set of monmap params
MONMAP_ADD=$(kubectl get pods --namespace=${CLUSTER} -l daemon=mon -o template --template="{{range .items}}{{if .status.podIP}}--add {{.metadata.name}} {{.status.podIP}} {{end}} {{end}}")
(( timeout-- ))
sleep 1
done
if [[ -z "${MONMAP_ADD// }" ]]; then
exit 1
fi
# Create a monmap with the Pod Names and IP
monmaptool --create ${MONMAP_ADD} --fsid ${FSID} /etc/ceph/monmap-${CLUSTER}
}
function get_config {
# No-op for static
log "k8s: config is stored as k8s secrets."
}