This message was deleted.
# general
s
This message was deleted.
b
@future-refrigerator-88869 I’m not super familiar with Ingress specifically and how it exposes it, but I do something similar with Contour and getting the LB information (it’s in Go but similar constructs):
Copy code
contourDeploy, err := yaml.NewConfigFile(ctx, "contour-deploy-file", &yaml.ConfigFileArgs{
		File: "./contour.yaml",
		Transformations: []yaml.Transformation{
			// Use an NLB instead of an ELB
			func(state map[string]interface{}, opts ...pulumi.ResourceOption) {
				metadata := state["metadata"].(map[string]interface{})
				name := metadata["name"]
				if state["kind"] == "Service" && name == "envoy" {
					annotations := metadata["annotations"].(map[string]interface{})
					delete(annotations, "<http://service.beta.kubernetes.io/aws-load-balancer-backend-protocol|service.beta.kubernetes.io/aws-load-balancer-backend-protocol>")
					annotations["<http://service.beta.kubernetes.io/aws-load-balancer-type|service.beta.kubernetes.io/aws-load-balancer-type>"] = "nlb"
				}
			},
		},
	}, pulumi.Provider(eksConfig.Provider))
	if err != nil {
		return nil, err
	}

	contourService := contourDeploy.GetResource("v1/Service", "envoy", "projectcontour").(*corev1.Service)
	contourServiceLB := contourService.Status.LoadBalancer().Ingress().Index(<http://pulumi.Int|pulumi.Int>(0)).Hostname().Elem()
f
c
I’ve sometimes been bitten by assuming the structure of the returned object. Do you see output if you export just
status
and then
status.loadBalancer
?
f
Copy code
contourServiceLB := contourService.Status.LoadBalancer().Ingress().Index(<http://pulumi.Int|pulumi.Int>(0)).Hostname().Elem()
that should be the equivalent of my export (i tried just exporting it without applying too). the result is undefined.
No. the while
status
is empty.
c
What is the status object?
How are you setting it?
f
I am not setting it, it should be returned by the ingress when it's finished
c
My bad. Then my question should have been, “What do you see when you export
ingress.status
?
Or just
ingress
?
f
ingress.status
is the one i am interested in but it is empty. It seems like it's not awaiting the creation of the ELB. I can see in aws console that when the ELB begins creation the
pulumi up
finishes execution while the elb is still deploying.
c
What about
ingress
itself?
f
that had some information like urn, metadata etc
b
Yeah, it is possible that
ingress
is not marked correctly in terms of this being an output, I’m not sure. In my case, I am not using an ingress object and I go to the underlying
Service
@future-refrigerator-88869 can yuo lookup the specific
Service
that
Ingress
is creating under the hood (I believe it does this)?
f
one of the github issues i linked mentioned that using
k8s.networking.v1.Ingress
is not exporting the
ingress.status
while the
k8s.extensions.v1beta1.Ingress
is working fine. So maybe there's a problem there
b
Sounds plausible.
f
@bored-table-20691 do you mean to lookup the k8s
service
or the elastic load balancer that is being created ?
b
look up the k8s service and get the
LoadBalancer
from that.
f
ah, let me give it a try
seems like the same issue.
service.status.loadBalancer.ingress
is
{}
b
Hmm. Not sure I have much that is helpful to add.
I can’t tell if what I have works to do to being lucky on timing or if it’s something else.