I'm using vSphere provider and I can't bootstrap juju controller to a specific cluster or a host in the cluster. Juju fails to bootstrap controller in case a cluster is in the folder.
This is the structure in vSphere: (or see attached screenshot)
Datacenter
+- Folder
+- Cluster
I'm getting "ERROR failed to bootstrap model: cannot start bootstrap instance: availability zone "FolderName/ClusterName" not found".
Here's how I bootstrap the controller:
```
juju bootstrap \
--config bootstrap-timeout=1800 \
--to zone=FolderName/ClusterName \
--constraints 'zone=FolderName/ClusterName cores=8 mem=24G root-disk=100G' \
--model-default /home/ubuntu/deploy/generated/model_defaults.yaml \
vsphere foundation_vsphere
```
$ juju --version
2.8.2-bionic-amd64
$ ubuntu@infra-1:~/deploy$ juju bootstrap \
--debug \
--config bootstrap-timeout=1800 \
--to zone=FolderName/ClusterName \
--constraints 'zones=FolderName/ClusterName cores=8 mem=24G root-disk=100G' \
--model-default /home/ubuntu/deploy/generated/model_defaults.yaml \
vsphere foundation_vsphere
14:01:50 INFO juju.cmd supercommand.go:54 running juju [2.8.2 0 a44e6eb38430da695737f5e9f37819478b9587c3 gc go1.14.7]
14:01:50 DEBUG juju.cmd supercommand.go:55 args: []string{"/snap/juju/14127/bin/juju", "bootstrap", "--debug", "--config", "bootstrap-timeout=1800", "--to", "zone=FolderName/ClusterName", "--constraints", "zones=FolderName/ClusterName cores=8 mem=24G root-disk=100G", "--model-default", "/home/ubuntu/deploy/generated/model_defaults.yaml", "vsphere", "foundation_vsphere"}
14:01:50 DEBUG juju.cmd.juju.commands bootstrap.go:1165 authenticating with region "" and credential "vsphere" ()
14:01:50 DEBUG juju.cmd.juju.commands bootstrap.go:1293 provider attrs: map[]
14:01:52 INFO cmd authkeys.go:114 Adding contents of "/home/ubuntu/.local/share/juju/ssh/juju_id_rsa.pub" to authorized-keys
14:01:52 INFO cmd authkeys.go:114 Adding contents of "/home/ubuntu/.ssh/id_rsa.pub" to authorized-keys
14:01:52 DEBUG juju.cmd.juju.commands bootstrap.go:1363 preparing controller with config: map[agent-metadata-url: agent-stream:released apt-ftp-proxy: apt-http-proxy: apt-https-proxy: apt-mirror: apt-no-proxy: authorized-keys:ssh-rsa [REDACTED]
ssh-rsa [REDACTED]
automatically-retry-hooks:true backup-dir: cloudinit-userdata: container-image-metadata-url: container-image-stream:released container-inherit-properties: container-networking-method: datastore:FC1660_MSG-SEC_04 default-series:bionic default-space: development:false disable-network-management:false egress-subnets: enable-os-refresh-update:true enable-os-upgrade:true fan-config: firewall-mode:instance ftp-proxy: http-proxy: https-proxy: ignore-machine-addresses:false image-metadata-url: image-stream:released juju-ftp-proxy: juju-http-proxy: juju-https-proxy: juju-no-proxy:127.0.0.1,localhost,::1 logforward-enabled:false logging-config: lxd-snap-channel:latest/stable max-action-results-age:336h max-action-results-size:5G max-status-history-age:336h max-status-history-size:5G name:controller net-bond-reconfigure-delay:17 no-proxy:127.0.0.1,localhost,::1 primary-network:NetworkName provisioner-harvest-mode:destroyed proxy-ssh:false resource-tags: snap-http-proxy: snap-https-proxy: snap-store-assertions: snap-store-proxy: snap-store-proxy-url: ssl-hostname-verification:true test-mode:false transmit-vendor-metrics:true type:vsphere update-status-hook-interval:5m uuid:7a81e787-3997-4689-8f52-1de76493b793]
14:01:52 INFO cmd bootstrap.go:775 Creating Juju controller "foundation_vsphere" on vsphere/DatacenterName
14:01:52 INFO juju.cmd.juju.commands bootstrap.go:844 combined bootstrap constraints: cores=8 mem=24576M root-disk=102400M zones=FolderName/ClusterName
14:01:52 DEBUG juju.environs.bootstrap bootstrap.go:308 model "controller" supports application/machine networks: false
14:01:52 DEBUG juju.environs.bootstrap bootstrap.go:310 network management by juju enabled: true
14:01:52 INFO cmd bootstrap.go:376 Loading image metadata
14:01:52 INFO cmd bootstrap.go:448 Looking for packaged Juju agent version 2.8.2 for amd64
14:01:52 INFO juju.environs.bootstrap tools.go:81 looking for bootstrap agent binaries: version=2.8.2
14:01:52 DEBUG juju.environs.tools tools.go:102 finding agent binaries in stream: "released"
14:01:52 DEBUG juju.environs.tools tools.go:104 reading agent binaries with major.minor version 2.8
14:01:52 DEBUG juju.environs.tools tools.go:112 filtering agent binaries by version: 2.8.2
14:01:52 DEBUG juju.environs.tools tools.go:115 filtering agent binaries by series: bionic
14:01:52 DEBUG juju.environs.tools tools.go:118 filtering agent binaries by architecture: amd64
14:01:52 DEBUG juju.environs.tools urls.go:138 trying datasource "keystone catalog"
14:01:57 DEBUG juju.environs.simplestreams simplestreams.go:692 using default candidate for content id "com.ubuntu.juju:released:tools" are {20161007 mirrors:1.0 content-download streams/v1/cpc-mirrors.sjson []}
14:01:57 INFO juju.environs.bootstrap tools.go:83 found 0 packaged agent binaries
14:01:57 INFO cmd bootstrap.go:472 No packaged binary found, preparing local Juju agent binary
14:01:57 DEBUG juju.environs.sync sync.go:311 Making agent binary tarball
14:01:57 DEBUG juju.environs.tools build.go:117 looking for: /snap/juju/14127/bin/juju
14:01:57 DEBUG juju.environs.tools build.go:194 checking: /snap/juju/14127/bin/jujud
14:01:57 INFO juju.environs.tools build.go:200 Found agent binary to upload (/snap/juju/14127/bin/jujud)
14:01:57 INFO juju.environs.tools build.go:202 target: /tmp/juju-tools884417937/jujud
14:01:57 INFO juju.environs.tools build.go:214 target jujuc: /tmp/juju-tools884417937/jujuc
14:01:57 INFO juju.environs.tools build.go:235 including versions file "/snap/juju/14127/bin/jujud-versions.yaml"
14:01:58 DEBUG juju.environs.tools versionfile.go:55 looking for sha256 36f8206be093103d8d03bb1d3ad8b2e030aca58f58d1fb7627e4727bd2fcd185
14:01:58 DEBUG juju.environs.tools build.go:325 using official version 2.8.2-bionic-amd64
14:01:58 DEBUG juju.environs.tools build.go:44 adding entry: &tar.Header{Typeflag:0x30, Name:"jujuc", Linkname:"", Size:8826880, Mode:493, Uid:0, Gid:0, Uname:"ubuntu", Gname:"ubuntu", ModTime:time.Time{wall:0x2c6f40be, ext:63734824917, loc:(*time.Location)(0x6480080)}, AccessTime:time.Time{wall:0x2c6f40be, ext:63734824917, loc:(*time.Location)(0x6480080)}, ChangeTime:time.Time{wall:0x2c6f40be, ext:63734824917, loc:(*time.Location)(0x6480080)}, Devmajor:0, Devminor:0, Xattrs:map[string]string(nil), PAXRecords:map[string]string(nil), Format:0}
14:01:58 DEBUG juju.environs.tools build.go:44 adding entry: &tar.Header{Typeflag:0x30, Name:"jujud", Linkname:"", Size:125026304, Mode:493, Uid:0, Gid:0, Uname:"ubuntu", Gname:"ubuntu", ModTime:time.Time{wall:0x2bf52e8a, ext:63734824917, loc:(*time.Location)(0x6480080)}, AccessTime:time.Time{wall:0x2bf52e8a, ext:63734824917, loc:(*time.Location)(0x6480080)}, ChangeTime:time.Time{wall:0x2bf52e8a, ext:63734824917, loc:(*time.Location)(0x6480080)}, Devmajor:0, Devminor:0, Xattrs:map[string]string(nil), PAXRecords:map[string]string(nil), Format:0}
14:02:05 DEBUG juju.environs.tools build.go:44 adding entry: &tar.Header{Typeflag:0x30, Name:"jujud-versions.yaml", Linkname:"", Size:119, Mode:420, Uid:0, Gid:0, Uname:"ubuntu", Gname:"ubuntu", ModTime:time.Time{wall:0x2c6f40be, ext:63734824917, loc:(*time.Location)(0x6480080)}, AccessTime:time.Time{wall:0x2c6f40be, ext:63734824917, loc:(*time.Location)(0x6480080)}, ChangeTime:time.Time{wall:0x2c6f40be, ext:63734824917, loc:(*time.Location)(0x6480080)}, Devmajor:0, Devminor:0, Xattrs:map[string]string(nil), PAXRecords:map[string]string(nil), Format:0}
14:02:05 INFO juju.environs.sync sync.go:343 using official agent binary 2.8.2-bionic-amd64 (37807kB)
14:02:05 INFO cmd bootstrap.go:535 Starting new instance for initial controller
14:02:05 DEBUG juju.provider.vmware client.go:125 relative folderPath "cloudname" found, join with DC vm folder "/DatacenterName/vm" now
14:02:06 INFO cmd bootstrap.go:177 Launching controller instance(s) on vsphere/DatacenterName...
14:02:06 ERROR juju.cmd.juju.commands bootstrap.go:795 failed to bootstrap model: cannot start bootstrap instance: availability zone "FolderName/ClusterName" not found
14:02:06 DEBUG juju.cmd.juju.commands bootstrap.go:796 (error details: [{/build/snapcraft-juju-35d6cf/parts/juju/src/cmd/juju/commands/bootstrap.go:889: failed to bootstrap model} {/build/snapcraft-juju-35d6cf/parts/juju/src/environs/bootstrap/bootstrap.go:633: } {/build/snapcraft-juju-35d6cf/parts/juju/src/environs/bootstrap/bootstrap.go:539: } {/build/snapcraft-juju-35d6cf/parts/juju/src/provider/common/bootstrap.go:57: } {/build/snapcraft-juju-35d6cf/parts/juju/src/provider/common/bootstrap.go:220: cannot start bootstrap instance} {/build/snapcraft-juju-35d6cf/parts/juju/src/provider/common/bootstrap.go:307: } {/build/snapcraft-juju-35d6cf/parts/juju/src/provider/vsphere/environ_availzones.go:154: } {/build/snapcraft-juju-35d6cf/parts/juju/src/provider/vsphere/environ_instance.go:120: } {/build/snapcraft-juju-35d6cf/parts/juju/src/provider/vsphere/environ_availzones.go:173: availability zone "FolderName/ClusterName" not found}])
14:02:06 DEBUG juju.cmd.juju.commands bootstrap.go:1471 cleaning up after failed bootstrap
14:02:06 INFO juju.provider.common destroy.go:21 destroying model "controller"
14:02:06 INFO juju.provider.common destroy.go:32 destroying instances
14:02:06 INFO juju.provider.common destroy.go:56 destroying storage
14:02:06 DEBUG juju.provider.vmware client.go:125 relative folderPath "cloudname/Juju Controller (*)/Model \"controller\" (7a81e787-3997-4689-8f52-1de76493b793)" found, join with DC vm folder "/DatacenterName/vm" now
14:02:06 DEBUG juju.provider.vmware client.go:160 no VMs matching path "cloudname/Juju Controller (25b5fae0-d10c-4c05-8819-6bd2728297ec)/Model \"*\" (*)/*"
14:02:06 DEBUG juju.provider.vmware client.go:125 relative folderPath "cloudname/Juju Controller (25b5fae0-d10c-4c05-8819-6bd2728297ec)" found, join with DC vm folder "/DatacenterName/vm" now
14:02:06 INFO cmd supercommand.go:544 command finished
FWIW, I have added some traces in the locally compiled juju client and found out that env.AvailabilityZones(ctx) in [1] returns empty 'zones'. It's not nil, it's just an empty array. Similarily env.zones in [2] is also an empty array.
1. https://github.com/juju/juju/blob/92301e2ff1ef993e35886c5f34a1b85edc7135c9/provider/vsphere/environ_availzones.go#L164
2. https://github.com/juju/juju/blob/92301e2ff1ef993e35886c5f34a1b85edc7135c9/provider/vsphere/environ_availzones.go#L66
Subscribed field-critical as this is blocking customer deployment.