mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-17 07:03:31 +00:00
Merge pull request #6259 from zmerlynn/fix_cloud_provider
Eliminate grains.cloud_provider (in preference to grains.cloud) from SaltStack
This commit is contained in:
@@ -4,10 +4,17 @@
|
||||
{% endif -%}
|
||||
|
||||
{% set cloud_provider = "" -%}
|
||||
{% if grains.cloud_provider is defined -%}
|
||||
{% set cloud_provider = "--cloud_provider=" + grains.cloud_provider -%}
|
||||
{% set cloud_config = "" -%}
|
||||
|
||||
{% if grains.cloud is defined -%}
|
||||
{% set cloud_provider = "--cloud_provider=" + grains.cloud -%}
|
||||
|
||||
{% if grains.cloud == 'aws' -%}
|
||||
{% set cloud_config = "--cloud_config=/etc/aws.conf" -%}
|
||||
{% endif -%}
|
||||
|
||||
{% endif -%} # grains.cloud is defined
|
||||
|
||||
{% set address = "--address=127.0.0.1" -%}
|
||||
|
||||
{% if pillar['instance_prefix'] is defined -%}
|
||||
@@ -30,17 +37,6 @@
|
||||
{% set etcd_servers = "--etcd_servers=http://" + ips[0][0] + ":4001" -%}
|
||||
{% endif -%}
|
||||
|
||||
{% set cloud_config = "" -%}
|
||||
{% if grains.cloud is defined -%}
|
||||
{% if grains.cloud == 'gce' -%}
|
||||
{% set cloud_provider = "--cloud_provider=gce" -%}
|
||||
{% endif -%}
|
||||
{% if grains.cloud == 'aws' -%}
|
||||
{% set cloud_provider = "--cloud_provider=aws" -%}
|
||||
{% set cloud_config = "--cloud_config=/etc/aws.conf" -%}
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
|
||||
{% if pillar['portal_net'] is defined -%}
|
||||
{% set portal_net = "--portal_net=" + pillar['portal_net'] -%}
|
||||
{% endif -%}
|
||||
|
@@ -1,4 +1,3 @@
|
||||
{% set cloud_config = "" -%}
|
||||
{% set daemon_args = "$DAEMON_ARGS" -%}
|
||||
{% if grains['os_family'] == 'RedHat' -%}
|
||||
{% set daemon_args = "" -%}
|
||||
@@ -7,31 +6,28 @@
|
||||
{% set master="--master=127.0.0.1:8080" -%}
|
||||
|
||||
{% set machines = ""-%}
|
||||
{% set cloud_provider = "" -%}
|
||||
{% set minion_regexp = "--minion_regexp=.*" -%}
|
||||
{% set sync_nodes = "--sync_nodes=true" -%}
|
||||
{% if grains.cloud_provider is defined -%}
|
||||
{% set cloud_provider = "--cloud_provider=" + grains.cloud_provider -%}
|
||||
{% endif -%}
|
||||
|
||||
{% if pillar['node_instance_prefix'] is defined -%}
|
||||
{% set minion_regexp = "--minion_regexp='" + pillar['node_instance_prefix'] + ".*'" -%}
|
||||
{% endif -%}
|
||||
|
||||
{% set cloud_provider = "" -%}
|
||||
{% set cloud_config = "" -%}
|
||||
|
||||
{% if grains.cloud is defined -%}
|
||||
{% if grains.cloud == 'gce' -%}
|
||||
{% set cloud_provider = "--cloud_provider=gce" -%}
|
||||
{% endif -%}
|
||||
{% set cloud_provider = "--cloud_provider=" + grains.cloud -%}
|
||||
|
||||
{% if grains.cloud == 'aws' -%}
|
||||
{% set cloud_provider = "--cloud_provider=aws" -%}
|
||||
{% set cloud_config = "--cloud_config=/etc/aws.conf" -%}
|
||||
{% set machines = "--machines=" + ','.join(salt['mine.get']('roles:kubernetes-pool', 'network.ip_addrs', expr_form='grain').keys()) -%}
|
||||
{% endif -%}
|
||||
{% if grains.cloud == 'azure' -%}
|
||||
|
||||
{% elif grains.cloud == 'azure' -%}
|
||||
MACHINES="{{ salt['mine.get']('roles:kubernetes-pool', 'grains.items', expr_form='grain').values()|join(',', attribute='hostnamef') }}"
|
||||
{% set machines = "--machines=$MACHINES" -%}
|
||||
{% endif -%}
|
||||
{% if grains.cloud == 'vsphere' -%}
|
||||
|
||||
{% elif grains.cloud == 'vsphere' -%}
|
||||
# Collect IPs of minions as machines list.
|
||||
#
|
||||
# Use a bash array to build the value we need. Jinja 2.7 does support a 'map'
|
||||
@@ -43,7 +39,9 @@
|
||||
{% endfor -%}
|
||||
{% set machines = "--machines=$(echo ${MACHINE_IPS[@]} | xargs -n1 echo | paste -sd,)" -%}
|
||||
{% set minion_regexp = "" -%}
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
|
||||
{% endif -%} # grains.cloud switch
|
||||
|
||||
{% endif -%} # grains.cloud is defined
|
||||
|
||||
DAEMON_ARGS="{{daemon_args}} {{master}} {{machines}} {{ minion_regexp }} {{ cloud_provider }} {{ sync_nodes }} {{ cloud_config }} {{pillar['log_level']}}"
|
||||
|
@@ -80,7 +80,6 @@ grains:
|
||||
etcd_servers: '$(echo "$MASTER_IP" | sed -e "s/'/''/g")'
|
||||
api_servers: '$(echo "$MASTER_IP" | sed -e "s/'/''/g")'
|
||||
cloud: vagrant
|
||||
cloud_provider: vagrant
|
||||
roles:
|
||||
- kubernetes-master
|
||||
runtime_config: '$(echo "$RUNTIME_CONFIG" | sed -e "s/'/''/g")'
|
||||
|
Reference in New Issue
Block a user