Skip to content

Commit fcc18d4

Browse files
authored
Fix AdoptedResources functionality for CapacityReservations (#268)
**Issue #, if available:** aws-controllers-k8s/community#2485 **Description of changes:** This PR adds the following hooks for CapacityReservations. 1. `sdk_read_many_post_set_output` - This hook is required to correctly set/update instance count for reservations while/after they are adopted. 2. `sdk_update_post_build_request` - This hook is needed to add support to update/modify capacity reservations using the `additionalInfo` reserved field. The new AdoptedResource config looks as follows, ``` apiVersion: services.k8s.aws/v1alpha1 kind: AdoptedResource metadata: name: test-adopt-existing-capacity # name of the adopted resource spec: aws: nameOrID: cr-XXXXXXXXX # ID of the actual capacity reservation in AWS kubernetes: group: ec2.services.k8s.aws kind: CapacityReservation metadata: name: test-adopt-capacity # name of the K8s capacity reservation resource created by ack-ec2-controller namespace: default ``` Resources can also be adopted [using annotations](https://aws-controllers-k8s.github.io/community/docs/user-docs/features/#resourceadoption) (only if [ResourceAdoption feature gate is enabled in the cluster](https://github.com/aws-controllers-k8s/ec2-controller/blob/b6dff777c35d03335ebb0c3ffca5ee7577e70f18/helm/values.yaml#L172)) with following config, ``` apiVersion: ec2.services.k8s.aws/v1alpha1 kind: CapacityReservation metadata: name: test-adopt annotations: services.k8s.aws/adoption-policy: "adopt" services.k8s.aws/adoption-fields: | {"capacityReservationID": "cr-XXXXXXXXXX"} ``` By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 5416861 commit fcc18d4

File tree

7 files changed

+260
-97
lines changed

7 files changed

+260
-97
lines changed

0 commit comments

Comments
 (0)