Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] add support support for VMC on AWS #491

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions config/crds/vsphere_v1alpha1_vsphereclusterproviderspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,33 @@ spec:
value is optional unless using clusterctl to bootstrap the initial management
cluster.
type: string
vmwareCloud:
description: VmwareCloud describes the supported cloud providers to run
VMC
properties:
awsProviderSpec:
description: AwsProvider specifies the information needed to run VMC
on AWS
properties:
region:
description: Region is the region used for the loadbalancers
type: string
subnets:
description: Subnets is the list of subnets where
items:
type: string
type: array
vpcID:
description: VpcID is the id of the VPC used to create loadBalancers
type: string
required:
- vpcID
- subnets
- region
type: object
required:
- awsProviderSpec
type: object
version: v1alpha1
status:
acceptedNames:
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.12
replace k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20181127025237-2b1284ed4c93

require (
github.com/aws/aws-sdk-go v1.21.6
github.com/go-logr/logr v0.1.0
github.com/gogo/protobuf v1.2.1 // indirect
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYU
github.com/appscode/jsonpatch v0.0.0-20190108182946-7c0e3b262f30 h1:Kn3rqvbUFqSepE2OqVu0Pn1CbDw9IuMlONapol0zuwk=
github.com/appscode/jsonpatch v0.0.0-20190108182946-7c0e3b262f30/go.mod h1:4AJxUpXUhv4N+ziTvIcWWXgeorXpxPZOfk9HdEVr96M=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/aws/aws-sdk-go v1.21.6 h1:3GuIm55Uls52aQIDGBnSEZbk073jpasfQyeM5eZU61Q=
github.com/aws/aws-sdk-go v1.21.6/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
Expand Down Expand Up @@ -300,6 +302,8 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
github.com/jackc/fake v0.0.0-20150926172116-812a484cc733/go.mod h1:WrMFNQdiFJ80sQsxDoMokWK1W5TQtxBFNpzWTD84ibQ=
github.com/jackc/pgx v3.2.0+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I=
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmoiron/sqlx v0.0.0-20180614180643-0dae4fefe7c0/go.mod h1:IiEW3SEiiErVyFdH8NTuWjSifiEQKUoyK3LNqr2kCHU=
github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
Expand Down
1 change: 1 addition & 0 deletions hack/update-generated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ gen-rbac() {

deepcopy-v1alpha1() {
gen-deepcopy ./pkg/apis/vsphere/v1alpha1/cloud
gen-deepcopy ./pkg/apis/vsphere/v1alpha1/cloud/vmc/aws
gen-deepcopy ./pkg/apis/vsphere/v1alpha1
}

Expand Down
19 changes: 19 additions & 0 deletions pkg/apis/vsphere/v1alpha1/cloud/vmc/aws/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
Copyright 2019 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Package aws contains API for VMC on AWS.
// +k8s:deepcopy-gen=package
package aws
36 changes: 36 additions & 0 deletions pkg/apis/vsphere/v1alpha1/cloud/vmc/aws/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Copyright 2019 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Package aws contains API for VMC on AWS.
package aws

// VmwareCloudSpec describes the supported cloud providers
type VmwareCloudSpec struct {
// AwsProvider specifies the information needed to run VMC on AWS
AwsProvider *ProviderSpec `json:"awsProviderSpec"`
}

// ProviderSpec specifies the information needed to run VMC on AWS
type ProviderSpec struct {
// VpcID is the id of the VPC used to create loadBalancers
VpcID string `json:"vpcID"`

// Subnets is the list of subnets where
Subnets []string `json:"subnets"`

// Region is the region used for the loadbalancers
Region string `json:"region"`
}
62 changes: 62 additions & 0 deletions pkg/apis/vsphere/v1alpha1/cloud/vmc/aws/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/apis/vsphere/v1alpha1/vsphereclusterproviderspec_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
kubeadmv1beta1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"

"sigs.k8s.io/cluster-api-provider-vsphere/pkg/apis/vsphere/v1alpha1/cloud"
"sigs.k8s.io/cluster-api-provider-vsphere/pkg/apis/vsphere/v1alpha1/cloud/vmc/aws"
)

// +genclient
Expand Down Expand Up @@ -83,6 +84,9 @@ type VsphereClusterProviderSpec struct {
// CloudProviderConfiguration holds the cluster-wide configuration for the
// vSphere cloud provider.
CloudProviderConfiguration cloud.Config `json:"cloudProviderConfiguration,omitempty"`

// VmwareCloud describes the supported cloud providers to run VMC
VmwareCloud *aws.VmwareCloudSpec `json:"vmwareCloud,omitempty"`
}

// KeyPair is how operators can supply custom keypairs for kubeadm to use.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"golang.org/x/net/context"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/cluster-api-provider-vsphere/pkg/apis/vsphere/v1alpha1/cloud/vmc/aws"
)

func TestStorageVsphereClusterProviderSpec(t *testing.T) {
Expand All @@ -43,6 +44,13 @@ func TestStorageVsphereClusterProviderSpec(t *testing.T) {
EtcdCAKeyPair: keyPair,
FrontProxyCAKeyPair: keyPair,
SAKeyPair: keyPair,
VmwareCloud: &aws.VmwareCloudSpec{
AwsProvider: &aws.ProviderSpec{
Region: "region-1",
VpcID: "vpc-az-1",
Subnets: []string{"subnet"},
},
},
}
g := gomega.NewGomegaWithT(t)

Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/vsphere/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading