Skip to content

Commit 66cb9aa

Browse files
authored
add DBInstance resource (#10)
Adds support for the DBInstance custom resource. There are a number of callouts for this CRD: 1) The DBSecurityGroups field of the CreateDBInstance API Input shape has been renamed to DBSecurityGroupNames in order to bypass an issue where a same-named field in the CreateDBInstance API Output shape was of a different data type. The DBSecurityGroups field in the CreateDBInstance API Output shape now appears as `Status.DBSecurityGroups` and has a data type that shows the DBSecurityGroup name and "status". 2) The MasterUserPassword field has been replaced with SecretKeyReference. 3) Hooks for sdk_update_pre_build_request and sdk_delete_pre_build_request have been added that check the DBInstanceStatus field. The valid values for this field had to be derived from the RDS control plane source code since there is no enum in the public API model. 4) The SkipFinalSnapshot field is always set to true in the DeleteDBInstance operation. This is not ideal but will suffice until we develop a method to generate a DBSnapshot name automatically. Issue aws-controllers-k8s/community#752 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 8c5df99 commit 66cb9aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+8143
-397
lines changed

apis/v1alpha1/db_instance.go

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

apis/v1alpha1/types.go

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

config/controller/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ spec:
3636
- "$(ACK_LOG_LEVEL)"
3737
- --resource-tags
3838
- "$(ACK_RESOURCE_TAGS)"
39+
- --watch-namespace
40+
- "$(ACK_WATCH_NAMESPACE)"
3941
image: controller:latest
4042
name: controller
4143
ports:

config/crd/bases/rds.services.k8s.aws_dbinstances.yaml

Lines changed: 1006 additions & 0 deletions
Large diffs are not rendered by default.

config/crd/bases/rds.services.k8s.aws_dbparametergroups.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ spec:
6666
and changes are applied when you reboot the DB instance without
6767
failover."
6868
items:
69+
description: "This data type is used as a request parameter in the
70+
ModifyDBParameterGroup and ResetDBParameterGroup actions. \n This
71+
data type is used as a response element in the DescribeEngineDefaultParameters
72+
and DescribeDBParameters actions."
6973
properties:
7074
allowedValues:
7175
type: string
@@ -96,6 +100,8 @@ spec:
96100
tags:
97101
description: Tags to assign to the DB parameter group.
98102
items:
103+
description: Metadata assigned to an Amazon RDS resource consisting
104+
of a key-value pair.
99105
properties:
100106
key:
101107
type: string

config/crd/bases/rds.services.k8s.aws_dbsecuritygroups.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ spec:
4949
tags:
5050
description: Tags to assign to the DB security group.
5151
items:
52+
description: Metadata assigned to an Amazon RDS resource consisting
53+
of a key-value pair.
5254
properties:
5355
key:
5456
type: string
@@ -122,6 +124,9 @@ spec:
122124
ec2SecurityGroups:
123125
description: Contains a list of EC2SecurityGroup elements.
124126
items:
127+
description: "This data type is used as a response element in the
128+
following actions: \n * AuthorizeDBSecurityGroupIngress \n
129+
\ * DescribeDBSecurityGroups \n * RevokeDBSecurityGroupIngress"
125130
properties:
126131
ec2SecurityGroupID:
127132
type: string
@@ -136,6 +141,8 @@ spec:
136141
iPRanges:
137142
description: Contains a list of IPRange elements.
138143
items:
144+
description: This data type is used as a response element in the
145+
DescribeDBSecurityGroups action.
139146
properties:
140147
cidrIP:
141148
type: string

config/crd/bases/rds.services.k8s.aws_dbsubnetgroups.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ spec:
5353
tags:
5454
description: Tags to assign to the DB subnet group.
5555
items:
56+
description: Metadata assigned to an Amazon RDS resource consisting
57+
of a key-value pair.
5658
properties:
5759
key:
5860
type: string
@@ -130,15 +132,24 @@ spec:
130132
subnets:
131133
description: Contains a list of Subnet elements.
132134
items:
135+
description: This data type is used as a response element for the
136+
DescribeDBSubnetGroups operation.
133137
properties:
134138
subnetAvailabilityZone:
139+
description: "Contains Availability Zone information. \n This
140+
data type is used as an element in the OrderableDBInstanceOption
141+
data type."
135142
properties:
136143
name:
137144
type: string
138145
type: object
139146
subnetIdentifier:
140147
type: string
141148
subnetOutpost:
149+
description: "A data type that represents an Outpost. \n For
150+
more information about RDS on Outposts, see Amazon RDS on
151+
AWS Outposts (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-on-outposts.html)
152+
in the Amazon RDS User Guide."
142153
properties:
143154
arn:
144155
type: string
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
2+
---
3+
apiVersion: apiextensions.k8s.io/v1
4+
kind: CustomResourceDefinition
5+
metadata:
6+
annotations:
7+
controller-gen.kubebuilder.io/version: v0.4.0
8+
creationTimestamp: null
9+
name: adoptedresources.services.k8s.aws
10+
spec:
11+
group: services.k8s.aws
12+
names:
13+
kind: AdoptedResource
14+
listKind: AdoptedResourceList
15+
plural: adoptedresources
16+
singular: adoptedresource
17+
scope: Namespaced
18+
versions:
19+
- name: v1alpha1
20+
schema:
21+
openAPIV3Schema:
22+
description: AdoptedResource is the schema for the AdoptedResource API.
23+
properties:
24+
apiVersion:
25+
description: 'APIVersion defines the versioned schema of this representation
26+
of an object. Servers should convert recognized schemas to the latest
27+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
28+
type: string
29+
kind:
30+
description: 'Kind is a string value representing the REST resource this
31+
object represents. Servers may infer this from the endpoint the client
32+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
33+
type: string
34+
metadata:
35+
type: object
36+
spec:
37+
description: AdoptedResourceSpec defines the desired state of the AdoptedResource.
38+
properties:
39+
aws:
40+
description: AWSIdentifiers provide all unique ways to reference an
41+
AWS resource.
42+
properties:
43+
arn:
44+
description: ARN is the AWS Resource Name for the resource. It
45+
is a globally unique identifier.
46+
type: string
47+
nameOrID:
48+
description: NameOrId is a user-supplied string identifier for
49+
the resource. It may or may not be globally unique, depending
50+
on the type of resource.
51+
type: string
52+
type: object
53+
kubernetes:
54+
description: TargetKubernetesResource provides all the values necessary
55+
to identify a given ACK type and override any metadata values when
56+
creating a resource of that type.
57+
properties:
58+
group:
59+
type: string
60+
kind:
61+
type: string
62+
metadata:
63+
description: "ObjectMeta is metadata that all persisted resources
64+
must have, which includes all objects users must create. It
65+
is not possible to use `metav1.ObjectMeta` inside spec, as the
66+
controller-gen automatically converts this to an arbitrary string-string
67+
map. https://github.com/kubernetes-sigs/controller-tools/issues/385
68+
\n Active discussion about inclusion of this field in the spec
69+
is happening in this PR: https://github.com/kubernetes-sigs/controller-tools/pull/395
70+
\n Until this is allowed, or if it never is, we will produce
71+
a subset of the object meta that contains only the fields which
72+
the user is allowed to modify in the metadata."
73+
properties:
74+
annotations:
75+
additionalProperties:
76+
type: string
77+
description: 'Annotations is an unstructured key value map
78+
stored with a resource that may be set by external tools
79+
to store and retrieve arbitrary metadata. They are not queryable
80+
and should be preserved when modifying objects. More info:
81+
http://kubernetes.io/docs/user-guide/annotations'
82+
type: object
83+
generateName:
84+
description: "GenerateName is an optional prefix, used by
85+
the server, to generate a unique name ONLY IF the Name field
86+
has not been provided. If this field is used, the name returned
87+
to the client will be different than the name passed. This
88+
value will also be combined with a unique suffix. The provided
89+
value has the same validation rules as the Name field, and
90+
may be truncated by the length of the suffix required to
91+
make the value unique on the server. \n If this field is
92+
specified and the generated name exists, the server will
93+
NOT return a 409 - instead, it will either return 201 Created
94+
or 500 with Reason ServerTimeout indicating a unique name
95+
could not be found in the time allotted, and the client
96+
should retry (optionally after the time indicated in the
97+
Retry-After header). \n Applied only if Name is not specified.
98+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency"
99+
type: string
100+
labels:
101+
additionalProperties:
102+
type: string
103+
description: 'Map of string keys and values that can be used
104+
to organize and categorize (scope and select) objects. May
105+
match selectors of replication controllers and services.
106+
More info: http://kubernetes.io/docs/user-guide/labels'
107+
type: object
108+
name:
109+
description: 'Name must be unique within a namespace. Is required
110+
when creating resources, although some resources may allow
111+
a client to request the generation of an appropriate name
112+
automatically. Name is primarily intended for creation idempotence
113+
and configuration definition. Cannot be updated. More info:
114+
http://kubernetes.io/docs/user-guide/identifiers#names'
115+
type: string
116+
namespace:
117+
description: "Namespace defines the space within each name
118+
must be unique. An empty namespace is equivalent to the
119+
\"default\" namespace, but \"default\" is the canonical
120+
representation. Not all objects are required to be scoped
121+
to a namespace - the value of this field for those objects
122+
will be empty. \n Must be a DNS_LABEL. Cannot be updated.
123+
More info: http://kubernetes.io/docs/user-guide/namespaces"
124+
type: string
125+
ownerReferences:
126+
description: List of objects depended by this object. If ALL
127+
objects in the list have been deleted, this object will
128+
be garbage collected. If this object is managed by a controller,
129+
then an entry in this list will point to this controller,
130+
with the controller field set to true. There cannot be more
131+
than one managing controller.
132+
items:
133+
description: OwnerReference contains enough information
134+
to let you identify an owning object. An owning object
135+
must be in the same namespace as the dependent, or be
136+
cluster-scoped, so there is no namespace field.
137+
properties:
138+
apiVersion:
139+
description: API version of the referent.
140+
type: string
141+
blockOwnerDeletion:
142+
description: If true, AND if the owner has the "foregroundDeletion"
143+
finalizer, then the owner cannot be deleted from the
144+
key-value store until this reference is removed. Defaults
145+
to false. To set this field, a user needs "delete"
146+
permission of the owner, otherwise 422 (Unprocessable
147+
Entity) will be returned.
148+
type: boolean
149+
controller:
150+
description: If true, this reference points to the managing
151+
controller.
152+
type: boolean
153+
kind:
154+
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
155+
type: string
156+
name:
157+
description: 'Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names'
158+
type: string
159+
uid:
160+
description: 'UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids'
161+
type: string
162+
required:
163+
- apiVersion
164+
- kind
165+
- name
166+
- uid
167+
type: object
168+
type: array
169+
type: object
170+
required:
171+
- group
172+
- kind
173+
type: object
174+
required:
175+
- aws
176+
- kubernetes
177+
type: object
178+
status:
179+
description: AdoptedResourceStatus defines the observed status of the
180+
AdoptedResource.
181+
properties:
182+
conditions:
183+
description: A collection of `ackv1alpha1.Condition` objects that
184+
describe the various terminal states of the adopted resource CR
185+
and its target custom resource
186+
items:
187+
description: Condition is the common struct used by all CRDs managed
188+
by ACK service controllers to indicate terminal states of the
189+
CR and its backend AWS service API resource
190+
properties:
191+
lastTransitionTime:
192+
description: Last time the condition transitioned from one status
193+
to another.
194+
format: date-time
195+
type: string
196+
message:
197+
description: A human readable message indicating details about
198+
the transition.
199+
type: string
200+
reason:
201+
description: The reason for the condition's last transition.
202+
type: string
203+
status:
204+
description: Status of the condition, one of True, False, Unknown.
205+
type: string
206+
type:
207+
description: Type is the type of the Condition
208+
type: string
209+
required:
210+
- status
211+
- type
212+
type: object
213+
type: array
214+
required:
215+
- conditions
216+
type: object
217+
type: object
218+
served: true
219+
storage: true
220+
subresources:
221+
status: {}
222+
status:
223+
acceptedNames:
224+
kind: ""
225+
plural: ""
226+
conditions: []
227+
storedVersions: []

0 commit comments

Comments
 (0)