Skip to content

Commit

Permalink
Update machine-controller API types
Browse files Browse the repository at this point in the history
  • Loading branch information
xmudrii committed Mar 20, 2020
1 parent d8bac13 commit 55b9130
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 27 deletions.
12 changes: 9 additions & 3 deletions examples/terraform/aws/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ output "kubeone_workers" {
diskSize = 50
diskType = "gp2"
## Only applicable if diskType = io1
diskIops = 500
diskIops = 500
isSpotInstance = false
ebsVolumeEncrypted = false
tags = {
"${var.cluster_name}-workers" = ""
}
Expand Down Expand Up @@ -102,7 +104,9 @@ output "kubeone_workers" {
diskSize = 50
diskType = "gp2"
## Only applicable if diskType = io1
diskIops = 500
diskIops = 500
isSpotInstance = false
ebsVolumeEncrypted = false
tags = {
"${var.cluster_name}-workers" = ""
}
Expand Down Expand Up @@ -133,7 +137,9 @@ output "kubeone_workers" {
diskSize = 50
diskType = "gp2"
## Only applicable if diskType = io1
diskIops = 500
diskIops = 500
isSpotInstance = false
ebsVolumeEncrypted = false
tags = {
"${var.cluster_name}-workers" = ""
}
Expand Down
2 changes: 2 additions & 0 deletions examples/terraform/vsphere/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ output "kubeone_workers" {
cluster = var.compute_cluster_name
cpus = 2
datacenter = var.dc_name
# Either Datastore or DatastoreCluster have to be provided.
datastore = var.datastore_name
datastoreCluster = var.datastore_cluster_name
# Optional: Resize the root disk to this size. Must be bigger than the existing size
# Default is to leave the disk at the same size as the template
diskSizeGB = 10
Expand Down
5 changes: 5 additions & 0 deletions examples/terraform/vsphere/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ variable "datastore_name" {
description = "datastore name"
}

variable "datastore_cluster_name" {
default = ""
description = "datastore cluster name"
}

variable "network_name" {
default = "public"
description = "network name"
Expand Down
50 changes: 26 additions & 24 deletions pkg/templates/machinecontroller/cloudprovider_specs.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@ package machinecontroller

// AWSSpec holds cloudprovider spec for AWS
type AWSSpec struct {
AMI string `json:"ami"`
AssignPublicIP *bool `json:"assignPublicIP"`
AvailabilityZone string `json:"availabilityZone"`
DiskIops *int `json:"diskIops,omitempty"`
DiskSize *int `json:"diskSize"`
DiskType string `json:"diskType"`
InstanceProfile string `json:"instanceProfile"`
InstanceType *string `json:"instanceType"`
Region string `json:"region"`
SecurityGroupIDs []string `json:"securityGroupIDs"`
SubnetID string `json:"subnetId"`
Tags map[string]string `json:"tags"`
VPCID string `json:"vpcId"`
IsSpotInstance *bool `json:"isSpotInstance,omitempty"`
AMI string `json:"ami"`
AssignPublicIP *bool `json:"assignPublicIP"`
AvailabilityZone string `json:"availabilityZone"`
DiskIops *int `json:"diskIops,omitempty"`
DiskSize *int `json:"diskSize"`
DiskType string `json:"diskType"`
InstanceProfile string `json:"instanceProfile"`
InstanceType *string `json:"instanceType"`
Region string `json:"region"`
SecurityGroupIDs []string `json:"securityGroupIDs"`
SubnetID string `json:"subnetId"`
Tags map[string]string `json:"tags"`
VPCID string `json:"vpcId"`
IsSpotInstance *bool `json:"isSpotInstance,omitempty"`
EBSVolumeEncrypted bool `json:"ebsVolumeEncrypted"`
}

// DigitalOceanSpec holds cloudprovider spec for DigitalOcean
Expand Down Expand Up @@ -96,16 +97,17 @@ type PacketSpec struct {

// VSphereSpec holds cloudprovider spec for vSphere
type VSphereSpec struct {
AllowInsecure bool `json:"allowInsecure"`
Cluster string `json:"cluster"`
CPUs int `json:"cpus"`
Datacenter string `json:"datacenter"`
Datastore string `json:"datastore"`
DiskSizeGB *int `json:"diskSizeGB,omitempty"`
Folder string `json:"folder"`
MemoryMB int `json:"memoryMB"`
TemplateVMName string `json:"templateVMName"`
VMNetName string `json:"vmNetName,omitempty"`
AllowInsecure bool `json:"allowInsecure"`
Cluster string `json:"cluster"`
CPUs int `json:"cpus"`
Datacenter string `json:"datacenter"`
Datastore string `json:"datastore"`
DatastoreCluster string `json:"datastoreCluster"`
DiskSizeGB *int `json:"diskSizeGB,omitempty"`
Folder string `json:"folder"`
MemoryMB int `json:"memoryMB"`
TemplateVMName string `json:"templateVMName"`
VMNetName string `json:"vmNetName,omitempty"`
}

// AzureSpec holds cloudprovider spec for Azure
Expand Down
5 changes: 5 additions & 0 deletions pkg/terraform/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ func (c *Config) updateAWSWorkerset(existingWorkerSet *kubeonev1alpha1.WorkerCon
{key: "subnetId", value: awsCloudConfig.SubnetID},
{key: "tags", value: awsCloudConfig.Tags},
{key: "vpcId", value: awsCloudConfig.VPCID},
{key: "isSpotInstance", value: awsCloudConfig.IsSpotInstance},
{key: "ebsVolumeEncrypted", value: awsCloudConfig.EBSVolumeEncrypted},
}

for _, flag := range flags {
Expand Down Expand Up @@ -374,6 +376,7 @@ func (c *Config) updateOpenStackWorkerset(existingWorkerSet *kubeonev1alpha1.Wor
{key: "subnet", value: openstackConfig.Subnet},
{key: "rootDiskSizeGB", value: openstackConfig.RootDiskSizeGB},
{key: "nodeVolumeAttachLimit", value: openstackConfig.NodeVolumeAttachLimit},
{key: "trustDevicePath", value: openstackConfig.TrustDevicePath},
{key: "tags", value: openstackConfig.Tags},
}

Expand All @@ -397,6 +400,7 @@ func (c *Config) updatePacketWorkerset(existingWorkerSet *kubeonev1alpha1.Worker
{key: "projectID", value: packetConfig.ProjectID},
{key: "facilities", value: packetConfig.Facilities},
{key: "instanceType", value: packetConfig.InstanceType},
{key: "tags", value: packetConfig.Tags},
}

for _, flag := range flags {
Expand All @@ -421,6 +425,7 @@ func (c *Config) updateVSphereWorkerset(existingWorkerSet *kubeonev1alpha1.Worke
{key: "cpus", value: vsphereConfig.CPUs},
{key: "datacenter", value: vsphereConfig.Datacenter},
{key: "datastore", value: vsphereConfig.Datastore},
{key: "datastoreCluster", value: vsphereConfig.DatastoreCluster},
{key: "diskSizeGB", value: vsphereConfig.DiskSizeGB},
{key: "folder", value: vsphereConfig.Folder},
{key: "memoryMB", value: vsphereConfig.MemoryMB},
Expand Down

0 comments on commit 55b9130

Please sign in to comment.