https://pulumi.com logo
#golang
Title
# golang
a

ambitious-salesmen-39356

05/26/2021, 4:15 PM
I'm trying to work with Kubernetes Custom Resources, specifically a TargetGroupBinding for the AWS LB Controller. I used
crd2pulumi
to take the CRD and convert it to Go types, pretty fabulous. However, I'm not sure if this is a me problem or something crd2pulumi missed - one of the types where I'd expect it to have fields is an empty struct:
Copy code
type TargetGroupBindingSpecServiceRefPortArgs struct {
}
I'd expect this to have like a
Port: <http://pulumi.Int|pulumi.Int>
field. When I go to define a port:
Copy code
_, err = tgb.NewTargetGroupBinding(ctx, serviceName, &tgb.TargetGroupBindingArgs{
			ApiVersion: pulumi.String("elbv2.k8s.aws/v1beta1"),
			Kind:       pulumi.String("TargetGroupBinding"),
			Metadata: &metav1.ObjectMetaArgs{
				Name:      pulumi.String(serviceName),
				Namespace: namespace.Metadata.Elem().Name(),
			},
			Spec: &tgb.TargetGroupBindingSpecArgs{
				TargetType: pulumi.String("ip"),
				ServiceRef: &tgb.TargetGroupBindingSpecServiceRefArgs{
					Name: svc.Metadata.Elem().Name().Elem().ToStringOutput(),
					Port: &tgb.TargetGroupBindingSpecServiceRefPortArgs{
						Port: <http://pulumi.Int|pulumi.Int>(80),
					},
				},
				TargetGroupARN: pulumi.Sprintf("%s", tgArnOutput),
			},
		})
I get an
unknown field Port in struct literal
b

billowy-army-68599

05/26/2021, 4:16 PM
this does indeed look like a bug 😞 can you open an issue on crd2pulumi
just as an aside, looks like you're install the aws loadbalancer controller? if you are, you might consider taking: https://github.com/jaxxstorm/pulumi-awsloadbalancercontroller for a spin. It's very raw
a

ambitious-salesmen-39356

05/26/2021, 4:17 PM
raw as in new and maybe bad or raw as in slang for super dope
b

billowy-army-68599

05/26/2021, 4:21 PM
raw as in new 😂 i'm not cool enough for slang
although, it is a multi language component, so it's sort of dope as well
a

ambitious-salesmen-39356

05/26/2021, 4:24 PM
I'll take a look. Currently that's done in terraform via the helm provider (we're using our kube service definitions as a test case for pulumi since Terraform's CRD support is really really alpha)
b

billowy-army-68599

05/26/2021, 4:24 PM
👍
a

ambitious-salesmen-39356

05/26/2021, 4:33 PM
FYI I ended up manually editing the types.
12 Views