-
Notifications
You must be signed in to change notification settings - Fork 0
rough controller generation for cp #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: crossplane
Are you sure you want to change the base?
Conversation
DO NOT MERGE Adds a new `ack-generate crossplane` CLI command, set of templates and generated crossplane API types.
Signed-off-by: Muvaffak Onus <[email protected]>
Signed-off-by: Muvaffak Onus <[email protected]>
Signed-off-by: Muvaffak Onus <[email protected]>
if found { | ||
sourceAdaptedVarName += ".Spec" | ||
sourceAdaptedVarName += ".Spec.ForProvider" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Crossplane, we always keep cloud provider related things under either spec.forProvider
and status.atProvider
. So, it'd be awesome if we can configure the this string.
cr.SetConditions(runtimev1alpha1.Available()) | ||
{{- if .CRD.Ops.ReadMany }} | ||
input := Generate{{ .CRD.Ops.ReadMany.InputRef.Shape.ShapeName }}(cr) | ||
// TODO(muvaf): Generated conversion code has logic about the input, like if(len...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is what it looks like. The code won't compile because the first return value is not a pointer and we're not able to configure that.
} | ||
observed, err := rm.sdkFind(ctx, r) | ||
cfg, err := awsclient.GetConfig(ctx, c.kube, mg, cr.Spec.ForProvider.Region) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In AWS Provider, we actually treat region
as one of the spec fields and it doesn't really appear in any *Input
queries but in *aws.config
object. It'd be great to have support for additional fields in the generation code. Another option could be a CustomFields
struct that's inline
d and filled in custom.go
file that's manually written.
// and has a return statement we can't control here in an arbitrary function. | ||
// TODO(muvaf): Generated code has an assumption about the module name of the type (svcapitypes) | ||
// but that doesn't always hold true. | ||
{{ $setCode := GoCodeSetReadManyOutput .CRD "resp" "cr" 1 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACKResourceMetadata
field is not generated for Crossplane but we can certainly add something similar to show that all status fields have ARN embedded, which should already be the case for most of the AWS resources.
Signed-off-by: Muvaffak Onus <[email protected]>
f74d52f
to
b5aab6a
Compare
b1d4fe8
to
d4015d0
Compare
Signed-off-by: Muvaffak Onus [email protected]
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.