Skip to content

Commit

Permalink
pkg: remove IAMRoleName field from machinepool
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajat Chopra committed Nov 20, 2018
1 parent 3ff579e commit 95a9bad
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 24 deletions.
1 change: 0 additions & 1 deletion data/data/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ module "bootstrap" {
ami = "${var.tectonic_aws_ec2_ami_override}"
associate_public_ip_address = "${var.tectonic_aws_endpoints != "private"}"
cluster_name = "${var.tectonic_cluster_name}"
iam_role = "${var.tectonic_aws_master_iam_role_name}"
ignition = "${var.ignition_bootstrap}"
subnet_id = "${module.vpc.master_subnet_ids[0]}"
target_group_arns = "${module.vpc.aws_lb_target_group_arns}"
Expand Down
6 changes: 3 additions & 3 deletions data/data/aws/master/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ resource "aws_instance" "master" {
count = "${var.instance_count}"
ami = "${var.ec2_ami}"

instance_type = "${var.ec2_type}"
subnet_id = "${element(var.subnet_ids, count.index)}"
user_data = "${var.user_data_ign}"
instance_type = "${var.ec2_type}"
subnet_id = "${element(var.subnet_ids, count.index)}"
user_data = "${var.user_data_ign}"

vpc_security_group_ids = ["${var.master_sg_ids}"]
associate_public_ip_address = "${var.public_endpoints}"
Expand Down
2 changes: 1 addition & 1 deletion data/data/aws/variables-aws.tf
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ variable "tectonic_aws_region" {
description = "The target AWS region for the cluster."
}

variable ":ectonic_aws_installer_role" {
variable "tectonic_aws_installer_role" {
type = "string"
default = ""

Expand Down
10 changes: 4 additions & 6 deletions pkg/asset/machines/aws/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/utils/pointer"
awsprovider "sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1"
clusterapi "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1"

Expand Down Expand Up @@ -80,11 +79,10 @@ func provider(clusterID, clusterName string, platform *aws.Platform, mpool *aws.
APIVersion: "aws.cluster.k8s.io/v1alpha1",
Kind: "AWSMachineProviderConfig",
},
InstanceType: mpool.InstanceType,
AMI: awsprovider.AWSResourceReference{ID: &mpool.AMIID},
Tags: tags,
IAMInstanceProfile: &awsprovider.AWSResourceReference{ID: pointer.StringPtr(fmt.Sprintf("%s-%s-profile", clusterName, role))},
UserDataSecret: &corev1.LocalObjectReference{Name: userDataSecret},
InstanceType: mpool.InstanceType,
AMI: awsprovider.AWSResourceReference{ID: &mpool.AMIID},
Tags: tags,
UserDataSecret: &corev1.LocalObjectReference{Name: userDataSecret},
Subnet: awsprovider.AWSResourceReference{
Filters: []awsprovider.Filter{{
Name: "tag:Name",
Expand Down
2 changes: 0 additions & 2 deletions pkg/tfvars/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ type Master struct {
CustomSubnets map[string]string `json:"tectonic_aws_master_custom_subnets,omitempty"`
EC2Type string `json:"tectonic_aws_master_ec2_type,omitempty"`
ExtraSGIDs []string `json:"tectonic_aws_master_extra_sg_ids,omitempty"`
IAMRoleName string `json:"tectonic_aws_master_iam_role_name,omitempty"`
MasterRootVolume `json:",inline"`
}

Expand All @@ -58,7 +57,6 @@ type Worker struct {
CustomSubnets map[string]string `json:"tectonic_aws_worker_custom_subnets,omitempty"`
EC2Type string `json:"tectonic_aws_worker_ec2_type,omitempty"`
ExtraSGIDs []string `json:"tectonic_aws_worker_extra_sg_ids,omitempty"`
IAMRoleName string `json:"tectonic_aws_worker_iam_role_name,omitempty"`
LoadBalancers []string `json:"tectonic_aws_worker_load_balancers,omitempty"`
WorkerRootVolume `json:",inline"`
}
Expand Down
6 changes: 2 additions & 4 deletions pkg/tfvars/tfvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ func TFVars(cfg *types.InstallConfig, bootstrapIgn, masterIgn, workerIgn string)
config.Masters += replicas
if m.Platform.AWS != nil {
config.AWS.Master = aws.Master{
EC2Type: m.Platform.AWS.InstanceType,
IAMRoleName: m.Platform.AWS.IAMRoleName,
EC2Type: m.Platform.AWS.InstanceType,
MasterRootVolume: aws.MasterRootVolume{
IOPS: m.Platform.AWS.EC2RootVolume.IOPS,
Size: m.Platform.AWS.EC2RootVolume.Size,
Expand All @@ -69,8 +68,7 @@ func TFVars(cfg *types.InstallConfig, bootstrapIgn, masterIgn, workerIgn string)
config.Workers += replicas
if m.Platform.AWS != nil {
config.AWS.Worker = aws.Worker{
EC2Type: m.Platform.AWS.InstanceType,
IAMRoleName: m.Platform.AWS.IAMRoleName,
EC2Type: m.Platform.AWS.InstanceType,
WorkerRootVolume: aws.WorkerRootVolume{
IOPS: m.Platform.AWS.EC2RootVolume.IOPS,
Size: m.Platform.AWS.EC2RootVolume.Size,
Expand Down
7 changes: 0 additions & 7 deletions pkg/types/aws/machinepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ type MachinePool struct {
// eg. m4-large
InstanceType string `json:"type"`

// IAMRoleName defines the IAM role associated
// with the ec2 instance.
IAMRoleName string `json:"iamRoleName"`

// EC2RootVolume defines the storage for ec2 instance.
EC2RootVolume `json:"rootVolume"`
}
Expand All @@ -36,9 +32,6 @@ func (a *MachinePool) Set(required *MachinePool) {
if required.InstanceType != "" {
a.InstanceType = required.InstanceType
}
if required.IAMRoleName != "" {
a.IAMRoleName = required.IAMRoleName
}

if required.EC2RootVolume.IOPS != 0 {
a.EC2RootVolume.IOPS = required.EC2RootVolume.IOPS
Expand Down

0 comments on commit 95a9bad

Please sign in to comment.