Skip to content

Commit 605262a

Browse files
committed
Add hook code to PopulareResourceFromAnnotation
Hooks: * `pre_populate_resource_from_annotation` * `post_populate_resource_from_annotation` This function is similar to the `SetIdentifiers` function. If any controller has a hook for `SetIdentifiers`, we need a similar one for `PopulateResourceFromAnnotation`
1 parent ce8a66e commit 605262a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

templates/pkg/resource/resource.go.tpl

Lines changed: 6 additions & 0 deletions
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)