Skip to content

Commit 592ce2f

Browse files
authored
doc: enhance alpha features doc (#2425)
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent aea927e commit 592ce2f

File tree

1 file changed

+54
-3
lines changed

1 file changed

+54
-3
lines changed

docs/content/docs/user-docs/features.md

+54-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ toc: true
1111
---
1212

1313
Currently we support 4 feature gates for our controllers.
14+
To use these feature, ensure you enable the [feature gates](https://github.com/aws-controllers-k8s/ec2-controller/blob/b6dff777c35d03335ebb0c3ffca5ee7577e70f18/helm/values.yaml#L164-L172) during helm install, as they are disabled by default.
1415

1516
### ResourceAdoption
16-
This feature allows users to adopt AWS resources by specifying the adoption policy as an annotation `services.k8s.aws/adoption-policy` (currently only supporting `adopt` as a value), and providing the fields required for a read operation in an annotation called `services.k8s.aws/adoption-fields` in json format, and an empty spec.
17+
This feature allows users to adopt AWS resources by specifying the adoption policy as an annotation `services.k8s.aws/adoption-policy`.
18+
This annotation currently supports two values, `adopt` and `adopt-or-create`.
19+
`adopt` adoption policy strictly adopts resources as they are in AWS, and it is highly recommended to provide an empty spec (as it will be overriden
20+
if adoption is successful) and `services.k8s.aws/adoption-fields` annotation with all the fields necessary to retrieve the resource from AWS
21+
(this would be the `name` for EKS cluster, `queueURL` for SQS queues, `vpcID` for VPCs, or `arn` for SNS Topic, etc.)
1722
Here's an example for how to adopt an EKS cluster:
1823

1924
```yaml
@@ -29,8 +34,54 @@ metadata:
2934
}
3035
```
3136
Applying the above manifest allows users to adopt an existing EKS cluster named `my-cluster`.
32-
After reconciliation, all the fields in the spec and status will be filled by the controleler.
33-
This feature is currently available for the s3 controller, and we'll see more releases in the future for other controllers
37+
After reconciliation, all the fields in the spec and status will be populated by the controller.
38+
39+
When you want the controller to create resources if they don't exist, you can set
40+
`adopt-or-create` adoption policy. With this policy, as the name suggests, the controller
41+
will adopt the resource if it exists, or create it if it doesn't.
42+
For `adopt-or-create` the controller expects the spec to be populated by the user with all the
43+
fields necessary for a find/create. If the read operation required field is in the status
44+
the `adoption-fields` annotation will be used to retrieve such fields.
45+
If the adoption is successful for `adopt-or-create`, the controller will attempt updating
46+
your AWS resource, to ensure your ACK manifest is the source of truth.
47+
Here are some sample manifests:
48+
EKS Cluster
49+
```yaml
50+
apiVersion: eks.services.k8s.aws/v1alpha1
51+
kind: Cluster
52+
metadata:
53+
name: my-cluster
54+
annotations:
55+
services.k8s.aws/adoption-policy: "adopt-or-create"
56+
spec:
57+
name: my-cluster
58+
roleARN: arn:role:123456789/myrole
59+
version: "1.32"
60+
resourcesVPCConfig:
61+
endpointPrivateAccess: true
62+
endpointPublicAccess: true
63+
subnetIDs:
64+
- subnet-312ensdj2313dnsa2
65+
- subnet-1e323124ewqe43213
66+
67+
```
68+
VPC
69+
```yaml
70+
apiVersion: ec2.services.k8s.aws/v1alpha1
71+
kind: VPC
72+
metadata:
73+
name: hello
74+
annotations:
75+
services.k8s.aws/adoption-policy: adopt-or-create
76+
services.k8s.aws/adoption-fields: |
77+
{"vpcID": "vpc-123456789012"}
78+
spec:
79+
cidrBlocks:
80+
- "2.0.0.0/16"
81+
tags:
82+
- key: k1
83+
value: v1
84+
```
3485

3586
### ReadOnlyResources
3687
This feature allows users to mark a resource as read only, as in, it would ensure that the resource will not call any update operation, and will not be patching anything in the spec, but instead, it will be reconciling the status and ensuring it matches the resource it points to.

0 commit comments

Comments
 (0)