Added vSphere cloud provider config update for Kubernetes >= 1.9.2

This commit is contained in:
Julian Hübenthal 2018-01-31 09:15:46 +01:00
parent ac4d782937
commit 989e9174c2
3 changed files with 36 additions and 2 deletions

View file

@ -34,9 +34,9 @@ Then, in the same file, you need to declare your vCenter credential following th
| vsphere_datastore | TRUE | string | | | Datastore name to use |
| vsphere_working_dir | TRUE | string | | | Working directory from the view "VMs and template" in the vCenter where VM are placed |
| vsphere_scsi_controller_type | TRUE | string | buslogic, pvscsi, parallel | pvscsi | SCSI controller name. Commonly "pvscsi". |
| vsphere_vm_uuid | FALSE | string | | | VM Instance UUID of virtual machine that host K8s master. Can be retrieved from instanceUuid property in VmConfigInfo, or as vc.uuid in VMX file or in `/sys/class/dmi/id/product_serial` |
| vsphere_vm_uuid | FALSE | string | | | VM Instance UUID of virtual machine that host K8s master. Can be retrieved from instanceUuid property in VmConfigInfo, or as vc.uuid in VMX file or in `/sys/class/dmi/id/product_serial` (only optional for Kubernetes <= 1.9.2) |
| vsphere_public_network | FALSE | string | | Blank | Name of the network the VMs are joined to |
| vsphere_resource_pool | FALSE | string | | Blank | Name of the Resource pool where the VMs are located (optional for Kubernetes >= 1.9.2) |
Example configuration
```yml
vsphere_vcenter_ip: "myvcenter.domain.com"
@ -48,6 +48,7 @@ vsphere_datacenter: "DATACENTER_name"
vsphere_datastore: "DATASTORE_name"
vsphere_working_dir: "Docker_hosts"
vsphere_scsi_controller_type: "pvscsi"
vsphere_resource_pool: "K8s-Pool"
```
## Deployment

View file

@ -47,6 +47,8 @@ vsphere_datacenter: "{{ lookup('env', 'VSPHERE_DATACENTER') }}"
vsphere_datastore: "{{ lookup('env', 'VSPHERE_DATASTORE') }}"
vsphere_working_dir: "{{ lookup('env', 'VSPHERE_WORKING_DIR') }}"
vsphere_insecure: "{{ lookup('env', 'VSPHERE_INSECURE') }}"
vsphere_resource_pool: "{{ lookup('env', 'VSPHERE_RESOURCE_POOL') }}"
vsphere_scsi_controller_type: pvscsi
# vsphere_public_network is name of the network the VMs are joined to
vsphere_public_network: "{{ lookup('env', 'VSPHERE_PUBLIC_NETWORK')|default('') }}"

View file

@ -1,3 +1,31 @@
{%- if kube_version | version_compare('v1.9.2', '>=') -%}
[Global]
datacenters = "{{ vsphere_datacenter }}"
insecure-flag = {{ vsphere_insecure }}
password = "{{ vsphere_password }}"
port = {{ vsphere_vcenter_port }}
user = "{{ vsphere_user }}"
[VirtualCenter "{{ vsphere_vcenter_ip }}"]
[Workspace]
server = "{{ vsphere_vcenter_ip }}"
datacenter = "{{ vsphere_datacenter }}"
folder = "{{ vsphere_working_dir }}"
default-datastore = "{{ vsphere_datastore }}"
resourcepool-path = "{{ vsphere_resource_pool }}"
[Disk]
scsicontrollertype = {{ vsphere_scsi_controller_type }}
{% if vsphere_public_network is defined and vsphere_public_network != "" %}
[Network]
public-network = {{ vsphere_public_network }}
{% endif %}
{%- else -%}
[Global]
datacenter = "{{ vsphere_datacenter }}"
datastore = "{{ vsphere_datastore }}"
@ -18,3 +46,6 @@ scsicontrollertype = {{ vsphere_scsi_controller_type }}
[Network]
public-network = {{ vsphere_public_network }}
{% endif %}
{%- endif -%}