-
Notifications
You must be signed in to change notification settings - Fork 9
Replace AnyTypes with apiextensions.JSON #295
Conversation
|
||
# Exclusions for packages that currently produce types including AnyType. | ||
# TODO: get rid of these, either by chasing the teams generating | ||
# weird json or by handling them differently in the generator. | ||
anyTypePackages: | ||
- microsoft.authorization/v20180301 |
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.
wooh!
- action: exclude | ||
group: microsoft.machinelearning | ||
version: v20170101 | ||
because: ExampleRequest.Inputs is a map[string][][]map[string]v1.JSON, which controller-gen doesn't know how to handle. |
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.
oh wow
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.
#mindboggling
This came out nicely! |
008caa7
to
b38a2c9
Compare
- action: exclude | ||
group: microsoft.machinelearning | ||
version: v20170101 | ||
because: ExampleRequest.Inputs is a map[string][][]map[string]v1.JSON, which controller-gen doesn't know how to handle. |
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.
#mindboggling
assignmentHandler(params.destination, newSource), | ||
} | ||
} | ||
|
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.
Once my Test Cases branch is merged, we should loop back here and use some of the helper methods I've written to simplify the code.
96a5297
to
6933103
Compare
Allowing arbitrary JSON in these fields makes sense since they're underconstrained in the ARM schemas. Updated the golden tests accordingly.
These are converted to map[string]JSON, because controller-gen has issues with maps of maps. kubernetes-sigs/controller-tools#287
microsoft.machinelearning/v20170101: ExampleRequest.Input comes out as a map[string][][]map[string]v1.JSON, which controller-gen can't handle. (Our ARM conversion code generation is also wrong for this, see https://github.com/Azure/k8s-infra/issues/289.) microsoft.web/v20150801: ARM conversion needs to add type casting to convert SitesSpecResourcesAppsettingsSpec.Name to SitesSpecResourcesAppsettingsSpecName in a number of places. Or possibly to just collapse the SitesSpecResourcesAppsettingsSpecName type back to a string? I'm not sure why that one stays a type alias when we change lots of other ones. microsoft.datafactory/v20180601: ExecuteSSISPackageActivityTypeProperties.PackageConnectionManagers is a map[string]map[string]SSISExecutionParameter
It's not needed now that the replaceAnyTypeWithJSON stage is in the pipeline. Keep the final check for AnyType though.
df111c4
to
ad869ce
Compare
Adds a pipeline stage to convert AnyTypes to
k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.JSON
, which can store arbitrary JSON values in the API. This enables generating all of the packages that were previously being filtered out because they generated interface{} fields.Removes the
filterOutDefinitionsUsingAnyType
stage, although leaves theensureDefinitionsDoNotUseAnyTypes
check at the end just in case later stages introduce AnyTypes again.A lot of packages include fields that come out as
map[string]map[string]v1.JSON
(especially for UserAssignedIdentities fields), butcontroller-gen
can't generate deep-copy code for these types. To handle these the stage collapses them down tomap[string]v1.JSON
as well. kubernetes-sigs/controller-tools#287Adds special-case handling in the ARM conversion generation to ensure that JSON fields are deep-copied when converting to/from ARM types.
There are still a couple of packages that need to be excluded because the ARM conversion code generated for them has an issue or hits
controller-gen
limitations.Fixes #133.