Java Example of Enabling
vSphere with Tanzu
on a Cluster with NSX-T Networking

This example enables
vSphere with Tanzu
on a cluster that has NSX-T configured as the networking stack.
The following code snippet is part of the
EnableSupervisorCluster.java
sample. Some parts of the original code sample are omitted to save space. You can view the complete and up-to-date version of this sample in the
vsphere-automation-sdk-java
VMware repository at GitHub.
(...) @Override protected void run() throws Exception { System.out.println("We are building the Spec for enabling vSphere supervisor cluster"); ClustersTypes.EnableSpec spec = new ClustersTypes.EnableSpec(); (...) spec.setSizeHint(SizingHint.TINY); (...) spec.setServiceCidr(serCidr); spec.setNetworkProvider(ClustersTypes.NetworkProvider.NSXT_CONTAINER_PLUGIN); (...) spec.setNcpClusterNetworkSpec(NCPSpec); (...) spec.setMasterManagementNetwork(masterNet); (...) spec.setMasterDNS(masterDNS); (...) spec.setWorkerDNS(workerDNS); (...) spec.setMasterNTPServers(NTPserver); spec.setMasterStoragePolicy(this.storagePolicyId); // Storage policy identifier spec.setEphemeralStoragePolicy(this.storagePolicyId);// Storage policy identifier spec.setLoginBanner("This is your first Project pacific cluster"); (...) spec.setImageStorage(imageSpec); this.ppClusterService.enable(clusterId, spec); System.out.println("Invocation is successful for enabling vSphere supervisor cluster, check H5C"); } (...)