crd2pulumi
crd2pulumi copied to clipboard
[Golang] AWS LB Controller TargetGroupBinding generates empty struct for TargetGroupBindingSpecServiceRefArgs
Essentially, it seems that when generating types from the AWS LB controller's TargetGroupBinding CRD, at least one struct is missing fields (TargetGroupBindingSpecServiceRefArgs).
Expected behavior
I'd expect it to have a Port field:
serviceRef:
description: serviceRef is a reference to a Kubernetes Service and
ServicePort.
properties:
name:
description: Name is the name of the Service.
type: string
port:
anyOf:
- type: integer
- type: string
description: Port is the port of the ServicePort.
x-kubernetes-int-or-string: true
required:
- name
- port
type: object
Current behavior
no fields at all:
type TargetGroupBindingSpecServiceRefPortArgs struct {
}
Steps to reproduce
- have AWS LB Controller installed in your Kube cluster
-
kubectl get crd targetgroupbindings.elbv2.k8s.aws -o yaml > tgb-crd.yml
-
crd2pulumi --goPath tgb-crd.yml
Context (Environment)
Go 1.16 WSL2 Ubuntu 20.04
Affected feature
?
Does this only impact the Go code generation, or does it also impact other languages?
I am not in a position to say as I'm not using any other languages with Pulumi.
Have also struck this with traefik CRDs that follow a similar pattern:
retry:
description: Retry holds the retry configuration.
properties:
attempts:
type: integer
initialInterval:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
type: object
results in a struct with no parameters.
The same thing happens for Traefik IngressRoute, services port struct has no fields. CRD: https://github.com/traefik/traefik-helm-chart/blob/5ee335a0f96179ad2457e2d3289776e1c20184d4/traefik/crds/ingressroute.yaml#L87
The same thing happens for prometheuses.monitoring.coreos.com
(prometheus-operator). The fields PrometheusSpecResourcesLimitsArgs
and PrometheusSpecResourcesRequestsArgs
are empty structs.
They follow the same pattern as the above, i.e:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
@lukehoban any progress? I'd love to help if you can point me in the right direction
I had a similar issue generating code for dotnet from a crd containing the following pattern:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
It would seem that crd2pulumi ignores the x-kubernetes-int-or-string
property if the oneOf
, anyOf
or allOf
properties exists. From what i can gather (specifically here and here) x-kubernetes-int-or-string
should take precedence over oneOf
, anyOf
and allOf
.
I fixed it by moving the code for checking for the existence of x-kubernetes-int-or-string
above the other three, which made it work for me. A commit containing what i changed to make it work for me can be found here.
Fixed in https://github.com/pulumi/crd2pulumi/pull/60