Skip to content

Commit 4a256e1

Browse files
authored
Merge pull request #367 from vmware/feature/provisioner
Management cluster provisioner resource support
2 parents 001ba22 + 8e66181 commit 4a256e1

26 files changed

+1377
-3
lines changed

Diff for: .github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- 'v*'
77

88
env:
9-
BUILD_TAGS: 'akscluster cluster clustergroup credential ekscluster gitrepository iampolicy kustomization namespace custompolicy imagepolicy networkpolicy quotapolicy securitypolicy sourcesecret workspace tanzupackage tanzupackages packagerepository packageinstall clustersecret integration mutationpolicy backupschedule targetlocation dataprotection tanzukubernetescluster clusterclass managementcluster'
9+
BUILD_TAGS: 'akscluster cluster clustergroup credential ekscluster gitrepository iampolicy kustomization namespace custompolicy imagepolicy networkpolicy quotapolicy securitypolicy sourcesecret workspace tanzupackage tanzupackages packagerepository packageinstall clustersecret integration mutationpolicy backupschedule targetlocation dataprotection tanzukubernetescluster clusterclass managementcluster provisioner'
1010

1111
jobs:
1212
goreleaser:

Diff for: .github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Test and coverage
33
on: [pull_request, push]
44

55
env:
6-
BUILD_TAGS: 'akscluster cluster clustergroup credential ekscluster gitrepository iampolicy kustomization namespace custompolicy imagepolicy networkpolicy quotapolicy securitypolicy sourcesecret workspace tanzupackage tanzupackages packagerepository packageinstall clustersecret integration mutationpolicy backupschedule targetlocation dataprotection tanzukubernetescluster clusterclass managementcluster'
6+
BUILD_TAGS: 'akscluster cluster clustergroup credential ekscluster gitrepository iampolicy kustomization namespace custompolicy imagepolicy networkpolicy quotapolicy securitypolicy sourcesecret workspace tanzupackage tanzupackages packagerepository packageinstall clustersecret integration mutationpolicy backupschedule targetlocation dataprotection tanzukubernetescluster clusterclass managementcluster provisioner'
77
jobs:
88
build:
99
name: Test and coverage

Diff for: .golangci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ run:
8989
- helmfeature
9090
- helmrelease
9191
- managementcluster
92+
- provisioner
9293

9394
linters-settings:
9495
funlen:

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ifeq ($(TEST_FLAGS),)
2222
endif
2323

2424
ifeq ($(BUILD_TAGS),)
25-
BUILD_TAGS := 'akscluster cluster clustergroup credential ekscluster gitrepository iampolicy kustomization namespace custompolicy imagepolicy networkpolicy quotapolicy securitypolicy sourcesecret workspace tanzupackage tanzupackages packagerepository packageinstall clustersecret integration mutationpolicy helmfeature helmrelease backupschedule targetlocation dataprotection tanzukubernetescluster clusterclass managementcluster'
25+
BUILD_TAGS := 'akscluster cluster clustergroup credential ekscluster gitrepository iampolicy kustomization namespace custompolicy imagepolicy networkpolicy quotapolicy securitypolicy sourcesecret workspace tanzupackage tanzupackages packagerepository packageinstall clustersecret integration mutationpolicy helmfeature helmrelease backupschedule targetlocation dataprotection tanzukubernetescluster clusterclass managementcluster provisioner'
2626
endif
2727

2828
.PHONY: build clean-up test gofmt vet lint acc-test website-lint website-lint-fix

Diff for: docs/data-sources/provisioner.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
Title: "Provisioner data source in a management cluster"
3+
Description: |-
4+
Provisioner data source in a management cluster.
5+
---
6+
7+
# Management Cluster Provisioner
8+
9+
Read provisioner in a management cluster using this Terraform module.
10+
11+
### Tanzu Kubernetes Grid Service and Tanzu Kubernetes Grid vSphere
12+
- Only provisioner read feature is enabled for Tanzu Kubernetes Grid Service and Tanzu Kubernetes Grid vSphere management clusters.
13+
- For a Tanzu Kubernetes cluster running in vSphere, you add a provisioner by creating
14+
a namespace in the management cluster, which you can do using kubectl.
15+
For more information, see [Create Namespaces in the Management Cluster] in the VMware Tanzu Kubernetes Grid Product Documentation.
16+
- For a Tanzu Kubernetes cluster running in vSphere with Tanzu, you add a provisioner by creating
17+
a vSphere namespace in the Supervisor Cluster, which you can do in your vSphere environment.
18+
For more information, see [Configuring and Managing vSphere Namespaces] in the vSphere with
19+
Tanzu Configuration and Management documentation.
20+
21+
[Create Namespaces in the Management Cluster] : https://docs.vmware.com/en/VMware-Tanzu-Kubernetes-Grid/1.5/vmware-tanzu-kubernetes-grid-15/GUID-cluster-lifecycle-multiple-management-clusters.html#namespaces
22+
[Configuring and Managing vSphere 7.x Namespaces] : https://docs.vmware.com/en/VMware-vSphere/7.0/vmware-vsphere-with-tanzu/GUID-1544C9FE-0B23-434E-B823-C59EFC2F7309.html
23+
[Configuring and Managing vSphere 8.x Namespaces] : https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-with-tanzu-services-workloads/GUID-1544C9FE-0B23-434E-B823-C59EFC2F7309.html
24+
25+
### Example Usage
26+
27+
```terraform
28+
# Read Tanzu Mission Control provisioner : fetch the given provisioner details
29+
data "tanzu-mission-control_provisioner" "read_provisioner" {
30+
name = "test-provisioner" # Optional
31+
management_cluster = "eks" # Required
32+
}
33+
34+
# Read Tanzu Mission Control provisioner : fetch all the provisioner details for the given management cluster
35+
data "tanzu-mission-control_provisioner" "read_provisioner" {
36+
management_cluster = "eks" # Required
37+
}
38+
```
39+
40+
<!-- schema generated by tfplugindocs -->
41+
## Schema
42+
43+
### Required
44+
45+
- `management_cluster` (String) Name of the management cluster
46+
47+
### Optional
48+
49+
- `meta` (Block List, Max: 1) Metadata for the resource (see [below for nested schema](#nestedblock--meta))
50+
- `name` (String) Name of the provisioner
51+
- `org_id` (String) ID of the organization
52+
53+
### Read-Only
54+
55+
- `id` (String) The ID of this resource.
56+
57+
<a id="nestedblock--meta"></a>
58+
### Nested Schema for `meta`
59+
60+
Optional:
61+
62+
- `annotations` (Map of String) Annotations for the resource
63+
- `description` (String) Description of the resource
64+
- `labels` (Map of String) Labels for the resource
65+
66+
Read-Only:
67+
68+
- `resource_version` (String) Resource version of the resource
69+
- `uid` (String) UID of the resource

Diff for: docs/resources/provisioner.md

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
Title: "Provisioner resource in a management cluster"
3+
Description: |-
4+
Provisioner resource lifecycle management.
5+
---
6+
7+
# Management Cluster Provisioner
8+
9+
Lifecycle management of provisioner in a management cluster using this Terraform module.
10+
11+
Addition of a provisioner resource refers to creation of namespace in the management cluster.
12+
13+
### Tanzu Kubernetes Grid Service and Tanzu Kubernetes Grid vSphere
14+
- Only provisioner read only feature is enabled for Tanzu Kubernetes Grid Service and Tanzu Kubernetes Grid vSphere management clusters.
15+
- For a Tanzu Kubernetes cluster running in vSphere, you add a provisioner by creating
16+
a namespace in the management cluster, which you can do using kubectl.
17+
For more information, see [Create Namespaces in the Management Cluster] in the VMware Tanzu Kubernetes Grid Product Documentation.
18+
- For a Tanzu Kubernetes cluster running in vSphere with Tanzu, you add a provisioner by creating
19+
a vSphere namespace in the Supervisor Cluster, which you can do in your vSphere environment.
20+
For more information, see [Configuring and Managing vSphere Namespaces] in the vSphere with
21+
Tanzu Configuration and Management documentation.
22+
23+
[Create Namespaces in the Management Cluster] : https://docs.vmware.com/en/VMware-Tanzu-Kubernetes-Grid/1.5/vmware-tanzu-kubernetes-grid-15/GUID-cluster-lifecycle-multiple-management-clusters.html#namespaces
24+
[Configuring and Managing vSphere 7.x Namespaces] : https://docs.vmware.com/en/VMware-vSphere/7.0/vmware-vsphere-with-tanzu/GUID-1544C9FE-0B23-434E-B823-C59EFC2F7309.html
25+
[Configuring and Managing vSphere 8.x Namespaces] : https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-with-tanzu-services-workloads/GUID-1544C9FE-0B23-434E-B823-C59EFC2F7309.html
26+
27+
### Example Usage
28+
29+
```terraform
30+
# Create provisioner resource
31+
resource "tanzu-mission-control_provisioner" "create_provisioner" {
32+
name = "demo-test" # Required
33+
management_cluster = "eks" # Required
34+
35+
meta {
36+
description = "Create provisioner through terraform"
37+
labels = {
38+
"key1" : "value1",
39+
"key2" : "value2",
40+
}
41+
}
42+
}
43+
```
44+
45+
<!-- schema generated by tfplugindocs -->
46+
## Schema
47+
48+
### Required
49+
50+
- `management_cluster` (String) Name of the management cluster. Edit operation such as create, update and delete is not supported for TKG vSphere & TKG service vSphere management cluster provisioners.
51+
- `name` (String) Name of the provisioner
52+
53+
### Optional
54+
55+
- `meta` (Block List, Max: 1) Metadata for the resource (see [below for nested schema](#nestedblock--meta))
56+
- `org_id` (String) ID of the organization
57+
58+
### Read-Only
59+
60+
- `id` (String) The ID of this resource.
61+
62+
<a id="nestedblock--meta"></a>
63+
### Nested Schema for `meta`
64+
65+
Optional:
66+
67+
- `annotations` (Map of String) Annotations for the resource
68+
- `description` (String) Description of the resource
69+
- `labels` (Map of String) Labels for the resource
70+
71+
Read-Only:
72+
73+
- `resource_version` (String) Resource version of the resource
74+
- `uid` (String) UID of the resource
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Read Tanzu Mission Control provisioner : fetch the given provisioner details
2+
data "tanzu-mission-control_provisioner" "read_provisioner" {
3+
name = "test-provisioner" # Optional
4+
management_cluster = "eks" # Required
5+
}
6+
7+
# Read Tanzu Mission Control provisioner : fetch all the provisioner details for the given management cluster
8+
data "tanzu-mission-control_provisioner" "read_provisioner" {
9+
management_cluster = "eks" # Required
10+
}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Create provisioner resource
2+
resource "tanzu-mission-control_provisioner" "create_provisioner" {
3+
name = "demo-test" # Required
4+
management_cluster = "eks" # Required
5+
6+
meta {
7+
description = "Create provisioner through terraform"
8+
labels = {
9+
"key1" : "value1",
10+
"key2" : "value2",
11+
}
12+
}
13+
}

Diff for: internal/client/http_client.go

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import (
5151
helmchartsorgclient "github.com/vmware/terraform-provider-tanzu-mission-control/internal/client/organization/helmcharts"
5252
iamorganizationclient "github.com/vmware/terraform-provider-tanzu-mission-control/internal/client/organization/iam_policy"
5353
policyorganizationclient "github.com/vmware/terraform-provider-tanzu-mission-control/internal/client/organization/policy"
54+
provisionerclient "github.com/vmware/terraform-provider-tanzu-mission-control/internal/client/provisioner"
5455
"github.com/vmware/terraform-provider-tanzu-mission-control/internal/client/proxy"
5556
tanzukubernetesclusterclient "github.com/vmware/terraform-provider-tanzu-mission-control/internal/client/tanzukubernetescluster"
5657
tanzupackageclusterclient "github.com/vmware/terraform-provider-tanzu-mission-control/internal/client/tanzupackage"
@@ -142,6 +143,7 @@ func newHTTPClient(httpClient *transport.Client) *TanzuMissionControl {
142143
ManagementClusterRegistrationResourceService: managementclusterregistrationclient.New(httpClient),
143144
ClusterClassResourceService: clusterclassclient.New(httpClient),
144145
TanzuKubernetesClusterResourceService: tanzukubernetesclusterclient.New(httpClient),
146+
ProvisionerResourceService: provisionerclient.New(httpClient),
145147
}
146148
}
147149

@@ -199,4 +201,5 @@ type TanzuMissionControl struct {
199201
ManagementClusterRegistrationResourceService managementclusterregistrationclient.ClientService
200202
ClusterClassResourceService clusterclassclient.ClientService
201203
TanzuKubernetesClusterResourceService tanzukubernetesclusterclient.ClientService
204+
ProvisionerResourceService provisionerclient.ClientService
202205
}

Diff for: internal/client/provisioner/provisioner_resource.go

+104
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: internal/models/provisioner/provisioner_create.go

+42
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)