Skip to content

Commit 64c4c4d

Browse files
authored
Merge pull request #471 from akutz/feature/cloud-provider-config
Centralized cloud provider configuration
2 parents b9232ad + 62fa84c commit 64c4c4d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3704
-1298
lines changed

cmd/clusterctl/examples/vsphere/cluster.yaml.template

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,18 @@ spec:
1818
password: "${VSPHERE_PASSWORD}"
1919
sshAuthorizedKeys:
2020
- "${SSH_AUTHORIZED_KEY}"
21+
cloudProviderConfiguration:
22+
global:
23+
secretName: "cloud-provider-vsphere-credentials"
24+
secretNamespace: "kube-system"
25+
virtualCenter:
26+
"${VSPHERE_SERVER}":
27+
datacenters: "${VSPHERE_DATACENTER}"
28+
network:
29+
name: "${VSPHERE_NETWORK}"
30+
workspace:
31+
server: "${VSPHERE_SERVER}"
32+
datacenter: "${VSPHERE_DATACENTER}"
33+
datastore: "${VSPHERE_DATASTORE}"
34+
resourcePool: "${VSPHERE_RESOURCE_POOL}"
35+
folder: "${VSPHERE_FOLDER}"

cmd/clusterctl/examples/vsphere/machines.yaml.template

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ items:
1313
apiVersion: vsphere.cluster.k8s.io/v1alpha1
1414
kind: VsphereMachineProviderSpec
1515
datacenter: "${VSPHERE_DATACENTER}"
16-
datastore: "${VSPHERE_DATASTORE}"
17-
resourcePool: "${VSPHERE_RESOURCE_POOL}"
18-
folder: "${VSPHERE_FOLDER}"
1916
network:
2017
devices:
2118
- networkName: "${VSPHERE_NETWORK}"

cmd/clusterctl/examples/vsphere/machineset.yaml.template

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ spec:
2222
apiVersion: vsphere.cluster.k8s.io/v1alpha1
2323
kind: VsphereMachineProviderSpec
2424
datacenter: "${VSPHERE_DATACENTER}"
25-
datastore: "${VSPHERE_DATASTORE}"
26-
resourcePool: "${VSPHERE_RESOURCE_POOL}"
27-
folder: "${VSPHERE_FOLDER}"
2825
network:
2926
devices:
3027
- networkName: "${VSPHERE_NETWORK}"

config/crds/vsphere_v1alpha1_vsphereclusterproviderspec.yaml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,122 @@ spec:
3333
- cert
3434
- key
3535
type: object
36+
cloudProviderConfiguration:
37+
description: CloudProviderConfiguration holds the cluster-wide configuration
38+
for the vSphere cloud provider.
39+
properties:
40+
disk:
41+
description: Disk is the vSphere cloud provider's disk configuration.
42+
properties:
43+
scsiControllerType:
44+
description: SCSIControllerType defines SCSI controller to be used.
45+
type: string
46+
type: object
47+
global:
48+
description: Global is the vSphere cloud provider's global configuration.
49+
properties:
50+
apiBindPort:
51+
description: APIBindPort configures the vSphere cloud controller
52+
manager API port. Defaults to 43001.
53+
type: string
54+
apiDisable:
55+
description: APIDisable disables the vSphere cloud controller manager
56+
API. Defaults to true.
57+
type: boolean
58+
caFile:
59+
description: CAFile Specifies the path to a CA certificate in PEM
60+
format. If not configured, the system's CA certificates will be
61+
used.
62+
type: string
63+
datacenters:
64+
description: Datacenters is a CSV string of the datacenters in which
65+
VMs are located.
66+
type: string
67+
insecure:
68+
description: Insecure is a flag that disables TLS peer verification.
69+
type: boolean
70+
password:
71+
description: Password is the password used to access a vSphere endpoint.
72+
type: string
73+
port:
74+
description: Port is the port on which the vSphere endpoint is listening.
75+
Defaults to 443.
76+
type: string
77+
roundTripperCount:
78+
description: RoundTripperCount specifies the SOAP round tripper
79+
count (retries = RoundTripper - 1)
80+
format: int32
81+
type: integer
82+
secretName:
83+
description: SecretName is the name of the Kubernetes secret in
84+
which the vSphere credentials are located.
85+
type: string
86+
secretNamespace:
87+
description: SecretNamespace is the namespace for SecretName.
88+
type: string
89+
secretsDirectory:
90+
description: 'SecretsDirectory is a directory in which secrets may
91+
be found. This may used in the event that: 1. It is not desirable
92+
to use the K8s API to watch changes to secrets 2. The cloud controller
93+
manager is not running in a K8s environment, such as DC/OS.
94+
For example, the container storage interface (CSI) is container
95+
orcehstrator (CO) agnostic, and should support non-K8s COs. Defaults
96+
to /etc/cloud/credentials.'
97+
type: string
98+
serviceAccount:
99+
description: ServiceAccount is the Kubernetes service account used
100+
to launch the cloud controller manager. Defaults to cloud-controller-manager.
101+
type: string
102+
thumbprint:
103+
description: Thumbprint is the cryptographic thumbprint of the vSphere
104+
endpoint's certificate.
105+
type: string
106+
username:
107+
description: Username is the username used to access a vSphere endpoint.
108+
type: string
109+
type: object
110+
labels:
111+
description: Labels is the vSphere cloud provider's zone and region
112+
configuration.
113+
properties:
114+
region:
115+
description: Region is the region in which VMs are created/located.
116+
type: string
117+
zone:
118+
description: Zone is the zone in which VMs are created/located.
119+
type: string
120+
type: object
121+
network:
122+
description: Network is the vSphere cloud provider's network configuration.
123+
properties:
124+
name:
125+
description: Name is the name of the network to which VMs are connected.
126+
type: string
127+
type: object
128+
virtualCenter:
129+
description: VCenter is a list of vCenter configurations.
130+
type: object
131+
workspace:
132+
description: Workspace is the vSphere cloud provider's workspace configuration.
133+
properties:
134+
datacenter:
135+
description: Datacenter is the datacenter in which VMs are created/located.
136+
type: string
137+
datastore:
138+
description: Datastore is the datastore in which VMs are created/located.
139+
type: string
140+
folder:
141+
description: Folder is the folder in which VMs are created/located.
142+
type: string
143+
resourcePool:
144+
description: ResourcePool is the resource pool in which VMs are
145+
created/located.
146+
type: string
147+
server:
148+
description: Server is the IP address or FQDN of the vSphere endpoint.
149+
type: string
150+
type: object
151+
type: object
36152
clusterConfiguration:
37153
description: ClusterConfiguration holds the cluster-wide information used
38154
during a kubeadm init call.

config/crds/vsphere_v1alpha1_vspheremachineproviderspec.yaml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,12 @@ spec:
2323
description: Datacenter is the name or inventory path of the datacenter
2424
where this machine's VM is created/located.
2525
type: string
26-
datastore:
27-
description: Datastore is the name or inventory path of the datastore where
28-
this machine's VM is created/located. When omitted, GoVmomi's DatastoreOrDefault
29-
method is used to determine the default datastore. It is recommended to
30-
explicitly set this value.
31-
type: string
3226
diskGiB:
3327
description: DiskGiB is the size of a virtual machine's disk, in GiB. Defaults
3428
to the analogue property value in the template from which this machine
3529
is cloned.
3630
format: int32
3731
type: integer
38-
folder:
39-
description: Folder is the name or inventory path of the folder where this
40-
machine's VM is created/located. When omitted, GoVmomi's FolderOrDefault
41-
method is used to determine the default folder. It is recommended to explicitly
42-
set this value.
43-
type: string
4432
kind:
4533
description: 'Kind is a string value representing the REST resource this
4634
object represents. Servers may infer this from the endpoint the client
@@ -342,7 +330,7 @@ spec:
342330
properties:
343331
devices:
344332
description: Devices is the list of network devices used by the virtual
345-
machine.
333+
machine. TODO(akutz) Make sure at least one network matches the ClusterSpec.CloudProviderConfiguration.Network.Name
346334
items:
347335
properties:
348336
dhcp4:
@@ -469,12 +457,6 @@ spec:
469457
template from which this machine is cloned.
470458
format: int32
471459
type: integer
472-
resourcePool:
473-
description: ResourcePool is the name or inventory path of the resource
474-
pool where this machine's VM is created/located. When omitted, GoVmomi's
475-
ResourcePoolOrDefault method is used to determine the default resource
476-
pool. It is recommended to explicitly set this value.
477-
type: string
478460
template:
479461
description: Template is the name, inventory path, or instance UUID of the
480462
template used to clone new machines.

docs/getting_started.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
This is a guide on how to get started with CAPV (Cluster API Provider vSphere). To learn more about cluster API in more depth, check out the the [cluster api docs page](https://cluster-api.sigs.k8s.io/).
44

5-
* [Getting Started](#Getting-Started)
6-
* [Bootstrapping a Management Cluster with clusterctl](#Bootstrapping-a-Management-Cluster-with-clusterctl)
7-
* [Install Requirements](#Install-Requirements)
5+
* [Getting Started](#getting-started)
6+
* [Bootstrapping a Management Cluster with clusterctl](#bootstrapping-a-management-cluster-with-clusterctl)
7+
* [Install Requirements](#install-requirements)
88
* [clusterctl](#clusterctl)
9-
* [Docker](#Docker)
10-
* [Kind](#Kind)
9+
* [Docker](#docker)
10+
* [Kind](#kind)
1111
* [kubectl](#kubectl)
12-
* [vSphere Requirements](#vSphere-Requirements)
13-
* [vCenter Credentials](#vCenter-Credentials)
14-
* [Uploading the CAPV Machine Image](#Uploading-the-CAPV-Machine-Image)
15-
* [Generating YAML for the Bootstrap Cluster](#Generating-YAML-for-the-Bootstrap-Cluster)
16-
* [Using clusterctl](#Using-clusterctl)
17-
* [Managing Workload Clusters using the Management Cluster](#Managing-Workload-Clusters-using-the-Management-Cluster)
12+
* [vSphere Requirements](#vsphere-requirements)
13+
* [vCenter Credentials](#vcenter-credentials)
14+
* [Uploading the CAPV Machine Image](#uploading-the-capv-machine-image)
15+
* [Generating YAML for the Bootstrap Cluster](#generating-yaml-for-the-bootstrap-cluster)
16+
* [Using clusterctl](#using-clusterctl)
17+
* [Managing Workload Clusters using the Management Cluster](#managing-workload-clusters-using-the-management-cluster)
1818

1919
## Bootstrapping a Management Cluster with clusterctl
2020

@@ -171,6 +171,20 @@ spec:
171171
server: "<REDACTED>"
172172
username: "<REDACTED>"
173173
password: "<REDACTED>"
174+
cloudProviderConfiguration:
175+
global:
176+
secretName: "cloud-provider-vsphere-credentials"
177+
secretNamespace: "kube-system"
178+
virtualCenter:
179+
"<REDACTED>":
180+
network:
181+
name: "vm-network-1"
182+
workspace:
183+
server: "<REDACTED>"
184+
datacenter: "SDDC-Datacenter"
185+
datastore: "DefaultDatastore"
186+
resourcePool: "Resources"
187+
folder: "vm"
174188
---
175189
apiVersion: cluster.k8s.io/v1alpha1
176190
kind: Machine
@@ -184,9 +198,6 @@ spec:
184198
apiVersion: vsphere.cluster.k8s.io/v1alpha1
185199
kind: VsphereMachineProviderSpec
186200
datacenter: "SDDC-Datacenter"
187-
datastore: "DefaultDatastore"
188-
resourcePool: "Resources"
189-
folder: "vm"
190201
network:
191202
devices:
192203
- networkName: "vm-network-1"
@@ -225,9 +236,6 @@ spec:
225236
apiVersion: vsphere.cluster.k8s.io/v1alpha1
226237
kind: VsphereMachineProviderSpec
227238
datacenter: "SDDC-Datacenter"
228-
datastore: "DefaultDatastore"
229-
resourcePool: "Resources"
230-
folder: "vm"
231239
network:
232240
devices:
233241
- networkName: "vm-network-1"

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ require (
2525
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980
2626
golang.org/x/oauth2 v0.0.0-20190523182746-aaccbc9213b0 // indirect
2727
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
28-
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138
28+
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384
29+
gopkg.in/gcfg.v1 v1.2.3
30+
gopkg.in/warnings.v0 v0.1.2 // indirect
2931
gopkg.in/yaml.v2 v2.2.2
3032
k8s.io/api v0.0.0-20190222213804-5cb15d344471
3133
k8s.io/apimachinery v0.0.0-20190703205208-4cfb76a8bf76

go.sum

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTV
274274
github.com/gophercloud/gophercloud v0.0.0-20190221164956-3f3cc5a566b2/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8=
275275
github.com/gophercloud/gophercloud v0.1.0 h1:P/nh25+rzXouhytV2pUHBb65fnds26Ghl8/391+sT5o=
276276
github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8=
277+
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
277278
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
278279
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
279280
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
@@ -612,8 +613,8 @@ golang.org/x/tools v0.0.0-20190102213336-ca9055ed7d04/go.mod h1:n7NCudcB/nEzxVGm
612613
golang.org/x/tools v0.0.0-20190104182027-498d95493402/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
613614
golang.org/x/tools v0.0.0-20190111214448-fc1d57b08d7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
614615
golang.org/x/tools v0.0.0-20190124215303-cc6a436ffe6b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
615-
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138 h1:H3uGjxCR/6Ds0Mjgyp7LMK81+LvmbvWWEnJhzk1Pi9E=
616-
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
616+
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384 h1:TFlARGu6Czu1z7q93HTxcP1P+/ZFC/IKythI5RzrnRg=
617+
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
617618
google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
618619
google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
619620
google.golang.org/api v0.1.0 h1:K6z2u68e86TPdSdefXdzvXgR1zEMa+459vBSfWYAZkI=
@@ -646,13 +647,17 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8
646647
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
647648
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
648649
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
650+
gopkg.in/gcfg.v1 v1.2.3 h1:m8OOJ4ccYHnx2f4gQwpno8nAX5OGOh7RLaaz0pj3Ogs=
651+
gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
649652
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo=
650653
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=
651654
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
652655
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
653656
gopkg.in/mail.v2 v2.0.0-20180731213649-a0242b2233b4/go.mod h1:htwXN1Qh09vZJ1NVKxQqHPBaCBbzKhp5GzuJEA4VJWw=
654657
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
655658
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
659+
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
660+
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
656661
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
657662
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
658663
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

hack/generate-yaml.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,4 @@ EOF
209209

210210
# If running in Docker then ensure the contents of the OUT_DIR have the
211211
# the same owner as the volume mounted to the /out directory.
212-
[ "${DOCKER_ENABLED}" ] && chown -R "$(stat -c '%u:%g' /out)" "${OUT_DIR}"
212+
[ "${DOCKER_ENABLED-}" ] && chown -R "$(stat -c '%u:%g' /out)" "${OUT_DIR}"

hack/update-generated.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ gen-rbac() {
5555
}
5656

5757
deepcopy-v1alpha1() {
58+
gen-deepcopy ./pkg/apis/vsphere/v1alpha1/cloud
5859
gen-deepcopy ./pkg/apis/vsphere/v1alpha1
5960
}
6061

0 commit comments

Comments
 (0)