Skip to content

Commit 9b2be48

Browse files
authored
Add hook code to PopulareResourceFromAnnotation (#560)
Description of changes: This function is similar to the `SetIdentifiers` function. If any controller has a hook for `SetIdentifiers`, we need a similar one for `PopulateResourceFromAnnotation` Hooks: * `pre_populate_resource_from_annotation` * `post_populate_resource_from_annotation` By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent ce8a66e commit 9b2be48

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

templates/pkg/resource/resource.go.tpl

+6
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,13 @@ func (r *resource) SetIdentifiers(identifier *ackv1alpha1.AWSIdentifiers) error
8585
// PopulateResourceFromAnnotation populates the fields passed from adoption annotation
8686
//
8787
func (r *resource) PopulateResourceFromAnnotation(fields map[string]string) error {
88+
{{- if $hookCode := Hook .CRD "pre_populate_resource_from_annotation" }}
89+
{{ $hookCode }}
90+
{{- end }}
8891
{{- GoCodePopulateResourceFromAnnotation .CRD "fields" "r.ko" 1}}
92+
{{- if $hookCode := Hook .CRD "post_populate_resource_from_annotation" }}
93+
{{ $hookCode }}
94+
{{- end }}
8995
return nil
9096
}
9197

0 commit comments

Comments
 (0)