vmware-archive / kubernetes-archived

This repository is archived. Please file in-tree vSphere Cloud Provider issues at https://github.com/kubernetes/kubernetes/issues . CSI Driver for vSphere is available at https://github.com/kubernetes/cloud-provider-vsphere
Apache License 2.0
46 stars 31 forks source link

K8S Vsphere Provider Automation Scripts lazy handling of indent from GOVC parsing #503

Open james-powis opened 6 years ago

james-powis commented 6 years ago

/kind bug

What happened: Automation script fails due to path spaces being removed

What you expected to happen: It should work...

How to reproduce it (as minimally and precisely as possible): The vpc_daemon set produces the following logs:

++ govc vm.info -dc=ctec-ae-core -vm.uuid=422ef72c-6f09-4deb-f705-7f7de63deeb7
++ grep Path:
++ awk 'BEGIN {FS=":"};{print $2}'
++ tr -d ' '
+ vmpath=/ctec-ae-core/vm/Discoveredvirtualmachine/k8sm02
+ '[' -z /ctec-ae-core/vm/Discoveredvirtualmachine/k8sm02 ']'
+ govc vm.change -e=disk.enableUUID=1 -vm=/ctec-ae-core/vm/Discoveredvirtualmachine/k8sm02
+ '[' 1 -eq 0 ']'
+ ERROR_MSG='Failed to enable disk.enableUUID flag on the Node Virtual Machine'
+ update_VcpConfigStatus vcp-daementset-2v98f '[PHASE 2] Enable disk.enableUUID on the VM' FAILED 'Failed to enable disk.enableUUID flag on the Node Virtual Machine'
+ POD_NAME=vcp-daementset-2v98f
+ PHASE='[PHASE 2] Enable disk.enableUUID on the VM'
+ STATUS=FAILED
+ ERROR='Failed to enable disk.enableUUID flag on the Node Virtual Machine'

Manually stepping through the bash pipes produces the following.

$ govc vm.info -dc=ctec-ae-core -vm.uuid=422ef72c-6f09-4deb-f705-7f7de63deeb7 | grep Path: | awk 'BEGIN {FS=":"};{print $2}'
         /ctec-ae-core/vm/Discovered virtual machine/k8sm02

$ govc vm.info -dc=ctec-ae-core -vm.uuid=422ef72c-6f09-4deb-f705-7f7de63deeb7 | grep Path: | awk 'BEGIN {FS=":"};{print $2}' | tr -d ' '
/ctec-ae-core/vm/Discoveredvirtualmachine/k8sm02

Obviously the indent from govc needs to be removed, but the spaces in the actual path need to be preserved, and the result encapsulated in quotes.

james-powis commented 6 years ago

The immediate work around is to manually move the nodes to the kubernetes folder created prior to the failing step. But given that "Discovered virtual machines" folder is the default for VSphere/VCenter this is pretty annoying.