Skip to content

Commit 8c53852

Browse files
Add route table assocations to Subnet (#45)
Closes aws-controllers-k8s/community#1219 Description of changes: Generates the `Subnet` CRD with a new custom field `RouteTables`, which represent an array of route table IDs. Route tables are associated with the `Subnet` using the `AssociateRouteTable` API call, and then updated by deleting the association (using `DisassociateRouteTable`) and re-associating. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 34a6747 commit 8c53852

19 files changed

+1644
-21
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2022-03-25T18:17:02Z"
3-
build_hash: c6b852a8017aa73cfc5a882b1ba60c88d820e967
4-
go_version: go1.17.5
5-
version: v0.18.1
6-
api_directory_checksum: cc3671a6c2f26f433ffe32815ccfaa24d12e42d1
2+
build_date: "2022-03-29T17:33:11Z"
3+
build_hash: 6f659f796434e8fd6443c0b3a5b495daae910035
4+
go_version: go1.17.8
5+
version: v0.18.0
6+
api_directory_checksum: e5bf2003f6be051fdeda5059df47eb7fff0a9c86
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.42.0
99
generator_config_info:
10-
file_checksum: 721b58308fb63699f1ac3c233e529189e7d59c4c
10+
file_checksum: c041dcc9493bdd9baed2e0599d8bc4401b5f2d25
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/generator.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,12 @@ resources:
238238
- VPCIdNotSpecified
239239
Subnet:
240240
fields:
241+
RouteTables:
242+
custom_field:
243+
list_of: String
244+
references:
245+
resource: RouteTable
246+
path: Status.RouteTableID
241247
VpcId:
242248
references:
243249
resource: VPC
@@ -246,6 +252,13 @@ resources:
246252
terminal_codes:
247253
- InvalidVpcID.Malformed
248254
- InvalidVpcID.NotFound
255+
hooks:
256+
sdk_create_post_set_output:
257+
template_path: hooks/subnet/sdk_create_post_set_output.go.tpl
258+
sdk_read_many_post_set_output:
259+
template_path: hooks/subnet/sdk_read_many_post_set_output.go.tpl
260+
update_operation:
261+
custom_method_name: customUpdateSubnet
249262
Vpc:
250263
update_operation:
251264
custom_method_name: customUpdate

apis/v1alpha1/subnet.go

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/types.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/zz_generated.deepcopy.go

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/ec2.services.k8s.aws_subnets.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,26 @@ spec:
6767
specify an Outpost ARN, you must also specify the Availability Zone
6868
of the Outpost subnet.
6969
type: string
70+
routeTableRefs:
71+
items:
72+
description: 'AWSResourceReferenceWrapper provides a wrapper around
73+
*AWSResourceReference type to provide more user friendly syntax
74+
for references using ''from'' field Ex: APIIDRef: from: name:
75+
my-api'
76+
properties:
77+
from:
78+
description: AWSResourceReference provides all the values necessary
79+
to reference another k8s resource for finding the identifier(Id/ARN/Name)
80+
properties:
81+
name:
82+
type: string
83+
type: object
84+
type: object
85+
type: array
86+
routeTables:
87+
items:
88+
type: string
89+
type: array
7090
tagSpecifications:
7191
description: The tags to assign to the subnet.
7292
items:

generator.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,12 @@ resources:
238238
- VPCIdNotSpecified
239239
Subnet:
240240
fields:
241+
RouteTables:
242+
custom_field:
243+
list_of: String
244+
references:
245+
resource: RouteTable
246+
path: Status.RouteTableID
241247
VpcId:
242248
references:
243249
resource: VPC
@@ -246,6 +252,13 @@ resources:
246252
terminal_codes:
247253
- InvalidVpcID.Malformed
248254
- InvalidVpcID.NotFound
255+
hooks:
256+
sdk_create_post_set_output:
257+
template_path: hooks/subnet/sdk_create_post_set_output.go.tpl
258+
sdk_read_many_post_set_output:
259+
template_path: hooks/subnet/sdk_read_many_post_set_output.go.tpl
260+
update_operation:
261+
custom_method_name: customUpdateSubnet
249262
Vpc:
250263
update_operation:
251264
custom_method_name: customUpdate

go.local.mod

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
module github.com/aws-controllers-k8s/ec2-controller
2+
3+
go 1.17
4+
5+
replace github.com/aws-controllers-k8s/runtime => ../runtime
6+
7+
require (
8+
github.com/aws-controllers-k8s/runtime v0.0.0
9+
github.com/aws/aws-sdk-go v1.42.0
10+
github.com/go-logr/logr v1.2.0
11+
github.com/spf13/pflag v1.0.5
12+
k8s.io/api v0.23.0
13+
k8s.io/apimachinery v0.23.0
14+
k8s.io/client-go v0.23.0
15+
sigs.k8s.io/controller-runtime v0.11.0
16+
)
17+
18+
require (
19+
github.com/beorn7/perks v1.0.1 // indirect
20+
github.com/cespare/xxhash/v2 v2.1.1 // indirect
21+
github.com/davecgh/go-spew v1.1.1 // indirect
22+
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
23+
github.com/fsnotify/fsnotify v1.5.1 // indirect
24+
github.com/go-logr/zapr v1.2.0 // indirect
25+
github.com/gogo/protobuf v1.3.2 // indirect
26+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
27+
github.com/golang/protobuf v1.5.2 // indirect
28+
github.com/google/go-cmp v0.5.5 // indirect
29+
github.com/google/gofuzz v1.1.0 // indirect
30+
github.com/google/uuid v1.1.2 // indirect
31+
github.com/googleapis/gnostic v0.5.5 // indirect
32+
github.com/imdario/mergo v0.3.12 // indirect
33+
github.com/itchyny/gojq v0.12.6 // indirect
34+
github.com/itchyny/timefmt-go v0.1.3 // indirect
35+
github.com/jaypipes/envutil v1.0.0 // indirect
36+
github.com/jmespath/go-jmespath v0.4.0 // indirect
37+
github.com/json-iterator/go v1.1.12 // indirect
38+
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
39+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
40+
github.com/modern-go/reflect2 v1.0.2 // indirect
41+
github.com/pkg/errors v0.9.1 // indirect
42+
github.com/prometheus/client_golang v1.11.0 // indirect
43+
github.com/prometheus/client_model v0.2.0 // indirect
44+
github.com/prometheus/common v0.28.0 // indirect
45+
github.com/prometheus/procfs v0.6.0 // indirect
46+
github.com/stretchr/objx v0.2.0 // indirect
47+
go.uber.org/atomic v1.7.0 // indirect
48+
go.uber.org/multierr v1.6.0 // indirect
49+
go.uber.org/zap v1.19.1 // indirect
50+
golang.org/x/net v0.0.0-20210825183410-e898025ed96a // indirect
51+
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
52+
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881 // indirect
53+
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
54+
golang.org/x/text v0.3.7 // indirect
55+
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
56+
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
57+
google.golang.org/appengine v1.6.7 // indirect
58+
google.golang.org/protobuf v1.27.1 // indirect
59+
gopkg.in/inf.v0 v0.9.1 // indirect
60+
gopkg.in/yaml.v2 v2.4.0 // indirect
61+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
62+
k8s.io/apiextensions-apiserver v0.23.0 // indirect
63+
k8s.io/component-base v0.23.0 // indirect
64+
k8s.io/klog/v2 v2.30.0 // indirect
65+
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
66+
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b // indirect
67+
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
68+
sigs.k8s.io/structured-merge-diff/v4 v4.2.0 // indirect
69+
sigs.k8s.io/yaml v1.3.0 // indirect
70+
)

0 commit comments

Comments
 (0)