|
1 | | -# terraform-provider-namespace-management |
| 1 | +# Namespace Management Terraform provider |
2 | 2 |
|
3 | | -## Overview |
| 3 | +This Terraform Provider enables control of vSphere Workload Management. |
| 4 | +This includes enabling or disabling workload management |
| 5 | +(effectively creating, and destroying, Tanzu Supervisor Clusters), |
| 6 | +and enabling or disabling supervisor cluster services. |
| 7 | + |
| 8 | +The project is called namespace-management rather than tanzu-supervisor |
| 9 | +to be consistent with the vSphere API name which it wraps. |
| 10 | + |
| 11 | +Note that Tanzu Workload Clusters should be requested by sending YAML |
| 12 | +configuration via kubectl to the appropriate Supervisor Cluster's |
| 13 | +vSphere namespace. There is no internal vSphere REST API for this by design. |
| 14 | +(This is internalised in CAPV - Cluster API for vSphere). |
| 15 | + |
| 16 | +Likewise, creating the underlying infrastructure in vSphere can be |
| 17 | +accomplished by using the |
| 18 | +[HashiCorp vSphere provider](https://registry.terraform.io/providers/hashicorp/vsphere) |
| 19 | +and the [Avi Terraform Provider](). |
| 20 | +An example of these being used alongside our Workload Management |
| 21 | +Terraform provider is provided in the |
| 22 | +examples/full_esxi_tanzu_cluster sample. |
| 23 | + |
| 24 | +## Pre initial release sprints |
| 25 | + |
| 26 | +- Alpha 1 |
| 27 | + - Single Avi controller instance, Avi Essentials configuration only, v21.1.2 |
| 28 | + - vDS networking 7.0u2 and 7.0u3 support for vCenter |
| 29 | + - Works with latest photon build for TKGS (see concourse/combinations/README.md) |
| 30 | + - Tested against h2o.vmware.com and my own homelab nested esxi environment |
| 31 | + - No automated CI/CD testing |
| 32 | + - Manual uploading of OVAs and manual Content Library creation |
| 33 | + - Add all necessary repo files (Update CLA from DCO, CONTRIBUTING changes for this too) |
| 34 | + - Support manual build only (Provider not yet added to Terraform registry) |
| 35 | + - Govmomi bug fixes and enhancements contributed back to project |
| 36 | + - REQUEST REPO BE MADE PUBLIC |
| 37 | +- Alpha 2 |
| 38 | + - Functional validation tests post cluster creation (Node up, node reachable) |
| 39 | + - Overarching Concourse tests for develop branch |
| 40 | + - Concourse loads environment combinations and runs multiple env pipelines in order using Terraform |
| 41 | + - Support n-2 photon versions |
| 42 | + - Automate testing on h20 (7.0u2) and homelab (7.0u3) using Concourse remote workers |
| 43 | + - This is a total of 6 combinations |
| 44 | + - Include initial vDS creation |
| 45 | + - Include file upload from staging to datastore |
| 46 | + - Include content library creation and uploading of TKR releases |
| 47 | + - Produce test report summary files for develop branch |
| 48 | + - Project introduction video |
| 49 | + - Support manual build only (Provider not yet added to Terraform registry) |
| 50 | +- Beta 1 |
| 51 | + - Beta builds submitted automatically to Terraform registry on tag and release (main branch) |
| 52 | + - Full sample documentation |
| 53 | + - Include support for TkgServiceConfiguration customisation |
| 54 | + - Include support for Custom ingress and egress CIDR ranges, CA certs |
| 55 | + - Include restriction of Certs used for EC P-256 |
| 56 | + - Multi-node Avi controller support |
| 57 | + - Avi Enterprise support (including license key upload) |
| 58 | + - Add more version combinations |
| 59 | + - n-2 Avi version support |
| 60 | + - This is a total of 12 combinations |
| 61 | + - Bootstrap Harbor VM support |
| 62 | + - Helm Harbor services cluster support and sample |
| 63 | + - Node/pod communication check tests (VMs, Pods) |
| 64 | + - More detailed Concourse build success reports |
| 65 | +- Beta 2 |
| 66 | + - Add more version and environment combinations |
| 67 | + - Include basic Workload Cluster creation for photon and ubuntu TKR at n-2 (Only 2 supported currently) |
| 68 | + - Latest NSX-T support with own load balancer |
| 69 | + - This is 48 combinations in total |
| 70 | + - NSX-T support intro video |
| 71 | + - Built in Harbor support |
| 72 | + - Support for shared and standalone prometheus, grafana |
| 73 | +- Initial full release |
| 74 | + - Add new environment and versions |
| 75 | + - NSX-T n-2 version support |
| 76 | + - NSX-T support with Avi load balancer |
| 77 | + - Latest ESXi/vSphere version tested (currently 7.0u3d) |
| 78 | + - n-2 tests for Avi Load Balancer, Avi Terraform Plugin (Matched to Avi), NSX-T and NSX-T Terraform Plugin (Matched to NSX-T) |
| 79 | + - This is 576 combinations |
| 80 | + - Full suite of tests (main and develop branches) with all latest minor releases of k8s TKRs |
| 81 | + - Tanzu Standard on top of vSphere for Tanzu, with restricted psp/opa |
| 82 | + - Istio with ingress, egress, istio-cni, minimum extra permissions (just the CNI pod) |
| 83 | + - Kiali support for istio configuration validation/manual checking |
| 84 | + - Full release documentation |
| 85 | + - Launch video |
| 86 | + |
| 87 | + |
| 88 | +## Status (PRIOR TO INITIAL PUBLIC RELEASE ONLY, THEN REMOVED FROM HERE) |
| 89 | + |
| 90 | +- data_source_clusters |
| 91 | + - clustersRead() |
| 92 | + - lists clusters with id, name, k8s status, config status |
| 93 | + - Uses GET /api/vcenter/namespace-management/clusters |
| 94 | + - Working, see examples/03_basic_list/clusters/main.tf |
| 95 | + - Returns { clusters: [ {id: "domain-c1005", name:"Cluster01", kubernetes_status:"READY", config_status:"RUNNING"}, ... ] } |
| 96 | +- data_source_cluster |
| 97 | + - clusterRead() |
| 98 | + - Given a cluster NAME (NOT id) like 'Cluster01' returns the cluster's Tanzu Supervisor Cluster summary |
| 99 | + - Uses GET /api/vcenter/namespace-management/clusters |
| 100 | + - Summary includes (only) id, name, kubernetes_status, config_status |
| 101 | + - Working, see see examples/02_basic_read/clusters/main.tf |
| 102 | + - Returns {id: "domain-c1005", name:"Cluster01", kubernetes_status:"READY", config_status:"RUNNING"} |
| 103 | +- resource_cluster |
| 104 | + - clusterCreate() |
| 105 | + - Given a vSphere cluster ID (NOT name) like 'domain-c1005', enables workload management |
| 106 | + - Uses POST /api/vcenter/namespace-management/clusters/{cluster}?action=enable |
| 107 | + - Implemented, untested, see examples/01_basic_create/clusters/main.tf |
| 108 | + - Uses hardcoded cluster enable spec data today |
| 109 | + - Limited to NSX-T today rather than full information due to missing govmomi features: https://github.com/vmware/govmomi/issues/2860 |
| 110 | + - Warning: Due to the above, the workload cluster NTP source(s) will not be set, which will cause your workload clusters to not spin up successfully until you manually add this configuration element via vCenter |
| 111 | + - clusterRead() |
| 112 | + - Given a cluster NAME (NOT id) like 'Cluster01' returns the cluster's Tanzu Supervisor Cluster summary |
| 113 | + - Uses List method as data_clusters clusterRead today |
| 114 | + - Working, see see examples/02_basic_read/clusters/main.tf |
| 115 | + - Limited to cluster summary today rather than full information due to missing govmomi feature: https://github.com/vmware/govmomi/issues/2860 |
| 116 | + - clusterUpdate() |
| 117 | + - Given a vSphere cluster ID (NOT name) like 'domain-c1005', replaces the current cluster enable spec with a new full spec |
| 118 | + - Not implemented today |
| 119 | + - clusterDelete() |
| 120 | + - Given a vSphere cluster ID (NOT name) like 'domain-c1005', disables workload management |
| 121 | + - Doesn't actually delete the vSphere cluster, just the Tanzu Supervisor Cluster |
| 122 | + - Not implemented |
4 | 123 |
|
5 | 124 | ## Try it out |
6 | 125 |
|
7 | 126 | ### Prerequisites |
8 | 127 |
|
9 | | -* Prereq 1 |
10 | | -* Prereq 2 |
11 | | -* Prereq 3 |
| 128 | +* You must have Terraform installed on your system |
| 129 | +* You must have a Go runtime installed with corresponding build tools |
| 130 | +* You must have a vSphere 7.0 update 2 (7.0.2) system configured with a vCenter and at least two hosts (ideally 3 or more) |
| 131 | + |
| 132 | +## Building the provider |
| 133 | + |
| 134 | +Run the following command to build the provider |
| 135 | + |
| 136 | +```shell |
| 137 | +go build -o terraform-provider-namespace-management |
| 138 | +``` |
| 139 | + |
| 140 | +## Test sample configuration |
| 141 | + |
| 142 | +First, build and install the provider. |
| 143 | + |
| 144 | +```shell |
| 145 | +make install |
| 146 | +``` |
| 147 | + |
| 148 | +Download the simulator from here: |
| 149 | + |
| 150 | +TODO REWORK THIS SECTION TO NOT USE THE SIMULATOR |
| 151 | + |
| 152 | +Now unpack and run the VMware simulator |
| 153 | +```shell |
| 154 | +cat ~/Downloads/vcsim_PLATFORM_ARCH.tar.gz | sudo tar -C /usr/local/bin -xzvf - vcsim |
| 155 | +vcsim & |
| 156 | +``` |
| 157 | + |
| 158 | +This will report `export GOVC_URL=https://user:pass@127.0.0.1:8989/sdk GOVC_SIM_PID=69867` when running |
| 159 | + |
| 160 | +Then, run the following command to initialize the workspace and apply the sample configuration. |
| 161 | + |
| 162 | +```shell |
| 163 | +cd examples/SOME_EXAMPLE |
| 164 | +terraform init && terraform apply |
| 165 | +``` |
12 | 166 |
|
13 | 167 | ### Build & Run |
14 | 168 |
|
|
20 | 174 |
|
21 | 175 | ## Contributing |
22 | 176 |
|
| 177 | +TODO REPLACE WITH CLA (As it's Apache 2) |
| 178 | + |
23 | 179 | The terraform-provider-namespace-management project team welcomes contributions from the community. Before you start working with terraform-provider-namespace-management, please |
24 | 180 | read our [Developer Certificate of Origin](https://cla.vmware.com/dco). All contributions to this repository must be |
25 | 181 | signed as described on that page. Your signature certifies that you wrote the patch or have the right to pass it on |
26 | 182 | as an open-source patch. For more detailed information, refer to [CONTRIBUTING.md](CONTRIBUTING.md). |
27 | 183 |
|
28 | 184 | ## License |
29 | 185 |
|
| 186 | +This project is licensed under the terms of the Apache-2.0 license and is Copyright VMware, Inc. 2022. See the LICENSE file for full details. |
0 commit comments