Add volume to Kub master

Add Cinder volume to the master and configure Docker DeviceMapper to use it

Change-Id: I87a69175bae941d4e3bea95fce71fe3974b7cdc5
Related-Bug: #1500062
changes/34/270634/1
Egor Guz 7 years ago
parent 96a6a369f6
commit ca34c5d813
  1. 2
      magnum/templates/kubernetes/fragments/configure-docker-storage.sh
  2. 2
      magnum/templates/kubernetes/fragments/configure-kubernetes-minion.sh
  3. 1
      magnum/templates/kubernetes/fragments/write-heat-params-master.yaml
  4. 1
      magnum/templates/kubernetes/kubecluster.yaml
  5. 33
      magnum/templates/kubernetes/kubemaster.yaml

@ -26,3 +26,5 @@ vgcreate docker ${device_path}
cat > /etc/sysconfig/docker-storage-setup << EOF
VG=docker
EOF
sed -i '/^DOCKER_STORAGE_OPTIONS=/ s/=.*/=--storage-driver devicemapper --storage-opt dm.fs=xfs --storage-opt dm.thinpooldev=\/dev\/mapper\/docker-docker--pool --storage-opt dm.use_deferred_removal=true/' /etc/sysconfig/docker-storage

@ -42,6 +42,4 @@ cat >> /etc/environment <<EOF
KUBERNETES_MASTER=$KUBE_MASTER_URI
EOF
sed -i '/^DOCKER_STORAGE_OPTIONS=/ s/=.*/=--storage-driver devicemapper --storage-opt dm.fs=xfs --storage-opt dm.thinpooldev=\/dev\/mapper\/docker-docker--pool --storage-opt dm.use_deferred_removal=true/' /etc/sysconfig/docker-storage
hostname `hostname | sed 's/.novalocal//'`

@ -9,6 +9,7 @@ write_files:
KUBE_API_PRIVATE_ADDRESS="$KUBE_API_PRIVATE_ADDRESS"
KUBE_API_PORT="$KUBE_API_PORT"
KUBE_ALLOW_PRIV="$KUBE_ALLOW_PRIV"
DOCKER_VOLUME="$DOCKER_VOLUME"
NETWORK_DRIVER="$NETWORK_DRIVER"
FLANNEL_NETWORK_CIDR="$FLANNEL_NETWORK_CIDR"
FLANNEL_NETWORK_SUBNETLEN="$FLANNEL_NETWORK_SUBNETLEN"

@ -400,6 +400,7 @@ resources:
master_flavor: {get_param: master_flavor}
external_network: {get_param: external_network}
kube_allow_priv: {get_param: kube_allow_priv}
docker_volume_size: {get_param: docker_volume_size}
wait_condition_timeout: {get_param: wait_condition_timeout}
network_driver: {get_param: network_driver}
flannel_network_cidr: {get_param: flannel_network_cidr}

@ -39,6 +39,13 @@ parameters:
constraints:
- allowed_values: ["true", "false"]
docker_volume_size:
type: number
description: >
size of a cinder volume to allocate to docker for container/image
storage
default: 25
flannel_network_cidr:
type: string
description: network range for flannel overlay network
@ -178,6 +185,7 @@ resources:
"$KUBE_API_PRIVATE_ADDRESS": {get_param: api_private_address}
"$KUBE_API_PORT": {get_param: kubernetes_port}
"$KUBE_ALLOW_PRIV": {get_param: kube_allow_priv}
"$DOCKER_VOLUME": {get_resource: docker_volume}
"$NETWORK_DRIVER": {get_param: network_driver}
"$FLANNEL_NETWORK_CIDR": {get_param: flannel_network_cidr}
"$FLANNEL_NETWORK_SUBNETLEN": {get_param: flannel_network_subnetlen}
@ -204,6 +212,12 @@ resources:
group: ungrouped
config: {get_file: fragments/make-cert.sh}
configure_docker_storage:
type: OS::Heat::SoftwareConfig
properties:
group: ungrouped
config: {get_file: fragments/configure-docker-storage.sh}
configure_etcd:
type: OS::Heat::SoftwareConfig
properties:
@ -316,6 +330,7 @@ resources:
- config: {get_resource: kube_user}
- config: {get_resource: write_kube_os_config}
- config: {get_resource: make_cert}
- config: {get_resource: configure_docker_storage}
- config: {get_resource: configure_kubernetes}
- config: {get_resource: add_proxy}
- config: {get_resource: enable_services}
@ -376,6 +391,24 @@ resources:
address: {get_attr: [kube_master_eth0, fixed_ips, 0, ip_address]}
protocol_port: 2379
######################################################################
#
# docker storage. This allocates a cinder volume and attaches it
# to the minion.
#
docker_volume:
type: OS::Cinder::Volume
properties:
size: {get_param: docker_volume_size}
docker_volume_attach:
type: OS::Cinder::VolumeAttachment
properties:
instance_uuid: {get_resource: kube_master}
volume_id: {get_resource: docker_volume}
mountpoint: /dev/vdb
outputs:
kube_master_ip:

Loading…
Cancel
Save