Skip to content

Commit 94e8570

Browse files
committed
add AWSQS::Kubernetes::Resource resource
1 parent 9fc4bef commit 94e8570

File tree

10 files changed

+469
-278
lines changed

10 files changed

+469
-278
lines changed

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,20 @@ RUN cd get/src && zip -r -q ../ResourceProvider.zip ./ && \
2424
mv awsqs-kubernetes-get.json schema.json && \
2525
zip -r -q ../awsqs_kubernetes_get.zip ./ResourceProvider.zip .rpdk-config schema.json
2626

27+
RUN pip3 install -t apply/src --upgrade -r apply/requirements.txt && \
28+
find apply/src -name __pycache__ | xargs rm -rf && \
29+
rm -rf apply/src/*.dist-info && \
30+
cp -p get/src/bin/kubectl apply/src/bin/ && \
31+
cp -p get/src/bin/aws-iam-authenticator apply/src/bin/
32+
33+
RUN cd apply/src && \
34+
zip -r ../vpc.zip ./ && \
35+
cp ../vpc.zip /build/awsqs_kubernetes_apply_vpc.zip && \
36+
mv ../vpc.zip ./awsqs_kubernetes_resource/
37+
38+
RUN cd apply/src && zip -r -q ../ResourceProvider.zip ./ && \
39+
cd ../ && \
40+
mv awsqs-kubernetes-resource.json schema.json && \
41+
zip -r -q ../awsqs_kubernetes_apply.zip ./ResourceProvider.zip .rpdk-config schema.json
42+
2743
CMD mkdir -p /output/ && mv /build/*.zip /output/

apply/awsqs-kubernetes-resource.json

Lines changed: 73 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,114 @@
11
{
22
"typeName": "AWSQS::Kubernetes::Resource",
3-
"description": "An example resource schema demonstrating some basic constructs and validation rules.",
4-
"sourceUrl": "https://github.com/aws-cloudformation/aws-cloudformation-rpdk.git",
5-
"definitions": {
6-
"InitechDateFormat": {
7-
"$comment": "Use the `definitions` block to provide shared resource property schemas",
8-
"type": "string",
9-
"format": "date-time"
10-
},
11-
"Memo": {
12-
"type": "object",
13-
"properties": {
14-
"Heading": {
15-
"type": "string"
16-
},
17-
"Body": {
18-
"type": "string"
19-
}
20-
},
21-
"additionalProperties": false
22-
}
23-
},
3+
"description": "Applys a YAML manifest to the specified Kubernetes cluster",
4+
"sourceUrl": "https://github.com/aws-quickstart/quickstart-amazon-eks.git",
245
"properties": {
25-
"TPSCode": {
26-
"description": "A TPS Code is automatically generated on creation and assigned as the unique identifier.",
27-
"type": "string",
28-
"pattern": "^[A-Z]{3,5}[0-9]{8}-[0-9]{4}$"
6+
"ClusterName": {
7+
"description": "Name of the EKS cluster",
8+
"type": "string"
299
},
30-
"Title": {
31-
"description": "The title of the TPS report is a mandatory element.",
32-
"type": "string",
33-
"minLength": 20,
34-
"maxLength": 250
10+
"Namespace": {
11+
"description": "Kubernetes namespace",
12+
"type": "string"
3513
},
36-
"CoverSheetIncluded": {
37-
"description": "Required for all TPS Reports submitted after 2/19/1999",
38-
"type": "boolean"
14+
"Manifest": {
15+
"description": "Text representation of the kubernetes yaml manifests to apply to the cluster.",
16+
"type": "string"
3917
},
40-
"DueDate": {
41-
"$ref": "#/definitions/InitechDateFormat"
18+
"Url": {
19+
"type":"string",
20+
"description": "Url to the kubernetes yaml manifests to apply to the cluster. Urls starting with s3:// will be fetched using an authenticated S3 read."
4221
},
43-
"ApprovalDate": {
44-
"$ref": "#/definitions/InitechDateFormat"
22+
"name": {
23+
"type":"string",
24+
"description": "Name of the resource."
4525
},
46-
"Memo": {
47-
"$ref": "#/definitions/Memo"
26+
"resourceVersion": {
27+
"type":"string",
28+
"description": "Resource version."
4829
},
49-
"SecondCopyOfMemo": {
50-
"description": "In case you didn't get the first one.",
51-
"$ref": "#/definitions/Memo"
52-
},
53-
"TestCode": {
54-
"type": "string",
55-
"enum": [
56-
"NOT_STARTED",
57-
"CANCELLED"
58-
]
30+
"selfLink": {
31+
"type":"string",
32+
"description": "Link returned by the kubernetes api."
5933
},
60-
"Authors": {
61-
"type": "array",
62-
"items": {
63-
"type": "string"
64-
}
34+
"uid": {
35+
"type":"string",
36+
"description": "Resource unique ID."
6537
}
6638
},
6739
"additionalProperties": false,
6840
"required": [
69-
"TestCode",
70-
"Title"
41+
"ClusterName",
42+
"Namespace"
7143
],
7244
"readOnlyProperties": [
73-
"/properties/TPSCode"
45+
"/properties/name",
46+
"/properties/resourceVersion",
47+
"/properties/selfLink",
48+
"/properties/uid"
7449
],
7550
"primaryIdentifier": [
76-
"/properties/TPSCode"
51+
"/properties/ClusterName",
52+
"/properties/selfLink"
7753
],
7854
"handlers": {
7955
"create": {
8056
"permissions": [
81-
"initech:CreateReport"
57+
"ssm:GetParameter",
58+
"eks:DescribeCluster",
59+
"ec2:Describe*",
60+
"ec2:CreateNetworkInterface",
61+
"ec2:DeleteNetworkInterface",
62+
"iam:PassRole",
63+
"sts:GetCallerIdentity",
64+
"lambda:*"
8265
]
8366
},
8467
"read": {
8568
"permissions": [
86-
"initech:DescribeReport"
69+
"ssm:GetParameter",
70+
"eks:DescribeCluster",
71+
"ec2:Describe*",
72+
"ec2:CreateNetworkInterface",
73+
"ec2:DeleteNetworkInterface",
74+
"iam:PassRole",
75+
"sts:GetCallerIdentity",
76+
"lambda:*"
8777
]
8878
},
8979
"update": {
9080
"permissions": [
91-
"initech:UpdateReport"
81+
"ssm:GetParameter",
82+
"eks:DescribeCluster",
83+
"ec2:Describe*",
84+
"ec2:CreateNetworkInterface",
85+
"ec2:DeleteNetworkInterface",
86+
"iam:PassRole",
87+
"lambda:*"
9288
]
9389
},
9490
"delete": {
9591
"permissions": [
96-
"initech:DeleteReport"
92+
"ssm:GetParameter",
93+
"eks:DescribeCluster",
94+
"ec2:Describe*",
95+
"ec2:CreateNetworkInterface",
96+
"ec2:DeleteNetworkInterface",
97+
"iam:PassRole",
98+
"sts:GetCallerIdentity",
99+
"lambda:*"
97100
]
98101
},
99102
"list": {
100103
"permissions": [
101-
"initech:ListReports"
104+
"ssm:GetParameter",
105+
"eks:DescribeCluster",
106+
"ec2:Describe*",
107+
"ec2:CreateNetworkInterface",
108+
"ec2:DeleteNetworkInterface",
109+
"iam:PassRole",
110+
"sts:GetCallerIdentity",
111+
"lambda:*"
102112
]
103113
}
104114
}

apply/docs/README.md

Lines changed: 31 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AWSQS::Kubernetes::Resource
22

3-
An example resource schema demonstrating some basic constructs and validation rules.
3+
Applys a YAML manifest to the specified Kubernetes cluster
44

55
## Syntax
66

@@ -12,14 +12,10 @@ To declare this entity in your AWS CloudFormation template, use the following sy
1212
{
1313
"Type" : "AWSQS::Kubernetes::Resource",
1414
"Properties" : {
15-
"<a href="#title" title="Title">Title</a>" : <i>String</i>,
16-
"<a href="#coversheetincluded" title="CoverSheetIncluded">CoverSheetIncluded</a>" : <i>Boolean</i>,
17-
"<a href="#duedate" title="DueDate">DueDate</a>" : <i>String</i>,
18-
"<a href="#approvaldate" title="ApprovalDate">ApprovalDate</a>" : <i>String</i>,
19-
"<a href="#memo" title="Memo">Memo</a>" : <i><a href="secondcopyofmemo.md">SecondCopyOfMemo</a></i>,
20-
"<a href="#secondcopyofmemo" title="SecondCopyOfMemo">SecondCopyOfMemo</a>" : <i><a href="secondcopyofmemo.md">SecondCopyOfMemo</a></i>,
21-
"<a href="#testcode" title="TestCode">TestCode</a>" : <i>String</i>,
22-
"<a href="#authors" title="Authors">Authors</a>" : <i>[ String, ... ]</i>
15+
"<a href="#clustername" title="ClusterName">ClusterName</a>" : <i>String</i>,
16+
"<a href="#namespace" title="Namespace">Namespace</a>" : <i>String</i>,
17+
"<a href="#manifest" title="Manifest">Manifest</a>" : <i>String</i>,
18+
"<a href="#url" title="Url">Url</a>" : <i>String</i>,
2319
}
2420
}
2521
</pre>
@@ -29,106 +25,75 @@ To declare this entity in your AWS CloudFormation template, use the following sy
2925
<pre>
3026
Type: AWSQS::Kubernetes::Resource
3127
Properties:
32-
<a href="#title" title="Title">Title</a>: <i>String</i>
33-
<a href="#coversheetincluded" title="CoverSheetIncluded">CoverSheetIncluded</a>: <i>Boolean</i>
34-
<a href="#duedate" title="DueDate">DueDate</a>: <i>String</i>
35-
<a href="#approvaldate" title="ApprovalDate">ApprovalDate</a>: <i>String</i>
36-
<a href="#memo" title="Memo">Memo</a>: <i><a href="secondcopyofmemo.md">SecondCopyOfMemo</a></i>
37-
<a href="#secondcopyofmemo" title="SecondCopyOfMemo">SecondCopyOfMemo</a>: <i><a href="secondcopyofmemo.md">SecondCopyOfMemo</a></i>
38-
<a href="#testcode" title="TestCode">TestCode</a>: <i>String</i>
39-
<a href="#authors" title="Authors">Authors</a>: <i>
40-
- String</i>
28+
<a href="#clustername" title="ClusterName">ClusterName</a>: <i>String</i>
29+
<a href="#namespace" title="Namespace">Namespace</a>: <i>String</i>
30+
<a href="#manifest" title="Manifest">Manifest</a>: <i>String</i>
31+
<a href="#url" title="Url">Url</a>: <i>String</i>
4132
</pre>
4233

4334
## Properties
4435

45-
#### Title
36+
#### ClusterName
4637

47-
The title of the TPS report is a mandatory element.
38+
Name of the EKS cluster
4839

4940
_Required_: Yes
5041

5142
_Type_: String
5243

53-
_Minimum_: <code>20</code>
54-
55-
_Maximum_: <code>250</code>
56-
5744
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
5845

59-
#### CoverSheetIncluded
60-
61-
Required for all TPS Reports submitted after 2/19/1999
62-
63-
_Required_: No
46+
#### Namespace
6447

65-
_Type_: Boolean
48+
Kubernetes namespace
6649

67-
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
68-
69-
#### DueDate
70-
71-
_Required_: No
50+
_Required_: Yes
7251

7352
_Type_: String
7453

7554
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
7655

77-
#### ApprovalDate
56+
#### Manifest
57+
58+
Text representation of the kubernetes yaml manifests to apply to the cluster.
7859

7960
_Required_: No
8061

8162
_Type_: String
8263

8364
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
8465

85-
#### Memo
86-
87-
_Required_: No
88-
89-
_Type_: <a href="secondcopyofmemo.md">SecondCopyOfMemo</a>
90-
91-
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
66+
#### Url
9267

93-
#### SecondCopyOfMemo
68+
Url to the kubernetes yaml manifests to apply to the cluster. Urls starting with s3:// will be fetched using an authenticated S3 read.
9469

9570
_Required_: No
9671

97-
_Type_: <a href="secondcopyofmemo.md">SecondCopyOfMemo</a>
98-
99-
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
100-
101-
#### TestCode
102-
103-
_Required_: Yes
104-
10572
_Type_: String
10673

107-
_Allowed Values_: <code>NOT_STARTED</code> | <code>CANCELLED</code>
108-
10974
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
11075

111-
#### Authors
76+
## Return Values
11277

113-
_Required_: No
78+
### Fn::GetAtt
11479

115-
_Type_: List of String
80+
The `Fn::GetAtt` intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
11681

117-
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
82+
For more information about using the `Fn::GetAtt` intrinsic function, see [Fn::GetAtt](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html).
11883

119-
## Return Values
84+
#### name
12085

121-
### Ref
86+
Name of the resource.
12287

123-
When you pass the logical ID of this resource to the intrinsic `Ref` function, Ref returns the TPSCode.
88+
#### resourceVersion
12489

125-
### Fn::GetAtt
90+
Resource version.
12691

127-
The `Fn::GetAtt` intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
92+
#### selfLink
12893

129-
For more information about using the `Fn::GetAtt` intrinsic function, see [Fn::GetAtt](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html).
94+
Link returned by the kubernetes api.
13095

131-
#### TPSCode
96+
#### uid
13297

133-
A TPS Code is automatically generated on creation and assigned as the unique identifier.
98+
Resource unique ID.
13499

apply/docs/memo.md

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)