Skip to content

Commit 90fbdaa

Browse files
authored
crossplane: fix the controller template for attribute-based APIs (#31)
Description of changes: Fixes the controller template for attribute-based APIs By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent e625f74 commit 90fbdaa

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

templates/crossplane/pkg/controller.go.tpl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,22 +180,30 @@ func newExternal(kube client.Client, client svcsdkapi.{{ .SDKAPIInterfaceTypeNam
180180
e := &external{
181181
kube: kube,
182182
client: client,
183-
{{- if or .CRD.Ops.ReadOne .CRD.Ops.GetAttributes .CRD.Ops.ReadMany }}
183+
{{- if .CRD.Ops.ReadOne }}
184184
preObserve: nopPreObserve,
185185
postObserve: nopPostObserve,
186186
lateInitialize: nopLateInitialize,
187187
isUpToDate: alwaysUpToDate,
188+
{{- else if .CRD.Ops.GetAttributes }}
189+
preObserve: nopPreObserve,
190+
postObserve: nopPostObserve,
191+
lateInitialize: nopLateInitialize,
192+
isUpToDate: alwaysUpToDate,
193+
{{- else if .CRD.Ops.ReadMany }}
194+
preObserve: nopPreObserve,
195+
postObserve: nopPostObserve,
196+
lateInitialize: nopLateInitialize,
197+
isUpToDate: alwaysUpToDate,
198+
filterList: nopFilterList,
188199
{{- else }}
189200
observe: nopObserve,
190201
{{- end }}
191-
{{- if and .CRD.Ops.ReadMany (not .CRD.Ops.ReadOne) }}
192-
filterList: nopFilterList,
193-
{{- end}}
194202
preCreate: nopPreCreate,
195203
postCreate: nopPostCreate,
196204
{{- if .CRD.Ops.Delete }}
197205
preDelete: nopPreDelete,
198-
postDelete: nopPostDelete,
206+
postDelete: nopPostDelete,
199207
{{- else }}
200208
delete: nopDelete,
201209
{{- end }}

0 commit comments

Comments
 (0)