k8s.io/kubernetes@v1.31.0-alpha.0.0.20240520171757-56147500dadc/test/images/volume/rbd/mon.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # Copyright 2015 The Kubernetes Authors.
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  
    17  #
    18  # Configures and launches a new MON.
    19  #
    20  
    21  # monitor setup
    22  monmaptool --create --clobber --fsid "$(uuidgen)" --add a "${1}":6789 /etc/ceph/monmap
    23  mkdir /var/lib/ceph/mon/ceph-a
    24  ceph-mon -i a --mkfs --monmap /etc/ceph/monmap -k /var/lib/ceph/mon/keyring
    25  cp /var/lib/ceph/mon/keyring /var/lib/ceph/mon/ceph-a
    26  ceph-mon -i a --monmap /etc/ceph/monmap -k /var/lib/ceph/mon/ceph-a/keyring
    27  
    28  # client setup (handy)
    29  cp /var/lib/ceph/mon/keyring /etc/ceph
    30  
    31  # for this test we want to
    32  ceph osd getcrushmap -o /tmp/crushc
    33  crushtool -d /tmp/crushc -o /tmp/crushd
    34  sed -i 's/step chooseleaf firstn 0 type host/step chooseleaf firstn 0 type osd/' /tmp/crushd
    35  crushtool -c /tmp/crushd -o /tmp/crushc
    36  ceph osd setcrushmap -i /tmp/crushc