Skip to content

Commit

Permalink
Update AWS examples to use networking and IAM resources
Browse files Browse the repository at this point in the history
This allows our examples to be more self contained, and exercise some of our
network and IAM plumbing resources.

Signed-off-by: Nic Cope <negz@rk0n.org>
  • Loading branch information
negz committed Apr 20, 2020
1 parent aa8b57f commit 1bc4f42
Show file tree
Hide file tree
Showing 7 changed files with 330 additions and 6 deletions.
74 changes: 74 additions & 0 deletions examples/cache/rediscluster/network.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: VPC
metadata:
name: rg-example
spec:
cidrBlock: 192.168.0.0/16
enableDnsSupport: true
enableDnsHostNames: true
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: Subnet
metadata:
name: rg-example
spec:
cidrBlock: 192.168.64.0/18
vpcIdRef:
name: rg-example
availabilityZone: us-east-1a
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: InternetGateway
metadata:
name: rg-example
spec:
vpcIdRef:
name: rg-example
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: RouteTable
metadata:
name: rg-example
spec:
vpcIdRef:
name: rg-example
routes:
- destinationCidrBlock: 0.0.0.0/0
gatewayIdRef:
name: rg-example
associations:
- subnetIdRef:
name: rg-example
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: SecurityGroup
metadata:
name: rg-example
spec:
vpcIdRef:
name: rg-example
groupName: rg-example
description: Open access to Redis
ingress:
- fromPort: 6379
toPort: 6379
protocol: tcp
cidrBlocks:
- cidrIp: 0.0.0.0/0
description: Not very secure
reclaimPolicy: Delete
providerRef:
name: example
122 changes: 122 additions & 0 deletions examples/database/mysqlinstance/network.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: VPC
metadata:
name: mysql-example
spec:
cidrBlock: 192.168.0.0/16
enableDnsSupport: true
enableDnsHostNames: true
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: Subnet
metadata:
name: mysql-example-1
spec:
cidrBlock: 192.168.64.0/18
vpcIdRef:
name: mysql-example
availabilityZone: us-east-1a
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: Subnet
metadata:
name: mysql-example-2
spec:
cidrBlock: 192.168.128.0/18
vpcIdRef:
name: mysql-example
availabilityZone: us-east-1b
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: Subnet
metadata:
name: mysql-example-3
spec:
cidrBlock: 192.168.192.0/18
vpcIdRef:
name: mysql-example
availabilityZone: us-east-1c
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: database.aws.crossplane.io/v1beta1
kind: DBSubnetGroup
metadata:
name: mysql-example
spec:
forProvider:
description: MySQL subnets
subnetIdRefs:
- name: mysql-example-1
- name: mysql-example-2
- name: mysql-example-3
tags:
- key: name
value: mysql-example
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: InternetGateway
metadata:
name: mysql-example
spec:
vpcIdRef:
name: mysql-example
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: RouteTable
metadata:
name: mysql-example
spec:
vpcIdRef:
name: mysql-example
routes:
- destinationCidrBlock: 0.0.0.0/0
gatewayIdRef:
name: mysql-example
associations:
- subnetIdRef:
name: mysql-example-1
- subnetIdRef:
name: mysql-example-2
- subnetIdRef:
name: mysql-example-3
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: SecurityGroup
metadata:
name: mysql-example
spec:
vpcIdRef:
name: mysql-example
groupName: mysql-example
description: Open access to RDS
reclaimPolicy: Delete
ingress:
- fromPort: 3306
toPort: 3306
protocol: tcp
cidrBlocks:
- cidrIp: 0.0.0.0/0
description: Not very secure
providerRef:
name: example
1 change: 1 addition & 0 deletions examples/database/mysqlinstance/resource-claim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ spec:
classSelector:
matchLabels:
example: "true"
engine: mysql
writeConnectionSecretToRef:
name: mysqlconn
engineVersion: "5.6"
8 changes: 5 additions & 3 deletions examples/database/mysqlinstance/resource-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ metadata:
name: rdsmysql
labels:
example: "true"
engine: mysql
specTemplate:
forProvider:
dbInstanceClass: db.t2.small
masterUsername: masteruser
# vpcSecurityGroupIds:
# - sg-ab1cdefg
# - sg-05adsfkaj1ksdjak
vpcSecurityGroupIDRefs:
- name: mysql-example
dbSubnetGroupNameRef:
name: mysql-example
allocatedStorage: 20
engine: mysql
skipFinalSnapshotBeforeDeletion: true
Expand Down
122 changes: 122 additions & 0 deletions examples/database/postgresqlinstance/network.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: VPC
metadata:
name: postgresql-example
spec:
cidrBlock: 192.168.0.0/16
enableDnsSupport: true
enableDnsHostNames: true
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: Subnet
metadata:
name: postgresql-example-1
spec:
cidrBlock: 192.168.64.0/18
vpcIdRef:
name: postgresql-example
availabilityZone: us-east-1a
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: Subnet
metadata:
name: postgresql-example-2
spec:
cidrBlock: 192.168.128.0/18
vpcIdRef:
name: postgresql-example
availabilityZone: us-east-1b
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: Subnet
metadata:
name: postgresql-example-3
spec:
cidrBlock: 192.168.192.0/18
vpcIdRef:
name: postgresql-example
availabilityZone: us-east-1c
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: database.aws.crossplane.io/v1beta1
kind: DBSubnetGroup
metadata:
name: postgresql-example
spec:
forProvider:
description: MySQL subnets
subnetIdRefs:
- name: postgresql-example-1
- name: postgresql-example-2
- name: postgresql-example-3
tags:
- key: name
value: postgresql-example
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: InternetGateway
metadata:
name: postgresql-example
spec:
vpcIdRef:
name: postgresql-example
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: RouteTable
metadata:
name: postgresql-example
spec:
vpcIdRef:
name: postgresql-example
routes:
- destinationCidrBlock: 0.0.0.0/0
gatewayIdRef:
name: postgresql-example
associations:
- subnetIdRef:
name: postgresql-example-1
- subnetIdRef:
name: postgresql-example-2
- subnetIdRef:
name: postgresql-example-3
reclaimPolicy: Delete
providerRef:
name: example
---
apiVersion: network.aws.crossplane.io/v1alpha3
kind: SecurityGroup
metadata:
name: postgresql-example
spec:
vpcIdRef:
name: postgresql-example
groupName: postgresql-example
description: Open access to RDS
reclaimPolicy: Delete
ingress:
- fromPort: 3306
toPort: 3306
protocol: tcp
cidrBlocks:
- cidrIp: 0.0.0.0/0
description: Not very secure
providerRef:
name: example
1 change: 1 addition & 0 deletions examples/database/postgresqlinstance/resource-claim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ spec:
classSelector:
matchLabels:
example: "true"
engine: postgresql
writeConnectionSecretToRef:
name: postgresqlconn
engineVersion: "9.6"
8 changes: 5 additions & 3 deletions examples/database/postgresqlinstance/resource-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ metadata:
name: rdspostgresql-standard
labels:
example: "true"
engine: postgresql
specTemplate:
forProvider:
dbInstanceClass: db.t2.small
masterUsername: masteruser
# vpcSecurityGroupIds:
# - sg-ab1cdefg
# - sg-05adsfkaj1ksdjak
vpcSecurityGroupIDRefs:
- name: mysql-example
dbSubnetGroupNameRef:
name: mysql-example
allocatedStorage: 20
engine: postgresql
skipFinalSnapshotBeforeDeletion: true
Expand Down

0 comments on commit 1bc4f42

Please sign in to comment.