mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-10-30 21:30:16 +00:00 
			
		
		
		
	Update the AWS configs to handle VPC
This commit is contained in:
		| @@ -60,15 +60,34 @@ | |||||||
|       "Default": "0.0.0.0/0", |       "Default": "0.0.0.0/0", | ||||||
|       "Type": "String" |       "Type": "String" | ||||||
|     }, |     }, | ||||||
|     "KeyPair" : { |     "KeyPair": { | ||||||
|       "Description": "The name of an EC2 Key Pair to allow SSH access to the instance.", |       "Description": "The name of an EC2 Key Pair to allow SSH access to the instance.", | ||||||
|       "Type": "String" |       "Type": "String" | ||||||
|     } |     }, | ||||||
|  |     "VpcId": { | ||||||
|  |        "Description": "The ID of the VPC to launch into.", | ||||||
|  |        "Type": "String", | ||||||
|  |        "Default": "" | ||||||
|  |      }, | ||||||
|  |      "SubnetId": { | ||||||
|  |        "Description": "The ID of the VPC to launch into (that must be within the supplied VPC)", | ||||||
|  |        "Type": "String", | ||||||
|  |        "Default": "" | ||||||
|  |      }, | ||||||
|  |      "SubnetAZ": { | ||||||
|  |        "Description": "The availability zone of the subnet supplied (for example eu-west-1a)", | ||||||
|  |        "Type": "String", | ||||||
|  |        "Default": "" | ||||||
|  |      } | ||||||
|  |   }, | ||||||
|  |   "Conditions": { | ||||||
|  |      "UseEC2Classic": {"Fn::Equals": [{"Ref": "VpcId"}, ""]} | ||||||
|   }, |   }, | ||||||
|   "Resources": { |   "Resources": { | ||||||
|     "KubernetesSecurityGroup": { |     "KubernetesSecurityGroup": { | ||||||
|       "Type": "AWS::EC2::SecurityGroup", |       "Type": "AWS::EC2::SecurityGroup", | ||||||
|       "Properties": { |       "Properties": { | ||||||
|  |         "VpcId": {"Fn::If": ["UseEC2Classic", {"Ref": "AWS::NoValue"}, {"Ref": "VpcId"}]}, | ||||||
|         "GroupDescription": "Kubernetes SecurityGroup", |         "GroupDescription": "Kubernetes SecurityGroup", | ||||||
|         "SecurityGroupIngress": [ |         "SecurityGroupIngress": [ | ||||||
|           { |           { | ||||||
| @@ -83,7 +102,7 @@ | |||||||
|     "KubernetesIngress": { |     "KubernetesIngress": { | ||||||
|       "Type": "AWS::EC2::SecurityGroupIngress", |       "Type": "AWS::EC2::SecurityGroupIngress", | ||||||
|       "Properties": { |       "Properties": { | ||||||
|         "GroupName": {"Ref": "KubernetesSecurityGroup"}, |         "GroupId": {"Fn::GetAtt": ["KubernetesSecurityGroup", "GroupId"]}, | ||||||
|         "IpProtocol": "tcp", |         "IpProtocol": "tcp", | ||||||
|         "FromPort": "1", |         "FromPort": "1", | ||||||
|         "ToPort": "65535", |         "ToPort": "65535", | ||||||
| @@ -95,7 +114,7 @@ | |||||||
|     "KubernetesIngressUDP": { |     "KubernetesIngressUDP": { | ||||||
|       "Type": "AWS::EC2::SecurityGroupIngress", |       "Type": "AWS::EC2::SecurityGroupIngress", | ||||||
|       "Properties": { |       "Properties": { | ||||||
|         "GroupName": {"Ref": "KubernetesSecurityGroup"}, |         "GroupId": {"Fn::GetAtt": ["KubernetesSecurityGroup", "GroupId"]}, | ||||||
|         "IpProtocol": "udp", |         "IpProtocol": "udp", | ||||||
|         "FromPort": "1", |         "FromPort": "1", | ||||||
|         "ToPort": "65535", |         "ToPort": "65535", | ||||||
| @@ -107,6 +126,7 @@ | |||||||
|     "KubernetesMasterInstance": { |     "KubernetesMasterInstance": { | ||||||
|       "Type": "AWS::EC2::Instance", |       "Type": "AWS::EC2::Instance", | ||||||
|       "Properties": { |       "Properties": { | ||||||
|  |         "SubnetId": {"Fn::If": ["UseEC2Classic", {"Ref": "AWS::NoValue"}, {"Ref": "SubnetId"}]}, | ||||||
|         "ImageId": {"Fn::FindInMap" : ["RegionMap", {"Ref": "AWS::Region" }, "AMI"]}, |         "ImageId": {"Fn::FindInMap" : ["RegionMap", {"Ref": "AWS::Region" }, "AMI"]}, | ||||||
|         "InstanceType": {"Ref": "InstanceType"}, |         "InstanceType": {"Ref": "InstanceType"}, | ||||||
|         "KeyName": {"Ref": "KeyPair"}, |         "KeyName": {"Ref": "KeyPair"}, | ||||||
| @@ -292,6 +312,7 @@ | |||||||
|     "KubernetesNodeLaunchConfig": { |     "KubernetesNodeLaunchConfig": { | ||||||
|       "Type": "AWS::AutoScaling::LaunchConfiguration", |       "Type": "AWS::AutoScaling::LaunchConfiguration", | ||||||
|       "Properties": { |       "Properties": { | ||||||
|  |         "SubnetId": {"Fn::If": ["UseEC2Classic", {"Ref": "AWS::NoValue"}, {"Ref": "SubnetId"}]}, | ||||||
|         "ImageId": {"Fn::FindInMap" : ["RegionMap", {"Ref": "AWS::Region" }, "AMI" ]}, |         "ImageId": {"Fn::FindInMap" : ["RegionMap", {"Ref": "AWS::Region" }, "AMI" ]}, | ||||||
|         "InstanceType": {"Ref": "InstanceType"}, |         "InstanceType": {"Ref": "InstanceType"}, | ||||||
|         "KeyName": {"Ref": "KeyPair"}, |         "KeyName": {"Ref": "KeyPair"}, | ||||||
| @@ -395,7 +416,8 @@ | |||||||
|     "KubernetesAutoScalingGroup": { |     "KubernetesAutoScalingGroup": { | ||||||
|       "Type": "AWS::AutoScaling::AutoScalingGroup", |       "Type": "AWS::AutoScaling::AutoScalingGroup", | ||||||
|       "Properties": { |       "Properties": { | ||||||
|         "AvailabilityZones": {"Fn::GetAZs": ""}, |         "AvailabilityZones": {"Fn::If": ["UseEC2Classic", {"Fn::GetAZs": ""}, [{"Ref": "SubnetAZ"}]]}, | ||||||
|  |         "VPCZoneIdentifier": {"Fn::If": ["UseEC2Classic", {"Ref": "AWS::NoValue"}, [{"Ref": "SubnetId"}]]}, | ||||||
|         "LaunchConfigurationName": {"Ref": "KubernetesNodeLaunchConfig"}, |         "LaunchConfigurationName": {"Ref": "KubernetesNodeLaunchConfig"}, | ||||||
|         "MinSize": "3", |         "MinSize": "3", | ||||||
|         "MaxSize": "12", |         "MaxSize": "12", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user