crossplane-contrib / provider-azure

Crossplane Azure Provider
Apache License 2.0
93 stars 64 forks source link

Generate provider-azure from the Azure Service Operator codegen pipeline #287

Open kasey opened 3 years ago

kasey commented 3 years ago

What problem are you facing?

We would like to build on the great work in https://github.com/azure/k8s-infra/ to generate experimental crossplane controllers using the same codegen pipeline as ASO. Doing so would allow us to keep functional parity with ASO as additional resources are supported by the project.

How could Crossplane help solve your problem?

There are likely to be many steps towards reconciling different design decisions and constraints between the 2 projects, so as a first discrete step we want to only attempt to generate crossplane types via an ASO subcommand. These types should be checked into a new crossplane provider template repo for further iteration towards a full Reconciler implementation.

kasey commented 3 years ago

Worked with @matthchr today, his branch is at https://github.com/matthchr/k8s-infra/tree/crossplane-hacking

We identified that some follow up work is needed to embed crossplane types in the generated go types. These are going to take the form of general improvements upstream in the k8s-infra code generator. He was able to generate types that are structured similar to crossplane types (ie spec.forProvider, status.atProvider). There were some other small improvements needed on the k8s-infra side to remove underscores from type names and to align the output path of generated code with import paths between generated packages.

We discussed the best integration point between our ExternalClient API and the existing k8s-infra Applier implementation. Further research and discussion is needed on both sides but we agreed that there should be a path forward for k8s-infra types to provide an API to ExternalClient that can be used to carry out the heavy lifting of translating between kubernetes types and ARM Deployments resources (which are handles on state change requests performed through ARM: https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/deploy-rest). We may want to embed some k8s-infra types to add metadata for the lilfecycle management of ARM deployment objects, and agree on the shape of a set of generated methods that would satisfy an interface for performing CRUD operations on k8s-infra resources via ARM.

kasey commented 3 years ago

@matthchr's WIP branch is here: https://github.com/matthchr/k8s-infra/tree/crossplane-hacking

negz commented 3 years ago

We've caught up with @mattchr a few times lately - just dropping a note to mention this is still a thing that is slowly progressing.

matthchr commented 3 years ago

@negz I think you mean @matthchr =)

negz commented 3 years ago

I did! My mistake.