Merge pull request #2221 from Xuxe/patch-vcp-v1.9.2

Updated vSphere cloud provider config for Kubernetes >= v1.9.2 and added resource pool deployment variable
This commit is contained in:
Spencer Smith 2018-01-31 16:06:07 -05:00 committed by GitHub
commit c0a3bcf9b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 9 deletions

View file

@ -34,10 +34,12 @@ Then, in the same file, you need to declare your vCenter credential following th
| vsphere_datastore | TRUE | string | | | Datastore name to use | | 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_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_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` (Optional, only used for Kubernetes <= 1.9.2) |
| vsphere_public_network | FALSE | string | | Blank | Name of the network the VMs are joined to | | 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, only used for Kubernetes >= 1.9.2) |
Example configuration Example configuration
```yml ```yml
vsphere_vcenter_ip: "myvcenter.domain.com" vsphere_vcenter_ip: "myvcenter.domain.com"
vsphere_vcenter_port: 443 vsphere_vcenter_port: 443
@ -48,6 +50,7 @@ vsphere_datacenter: "DATACENTER_name"
vsphere_datastore: "DATASTORE_name" vsphere_datastore: "DATASTORE_name"
vsphere_working_dir: "Docker_hosts" vsphere_working_dir: "Docker_hosts"
vsphere_scsi_controller_type: "pvscsi" vsphere_scsi_controller_type: "pvscsi"
vsphere_resource_pool: "K8s-Pool"
``` ```
## Deployment ## Deployment

View file

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

View file

@ -1,15 +1,36 @@
[Global] [Global]
datacenter = "{{ vsphere_datacenter }}" user = "{{ vsphere_user }}"
datastore = "{{ vsphere_datastore }}"
insecure-flag = {{ vsphere_insecure }}
password = "{{ vsphere_password }}" password = "{{ vsphere_password }}"
port = {{ vsphere_vcenter_port }} port = {{ vsphere_vcenter_port }}
server = "{{ vsphere_vcenter_ip }}" insecure-flag = {{ vsphere_insecure }}
user = "{{ vsphere_user }}"
{% if kube_version | version_compare('v1.9.2', '>=') %}
datacenters = "{{ vsphere_datacenter }}"
{% else %}
datastore = "{{ vsphere_datastore }}"
datacenter = "{{ vsphere_datacenter }}"
working-dir = "{{ vsphere_working_dir }}" working-dir = "{{ vsphere_working_dir }}"
{% if vsphere_vm_uuid is defined %} server = "{{ vsphere_vcenter_ip }}"
vm-uuid = {{ vsphere_vm_uuid }} {% if vsphere_vm_uuid is defined and vsphere_vm_uuid != "" %}
vm-uuid = "{{ vsphere_vm_uuid }}"
{% endif %} {% endif %}
{% endif %}
{% if kube_version | version_compare('v1.9.2', '>=') %}
[VirtualCenter "{{ vsphere_vcenter_ip }}"]
[Workspace]
server = "{{ vsphere_vcenter_ip }}"
datacenter = "{{ vsphere_datacenter }}"
folder = "{{ vsphere_working_dir }}"
default-datastore = "{{ vsphere_datastore }}"
{% if vsphere_resource_pool is defined and vsphere_resource_pool != "" %}
resourcepool-path = "{{ vsphere_resource_pool }}"
{% endif %}
{% endif %}
[Disk] [Disk]
scsicontrollertype = {{ vsphere_scsi_controller_type }} scsicontrollertype = {{ vsphere_scsi_controller_type }}