Skip to content
This repository has been archived by the owner on Dec 9, 2020. It is now read-only.

Commit

Permalink
start of nested stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
detiber committed Nov 21, 2016
1 parent f5a7778 commit 818642f
Show file tree
Hide file tree
Showing 9 changed files with 1,353 additions and 59 deletions.
289 changes: 238 additions & 51 deletions inventory/aws/ec2.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
AWSTemplateFormatVersion: '2010-09-09'
Description: OpenShift Integrated Control Plane
Parameters:
MasterSGs:
Type: 'List<AWS::EC2::SecurityGroup::Id>'
MasterExtElbSGs:
Type: 'List<AWS::EC2::SecurityGroup::Id>'
MasterIntElbSGs:
Type: 'List<AWS::EC2::SecurityGroup::Id>'
MasterInstanceType:
Type: String
Default: t2.medium
MasterImageId:
Type: 'AWS::EC2::Image::Id'
Default: ami-10251c7a
MasterInstanceProfile:
Type: String
KeyName:
Type: 'AWS::EC2::KeyPair::KeyName'
Master01Subnet:
Type: 'AWS::EC2::Subnet::Id'
Master02Subnet:
Type: 'AWS::EC2::Subnet::Id'
Master03Subnet:
Type: 'AWS::EC2::Subnet::Id'
MasterApiPort:
Type: Number
Default: 443
MasterRootVolSize:
Type: String
Default: 10
MasterDockerVolSize:
Type: String
Default: 25
MasterEtcdVolSize:
Type: String
Default: 25
MasterUserData:
Type: String

Conditions:
SetMasterInstanceProfile:
'Fn::Not':
- 'Fn::Equals':
- ''
- Ref: MasterInstanceProfile

Resources:
Master01:
Type: 'AWS::EC2::Instance'
Properties:
ImageId:
Ref: MasterImageId
KeyName:
Ref: KeyName
InstanceType:
Ref: MasterInstanceType
SecurityGroupIds:
Ref: MasterSGs
SubnetId:
Ref: Master01Subnet
IamInstanceProfile:
Ref: MasterInstanceProfile
BlockDeviceMappings:
- DeviceName: /dev/sda1
Ebs:
DeleteOnTermination: True
VolumeSize:
Ref: MasterRootVolSize
VolumeType: gp2
- DeviceName: /dev/xvdb
Ebs:
DeleteOnTermination: True
VolumeSize:
Ref: MasterDockerVolSize
VolumeType: gp2
- DeviceName: /dev/xvdc
Ebs:
DeleteOnTermination: True
VolumeSize:
Ref: MasterEtcdVolSize
VolumeType: gp2
UserData:
Ref: MasterUserData
Master02:
Type: 'AWS::EC2::Instance'
Properties:
ImageId:
Ref: MasterImageId
KeyName:
Ref: KeyName
InstanceType:
Ref: MasterInstanceType
SecurityGroupIds:
Ref: MasterSGs
SubnetId:
Ref: Master02Subnet
IamInstanceProfile:
Ref: MasterInstanceProfile
BlockDeviceMappings:
- DeviceName: /dev/sda1
Ebs:
DeleteOnTermination: True
VolumeSize:
Ref: MasterRootVolSize
VolumeType: gp2
- DeviceName: /dev/xvdb
Ebs:
DeleteOnTermination: True
VolumeSize:
Ref: MasterDockerVolSize
VolumeType: gp2
- DeviceName: /dev/xvdc
Ebs:
DeleteOnTermination: True
VolumeSize:
Ref: MasterEtcdVolSize
VolumeType: gp2
UserData:
Ref: MasterUserData
Master03:
Type: 'AWS::EC2::Instance'
Properties:
ImageId:
Ref: MasterImageId
KeyName:
Ref: KeyName
InstanceType:
Ref: MasterInstanceType
SecurityGroupIds:
Ref: MasterSGs
SubnetId:
Ref: Master03Subnet
IamInstanceProfile:
Ref: MasterInstanceProfile
BlockDeviceMappings:
- DeviceName: /dev/sda1
Ebs:
DeleteOnTermination: True
VolumeSize:
Ref: MasterRootVolSize
VolumeType: gp2
- DeviceName: /dev/xvdb
Ebs:
DeleteOnTermination: True
VolumeSize:
Ref: MasterDockerVolSize
VolumeType: gp2
- DeviceName: /dev/xvdc
Ebs:
DeleteOnTermination: True
VolumeSize:
Ref: MasterEtcdVolSize
VolumeType: gp2
UserData:
Ref: MasterUserData
MasterIntElb:
Type: 'AWS::ElasticLoadBalancing::LoadBalancer'
Properties:
CrossZone: True
ConnectionSettings:
IdleTimeout: 3600
Listeners:
- InstancePort:
Ref: MasterApiPort
InstanceProtocol: TCP
LoadBalancerPort:
Ref: MasterApiPort
Protocol: TCP
Scheme: internal
SecurityGroups:
Ref: MasterIntElbSGs
Subnets:
- Ref: Master01Subnet
- Ref: Master02Subnet
- Ref: Master03Subnet
Instances:
- Ref: Master01
- Ref: Master02
- Ref: Master03
HealthCheck:
HealthyThreshold: 2
Interval: 5
Timeout: 2
UnhealthyThreshold: 2
Target:
'Fn::Join':
- ''
- - 'Fn::Join':
- ':'
- - 'HTTPS'
- Ref: MasterApiPort
- /healthz/ready
MasterExtElb:
Type: 'AWS::ElasticLoadBalancing::LoadBalancer'
Properties:
CrossZone: True
ConnectionSettings:
IdleTimeout: 3600
Listeners:
- InstancePort:
Ref: MasterApiPort
InstanceProtocol: TCP
LoadBalancerPort:
Ref: MasterApiPort
Protocol: TCP
SecurityGroups:
Ref: MasterExtElbSGs
Subnets:
- Ref: Master01Subnet
- Ref: Master02Subnet
- Ref: Master03Subnet
Instances:
- Ref: Master01
- Ref: Master02
- Ref: Master03
HealthCheck:
HealthyThreshold: 2
Interval: 5
Timeout: 2
UnhealthyThreshold: 2
Target:
'Fn::Join':
- ''
- - 'Fn::Join':
- ':'
- - 'HTTPS'
- Ref: MasterApiPort
- /healthz/ready
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
AWSTemplateFormatVersion: '2010-09-09'
Description: OpenShift IAM Profiles
Outputs:
MasterInstanceProfile:
Description: Master Instance Profile
Value:
Ref: MasterInstanceProfile
NodeInstanceProfile:
Description: Node Instance Profile
Value:
Ref: NodeInstanceProfile
Resources:
MasterPolicy:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service:
- ec2.amazonaws.com
Action:
- 'sts:AssumeRole'
Policies:
- PolicyName: openshift-master
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action: 'ec2:*'
Resource: '*'
- Effect: Allow
Action: 'elasticloadbalancing:*'
Resource: '*'
NodePolicy:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service:
- ec2.amazonaws.com
Action:
- 'sts:AssumeRole'
Policies:
- PolicyName: openshift-node
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action: 'ec2:Describe*'
Resource: '*'
MasterInstanceProfile:
Type: 'AWS::IAM::InstanceProfile'
Properties:
Roles:
- Ref: MasterPolicy
NodeInstanceProfile:
Type: 'AWS::IAM::InstanceProfile'
Properties:
Roles:
- Ref: NodePolicy
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#cloud-config
cloud_config_modules:
- disk_setup
- mounts

fs_setup:
- label: etcd_storage
filesystem: xfs
device: /dev/xdc
partition: auto

runcmd:
- mkdir -p /var/lib/etcd

mounts:
- [ /dev/xvdc, /var/lib/etcd, xfs, 'defaults' ]

write_files:
- content: |
DEVS='/dev/xvdb'
VG=docker_vol
DATA_SIZE=95%VG
EXTRA_DOCKER_STORAGE_OPTIONS="--storage-opt dm.basesize=3G"
path: /etc/sysconfig/docker-storage-setup
owner: root:root
Loading

0 comments on commit 818642f

Please sign in to comment.