Skip to content

Commit 687118b

Browse files
authoredAug 9, 2018
Merge pull request #482 from awslabs/develop
Release 1.5.3
2 parents ff1a6e0 + f6253b4 commit 687118b

File tree

10 files changed

+60
-15
lines changed

10 files changed

+60
-15
lines changed
 

‎CHANGELOG.rst

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
CHANGELOG
33
=========
44

5+
1.5.3
6+
=====
7+
* Add support for GovCloud, us-gov-west-1 region
8+
59
1.5.2
610
=====
711
* feature:``cfncluster``: Added ClusterUser as a stack output. This makes it easier to get the username of the head node.

‎amis.txt

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ eu-west-3: ami-0b1472bf5fed029bd
1313
sa-east-1: ami-0a390e1998fb6b22f
1414
us-east-1: ami-0fd6854902340b407
1515
us-east-2: ami-04fc90a3f60cb3dc7
16+
us-gov-west-1: ami-af2cbece
1617
us-west-1: ami-0054acc8361046ccc
1718
us-west-2: ami-01382f63e2667a7d1
1819
# centos6
@@ -64,6 +65,7 @@ eu-west-3: ami-0e8f93d19635c5d49
6465
sa-east-1: ami-048422e42509a1596
6566
us-east-1: ami-0ba2fcbf9fa378762
6667
us-east-2: ami-05aea9ea89d577194
68+
us-gov-west-1: ami-4aca572b
6769
us-west-1: ami-0089ace30f2612d13
6870
us-west-2: ami-06142a55749b7912b
6971
# ubuntu1604
@@ -81,5 +83,6 @@ eu-west-3: ami-09c4322a65746f77b
8183
sa-east-1: ami-0740b75b4caaa3b77
8284
us-east-1: ami-05790a6a634720a0d
8385
us-east-2: ami-0a0fcd1219e40a8f5
86+
us-gov-west-1: ami-3dc8555c
8487
us-west-1: ami-056472d51cf2fed45
8588
us-west-2: ami-0702d59e57ada76b8

‎cli/cfncluster/cfnconfig.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def __init__(self, args):
177177
'URL', self.template_url)
178178
except configparser.NoOptionError:
179179
if self.region == 'us-gov-west-1':
180-
self.template_url = ('https://s3-%s.amazonaws.com/cfncluster-%s/templates/cfncluster-%s.cfn.json'
180+
self.template_url = ('https://s3-%s.amazonaws.com/%s-cfncluster/templates/cfncluster-%s.cfn.json'
181181
% (self.region, self.region, self.version))
182182
else:
183183
self.template_url = ('https://s3.amazonaws.com/%s-cfncluster/templates/cfncluster-%s.cfn.json'

‎cli/cfncluster/easyconfig.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from . import cfnconfig
2626

2727
logger = logging.getLogger('cfncluster.cfncluster')
28-
unsupported_regions = ['ap-northeast-3']
28+
unsupported_regions = ['ap-northeast-3', 'cn-north-1', 'cn-northwest-1']
2929

3030
def prompt(prompt, default_value=None, hidden=False, options=None):
3131
if hidden and default_value is not None:

‎cli/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def read(fname):
2020
return open(os.path.join(os.path.dirname(__file__), fname)).read()
2121

2222
console_scripts = ['cfncluster = cfncluster.cli:main']
23-
version = "1.5.2"
23+
version = "1.5.3"
2424
requires = ['boto3>=1.7.33', 'awscli>=1.11.175', 'future>=0.16.0']
2525

2626
if sys.version_info[:2] == (2, 6):

‎cloudformation/cfncluster.cfn.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -1741,6 +1741,11 @@
17411741
"centos7": "ami-0df85f5bc2d980e57",
17421742
"ubuntu1404": "ami-06142a55749b7912b",
17431743
"ubuntu1604": "ami-0702d59e57ada76b8"
1744+
},
1745+
"us-gov-west-1": {
1746+
"alinux": "ami-af2cbece",
1747+
"ubuntu1404": "ami-4aca572b",
1748+
"ubuntu1604": "ami-3dc8555c"
17441749
}
17451750
},
17461751
"OSFeatures": {
@@ -1767,7 +1772,7 @@
17671772
},
17681773
"CfnClusterVersions": {
17691774
"default": {
1770-
"cfncluster": "cfncluster-1.5.2",
1775+
"cfncluster": "cfncluster-1.5.3",
17711776
"cookbook": "cfncluster-cookbook-1.5.2",
17721777
"chef": "14.2.0",
17731778
"ridley": "5.1.1",

‎docs/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
# The short X.Y version.
5353
version = '1.5'
5454
# The full version, including alpha/beta/rc tags.
55-
release = '1.5.2'
55+
release = '1.5.3'
5656

5757
# The language for content autogenerated by Sphinx. Refer to documentation
5858
# for a list of supported languages.

‎docs/source/iam.rst

+7-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ IAM in CfnCluster
88

99

1010
CfnCluster utilizes multiple AWS services to deploy and operate a cluster. The services used are listed in the :ref:`AWS Services used in CfnCluster <aws_services>` section of the documentation.
11-
11+
1212
CfnCluster uses EC2 IAM roles to enable instances access to AWS services for the deployment and operation of the cluster. By default the EC2 IAM role is created as part of the cluster creation by CloudFormation. This means that the user creating the cluster must have the appropriate level of permissions
1313

1414
Defaults
@@ -176,7 +176,9 @@ CfnClusterUserPolicy
176176
"ec2:DeleteSecurityGroup",
177177
"ec2:DisassociateAddress",
178178
"ec2:RevokeSecurityGroupIngress",
179-
"ec2:ReleaseAddress"
179+
"ec2:ReleaseAddress",
180+
"ec2:CreatePlacementGroup",
181+
"ec2:DeletePlacementGroup"
180182
],
181183
"Effect": "Allow",
182184
"Resource": "*"
@@ -308,7 +310,9 @@ CfnClusterUserPolicy
308310
"Action": [
309311
"iam:PassRole",
310312
"iam:CreateRole",
311-
"iam:DeleteRole"
313+
"iam:DeleteRole",
314+
"iam:GetRole",
315+
"iam:SimulatePrincipalPolicy"
312316
],
313317
"Effect": "Allow",
314318
"Resource": "arn:aws:iam::<AWS ACCOUNT ID>:role/<CFNCLUSTER EC2 ROLE NAME>"

‎tests/cluster-check.sh

+21-2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ sge_get_slots() {
4343
echo ${ppn}
4444
}
4545

46+
slurm_get_slots() {
47+
local -- ppn i=0
48+
ppn=$(scontrol show nodes -o | head -n 1 | sed -n -e 's/^.* CPUTot=\([0-9]\+\) .*$/\1/p')
49+
# wait 15 secs before giving up retrieving the slots per host
50+
while [ -z "${ppn}" -a $i -lt 15 ]; do
51+
sleep 1
52+
i=$((i+1))
53+
ppn=$(scontrol show nodes -o | head -n 1 | sed -n -e 's/^.* CPUTot=\([0-9]\+\) .*$/\1/p')
54+
done
55+
56+
echo ${ppn}
57+
}
58+
4659
torque_get_slots() {
4760
local -- chost ppn i=0
4861

@@ -76,6 +89,12 @@ set -e
7689
# less than 8 minutes in order for the test to succeed.
7790

7891
if test "$scheduler" = "slurm" ; then
92+
_ppn=$(slurm_get_slots)
93+
if [ -z "${_ppn}" ]; then
94+
>&2 echo "The number of slots per instance couldn't be retrieved, no compute nodes available in Slurm cluster"
95+
exit 1
96+
fi
97+
7998
cat > job1.sh <<EOF
8099
#!/bin/bash
81100
srun sleep ${_sleepjob1}
@@ -90,8 +109,8 @@ EOF
90109
chmod +x job1.sh job2.sh
91110
rm -f job1.done job2.done
92111

93-
sbatch -N 1 ./job1.sh
94-
sbatch -N 1 ./job2.sh
112+
sbatch -N 1 -n ${_ppn} ./job1.sh
113+
sbatch -N 1 -n ${_ppn} ./job2.sh
95114

96115
elif test "$scheduler" = "sge" ; then
97116
# get the slots per node count of the first real node (one with a

‎util/generate-ami-list.py

+15-5
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,16 @@
2525
import sys
2626
from collections import OrderedDict
2727

28-
29-
owners = ["247102896272"]
3028
distros = OrderedDict([("alinux", "amzn"), ("centos6", "centos6"), ("centos7", "centos7"), ("ubuntu1404", "ubuntu-1404"), ("ubuntu1604", "ubuntu-1604")])
3129

3230

33-
def get_ami_list(regions, date, version):
31+
def get_ami_list(regions, date, version, owner):
3432
amis_json = {}
3533

3634
for region_name in regions:
3735
try:
3836
ec2 = boto3.client('ec2', region_name=region_name)
39-
images = ec2.describe_images(Owners=owners, Filters=[{'Name': 'name', "Values": ["cfncluster-%s*%s" % (version, date)]}])
37+
images = ec2.describe_images(Owners=[owner], Filters=[{'Name': 'name', "Values": ["cfncluster-%s*%s" % (version, date)]}])
4038

4139
amis = OrderedDict()
4240
for image in images.get('Images'):
@@ -76,20 +74,32 @@ def convert_json_to_txt(regions, amis_json):
7674
parser.add_argument('--date', type=str, help='release date [timestamp] (e.g. 201801112350)', required=True)
7775
parser.add_argument('--json-file', type=str, help='json output file path', required=False, default="amis.json")
7876
parser.add_argument('--txt-file', type=str, help='txt output file path', required=False, default="amis.txt")
77+
parser.add_argument('--account-id', type=str, help='account id that owns the amis', required=False, default="247102896272")
78+
parser.add_argument('--append', type=str, help='append new amis to current amis.txt', required=False, default=False)
79+
parser.add_argument('--cloudformation-template', type=str, help='path to cloudfomation template', required=False, default='cloudformation/cfncluster.cfn.json')
7980
args = parser.parse_args()
8081

8182
# get all regions
8283
ec2 = boto3.client('ec2')
8384
regions = sorted(r.get('RegionName') for r in ec2.describe_regions().get('Regions'))
8485

8586
# get ami list
86-
amis_json = get_ami_list(regions=regions, date=args.date, version=args.version)
87+
amis_json = get_ami_list(regions=regions, date=args.date, version=args.version, owner=args.account_id)
8788

8889
# write amis.json file
8990
amis_json_file = open(args.json_file, "w")
9091
json.dump(amis_json, amis_json_file, indent=2, sort_keys=True)
9192
amis_json_file.close()
9293

94+
# append to amis.txt file
95+
if args.append:
96+
with open(args.cloudformation_template) as f:
97+
data = json.load(f)
98+
amis = data.get('Mappings').get('AWSRegionOS2AMI')
99+
amis.update(amis_json)
100+
amis_json = amis
101+
regions = sorted(amis_json)
102+
93103
# convert json to txt
94104
amis_txt = convert_json_to_txt(regions=regions, amis_json=amis_json)
95105

0 commit comments

Comments
 (0)
Please sign in to comment.