From 95a9bad01bd2dbcdc7c02164ed99037f813f3d1b Mon Sep 17 00:00:00 2001 From: Rajat Chopra Date: Mon, 19 Nov 2018 14:11:48 -0500 Subject: [PATCH] pkg: remove IAMRoleName field from machinepool --- data/data/aws/main.tf | 1 - data/data/aws/master/main.tf | 6 +++--- data/data/aws/variables-aws.tf | 2 +- pkg/asset/machines/aws/machines.go | 10 ++++------ pkg/tfvars/aws/aws.go | 2 -- pkg/tfvars/tfvars.go | 6 ++---- pkg/types/aws/machinepool.go | 7 ------- 7 files changed, 10 insertions(+), 24 deletions(-) diff --git a/data/data/aws/main.tf b/data/data/aws/main.tf index 3f589ba2f2a..183e403479b 100644 --- a/data/data/aws/main.tf +++ b/data/data/aws/main.tf @@ -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}" diff --git a/data/data/aws/master/main.tf b/data/data/aws/master/main.tf index 92d74637f6f..f6f052f5593 100644 --- a/data/data/aws/master/main.tf +++ b/data/data/aws/master/main.tf @@ -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}" diff --git a/data/data/aws/variables-aws.tf b/data/data/aws/variables-aws.tf index edddaf767de..c744a292ea2 100644 --- a/data/data/aws/variables-aws.tf +++ b/data/data/aws/variables-aws.tf @@ -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 = "" diff --git a/pkg/asset/machines/aws/machines.go b/pkg/asset/machines/aws/machines.go index 1c7a9dc419a..dcf7f1cddf5 100644 --- a/pkg/asset/machines/aws/machines.go +++ b/pkg/asset/machines/aws/machines.go @@ -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" @@ -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", diff --git a/pkg/tfvars/aws/aws.go b/pkg/tfvars/aws/aws.go index 24de057bcdb..d282d988c36 100644 --- a/pkg/tfvars/aws/aws.go +++ b/pkg/tfvars/aws/aws.go @@ -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"` } @@ -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"` } diff --git a/pkg/tfvars/tfvars.go b/pkg/tfvars/tfvars.go index 1fa70bb2f2a..ce7afdf1943 100644 --- a/pkg/tfvars/tfvars.go +++ b/pkg/tfvars/tfvars.go @@ -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, @@ -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, diff --git a/pkg/types/aws/machinepool.go b/pkg/types/aws/machinepool.go index 1e5331b512c..187b9add6c1 100644 --- a/pkg/types/aws/machinepool.go +++ b/pkg/types/aws/machinepool.go @@ -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"` } @@ -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