Skip to content

Commit

Permalink
crossplane: fix the controller template for attribute-based APIs
Browse files Browse the repository at this point in the history
Signed-off-by: Muvaffak Onus <me@muvaf.com>
  • Loading branch information
muvaf committed May 31, 2021
1 parent 8f9a108 commit 9590072
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions templates/crossplane/pkg/controller.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -180,22 +180,30 @@ func newExternal(kube client.Client, client svcsdkapi.{{ .SDKAPIInterfaceTypeNam
e := &external{
kube: kube,
client: client,
{{- if or .CRD.Ops.ReadOne .CRD.Ops.GetAttributes .CRD.Ops.ReadMany }}
{{- if .CRD.Ops.ReadOne }}
preObserve: nopPreObserve,
postObserve: nopPostObserve,
lateInitialize: nopLateInitialize,
isUpToDate: alwaysUpToDate,
{{- else if .CRD.Ops.GetAttributes }}
preObserve: nopPreObserve,
postObserve: nopPostObserve,
lateInitialize: nopLateInitialize,
isUpToDate: alwaysUpToDate,
{{- else if .CRD.Ops.ReadMany }}
preObserve: nopPreObserve,
postObserve: nopPostObserve,
lateInitialize: nopLateInitialize,
isUpToDate: alwaysUpToDate,
filterList: nopFilterList,
{{- else }}
observe: nopObserve,
{{- end }}
{{- if and .CRD.Ops.ReadMany (not .CRD.Ops.ReadOne) }}
filterList: nopFilterList,
{{- end}}
preCreate: nopPreCreate,
postCreate: nopPostCreate,
{{- if .CRD.Ops.Delete }}
preDelete: nopPreDelete,
postDelete: nopPostDelete,
postDelete: nopPostDelete,
{{- else }}
delete: nopDelete,
{{- end }}
Expand Down

0 comments on commit 9590072

Please sign in to comment.