"Fossies" - the Fresh Open Source Software Archive

Member "magnum-8.1.0/magnum/drivers/k8s_coreos_v1/templates/fragments/configure-etcd.yaml" (1 Oct 2019, 2293 Bytes) of package /linux/misc/openstack/magnum-8.1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ansible YAML source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #cloud-config
    2 write_files:
    3   - path: /etc/systemd/system/configure-etcd.service
    4     owner: "root:root"
    5     permissions: "0644"
    6     content: |
    7       [Unit]
    8       Description=Configure etcd
    9 
   10       [Service]
   11       Type=oneshot
   12       EnvironmentFile=/etc/sysconfig/heat-params
   13       ExecStart=/etc/sysconfig/configure-etcd.sh
   14 
   15       [Install]
   16       WantedBy=multi-user.target
   17 
   18   - path: /etc/sysconfig/configure-etcd.sh
   19     owner: "root:root"
   20     permissions: "0755"
   21     content: |
   22       #!/bin/sh
   23 
   24       if [ -z "${KUBE_NODE_IP}" ]; then
   25         KUBE_NODE_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)
   26       fi
   27 
   28       DROP_IN_FILE=/etc/systemd/system/etcd-member.service.d/20-configure-etcd.conf
   29       mkdir -p $(dirname $DROP_IN_FILE)
   30       protocol="https"
   31 
   32       if [ "$TLS_DISABLED" = "True" ]; then
   33           protocol="http"
   34       fi
   35       cat > $DROP_IN_FILE <<EOF
   36       [Service]
   37       EnvironmentFile=/etc/environment
   38       Environment=ETCD_NAME=$KUBE_NODE_IP
   39       Environment=ETCD_DATA_DIR=/var/lib/etcd/default.etcd
   40       Environment=ETCD_LISTEN_CLIENT_URLS=$protocol://$KUBE_NODE_IP:2379,http://127.0.0.1:2379
   41       Environment=ETCD_LISTEN_PEER_URLS=$protocol://$KUBE_NODE_IP:2380
   42 
   43       Environment=ETCD_ADVERTISE_CLIENT_URLS=$protocol://$KUBE_NODE_IP:2379,http://127.0.0.1:2379
   44       Environment=ETCD_INITIAL_ADVERTISE_PEER_URLS=$protocol://$KUBE_NODE_IP:2380
   45       Environment=ETCD_DISCOVERY=$ETCD_DISCOVERY_URL
   46       EOF
   47 
   48       if [ "$TLS_DISABLED" = "False" ]; then
   49 
   50       cat >> $DROP_IN_FILE <<EOF
   51       Environment=ETCD_CA_FILE=${KUBE_CERTS_PATH}/ca.pem
   52       Environment=ETCD_CERT_FILE=${KUBE_CERTS_PATH}/apiserver.pem
   53       Environment=ETCD_KEY_FILE=${KUBE_CERTS_PATH}/apiserver-key.pem
   54       Environment=ETCD_PEER_CA_FILE=${KUBE_CERTS_PATH}/ca.pem
   55       Environment=ETCD_PEER_CERT_FILE=${KUBE_CERTS_PATH}/apiserver.pem
   56       Environment=ETCD_PEER_KEY_FILE=${KUBE_CERTS_PATH}/apiserver-key.pem
   57       Environment="RKT_RUN_ARGS=--volume ssl,kind=host,source=${KUBE_CERTS_PATH} \
   58       --mount volume=ssl,target=${KUBE_CERTS_PATH}"
   59       EOF
   60 
   61       fi
   62 
   63       if [ -n "$HTTP_PROXY" ]; then
   64           echo "Environment=ETCD_DISCOVERY_PROXY=$HTTP_PROXY" >> $DROP_IN_FILE
   65       fi
   66 
   67       systemctl enable etcd-member
   68       systemctl --no-block start etcd-member