Skip to content

Commit

Permalink
Add Adoption by annotation logic, hook for `PopulateResourceFromAnnot…
Browse files Browse the repository at this point in the history
…ation` (#128)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • Loading branch information
michaelhtm authored Jan 14, 2025
1 parent 96ecc1e commit c6752a5
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 18 deletions.
8 changes: 4 additions & 4 deletions apis/v1alpha1/ack-generate-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ack_generate_info:
build_date: "2024-10-10T04:00:07Z"
build_hash: 36c2d234498c2bc4f60773ab8df632af4067f43b
build_date: "2024-12-05T16:58:13Z"
build_hash: 5b95c1667a03835266df2d3f598718dd164184af
go_version: go1.23.2
version: v0.39.1
version: v0.39.1-8-g5b95c16
api_directory_checksum: 4064c75a2b25943f3824149c2f4f31013738113e
api_version: v1alpha1
aws_sdk_go_version: v1.44.93
generator_config_info:
file_checksum: dd979bc999bfaa10546ce09b0bedecd039ea85c7
file_checksum: 222da7feaf9b432e6ae270d4b0db7ad7f6cc4781
original_file_name: generator.yaml
last_modification:
reason: API generation
2 changes: 2 additions & 0 deletions apis/v1alpha1/generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ resources:
code: rm.customSetDescribeScalingPoliciesInput(ctx, r, input)
post_set_resource_identifiers:
template_path: scaling_policy/post_set_resource_identifiers.go.tpl
post_populate_resource_from_annotation:
template_path: scaling_policy/post_populate_resource_from_annotation.go.tpl
fields:
ResourceID:
is_primary_key: true
Expand Down
4 changes: 4 additions & 0 deletions config/controller/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ spec:
- "$(LEADER_ELECTION_NAMESPACE)"
- --reconcile-default-max-concurrent-syncs
- "$(RECONCILE_DEFAULT_MAX_CONCURRENT_SYNCS)"
- --feature-gates
- "$(FEATURE_GATES)"
image: controller:latest
name: controller
ports:
Expand Down Expand Up @@ -76,6 +78,8 @@ spec:
value: "ack-system"
- name: "RECONCILE_DEFAULT_MAX_CONCURRENT_SYNCS"
value: "1"
- name: "FEATURE_GATES"
value: ""
securityContext:
allowPrivilegeEscalation: false
privileged: false
Expand Down
2 changes: 2 additions & 0 deletions generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ resources:
code: rm.customSetDescribeScalingPoliciesInput(ctx, r, input)
post_set_resource_identifiers:
template_path: scaling_policy/post_set_resource_identifiers.go.tpl
post_populate_resource_from_annotation:
template_path: scaling_policy/post_populate_resource_from_annotation.go.tpl
fields:
ResourceID:
is_primary_key: true
Expand Down
6 changes: 3 additions & 3 deletions helm/templates/caches-role-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ roleRef:
name: ack-namespaces-cache-applicationautoscaling-controller
subjects:
- kind: ServiceAccount
name: ack-applicationautoscaling-controller
name: {{ include "ack-applicationautoscaling-controller.service-account.name" . }}
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
Expand All @@ -22,5 +22,5 @@ roleRef:
name: ack-configmaps-cache-applicationautoscaling-controller
subjects:
- kind: ServiceAccount
name: ack-applicationautoscaling-controller
namespace: {{ .Release.Namespace }}
name: {{ include "ack-applicationautoscaling-controller.service-account.name" . }}
namespace: {{ .Release.Namespace }}
4 changes: 3 additions & 1 deletion helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,6 @@ featureGates:
# Enables the Team level granularity for CARM. See https://github.com/aws-controllers-k8s/community/issues/2031
TeamLevelCARM: false
# Enable ReadOnlyResources feature/annotation.
ReadOnlyResources: false
ReadOnlyResources: false
# Enable ResourceAdoption feature/annotation.
ResourceAdoption: false
10 changes: 5 additions & 5 deletions pkg/resource/scalable_target/descriptor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions pkg/resource/scalable_target/resource.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions pkg/resource/scaling_policy/descriptor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions pkg/resource/scaling_policy/resource.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
f6, f6ok := fields["policyName"]
if f6ok {
r.ko.Spec.PolicyName = &f6
}

0 comments on commit c6752a5

Please sign in to comment.