proud-chef-51117
09/24/2023, 3:16 PMApplyT
with the old interface{}
conversion:
func (dex *Dex) getIngress() pulumix.Output[*networkingv1.Ingress] {
// i: pulumi.AnyOutput
i := dex.HelmChart.GetResource("<http://networking.k8s.io/v1/Ingress|networking.k8s.io/v1/Ingress>", dex.fqn(), dex.P.Cfg().Dex.Namespace)
in := i.ApplyT(func(i interface{}) *networkingv1.Ingress {
return i.(*networkingv1.Ingress)
})
b := pulumix.MustConvertTyped[*networkingv1.Ingress](in)
return b
}
proud-chef-51117
09/24/2023, 3:18 PMApply
function and then I fear the output types get a bit scrambled:
func (dex *Dex) IngressIP() pulumix.Output[string] {
ingress := dex.getIngress()
frontendIP := pulumix.Apply(ingress, func(r *networkingv1.Ingress) pulumi.StringOutput {
status := r.Status
loadBalancer := status.LoadBalancer()
ingress := loadBalancer.Ingress()
lbiao := ingress.ToIngressLoadBalancerIngressArrayOutput()
ip := pulumix.Apply(lbiao, func(vs []networkingv1.IngressLoadBalancerIngress) string {
index := 0
if len(vs) <= index {
return ""
}
return *vs[index].Ip
})
return pulumix.Cast[pulumi.StringOutput](ip)
})
// leads to "cannot convert pulumi.StringOutput to string"
return pulumix.MustConvertTyped[string](frontendIP.ToOutput(context.Background()))
}
echoing-dinner-19531
09/25/2023, 9:09 AMproud-chef-51117
09/25/2023, 9:16 AMechoing-dinner-19531
09/25/2023, 10:51 AMThe kubernetes/helm provider is already full of pulumixWe're going to publish "sdkx" versions at some point which will generate pulumix style structs for things like the return value of GetResource.