Azure / azure-service-operator

Azure Service Operator allows you to create Azure resources using kubectl
https://azure.github.io/azure-service-operator/
MIT License
734 stars 194 forks source link

Feature: Support ServiceLinker #2073

Open yungezz opened 2 years ago

yungezz commented 2 years ago

Support creation of ServiceLinker in ASOv2.

ServiceLinker is an Azure service to make service to service connection. It's extension resource, such as to Microsoft.Web/sites, Microsoft.Appplatform/app/deployment

ServiceLinker is an extension resource, so it's not listed in https://schema.management.azure.com/schemas/common/autogeneratedResources.json like RoleAssignment, which defined scope like managementgroup, subscription, resourcegroup etc. So when using code generator to generate, met below error:

[controller:generate-types] I0129 06:48:39.266351   21341 code_generator.go:214] 20/55: Apply export filters to reduce the number of generated types
[controller:generate-types] E0129 06:48:40.616686   21341 gen_kustomize.go:111] Error during code generation:
[controller:generate-types] failed during pipeline stage 20/55: Apply export filters to reduce the number of generated types: Export filter action: "include-transitive", target: "Group: \"servicelinker\"; Name: \"ServiceLinker\"; Version: \"v*api20211101preview\"" matched no types
task: [controller:generate-kustomize] bin/aso-gen gen-kustomize config/crd
task: Failed to run task "controller:quick-checks": task: Failed to run task "controller:generate-types": exit status 1

More reference:

matthchr commented 2 years ago

It's likely that the issue here is that this is a -preview api and we exclude those by default. You can specify

  - action: include
    group: servicelinker
    version: v*api20211101preview
    because: We want to export this particular preview version

we will also look into removing the need to specify this.

yungezz commented 2 years ago

Thanks @matthchr . Previously I tried with include-transitive. Will try include.

matthchr commented 2 years ago

This is something we're still interested in supporting, but haven't had time to implement. @yungezz, did you end up trying include and did it work? We'd be open to accepting a PR for this if you wanted to provide one. Otherwise we will keep it in our backlog.

yungezz commented 2 years ago

hi @matthchr, still get the matched no types error, haven't chance to look at detail. Is there any configuration example of generating an extension resource? thanks

[controller:generate-types] E0719 13:24:09.759853   13872 gen_kustomize.go:111] Error during code generation:
[controller:generate-types] failed during pipeline stage 1/64: Load and walk schema: type filter action: "include": type matcher [Group: "servicelinker"; Version: "v*api20220501"; Name: "ServiceLinker"; Because: "including service linker resources"] matched no types; every group was excluded: no match for "servicelinker" (did you mean servicebus?)

The configuration is below

  - action: include
    group: servicelinker
    version: v*api20220501
    name: ServiceLinker
    because: including service linker resources
yungezz commented 2 years ago

after read latest v2 generator guideline, added below configuration in azure-arm.yaml , section objectModelConfiguration as below

  servicelinker:
    2022-05-01:
      Linker:
        $export: true
        $supportedFrom: v2.0.0-alpha.2

met below error:

[controller:generate-types] I0825 07:07:50.225648   27086 code_generator.go:240] 21/64: Apply export filters to reduce the number of generated types
[controller:generate-types] E0825 07:07:50.279476   27086 gen_kustomize.go:111] Error during code generation:
[controller:generate-types] failed during pipeline stage 21/64: Apply export filters to reduce the number of generated types: group servicelinker not seen (did you mean servicebus?): group servicelinker: version 2022-05-01: type Linker: $export: true not consumed
task: Failed to run task "controller:quick-checks": task: Failed to run task "controller:generate-types": exit status 1

hi @matthchr could you help to look at the error? any guidance on how to generate ServiceLinker RP? thanks

matthchr commented 1 year ago

Looks like this stalled back in August, but IIRC somebody reached out over Teams internally. We can revive this effort when we get time, or we would also accept a PR. There have been a lot of changes to the generator in the last 6 months so it might be worth retrying and seeing if what was not working before now works.

matthchr commented 6 months ago

No change from above.

theunrepentantgeek commented 6 days ago

We're still interested in exploring this.