Skip to content

Commit d5b114d

Browse files
authored
Add Code.S3Bucket reference (#63)
Description of changes: Adding functionality to the lambda controller to be able to reference Code.S3Bucket resource using resource references. This was generated using the patch aws-controllers-k8s/community#1514 is implemented. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent ab2edaf commit d5b114d

15 files changed

+161
-31
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2022-10-17T21:33:01Z"
3-
build_hash: 5ee0ac052c54f008dff50f6f5ebb73f2cf3a0bd7
2+
build_date: "2022-10-25T17:58:30Z"
3+
build_hash: 9727031b415481d9ac28bb94cac9f1e73336401d
44
go_version: go1.19
5-
version: v0.19.3-11-g5ee0ac0
6-
api_directory_checksum: 524eddcd9132990dfde91e2198972cb98824b0c8
5+
version: v0.19.3-9-g9727031
6+
api_directory_checksum: e2da75eafa3ab7fe7cc4c8c26ba01e495e31d494
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.44.93
99
generator_config_info:
10-
file_checksum: b80da83b8bcef0df08e435dbcfd6b744cffbdb71
10+
file_checksum: 1328b65627cf7280ef4df6c1b0435653e99fe62f
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/generator.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ ignore:
88
resources:
99
Function:
1010
fields:
11+
Code.S3Bucket:
12+
references:
13+
resource: Bucket
14+
path: Spec.Name
15+
service_name: s3
1116
VPCConfig.SubnetIDs:
1217
references:
1318
resource: Subnet

apis/v1alpha1/types.go

Lines changed: 7 additions & 5 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: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/controller/main.go

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

config/crd/bases/lambda.services.k8s.aws_functions.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ spec:
4949
type: string
5050
s3Bucket:
5151
type: string
52+
s3BucketRef:
53+
description: Reference field for S3Bucket
54+
properties:
55+
from:
56+
description: AWSResourceReference provides all the values
57+
necessary to reference another k8s resource for finding
58+
the identifier(Id/ARN/Name)
59+
properties:
60+
name:
61+
type: string
62+
type: object
63+
type: object
5264
s3Key:
5365
type: string
5466
s3ObjectVersion:

config/rbac/cluster-role-controller.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,20 @@ rules:
173173
- get
174174
- patch
175175
- update
176+
- apiGroups:
177+
- s3.services.k8s.aws
178+
resources:
179+
- buckets
180+
verbs:
181+
- get
182+
- list
183+
- apiGroups:
184+
- s3.services.k8s.aws
185+
resources:
186+
- buckets/status
187+
verbs:
188+
- get
189+
- list
176190
- apiGroups:
177191
- services.k8s.aws
178192
resources:

generator.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ ignore:
88
resources:
99
Function:
1010
fields:
11+
Code.S3Bucket:
12+
references:
13+
resource: Bucket
14+
path: Spec.Name
15+
service_name: s3
1116
VPCConfig.SubnetIDs:
1217
references:
1318
resource: Subnet

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ require (
66
github.com/aws-controllers-k8s/ec2-controller v0.0.21
77
github.com/aws-controllers-k8s/kms-controller v0.1.2
88
github.com/aws-controllers-k8s/runtime v0.20.1
9+
github.com/aws-controllers-k8s/s3-controller v0.1.5
910
github.com/aws/aws-sdk-go v1.44.93
1011
github.com/go-logr/logr v1.2.0
1112
github.com/spf13/pflag v1.0.5

go.sum

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,12 @@ github.com/aws-controllers-k8s/ec2-controller v0.0.21 h1:5O7/9aED2Tl9OT0TL2rWrc1
6868
github.com/aws-controllers-k8s/ec2-controller v0.0.21/go.mod h1:OMsmJeJ3iQZ1sJgs3hqnjBRnJ3hmTzJUO38W5rxnB5M=
6969
github.com/aws-controllers-k8s/kms-controller v0.1.2 h1:9lb98jspqOpFpmIFHOJ6pRnOkC8kDEPIgTAb5QnVGZo=
7070
github.com/aws-controllers-k8s/kms-controller v0.1.2/go.mod h1:6CoV0UMFd03EUF9dXgOTTScGdBhJzsWn9W0dw2n0kA4=
71+
github.com/aws-controllers-k8s/runtime v0.20.0/go.mod h1:oA8ML1/LL3chPn26P6SzBNu1CUI2nekB+PTqykNs0qU=
7172
github.com/aws-controllers-k8s/runtime v0.20.1 h1:L/Huf1shRahx5BqJBCSS5u+vYg3f0Rotsq1jutORpdI=
7273
github.com/aws-controllers-k8s/runtime v0.20.1/go.mod h1:k7z4qlf6aK1Kzd4ff49wzcyhDKHjWaUpqxrwgl4uS1o=
74+
github.com/aws-controllers-k8s/s3-controller v0.1.5 h1:5zb7jsh0fgbPM8cIvcsuH1dta1dKzaAnlwgvb6u3hOc=
75+
github.com/aws-controllers-k8s/s3-controller v0.1.5/go.mod h1:8Z8JlO5Hc1dZX2YELu94+lnOgKM0FioAHJBsyaWvtx8=
76+
github.com/aws/aws-sdk-go v1.42.0/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q=
7377
github.com/aws/aws-sdk-go v1.44.93 h1:hAgd9fuaptBatSft27/5eBMdcA8+cIMqo96/tZ6rKl8=
7478
github.com/aws/aws-sdk-go v1.44.93/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
7579
github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
@@ -604,6 +608,7 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd
604608
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
605609
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
606610
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
611+
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
607612
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
608613
golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
609614
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk=

helm/crds/lambda.services.k8s.aws_functions.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ spec:
4949
type: string
5050
s3Bucket:
5151
type: string
52+
s3BucketRef:
53+
description: Reference field for S3Bucket
54+
properties:
55+
from:
56+
description: AWSResourceReference provides all the values
57+
necessary to reference another k8s resource for finding
58+
the identifier(Id/ARN/Name)
59+
properties:
60+
name:
61+
type: string
62+
type: object
63+
type: object
5264
s3Key:
5365
type: string
5466
s3ObjectVersion:

helm/templates/cluster-role-controller.yaml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,11 @@ kind: ClusterRole
44
metadata:
55
creationTimestamp: null
66
name: ack-lambda-controller
7-
labels:
8-
{{- range $key, $value := .Values.role.labels }}
9-
{{ $key }}: {{ $value | quote }}
10-
{{- end }}
117
{{ else }}
128
kind: Role
139
metadata:
1410
creationTimestamp: null
1511
name: ack-lambda-controller
16-
labels:
17-
{{- range $key, $value := .Values.role.labels }}
18-
{{ $key }}: {{ $value | quote }}
19-
{{- end }}
2012
namespace: {{ .Release.Namespace }}
2113
{{ end }}
2214
rules:
@@ -188,6 +180,20 @@ rules:
188180
- get
189181
- patch
190182
- update
183+
- apiGroups:
184+
- s3.services.k8s.aws
185+
resources:
186+
- buckets
187+
verbs:
188+
- get
189+
- list
190+
- apiGroups:
191+
- s3.services.k8s.aws
192+
resources:
193+
- buckets/status
194+
verbs:
195+
- get
196+
- list
191197
- apiGroups:
192198
- services.k8s.aws
193199
resources:

helm/values.schema.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@
6565
],
6666
"type": "object"
6767
},
68-
"role": {
69-
"description": "Role settings",
70-
"properties": {
71-
"labels": {
72-
"type": "object"
73-
}
74-
}
75-
},
7668
"metrics": {
7769
"description": "Metrics settings",
7870
"properties": {

helm/values.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ deployment:
2828
# Which priorityClassName to set?
2929
# See: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#pod-priority
3030
priorityClassName: ""
31-
32-
# If "installScope: cluster" then these labels will be applied to ClusterRole
33-
role:
34-
labels: {}
3531

3632
metrics:
3733
service:

pkg/resource/function/references.go

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

0 commit comments

Comments
 (0)