mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #2988 from jbeda/yaml-quote
Quote strings in bash populated YAML files.
This commit is contained in:
		@@ -20,11 +20,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
mkdir -p /srv/salt-overlay/pillar
 | 
					mkdir -p /srv/salt-overlay/pillar
 | 
				
			||||||
cat <<EOF >/srv/salt-overlay/pillar/cluster-params.sls
 | 
					cat <<EOF >/srv/salt-overlay/pillar/cluster-params.sls
 | 
				
			||||||
node_instance_prefix: $NODE_INSTANCE_PREFIX
 | 
					node_instance_prefix: '$(echo "$NODE_INSTANCE_PREFIX" | sed -e "s/'/''/g")'
 | 
				
			||||||
portal_net: $PORTAL_NET
 | 
					portal_net: '$(echo "$PORTAL_NET" | sed -e "s/'/''/g")'
 | 
				
			||||||
enable_node_monitoring: $ENABLE_NODE_MONITORING
 | 
					enable_node_monitoring: '$(echo "$ENABLE_NODE_MONITORING" | sed -e "s/'/''/g")'
 | 
				
			||||||
enable_node_logging: $ENABLE_NODE_LOGGING
 | 
					enable_node_logging: '$(echo "$ENABLE_NODE_LOGGING" | sed -e "s/'/''/g")'
 | 
				
			||||||
logging_destination: $LOGGING_DESTINATION
 | 
					logging_destination: '$(echo "$LOGGING_DESTINATION" | sed -e "s/'/''/g")'
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
mkdir -p /srv/salt-overlay/salt/nginx
 | 
					mkdir -p /srv/salt-overlay/salt/nginx
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,7 +19,9 @@ sed -i -e "\|^deb.*http://ftp.debian.org/debian| s/^/#/" /etc/apt/sources.list.d
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Prepopulate the name of the Master
 | 
					# Prepopulate the name of the Master
 | 
				
			||||||
mkdir -p /etc/salt/minion.d
 | 
					mkdir -p /etc/salt/minion.d
 | 
				
			||||||
echo "master: $MASTER_NAME" > /etc/salt/minion.d/master.conf
 | 
					cat <<EOF >/etc/salt/minion.d/master.conf
 | 
				
			||||||
 | 
					master: '$(echo "$MASTER_NAME" | sed -e "s/'/''/g")'
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cat <<EOF >/etc/salt/minion.d/log-level-debug.conf
 | 
					cat <<EOF >/etc/salt/minion.d/log-level-debug.conf
 | 
				
			||||||
log_level: debug
 | 
					log_level: debug
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,9 @@ sed -i -e "\|^deb.*http://ftp.debian.org/debian| s/^/#/" /etc/apt/sources.list.d
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Prepopulate the name of the Master
 | 
					# Prepopulate the name of the Master
 | 
				
			||||||
mkdir -p /etc/salt/minion.d
 | 
					mkdir -p /etc/salt/minion.d
 | 
				
			||||||
echo "master: $MASTER_NAME" > /etc/salt/minion.d/master.conf
 | 
					cat <<EOF >/etc/salt/minion.d/master.conf
 | 
				
			||||||
 | 
					master: '$(echo "$MASTER_NAME" | sed -e "s/'/''/g")'
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cat <<EOF >/etc/salt/minion.d/log-level-debug.conf
 | 
					cat <<EOF >/etc/salt/minion.d/log-level-debug.conf
 | 
				
			||||||
log_level: debug
 | 
					log_level: debug
 | 
				
			||||||
@@ -32,7 +34,7 @@ cat <<EOF >/etc/salt/minion.d/grains.conf
 | 
				
			|||||||
grains:
 | 
					grains:
 | 
				
			||||||
  roles:
 | 
					  roles:
 | 
				
			||||||
    - kubernetes-pool
 | 
					    - kubernetes-pool
 | 
				
			||||||
  cbr-cidr: $MINION_IP_RANGE
 | 
					  cbr-cidr: '$(echo "$MINION_IP_RANGE" | sed -e "s/'/''/g")'
 | 
				
			||||||
  cloud: gce
 | 
					  cloud: gce
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -51,7 +53,7 @@ fi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if [[ -n "{DOCKER_OPTS}" ]]; then
 | 
					if [[ -n "{DOCKER_OPTS}" ]]; then
 | 
				
			||||||
cat <<EOF >>/etc/salt/minion.d/grains.conf
 | 
					cat <<EOF >>/etc/salt/minion.d/grains.conf
 | 
				
			||||||
  docker_opts: $DOCKER_OPTS
 | 
					  docker_opts: '$(echo "$DOCKER_OPTS" | sed -e "s/'/''/g")'
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,17 +62,19 @@ done
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Update salt configuration
 | 
					# Update salt configuration
 | 
				
			||||||
mkdir -p /etc/salt/minion.d
 | 
					mkdir -p /etc/salt/minion.d
 | 
				
			||||||
echo "master: $MASTER_NAME" > /etc/salt/minion.d/master.conf
 | 
					cat <<EOF >/etc/salt/minion.d/master.conf
 | 
				
			||||||
 | 
					master: '$(echo "$MASTER_NAME" | sed -e "s/'/''/g")'
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cat <<EOF >/etc/salt/minion.d/grains.conf
 | 
					cat <<EOF >/etc/salt/minion.d/grains.conf
 | 
				
			||||||
grains:
 | 
					grains:
 | 
				
			||||||
  node_ip: $MASTER_IP
 | 
					  node_ip: '$(echo "$MASTER_IP" | sed -e "s/'/''/g")'
 | 
				
			||||||
  master_ip: $MASTER_IP
 | 
					  master_ip: '$(echo "$MASTER_IP" | sed -e "s/'/''/g")'
 | 
				
			||||||
  publicAddressOverride: $MASTER_IP
 | 
					  publicAddressOverride: '$(echo "$MASTER_IP" | sed -e "s/'/''/g")'
 | 
				
			||||||
  network_mode: openvswitch
 | 
					  network_mode: openvswitch
 | 
				
			||||||
  networkInterfaceName: eth1
 | 
					  networkInterfaceName: eth1
 | 
				
			||||||
  etcd_servers: $MASTER_IP
 | 
					  etcd_servers: '$(echo "$MASTER_IP" | sed -e "s/'/''/g")'
 | 
				
			||||||
  api_servers: $MASTER_IP
 | 
					  api_servers: '$(echo "$MASTER_IP" | sed -e "s/'/''/g")'
 | 
				
			||||||
  cloud: vagrant
 | 
					  cloud: vagrant
 | 
				
			||||||
  cloud_provider: vagrant
 | 
					  cloud_provider: vagrant
 | 
				
			||||||
  roles:
 | 
					  roles:
 | 
				
			||||||
@@ -81,11 +83,11 @@ EOF
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
mkdir -p /srv/salt-overlay/pillar
 | 
					mkdir -p /srv/salt-overlay/pillar
 | 
				
			||||||
cat <<EOF >/srv/salt-overlay/pillar/cluster-params.sls
 | 
					cat <<EOF >/srv/salt-overlay/pillar/cluster-params.sls
 | 
				
			||||||
  portal_net: $PORTAL_NET
 | 
					  portal_net: '$(echo "$PORTAL_NET" | sed -e "s/'/''/g")'
 | 
				
			||||||
  cert_ip: $MASTER_IP
 | 
					  cert_ip: '$(echo "$MASTER_IP" | sed -e "s/'/''/g")'
 | 
				
			||||||
  enable_node_monitoring: $ENABLE_NODE_MONITORING
 | 
					  enable_node_monitoring: '$(echo "$ENABLE_NODE_MONITORING" | sed -e "s/'/''/g")'
 | 
				
			||||||
  enable_node_logging: $ENABLE_NODE_LOGGING
 | 
					  enable_node_logging: '$(echo "$ENABLE_NODE_LOGGING" | sed -e "s/'/''/g")'
 | 
				
			||||||
  logging_destination: $LOGGING_DESTINATION
 | 
					  logging_destination: '$(echo "$LOGGING_DESTINATION" | sed -e "s/'/''/g")'
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Configure the salt-master
 | 
					# Configure the salt-master
 | 
				
			||||||
@@ -155,7 +157,6 @@ rest_cherrypy:
 | 
				
			|||||||
  webhook_disable_auth: True
 | 
					  webhook_disable_auth: True
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
  # Install Salt Master
 | 
					  # Install Salt Master
 | 
				
			||||||
  #
 | 
					  #
 | 
				
			||||||
  # -M installs the master
 | 
					  # -M installs the master
 | 
				
			||||||
@@ -163,7 +164,7 @@ EOF
 | 
				
			|||||||
  curl -sS -L --connect-timeout 20 --retry 6 --retry-delay 10 https://bootstrap.saltstack.com | sh -s -- -M -N
 | 
					  curl -sS -L --connect-timeout 20 --retry 6 --retry-delay 10 https://bootstrap.saltstack.com | sh -s -- -M -N
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Install salt-api
 | 
					  # Install salt-api
 | 
				
			||||||
  #  
 | 
					  #
 | 
				
			||||||
  # This is used to provide the network transport for salt-api
 | 
					  # This is used to provide the network transport for salt-api
 | 
				
			||||||
  yum install -y python-cherrypy
 | 
					  yum install -y python-cherrypy
 | 
				
			||||||
  # This is used to inform the cloud provider used in the vagrant cluster
 | 
					  # This is used to inform the cloud provider used in the vagrant cluster
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -40,22 +40,24 @@ done
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Let the minion know who its master is
 | 
					# Let the minion know who its master is
 | 
				
			||||||
mkdir -p /etc/salt/minion.d
 | 
					mkdir -p /etc/salt/minion.d
 | 
				
			||||||
echo "master: $MASTER_NAME" > /etc/salt/minion.d/master.conf
 | 
					cat <<EOF >/etc/salt/minion.d/master.conf
 | 
				
			||||||
 | 
					master: '$(echo "$MASTER_NAME" | sed -e "s/'/''/g")'
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Our minions will have a pool role to distinguish them from the master.
 | 
					# Our minions will have a pool role to distinguish them from the master.
 | 
				
			||||||
cat <<EOF >/etc/salt/minion.d/grains.conf
 | 
					cat <<EOF >/etc/salt/minion.d/grains.conf
 | 
				
			||||||
grains:
 | 
					grains:
 | 
				
			||||||
  network_mode: openvswitch
 | 
					  network_mode: openvswitch
 | 
				
			||||||
  node_ip: $MINION_IP
 | 
					  node_ip: '$(echo "$MINION_IP" | sed -e "s/'/''/g")'
 | 
				
			||||||
  etcd_servers: $MASTER_IP
 | 
					  etcd_servers: '$(echo "$MASTER_IP" | sed -e "s/'/''/g")'
 | 
				
			||||||
  api_servers: $MASTER_IP
 | 
					  api_servers: '$(echo "$MASTER_IP" | sed -e "s/'/''/g")'
 | 
				
			||||||
  networkInterfaceName: eth1
 | 
					  networkInterfaceName: eth1
 | 
				
			||||||
  apiservers: $MASTER_IP
 | 
					  apiservers: '$(echo "$MASTER_IP" | sed -e "s/'/''/g")'
 | 
				
			||||||
  roles:
 | 
					  roles:
 | 
				
			||||||
    - kubernetes-pool
 | 
					    - kubernetes-pool
 | 
				
			||||||
    - kubernetes-pool-vagrant
 | 
					    - kubernetes-pool-vagrant
 | 
				
			||||||
  cbr-cidr: $MINION_IP_RANGE
 | 
					  cbr-cidr: '$(echo "$MINION_IP_RANGE" | sed -e "s/'/''/g")'
 | 
				
			||||||
  minion_ip: $MINION_IP
 | 
					  minion_ip: '$(echo "$MINION_IP" | sed -e "s/'/''/g")'
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# we will run provision to update code each time we test, so we do not want to do salt install each time
 | 
					# we will run provision to update code each time we test, so we do not want to do salt install each time
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user